Commit 856fc556 authored by Yuki Yamada's avatar Yuki Yamada Committed by Commit Bot

Check script execution is forbidden or not only in MainWorld

We should not forbid script execution in isolated worlds when
dispatching events (it should be operated by disabling Chrome
extension), so checking execution setting is necessary only in main
world.
V8EventListenerOrEventHandler::CallListenerFunction() already
implements this, so this CL make
GeneratedCodeHelper::IsCallbackRunnable() to do the same conditional
check for other callbacks generated by IDL files.

Test for this is already exists:
https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/fast/events/events-in-isolated-world.html

Bug: 872138, 608286, 608641
Change-Id: Ibc38e6033d6d0462362012f1c49271548c26a8ec
Reviewed-on: https://chromium-review.googlesource.com/1186212Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Yuki Yamada <yukiy@google.com>
Cr-Commit-Position: refs/heads/master@{#585449}
parent ae9017a2
...@@ -58,10 +58,14 @@ bool IsCallbackFunctionRunnable( ...@@ -58,10 +58,14 @@ bool IsCallbackFunctionRunnable(
// the incumbent context which originally schedules the currently-running // the incumbent context which originally schedules the currently-running
// callback to see whether the script setting is disabled before invoking // callback to see whether the script setting is disabled before invoking
// the callback. // the callback.
// TODO(crbug.com/608641): move IsMainWorld check into
// ExecutionContext::CanExecuteScripts()
return incumbent_execution_context && return incumbent_execution_context &&
!incumbent_execution_context->IsContextPaused() && !incumbent_execution_context->IsContextPaused() &&
!incumbent_execution_context->IsContextDestroyed() && !incumbent_execution_context->IsContextDestroyed() &&
incumbent_execution_context->CanExecuteScripts(kAboutToExecuteScript); (!incumbent_script_state->World().IsMainWorld() ||
incumbent_execution_context->CanExecuteScripts(
kAboutToExecuteScript));
} }
} // namespace blink } // namespace blink
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