Skip to content

Commit e9d0bdb

Browse files
committed
Stop evaluating <script>s moved between Documents during fetching
https://bugs.webkit.org/show_bug.cgi?id=202714 <rdar://problem/56208425> Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline WPT tests now that more checks are passing. Note that these checks were already passing in both Firefox and Chrome. * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-fetch-error-external-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-fetch-error-external-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-parse-error-external-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-parse-error-external-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-parse-error-inline-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-success-external-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-success-external-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-success-inline-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-fetch-error-external-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-fetch-error-external-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-parse-error-external-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-parse-error-external-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-parse-error-inline-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-success-external-classic-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-success-external-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-success-inline-classic-expected.txt: Source/WebCore: Stop evaluating <script>s moved between Documents during fetching: - whatwg/html#2469 - whatwg/html#2673 Both Firefox and Chrome already behave this way. No new tests, rebaselined existing tests. * dom/ScriptElement.cpp: (WebCore::ScriptElement::prepareScript): Set the element's preparation-time document to its node document, as per: - https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script (step 11) (WebCore::ScriptElement::executePendingScript): If scriptElement's preparation-time document is not equal to scriptElement's node document, then return, as per: - https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block (step 2) * dom/ScriptElement.h: Canonical link: https://commits.webkit.org/240442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280924 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 06b7e45 commit e9d0bdb

20 files changed

Lines changed: 107 additions & 36 deletions

LayoutTests/imported/w3c/ChangeLog

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
2021-08-11 Chris Dumez <cdumez@apple.com>
2+
3+
Stop evaluating <script>s moved between Documents during fetching
4+
https://bugs.webkit.org/show_bug.cgi?id=202714
5+
<rdar://problem/56208425>
6+
7+
Reviewed by Geoffrey Garen.
8+
9+
Rebaseline WPT tests now that more checks are passing. Note that these checks were already passing in both Firefox and Chrome.
10+
11+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-fetch-error-external-classic-expected.txt:
12+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-fetch-error-external-module-expected.txt:
13+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-parse-error-external-classic-expected.txt:
14+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-parse-error-external-module-expected.txt:
15+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-parse-error-inline-classic-expected.txt:
16+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-success-external-classic-expected.txt:
17+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-success-external-module-expected.txt:
18+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/after-prepare-iframe-success-inline-classic-expected.txt:
19+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-fetch-error-external-classic-expected.txt:
20+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-fetch-error-external-module-expected.txt:
21+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-parse-error-external-classic-expected.txt:
22+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-parse-error-external-module-expected.txt:
23+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-parse-error-inline-classic-expected.txt:
24+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-success-external-classic-expected.txt:
25+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-success-external-module-expected.txt:
26+
* web-platform-tests/html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-success-inline-classic-expected.txt:
27+
128
2021-08-11 Chris Dumez <cdumez@apple.com>
229

330
HTMLMetaElement http-equiv should not be processed in shadow trees
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
12

23

34
PASS Sanity check around top-level Window
45
PASS Eval: Move fetch-error external classic script to iframe after-prepare
56
PASS <script> load: Move fetch-error external classic script to iframe after-prepare
6-
FAIL <script> error: Move fetch-error external classic script to iframe after-prepare assert_unreached: Script error evennt fired unexpectedly Reached unreachable code
7+
PASS <script> error: Move fetch-error external classic script to iframe after-prepare
78
PASS window error: Move fetch-error external classic script to iframe after-prepare
89

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
12

23

34
PASS Sanity check around top-level Window
45
PASS Eval: Move fetch-error external module script to iframe after-prepare
56
PASS <script> load: Move fetch-error external module script to iframe after-prepare
6-
FAIL <script> error: Move fetch-error external module script to iframe after-prepare assert_unreached: Script error evennt fired unexpectedly Reached unreachable code
7+
PASS <script> error: Move fetch-error external module script to iframe after-prepare
78
PASS window error: Move fetch-error external module script to iframe after-prepare
89

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CONSOLE MESSAGE: SyntaxError: Left side of assignment is not a reference.
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
22

33

44
PASS Sanity check around top-level Window
55
PASS Eval: Move parse-error external classic script to iframe after-prepare
6-
FAIL <script> load: Move parse-error external classic script to iframe after-prepare assert_unreached: Script load event fired unexpectedly Reached unreachable code
6+
PASS <script> load: Move parse-error external classic script to iframe after-prepare
77
PASS <script> error: Move parse-error external classic script to iframe after-prepare
8-
FAIL window error: Move parse-error external classic script to iframe after-prepare assert_unreached: Window error event shouldn't fired on destination window Reached unreachable code
8+
PASS window error: Move parse-error external classic script to iframe after-prepare
99

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CONSOLE MESSAGE: SyntaxError: Left side of assignment is not a reference.
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
22

33

44
PASS Sanity check around top-level Window
55
PASS Eval: Move parse-error external module script to iframe after-prepare
66
PASS <script> load: Move parse-error external module script to iframe after-prepare
7-
FAIL <script> error: Move parse-error external module script to iframe after-prepare assert_unreached: Script error evennt fired unexpectedly Reached unreachable code
7+
PASS <script> error: Move parse-error external module script to iframe after-prepare
88
PASS window error: Move parse-error external module script to iframe after-prepare
99

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CONSOLE MESSAGE: SyntaxError: Left side of assignment is not a reference.
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
22

33

44
PASS Sanity check around top-level Window
55
PASS Eval: Move parse-error inline classic script to iframe after-prepare
6-
FAIL <script> load: Move parse-error inline classic script to iframe after-prepare assert_unreached: Script load event fired unexpectedly Reached unreachable code
6+
PASS <script> load: Move parse-error inline classic script to iframe after-prepare
77
PASS <script> error: Move parse-error inline classic script to iframe after-prepare
8-
FAIL window error: Move parse-error inline classic script to iframe after-prepare assert_unreached: Window error event shouldn't fired on destination window Reached unreachable code
8+
PASS window error: Move parse-error inline classic script to iframe after-prepare
99

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CONSOLE MESSAGE: exec
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
22

33

44
PASS Sanity check around top-level Window
5-
FAIL Eval: Move success external classic script to iframe after-prepare assert_false: The script must not have executed in destination window expected false got "executed"
6-
FAIL <script> load: Move success external classic script to iframe after-prepare assert_unreached: Script load event fired unexpectedly Reached unreachable code
5+
PASS Eval: Move success external classic script to iframe after-prepare
6+
PASS <script> load: Move success external classic script to iframe after-prepare
77
PASS <script> error: Move success external classic script to iframe after-prepare
88
PASS window error: Move success external classic script to iframe after-prepare
99

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CONSOLE MESSAGE: TypeError: Requested module is not instantiated yet.
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
22

33

44
PASS Sanity check around top-level Window
55
PASS Eval: Move success external module script to iframe after-prepare
6-
FAIL <script> load: Move success external module script to iframe after-prepare assert_unreached: Script load event fired unexpectedly Reached unreachable code
6+
PASS <script> load: Move success external module script to iframe after-prepare
77
PASS <script> error: Move success external module script to iframe after-prepare
8-
FAIL window error: Move success external module script to iframe after-prepare assert_unreached: Window error event shouldn't fired on destination window Reached unreachable code
8+
PASS window error: Move success external module script to iframe after-prepare
99

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
12

23

34
PASS Sanity check around top-level Window
4-
FAIL Eval: Move success inline classic script to iframe after-prepare assert_false: The script must not have executed in destination window expected false got "executed"
5-
FAIL <script> load: Move success inline classic script to iframe after-prepare assert_unreached: Script load event fired unexpectedly Reached unreachable code
5+
PASS Eval: Move success inline classic script to iframe after-prepare
6+
PASS <script> load: Move success inline classic script to iframe after-prepare
67
PASS <script> error: Move success inline classic script to iframe after-prepare
78
PASS window error: Move success inline classic script to iframe after-prepare
89

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
CONSOLE MESSAGE: Not executing script because it moved between documents during fetching
12

23

34
PASS Sanity check around top-level Window
45
PASS Eval: Move fetch-error external classic script to iframe move-back
56
PASS <script> load: Move fetch-error external classic script to iframe move-back
6-
FAIL <script> error: Move fetch-error external classic script to iframe move-back assert_unreached: Script error evennt fired unexpectedly Reached unreachable code
7+
PASS <script> error: Move fetch-error external classic script to iframe move-back
78
PASS window error: Move fetch-error external classic script to iframe move-back
89

0 commit comments

Comments
 (0)