| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "bindings/core/v8/ExceptionState.h" | 31 #include "bindings/core/v8/ExceptionState.h" |
| 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(ExceptionCode ec, const char* message) { |
| 41 throwDOMException(ec, String(message)); |
| 42 } |
| 43 |
| 44 void ExceptionState::throwRangeError(const char* message) { |
| 45 throwRangeError(String(message)); |
| 46 } |
| 47 |
| 48 void ExceptionState::throwSecurityError(const char* sanitizedMessage, |
| 49 const char* unsanitizedMessage) { |
| 50 throwSecurityError(String(sanitizedMessage), String(unsanitizedMessage)); |
| 51 } |
| 52 |
| 53 void ExceptionState::throwTypeError(const char* message) { |
| 54 throwTypeError(String(message)); |
| 55 } |
| 56 |
| 40 void ExceptionState::throwDOMException(ExceptionCode ec, | 57 void ExceptionState::throwDOMException(ExceptionCode ec, |
| 41 const String& message) { | 58 const String& message) { |
| 42 // SecurityError is thrown via ::throwSecurityError, and _careful_ | 59 // SecurityError is thrown via ::throwSecurityError, and _careful_ |
| 43 // consideration must be given to the data exposed to JavaScript via the | 60 // consideration must be given to the data exposed to JavaScript via the |
| 44 // 'sanitizedMessage'. | 61 // 'sanitizedMessage'. |
| 45 DCHECK(ec != SecurityError); | 62 DCHECK(ec != SecurityError); |
| 46 | 63 |
| 47 const String& processedMessage = addExceptionContext(message); | 64 const String& processedMessage = addExceptionContext(message); |
| 48 setException(ec, processedMessage, V8ThrowException::createDOMException( | 65 setException(ec, processedMessage, V8ThrowException::createDOMException( |
| 49 m_isolate, ec, processedMessage)); | 66 m_isolate, ec, processedMessage)); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 212 |
| 196 void DummyExceptionStateForTesting::throwTypeError(const String& message) { | 213 void DummyExceptionStateForTesting::throwTypeError(const String& message) { |
| 197 setException(V8TypeError, message, v8::Local<v8::Value>()); | 214 setException(V8TypeError, message, v8::Local<v8::Value>()); |
| 198 } | 215 } |
| 199 | 216 |
| 200 void DummyExceptionStateForTesting::rethrowV8Exception(v8::Local<v8::Value>) { | 217 void DummyExceptionStateForTesting::rethrowV8Exception(v8::Local<v8::Value>) { |
| 201 setException(kRethrownException, String(), v8::Local<v8::Value>()); | 218 setException(kRethrownException, String(), v8::Local<v8::Value>()); |
| 202 } | 219 } |
| 203 | 220 |
| 204 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |