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_); |
} |