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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ASSERT(ec); | 55 ASSERT(ec); |
56 ASSERT(m_isolate); | 56 ASSERT(m_isolate); |
57 ASSERT(!m_creationContext.IsEmpty()); | 57 ASSERT(!m_creationContext.IsEmpty()); |
58 | 58 |
59 // SecurityError is thrown via ::throwSecurityError, and _careful_ considera
tion must be given to the data exposed to JavaScript via the 'sanitizedMessage'. | 59 // SecurityError is thrown via ::throwSecurityError, and _careful_ considera
tion must be given to the data exposed to JavaScript via the 'sanitizedMessage'. |
60 ASSERT(ec != SecurityError); | 60 ASSERT(ec != SecurityError); |
61 | 61 |
62 m_code = ec; | 62 m_code = ec; |
63 String processedMessage = addExceptionContext(message); | 63 String processedMessage = addExceptionContext(message); |
64 m_message = processedMessage; | 64 m_message = processedMessage; |
65 setException(V8ThrowException::createDOMException(ec, processedMessage, m_cr
eationContext, m_isolate)); | 65 setException(V8ThrowException::createDOMException(m_isolate, ec, processedMe
ssage, m_creationContext)); |
66 } | 66 } |
67 | 67 |
68 void ExceptionState::throwSecurityError(const String& sanitizedMessage, const St
ring& unsanitizedMessage) | 68 void ExceptionState::throwSecurityError(const String& sanitizedMessage, const St
ring& unsanitizedMessage) |
69 { | 69 { |
70 ASSERT(m_isolate); | 70 ASSERT(m_isolate); |
71 ASSERT(!m_creationContext.IsEmpty()); | 71 ASSERT(!m_creationContext.IsEmpty()); |
72 m_code = SecurityError; | 72 m_code = SecurityError; |
73 String finalSanitized = addExceptionContext(sanitizedMessage); | 73 String finalSanitized = addExceptionContext(sanitizedMessage); |
74 m_message = finalSanitized; | 74 m_message = finalSanitized; |
75 String finalUnsanitized = addExceptionContext(unsanitizedMessage); | 75 String finalUnsanitized = addExceptionContext(unsanitizedMessage); |
76 | 76 |
77 setException(V8ThrowException::createDOMException(SecurityError, finalSaniti
zed, finalUnsanitized, m_creationContext, m_isolate)); | 77 setException(V8ThrowException::createDOMException(m_isolate, SecurityError,
finalSanitized, finalUnsanitized, m_creationContext)); |
78 } | 78 } |
79 | 79 |
80 void ExceptionState::setException(v8::Handle<v8::Value> exception) | 80 void ExceptionState::setException(v8::Handle<v8::Value> exception) |
81 { | 81 { |
82 // FIXME: Assert that exception is not empty? | 82 // FIXME: Assert that exception is not empty? |
83 if (exception.IsEmpty()) { | 83 if (exception.IsEmpty()) { |
84 clearException(); | 84 clearException(); |
85 return; | 85 return; |
86 } | 86 } |
87 | 87 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac
eName(), message); | 186 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac
eName(), message); |
187 else if (m_context == IndexedGetterContext) | 187 else if (m_context == IndexedGetterContext) |
188 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa
me(), message); | 188 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa
me(), message); |
189 else if (m_context == IndexedSetterContext) | 189 else if (m_context == IndexedSetterContext) |
190 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa
me(), message); | 190 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa
me(), message); |
191 } | 191 } |
192 return processedMessage; | 192 return processedMessage; |
193 } | 193 } |
194 | 194 |
195 } // namespace blink | 195 } // namespace blink |
OLD | NEW |