Index: content/renderer/pepper/pepper_plugin_instance_impl.cc |
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
index a1116811924e0ad9789ef791752b8a1de7341d0c..15fa1fe0d23f3fa43b76336a3181e0f7ff931dcd 100644 |
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc |
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
@@ -2384,9 +2384,11 @@ PP_Var PepperPluginInstanceImpl::ExecuteScript(PP_Instance instance, |
np_script.UTF8Length = script_string->value().length(); |
// Get the current frame to pass to the evaluate function. |
- WebLocalFrame* frame = container_->element().document().frame(); |
- if (!frame) { |
- try_catch.SetException("No frame to execute script in."); |
+ WebLocalFrame* frame = NULL; |
+ if (container_) |
+ frame = container_->element().document().frame(); |
+ if (!frame || !frame->windowObject()) { |
+ try_catch.SetException("No context in which to execute script."); |
return PP_MakeUndefined(); |
} |