Chromium Code Reviews| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 const String& message() const { return m_message; } | 89 const String& message() const { return m_message; } |
| 90 | 90 |
| 91 bool throwIfNeeded() | 91 bool throwIfNeeded() |
| 92 { | 92 { |
| 93 if (!hadException()) | 93 if (!hadException()) |
| 94 return false; | 94 return false; |
| 95 throwException(); | 95 throwException(); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void throwException(); | |
|
yhirano
2015/02/24 03:51:24
Can you tell me why you want this function in addi
Jens Widell
2015/02/24 07:31:43
I use it in a situation where I know an exception
Jens Widell
2015/02/24 15:34:56
I've reverted this change, as it wasn't really req
| |
| 100 | |
| 99 // This method clears out the exception which |this| has. | 101 // This method clears out the exception which |this| has. |
| 100 ScriptPromise reject(ScriptState*); | 102 ScriptPromise reject(ScriptState*); |
| 101 | 103 |
| 102 Context context() const { return m_context; } | 104 Context context() const { return m_context; } |
| 103 const char* propertyName() const { return m_propertyName; } | 105 const char* propertyName() const { return m_propertyName; } |
| 104 const char* interfaceName() const { return m_interfaceName; } | 106 const char* interfaceName() const { return m_interfaceName; } |
| 105 | 107 |
| 106 void rethrowV8Exception(v8::Handle<v8::Value> value) | 108 void rethrowV8Exception(v8::Handle<v8::Value> value) |
| 107 { | 109 { |
| 108 setException(value); | 110 setException(value); |
| 109 } | 111 } |
| 110 | 112 |
| 111 #if ENABLE(ASSERT) | 113 #if ENABLE(ASSERT) |
| 112 OnStackObjectChecker& onStackObjectChecker() { return m_onStackObjectChecker ; } | 114 OnStackObjectChecker& onStackObjectChecker() { return m_onStackObjectChecker ; } |
| 113 #endif | 115 #endif |
| 114 | 116 |
| 115 protected: | 117 protected: |
| 116 ExceptionCode m_code; | 118 ExceptionCode m_code; |
| 117 Context m_context; | 119 Context m_context; |
| 118 String m_message; | 120 String m_message; |
| 119 const char* m_propertyName; | 121 const char* m_propertyName; |
| 120 const char* m_interfaceName; | 122 const char* m_interfaceName; |
| 121 | 123 |
| 122 private: | 124 private: |
| 123 void setException(v8::Handle<v8::Value>); | 125 void setException(v8::Handle<v8::Value>); |
| 124 void throwException(); | |
| 125 | 126 |
| 126 String addExceptionContext(const String&) const; | 127 String addExceptionContext(const String&) const; |
| 127 | 128 |
| 128 ScopedPersistent<v8::Value> m_exception; | 129 ScopedPersistent<v8::Value> m_exception; |
| 129 v8::Handle<v8::Object> m_creationContext; | 130 v8::Handle<v8::Object> m_creationContext; |
| 130 v8::Isolate* m_isolate; | 131 v8::Isolate* m_isolate; |
| 131 #if ENABLE(ASSERT) | 132 #if ENABLE(ASSERT) |
| 132 OnStackObjectChecker m_onStackObjectChecker; | 133 OnStackObjectChecker m_onStackObjectChecker; |
| 133 #endif | 134 #endif |
| 134 }; | 135 }; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 149 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { } | 150 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { } |
| 150 virtual void throwDOMException(const ExceptionCode&, const String& message) override; | 151 virtual void throwDOMException(const ExceptionCode&, const String& message) override; |
| 151 virtual void throwTypeError(const String& message = String()) override; | 152 virtual void throwTypeError(const String& message = String()) override; |
| 152 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) override; | 153 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) override; |
| 153 virtual void throwRangeError(const String& message) override; | 154 virtual void throwRangeError(const String& message) override; |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 } // namespace blink | 157 } // namespace blink |
| 157 | 158 |
| 158 #endif // ExceptionState_h | 159 #endif // ExceptionState_h |
| OLD | NEW |