| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me
ssage) | 45 void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me
ssage) |
| 46 { | 46 { |
| 47 ASSERT(ec); | 47 ASSERT(ec); |
| 48 ASSERT(m_isolate); | 48 ASSERT(m_isolate); |
| 49 m_code = ec; | 49 m_code = ec; |
| 50 setException(V8ThrowException::createDOMException(ec, message, m_isolate)); | 50 setException(V8ThrowException::createDOMException(ec, message, m_isolate)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ExceptionState::throwSecurityError(const String& sanitizedMessage, const St
ring& unsanitizedMessage) |
| 54 { |
| 55 ASSERT(m_isolate); |
| 56 m_code = SecurityError; |
| 57 setException(V8ThrowException::createDOMException(SecurityError, sanitizedMe
ssage, unsanitizedMessage, m_isolate)); |
| 58 } |
| 59 |
| 53 void ExceptionState::setException(v8::Handle<v8::Value> exception) | 60 void ExceptionState::setException(v8::Handle<v8::Value> exception) |
| 54 { | 61 { |
| 55 // FIXME: Assert that exception is not empty? | 62 // FIXME: Assert that exception is not empty? |
| 56 if (exception.IsEmpty()) { | 63 if (exception.IsEmpty()) { |
| 57 clearException(); | 64 clearException(); |
| 58 return; | 65 return; |
| 59 } | 66 } |
| 60 | 67 |
| 61 m_exception.set(m_isolate, exception); | 68 m_exception.set(m_isolate, exception); |
| 62 } | 69 } |
| 63 | 70 |
| 64 void ExceptionState::throwTypeError(const String& message) | 71 void ExceptionState::throwTypeError(const String& message) |
| 65 { | 72 { |
| 66 ASSERT(m_isolate); | 73 ASSERT(m_isolate); |
| 67 m_code = TypeError; | 74 m_code = TypeError; |
| 68 setException(V8ThrowException::createTypeError(message, m_isolate)); | 75 setException(V8ThrowException::createTypeError(message, m_isolate)); |
| 69 } | 76 } |
| 70 | 77 |
| 71 void TrackExceptionState::throwDOMException(const ExceptionCode& ec, const Strin
g& message) | 78 void TrackExceptionState::throwDOMException(const ExceptionCode& ec, const Strin
g& message) |
| 72 { | 79 { |
| 73 m_code = ec; | 80 m_code = ec; |
| 74 } | 81 } |
| 75 | 82 |
| 76 void TrackExceptionState::throwTypeError(const String&) | 83 void TrackExceptionState::throwTypeError(const String&) |
| 77 { | 84 { |
| 78 m_code = TypeError; | 85 m_code = TypeError; |
| 79 } | 86 } |
| 80 | 87 |
| 88 void TrackExceptionState::throwSecurityError(const String&, const String&) |
| 89 { |
| 90 m_code = SecurityError; |
| 91 } |
| 92 |
| 81 } // namespace WebCore | 93 } // namespace WebCore |
| OLD | NEW |