0

[unseasoned-pdf] Enter the main world context when posting messages

It might be possible for the PDF plugin to post messages to its
embedder when no JavaScript is being executed in the embedding UI,
meaning it is possible for the main world context to be missing from
the stack.

Bug: 1109796
Change-Id: I57bceb766db06bcee36a7c218f71e5c3743c5dec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2756915
Auto-Submit: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862771}
This commit is contained in:
Daniel Hosseinian
2021-03-15 11:15:14 +00:00
committed by Chromium LUCI CQ
parent 7a57bc4de6
commit 7bf90524e5

@ -37,6 +37,7 @@ void PostMessageSender::Post(base::Value message) {
v8::Local<v8::Context> context =
container_->GetDocument().GetFrame()->MainWorldScriptContext();
DCHECK_EQ(isolate_, context->GetIsolate());
v8::Context::Scope context_scope(context);
if (!v8_value_converter_)
v8_value_converter_ = content::V8ValueConverter::Create();