| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void ExceptionState::reject(ScriptPromiseResolver* resolver) | 53 void ExceptionState::reject(ScriptPromiseResolver* resolver) |
| 54 { | 54 { |
| 55 resolver->reject(m_exception.newLocal(resolver->getScriptState()->isolate())
); | 55 resolver->reject(m_exception.newLocal(resolver->getScriptState()->isolate())
); |
| 56 clearException(); | 56 clearException(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me
ssage) | 59 void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me
ssage) |
| 60 { | 60 { |
| 61 ASSERT(ec); | 61 ASSERT(ec); |
| 62 ASSERT(m_isolate); | 62 ASSERT(m_isolate); |
| 63 ASSERT(!m_creationContext.IsEmpty()); | |
| 64 | 63 |
| 65 // SecurityError is thrown via ::throwSecurityError, and _careful_ considera
tion must be given to the data exposed to JavaScript via the 'sanitizedMessage'. | 64 // SecurityError is thrown via ::throwSecurityError, and _careful_ considera
tion must be given to the data exposed to JavaScript via the 'sanitizedMessage'. |
| 66 ASSERT(ec != SecurityError); | 65 ASSERT(ec != SecurityError); |
| 67 | 66 |
| 68 m_code = ec; | 67 m_code = ec; |
| 69 String processedMessage = addExceptionContext(message); | 68 String processedMessage = addExceptionContext(message); |
| 70 m_message = processedMessage; | 69 m_message = processedMessage; |
| 71 setException(V8ThrowException::createDOMException(m_isolate, ec, processedMe
ssage)); | 70 setException(V8ThrowException::createDOMException(m_isolate, ec, processedMe
ssage)); |
| 72 } | 71 } |
| 73 | 72 |
| 74 void ExceptionState::throwSecurityError(const String& sanitizedMessage, const St
ring& unsanitizedMessage) | 73 void ExceptionState::throwSecurityError(const String& sanitizedMessage, const St
ring& unsanitizedMessage) |
| 75 { | 74 { |
| 76 ASSERT(m_isolate); | 75 ASSERT(m_isolate); |
| 77 ASSERT(!m_creationContext.IsEmpty()); | |
| 78 m_code = SecurityError; | 76 m_code = SecurityError; |
| 79 String finalSanitized = addExceptionContext(sanitizedMessage); | 77 String finalSanitized = addExceptionContext(sanitizedMessage); |
| 80 m_message = finalSanitized; | 78 m_message = finalSanitized; |
| 81 String finalUnsanitized = addExceptionContext(unsanitizedMessage); | 79 String finalUnsanitized = addExceptionContext(unsanitizedMessage); |
| 82 | 80 |
| 83 setException(V8ThrowException::createDOMException(m_isolate, SecurityError,
finalSanitized, finalUnsanitized)); | 81 setException(V8ThrowException::createDOMException(m_isolate, SecurityError,
finalSanitized, finalUnsanitized)); |
| 84 } | 82 } |
| 85 | 83 |
| 86 void ExceptionState::setException(v8::Local<v8::Value> exception) | 84 void ExceptionState::setException(v8::Local<v8::Value> exception) |
| 87 { | 85 { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac
eName(), message); | 190 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac
eName(), message); |
| 193 else if (m_context == IndexedGetterContext) | 191 else if (m_context == IndexedGetterContext) |
| 194 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa
me(), message); | 192 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa
me(), message); |
| 195 else if (m_context == IndexedSetterContext) | 193 else if (m_context == IndexedSetterContext) |
| 196 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa
me(), message); | 194 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa
me(), message); |
| 197 } | 195 } |
| 198 return processedMessage; | 196 return processedMessage; |
| 199 } | 197 } |
| 200 | 198 |
| 201 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |