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

Unified Diff: src/inspector/injected-script.cc

Issue 2432163004: Avoid using stale InspectedContext pointers (Closed)
Patch Set: Fix nits Created 4 years, 2 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 | « AUTHORS ('k') | src/inspector/inspected-context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/injected-script.cc
diff --git a/src/inspector/injected-script.cc b/src/inspector/injected-script.cc
index 8e7ca6be3b55677d104221cd20014d94f4f7c569..d966d60bc6c1acb3590e3750fe8b7981f62ef9e9 100644
--- a/src/inspector/injected-script.cc
+++ b/src/inspector/injected-script.cc
@@ -99,10 +99,16 @@ std::unique_ptr<InjectedScript> InjectedScript::create(
v8::Number::New(isolate, inspectedContext->contextId())};
v8::MicrotasksScope microtasksScope(isolate,
v8::MicrotasksScope::kDoNotRunMicrotasks);
+
+ int contextGroupId = inspectedContext->contextGroupId();
+ int contextId = inspectedContext->contextId();
+ V8InspectorImpl* inspector = inspectedContext->inspector();
v8::Local<v8::Value> injectedScriptValue;
if (!function->Call(context, windowGlobal, arraysize(info), info)
.ToLocal(&injectedScriptValue))
return nullptr;
+ if (inspector->getContext(contextGroupId, contextId) != inspectedContext)
+ return nullptr;
if (!injectedScriptValue->IsObject()) return nullptr;
return wrapUnique(new InjectedScript(inspectedContext,
injectedScriptValue.As<v8::Object>(),
« no previous file with comments | « AUTHORS ('k') | src/inspector/inspected-context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698