Commit cdee6a85 authored by Timothy Gu's avatar Timothy Gu Committed by Commit Bot

Put a comment in the right place

The "element_document.ExecutingFrame()" check is identical to what the
HTML Standard calls "the node's node document has a browsing context,"
which belongs in step 11.

Also per kouhei@'s request, add a TODO for switching to ExecutingWindow
rather than ExecutingFrame.

Change-Id: I653d303861c0e02e65d7e5de466fecd90a4806d1
Reviewed-on: https://chromium-review.googlesource.com/1171988
Commit-Queue: Timothy Gu <timothygu@chromium.org>
Reviewed-by: default avatarDominic Farolino <domfarolino@gmail.com>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582699}
parent a739bf46
......@@ -301,15 +301,24 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
//
// FIXME: If script is parser inserted, verify it's still in the original
// document.
// <spec step="11">If scripting is disabled for the script element, then
// return. The script is not executed.</spec>
//
// <spec
// href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-noscript">
// Scripting is disabled for a node if [the node's node document has no
// browsing context], or if scripting is disabled in that browsing context.
// </spec>
Document& element_document = element_->GetDocument();
Document* context_document = element_document.ContextDocument();
// TODO(timothygu): Investigate if we could switch from ExecutingFrame() to
// ExecutingWindow().
if (!element_document.ExecutingFrame())
return false;
Document* context_document = element_document.ContextDocument();
if (!context_document || !context_document->ExecutingFrame())
return false;
// <spec step="11">If scripting is disabled for the script element, then
// return. The script is not executed.</spec>
if (!context_document->CanExecuteScripts(kAboutToExecuteScript))
return false;
......
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