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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8ThrowException.cpp

Issue 1419313003: Track the script state a listener was created in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8ThrowException.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.cpp
index ae242579ebaf5ce82f991d8f8db416488fb95710..56dbc54440ed9f835e8399cd6823a4100fad4406 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.cpp
@@ -68,9 +68,12 @@ v8::Local<v8::Value> V8ThrowException::createDOMException(v8::Isolate* isolate,
v8::Local<v8::Object> sanitizedCreationContext = creationContext;
// FIXME: Is the current context always the right choice?
- Frame* frame = toFrameIfNotDetached(creationContext->CreationContext());
- if (!frame || !BindingSecurity::shouldAllowAccessToFrame(isolate, callingDOMWindow(isolate), frame, DoNotReportSecurityError))
- sanitizedCreationContext = isolate->GetCurrentContext()->Global();
+ ScriptState* scriptState = ScriptState::from(creationContext->CreationContext());
+ Frame* frame = toFrameIfNotDetached(scriptState->context());
+ if (!frame || !BindingSecurity::shouldAllowAccessToFrame(isolate, callingDOMWindow(isolate), frame, DoNotReportSecurityError)) {
+ scriptState = ScriptState::current(isolate);
+ sanitizedCreationContext = scriptState->context()->Global();
+ }
v8::TryCatch tryCatch;
@@ -89,7 +92,7 @@ v8::Local<v8::Value> V8ThrowException::createDOMException(v8::Isolate* isolate,
v8::Local<v8::Object> exceptionObject = exception.As<v8::Object>();
v8::Maybe<bool> result = exceptionObject->SetAccessor(isolate->GetCurrentContext(), v8AtomicString(isolate, "stack"), domExceptionStackGetter, domExceptionStackSetter, v8::MaybeLocal<v8::Value>(error));
ASSERT_UNUSED(result, result.FromJust());
- V8HiddenValue::setHiddenValue(isolate, exceptionObject, V8HiddenValue::error(isolate), error);
+ V8HiddenValue::setHiddenValue(scriptState, exceptionObject, V8HiddenValue::error(isolate), error);
return exception;
}

Powered by Google App Engine
This is Rietveld 408576698