Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: Source/bindings/v8/ExceptionState.cpp

Issue 311733003: Fix ExceptionState with empty context. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/v8/V8Initializer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 void ExceptionState::clearException() 40 void ExceptionState::clearException()
41 { 41 {
42 m_code = 0; 42 m_code = 0;
43 m_exception.clear(); 43 m_exception.clear();
44 } 44 }
45 45
46 void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me ssage) 46 void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me ssage)
47 { 47 {
48 ASSERT(ec); 48 ASSERT(ec);
49 ASSERT(m_isolate); 49 ASSERT(m_isolate);
50 ASSERT(!m_creationContext.IsEmpty());
50 51
51 // SecurityError is thrown via ::throwSecurityError, and _careful_ considera tion must be given to the data exposed to JavaScript via the 'sanitizedMessage'. 52 // SecurityError is thrown via ::throwSecurityError, and _careful_ considera tion must be given to the data exposed to JavaScript via the 'sanitizedMessage'.
52 ASSERT(ec != SecurityError); 53 ASSERT(ec != SecurityError);
53 54
54 m_code = ec; 55 m_code = ec;
55 String processedMessage = addExceptionContext(message); 56 String processedMessage = addExceptionContext(message);
56 m_message = processedMessage; 57 m_message = processedMessage;
57 setException(V8ThrowException::createDOMException(ec, processedMessage, m_cr eationContext, m_isolate)); 58 setException(V8ThrowException::createDOMException(ec, processedMessage, m_cr eationContext, m_isolate));
58 } 59 }
59 60
60 void ExceptionState::throwSecurityError(const String& sanitizedMessage, const St ring& unsanitizedMessage) 61 void ExceptionState::throwSecurityError(const String& sanitizedMessage, const St ring& unsanitizedMessage)
61 { 62 {
62 ASSERT(m_isolate); 63 ASSERT(m_isolate);
64 ASSERT(!m_creationContext.IsEmpty());
63 m_code = SecurityError; 65 m_code = SecurityError;
64 String finalSanitized = addExceptionContext(sanitizedMessage); 66 String finalSanitized = addExceptionContext(sanitizedMessage);
65 m_message = finalSanitized; 67 m_message = finalSanitized;
66 String finalUnsanitized = addExceptionContext(unsanitizedMessage); 68 String finalUnsanitized = addExceptionContext(unsanitizedMessage);
67 69
68 setException(V8ThrowException::createDOMException(SecurityError, finalSaniti zed, finalUnsanitized, m_creationContext, m_isolate)); 70 setException(V8ThrowException::createDOMException(SecurityError, finalSaniti zed, finalUnsanitized, m_creationContext, m_isolate));
69 } 71 }
70 72
71 void ExceptionState::setException(v8::Handle<v8::Value> exception) 73 void ExceptionState::setException(v8::Handle<v8::Value> exception)
72 { 74 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac eName(), message); 158 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac eName(), message);
157 else if (m_context == IndexedGetterContext) 159 else if (m_context == IndexedGetterContext)
158 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa me(), message); 160 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa me(), message);
159 else if (m_context == IndexedSetterContext) 161 else if (m_context == IndexedSetterContext)
160 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa me(), message); 162 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa me(), message);
161 } 163 }
162 return processedMessage; 164 return processedMessage;
163 } 165 }
164 166
165 } // namespace WebCore 167 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/V8Initializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698