Commit b8f663b1 authored by tasak@google.com's avatar tasak@google.com

Fix ExceptionState with empty context.

Since NonThrowableExceptionState, TrackExceptionState, NoExceptionStateAssertionChecker and IgnorableExceptionState create no wrapper, we don't need to fix those exception state with empty context.

We need to fix ExceptionState. To ensure that all ExceptionStates are fixed, added ASSERT to ExceptionState::throwSecurityError and ExceptionState::throwDOMException.

BUG=369451

Review URL: https://codereview.chromium.org/311733003

git-svn-id: svn://svn.chromium.org/blink/trunk@175463 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0adc3134
...@@ -47,6 +47,7 @@ void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me ...@@ -47,6 +47,7 @@ void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me
{ {
ASSERT(ec); ASSERT(ec);
ASSERT(m_isolate); ASSERT(m_isolate);
ASSERT(!m_creationContext.IsEmpty());
// SecurityError is thrown via ::throwSecurityError, and _careful_ consideration must be given to the data exposed to JavaScript via the 'sanitizedMessage'. // SecurityError is thrown via ::throwSecurityError, and _careful_ consideration must be given to the data exposed to JavaScript via the 'sanitizedMessage'.
ASSERT(ec != SecurityError); ASSERT(ec != SecurityError);
...@@ -60,6 +61,7 @@ void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me ...@@ -60,6 +61,7 @@ void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me
void ExceptionState::throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage) void ExceptionState::throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage)
{ {
ASSERT(m_isolate); ASSERT(m_isolate);
ASSERT(!m_creationContext.IsEmpty());
m_code = SecurityError; m_code = SecurityError;
String finalSanitized = addExceptionContext(sanitizedMessage); String finalSanitized = addExceptionContext(sanitizedMessage);
m_message = finalSanitized; m_message = finalSanitized;
......
...@@ -142,7 +142,7 @@ static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ...@@ -142,7 +142,7 @@ static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8
DOMWindow* targetWindow = target->domWindow(); DOMWindow* targetWindow = target->domWindow();
// FIXME: We should modify V8 to pass in more contextual information (context, property, and object). // FIXME: We should modify V8 to pass in more contextual information (context, property, and object).
ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, v8::Handle<v8::Object>(), isolate); ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate->GetCurrentContext()->Global(), isolate);
exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessErrorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessage(callingDOMWindow(isolate))); exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessErrorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessage(callingDOMWindow(isolate)));
exceptionState.throwIfNeeded(); exceptionState.throwIfNeeded();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment