New issue
Advanced search Search tips

Issue 721914 link

Starred by 3 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug

Blocked on:
issue 686281



Sign in to add a comment

Don't execute scripts that have moved between documents

Project Member Reported by domenic@chromium.org, May 12 2017

Issue description

The background here is two HTML issues:

- https://github.com/whatwg/html/issues/2137 about moving between documents during parsing
- https://github.com/whatwg/html/issues/2469 about moving between documents during fetching

Tests are available at https://github.com/w3c/web-platform-tests/pull/5911 for both cases, with current cross-browser test results at https://github.com/w3c/web-platform-tests/pull/5911#issuecomment-301188437

We should try to at least pass the module script half of the tests for shipping modules; passing the classic scripts half may require an intent-to-deprecate-and-remove.
 
Blocking: 594639
Labels: -Pri-3 Pri-2
Status: Assigned (was: Untriaged)
Thanks for the good summary! I'll handle this.
Labels: M-61 OS-All
Status: Started (was: Assigned)
Targeting M-61.

Comment 3 by kouhei@chromium.org, May 29 2017

Labels: -Pri-2 Pri-1
Bumping to P1 assuming this will block shipping.

If not: please remove dep to 594639 and revert to P2
Agree > block shipping.
Blockedon: 686281
Project Member

Comment 6 by bugdroid1@chromium.org, Jul 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e386aa019f7e95b4c0ef1da85265a07bdd738dc2

commit e386aa019f7e95b4c0ef1da85265a07bdd738dc2
Author: Hiroshige Hayashizaki <hiroshige@chromium.org>
Date: Fri Jul 07 22:01:06 2017

Introduce ScriptLoader::ExecuteScriptBlock()

This CL introduces ExecuteScriptBlock() that is intended to directly
corresponds to "execute a script block" in the HTML spec:
https://html.spec.whatwg.org/#execute-the-script-block
Upcoming CLs will replace ExecuteScript() calls with
ExecuteScriptBlock() and make all script execution code paths call
ExecuteScriptBlock().

This provides a spec-conformant single control point of script
execution including load/error event dispatching, preparing
for Issue 721914.

This shouldn't change the behavior.

Bug: 686281, 721914
Change-Id: Ia4d1d8a2db2b3d203db99b3a9e66be956ca9db74
Reviewed-on: https://chromium-review.googlesource.com/554098
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485065}
[modify] https://crrev.com/e386aa019f7e95b4c0ef1da85265a07bdd738dc2/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
[modify] https://crrev.com/e386aa019f7e95b4c0ef1da85265a07bdd738dc2/third_party/WebKit/Source/core/dom/ScriptLoader.h

Anyway I'll forbid execution of module scripts and its load/error events when moved across *context* documents, and I feel this is sufficient to unblock  Issue 594639 .
CL: https://chromium-review.googlesource.com/c/576559/.

I'll continue/respond to spec discussions later (I'm still thinking...), and once we finalize the spec discussions, I'll send intent to deprecate and remove and do the same thing for classic scripts.

Comment 8 by kouhei@chromium.org, Jul 18 2017

Thanks! Agreed that the CL is sufficient for module scripts.
Would you update this bug to unblock 594639 after the CL land?
Project Member

Comment 9 by bugdroid1@chromium.org, Jul 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9a7b3a5d0d7a51ec085e8bdadc22648c9d02d24b

commit 9a7b3a5d0d7a51ec085e8bdadc22648c9d02d24b
Author: Hiroshige Hayashizaki <hiroshige@chromium.org>
Date: Wed Jul 19 02:15:45 2017

Forbid module script execution if moved to a different context document

Bug: 721914
Change-Id: I9463337a2fdc0c43d78366f146280e14a8fcb5f7
Reviewed-on: https://chromium-review.googlesource.com/576559
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487720}
[modify] https://crrev.com/9a7b3a5d0d7a51ec085e8bdadc22648c9d02d24b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
[modify] https://crrev.com/9a7b3a5d0d7a51ec085e8bdadc22648c9d02d24b/third_party/WebKit/Source/core/dom/ScriptLoader.h

Blocking: -594639
Unblocking 594639 by the CL at Comment #9 (See Comment #7, #8).
Project Member

Comment 11 by bugdroid1@chromium.org, Sep 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a664792a49d7462452d631f090d8f936f6b93252

commit a664792a49d7462452d631f090d8f936f6b93252
Author: Hiroshige Hayashizaki <hiroshige@chromium.org>
Date: Thu Sep 07 02:41:19 2017

Fix crashes when module scripts are moved between documents and failed loading

PendingScript::GetSource() can return nullptr when error_occurred is set to
true, causing null pointer crashes.
This CL uses ScriptLoader::GetScriptType() instead of Script::GetScriptType(),
which should be equivalent.

Bug:  761625 , 721914
Change-Id: Ic8cd45001f7ec385bfda6a3456e61401c9d78760
Reviewed-on: https://chromium-review.googlesource.com/653762
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#500195}
[modify] https://crrev.com/a664792a49d7462452d631f090d8f936f6b93252/third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Project Member

Comment 12 by bugdroid1@chromium.org, Aug 23

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/44a15d722f3bdbe9308aee0e1df453cd330d1ce8

commit 44a15d722f3bdbe9308aee0e1df453cd330d1ce8
Author: Hiroshige Hayashizaki <hiroshige@chromium.org>
Date: Thu Aug 23 08:10:13 2018

Add UseCounter for evaluating scripts moved between Documents

As a preparation for stopping evaluating scripts moved between Documents.

Bug: 721914
Change-Id: I611d4474f487f22ca8a1c18ec4d0fc6e90d83fad
Reviewed-on: https://chromium-review.googlesource.com/1180800
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585425}
[modify] https://crrev.com/44a15d722f3bdbe9308aee0e1df453cd330d1ce8/third_party/blink/public/platform/web_feature.mojom
[modify] https://crrev.com/44a15d722f3bdbe9308aee0e1df453cd330d1ce8/third_party/blink/renderer/core/script/pending_script.cc
[modify] https://crrev.com/44a15d722f3bdbe9308aee0e1df453cd330d1ce8/tools/metrics/histograms/enums.xml

Sign in to add a comment