Commit 41d1beae authored by raymes's avatar raymes Committed by Commit bot

Don't try to access a NULL plugin element or document in PepperPluginInstanceImpl

There appear to be cases where the WebElement or Document associated with a plugin
have been destroyed but the PepperPluginInstance isn't yet destroyed and there is
some attempt to script into the plugin which tries to access the plugin context.
In these case we should just return an empty handle to the context.

TBR=dmichael@chromium.org
BUG=411778

Review URL: https://codereview.chromium.org/558513002

Cr-Commit-Position: refs/heads/master@{#293873}
parent 3910fcab
...@@ -673,13 +673,15 @@ void PepperPluginInstanceImpl::MessageChannelDestroyed() { ...@@ -673,13 +673,15 @@ void PepperPluginInstanceImpl::MessageChannelDestroyed() {
} }
v8::Local<v8::Context> PepperPluginInstanceImpl::GetContext() { v8::Local<v8::Context> PepperPluginInstanceImpl::GetContext() {
if (!container_) if (!container_ ||
return v8::Handle<v8::Context>(); container_->element().isNull() ||
WebLocalFrame* frame = container_->element().document().frame(); container_->element().document().isNull() ||
if (!frame) !container_->element().document().frame()) {
return v8::Handle<v8::Context>(); return v8::Handle<v8::Context>();
}
v8::Local<v8::Context> context = frame->mainWorldScriptContext(); v8::Local<v8::Context> context =
container_->element().document().frame()->mainWorldScriptContext();
DCHECK(context->GetIsolate() == isolate_); DCHECK(context->GetIsolate() == isolate_);
return context; return context;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment