| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 { | 72 { |
| 73 // FIXME: Assert that exception is not empty? | 73 // FIXME: Assert that exception is not empty? |
| 74 if (exception.IsEmpty()) { | 74 if (exception.IsEmpty()) { |
| 75 clearException(); | 75 clearException(); |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 m_exception.set(m_isolate, exception); | 79 m_exception.set(m_isolate, exception); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void ExceptionState::throwException() |
| 83 { |
| 84 ASSERT(!m_exception.isEmpty() || m_code); |
| 85 if (m_exception.isEmpty()) |
| 86 throwDOMException(m_code, String()); // FIXME: Do we ever hit this? If s
o, where and why? |
| 87 ASSERT(!m_exception.isEmpty()); |
| 88 V8ThrowException::throwError(m_exception.newLocal(m_isolate), m_isolate); |
| 89 } |
| 90 |
| 82 void ExceptionState::throwTypeError(const String& message) | 91 void ExceptionState::throwTypeError(const String& message) |
| 83 { | 92 { |
| 84 ASSERT(m_isolate); | 93 ASSERT(m_isolate); |
| 85 m_code = TypeError; | 94 m_code = TypeError; |
| 86 m_message = message; | 95 m_message = message; |
| 87 setException(V8ThrowException::createTypeError(addExceptionContext(message),
m_isolate)); | 96 setException(V8ThrowException::createTypeError(addExceptionContext(message),
m_isolate)); |
| 88 } | 97 } |
| 89 | 98 |
| 90 void NonThrowableExceptionState::throwDOMException(const ExceptionCode& ec, cons
t String& message) | 99 void NonThrowableExceptionState::throwDOMException(const ExceptionCode& ec, cons
t String& message) |
| 91 { | 100 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac
eName(), message); | 159 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac
eName(), message); |
| 151 else if (m_context == IndexedGetterContext) | 160 else if (m_context == IndexedGetterContext) |
| 152 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa
me(), message); | 161 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa
me(), message); |
| 153 else if (m_context == IndexedSetterContext) | 162 else if (m_context == IndexedSetterContext) |
| 154 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa
me(), message); | 163 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa
me(), message); |
| 155 } | 164 } |
| 156 return processedMessage; | 165 return processedMessage; |
| 157 } | 166 } |
| 158 | 167 |
| 159 } // namespace WebCore | 168 } // namespace WebCore |
| OLD | NEW |