| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "bindings/core/v8/ExceptionMessages.h" | 33 #include "bindings/core/v8/ExceptionMessages.h" |
| 34 #include "bindings/core/v8/ScriptPromiseResolver.h" | 34 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 35 #include "bindings/core/v8/V8ThrowException.h" | 35 #include "bindings/core/v8/V8ThrowException.h" |
| 36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 void ExceptionState::throwDOMException(const ExceptionCode& ec, | 40 void ExceptionState::throwDOMException(const ExceptionCode& ec, |
| 41 const String& message) { | 41 const String& message) { |
| 42 // SecurityError is thrown via ::throwSecurityError, and _careful_ considerati
on must be given to the data exposed to JavaScript via the 'sanitizedMessage'. | 42 // SecurityError is thrown via ::throwSecurityError, and _careful_ |
| 43 // consideration must be given to the data exposed to JavaScript via the |
| 44 // 'sanitizedMessage'. |
| 43 DCHECK(ec != SecurityError); | 45 DCHECK(ec != SecurityError); |
| 44 | 46 |
| 45 const String& processedMessage = addExceptionContext(message); | 47 const String& processedMessage = addExceptionContext(message); |
| 46 setException(ec, processedMessage, V8ThrowException::createDOMException( | 48 setException(ec, processedMessage, V8ThrowException::createDOMException( |
| 47 m_isolate, ec, processedMessage)); | 49 m_isolate, ec, processedMessage)); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void ExceptionState::throwRangeError(const String& message) { | 52 void ExceptionState::throwRangeError(const String& message) { |
| 51 setException(V8RangeError, message, | 53 setException(V8RangeError, message, |
| 52 V8ThrowException::createRangeError( | 54 V8ThrowException::createRangeError( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 183 |
| 182 void TrackExceptionState::throwTypeError(const String& message) { | 184 void TrackExceptionState::throwTypeError(const String& message) { |
| 183 setException(V8TypeError, message, v8::Local<v8::Value>()); | 185 setException(V8TypeError, message, v8::Local<v8::Value>()); |
| 184 } | 186 } |
| 185 | 187 |
| 186 void TrackExceptionState::rethrowV8Exception(v8::Local<v8::Value>) { | 188 void TrackExceptionState::rethrowV8Exception(v8::Local<v8::Value>) { |
| 187 setException(kRethrownException, String(), v8::Local<v8::Value>()); | 189 setException(kRethrownException, String(), v8::Local<v8::Value>()); |
| 188 } | 190 } |
| 189 | 191 |
| 190 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |