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

Unified Diff: content/renderer/pepper/pepper_try_catch.cc

Issue 555583003: Always use the caller's context in PepperTryCatchV8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: content/renderer/pepper/pepper_try_catch.cc
diff --git a/content/renderer/pepper/pepper_try_catch.cc b/content/renderer/pepper/pepper_try_catch.cc
index 0d1aacc97a884a86222b632deebf0bb0ad620c3b..2a5efe799b2ea5c49ddc1eb08546324e74ff80f3 100644
--- a/content/renderer/pepper/pepper_try_catch.cc
+++ b/content/renderer/pepper/pepper_try_catch.cc
@@ -70,11 +70,19 @@ PepperTryCatchV8::PepperTryCatchV8(
// Typically when using PepperTryCatchV8 we are passed an isolate. We verify
// that this isolate is the same as the plugin isolate.
DCHECK(isolate == instance_->GetIsolate());
- // We assume we are already in the plugin context for PepperTryCatchV8.
- DCHECK(GetContext() == isolate->GetCurrentContext());
+
+ // We switch to the plugin context. We may be in a different context if we
+ // called into the plugin from a frame that differs from the plugin's frame.
dmichael (off chromium) 2014/09/09 21:38:06 d'oh... I don't think this is the right thing to
+ v8::Handle<v8::Context> context = GetContext();
+ if (!context.IsEmpty())
+ context->Enter();
}
PepperTryCatchV8::~PepperTryCatchV8() {
+ v8::Handle<v8::Context> context = GetContext();
+ if (!context.IsEmpty())
+ context->Exit();
+
ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(exception_);
}
« 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