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

Unified Diff: Source/bindings/v8/V8DOMActivityLogger.cpp

Issue 357873003: Check if the context is properly initialized before retrieving its script state. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8DOMActivityLogger.cpp
diff --git a/Source/bindings/v8/V8DOMActivityLogger.cpp b/Source/bindings/v8/V8DOMActivityLogger.cpp
index 93ca79b7f1994be91739d1944ece6bf5d6ba2c18..9046f568a19ba2854242b7f8514ff658268cb208 100644
--- a/Source/bindings/v8/V8DOMActivityLogger.cpp
+++ b/Source/bindings/v8/V8DOMActivityLogger.cpp
@@ -75,7 +75,11 @@ V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLogger()
if (!isolate->InContext())
return 0;
- V8PerContextData* contextData = ScriptState::current(isolate)->perContextData();
+ v8::Handle<v8::Context> context = isolate->GetCurrentContext();
+ if (context.IsEmpty() || !toDOMWindow(context))
+ return 0;
+
+ V8PerContextData* contextData = ScriptState::from(context)->perContextData();
if (!contextData)
return 0;
@@ -88,7 +92,11 @@ V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld()
if (!isolate->InContext())
return 0;
- ScriptState* scriptState = ScriptState::current(isolate);
+ v8::Handle<v8::Context> context = isolate->GetCurrentContext();
+ if (context.IsEmpty() || !toDOMWindow(context))
+ return 0;
+
+ ScriptState* scriptState = ScriptState::from(context);
if (!scriptState->world().isIsolatedWorld())
return 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698