зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1587902 [wpt PR 19632] - Scripts moved between documents, a=testonly
Automatic update from web-platform-tests Scripts moved between documents (#19632) This follows the changes in https://github.com/whatwg/html/pull/2673, but also tests the issue at https://github.com/whatwg/html/issues/2137 in favor of the current spec. Co-Authored-By: Domenic Denicola <d@domenic.me> -- wpt-commits: 299dd665683c2c5a4896bfb7727d8666aa6bba89 wpt-pr: 19632
This commit is contained in:
Родитель
5f7d8ce3b0
Коммит
e160f6cd8c
|
@ -0,0 +1,16 @@
|
|||
The tests in this directory are for script elements moved between documents.
|
||||
|
||||
Use
|
||||
|
||||
```
|
||||
$ tools/generate.py
|
||||
```
|
||||
|
||||
to generate test HTML files.
|
||||
|
||||
Background:
|
||||
|
||||
- https://www.w3.org/Bugs/Public/show_bug.cgi?id=11323
|
||||
- https://github.com/whatwg/html/issues/2137
|
||||
- https://github.com/whatwg/html/issues/2469
|
||||
- https://github.com/whatwg/html/pull/2673
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "createHTMLDocument", "fetch-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "createHTMLDocument", "fetch-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "createHTMLDocument", "parse-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "createHTMLDocument", "parse-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "createHTMLDocument", "success", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "createHTMLDocument", "success", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "fetch-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "fetch-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "parse-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "parse-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "parse-error", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "success", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "success", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("after-prepare", "iframe", "success", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "fetch-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "fetch-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "parse-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "parse-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "parse-error", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "parse-error", "inline", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "success", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "success", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "success", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "createHTMLDocument", "success", "inline", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "fetch-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "fetch-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "parse-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "parse-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "parse-error", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "parse-error", "inline", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "success", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "success", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "success", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("before-prepare", "iframe", "success", "inline", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "createHTMLDocument", "fetch-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "createHTMLDocument", "fetch-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "createHTMLDocument", "parse-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "createHTMLDocument", "parse-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "createHTMLDocument", "success", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "createHTMLDocument", "success", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "fetch-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "fetch-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "parse-error", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "parse-error", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "parse-error", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "success", "external", "classic");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "success", "external", "module");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("move-back", "iframe", "success", "inline", "classic");
|
||||
</script>
|
|
@ -0,0 +1,213 @@
|
|||
"use strict";
|
||||
|
||||
function createDocument(documentType, result, inlineOrExternal, type, hasBlockingStylesheet) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src =
|
||||
"resources/moving-between-documents-iframe.py" +
|
||||
"?result=" + result +
|
||||
"&inlineOrExternal=" + inlineOrExternal +
|
||||
"&type=" + type +
|
||||
"&hasBlockingStylesheet=" + hasBlockingStylesheet +
|
||||
"&cache=" + Math.random();
|
||||
// As blocking stylesheets delays Document load events, we use
|
||||
// DOMContentLoaded here.
|
||||
// After that point, we expect iframe.contentDocument exists
|
||||
// while still waiting for blocking stylesheet loading.
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
window.addEventListener('message', (event) => {
|
||||
if (documentType === "iframe") {
|
||||
resolve([iframe.contentWindow, iframe.contentDocument]);
|
||||
} else if (documentType === "createHTMLDocument") {
|
||||
resolve([
|
||||
iframe.contentWindow,
|
||||
iframe.contentDocument.implementation.createHTMLDocument("")]);
|
||||
} else {
|
||||
reject(new Error("Invalid document type: " + documentType));
|
||||
}
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
window.scriptErrorEventFired = false;
|
||||
window.didExecute = undefined;
|
||||
|
||||
// For a script, there are four associated Documents that can
|
||||
// potentially different:
|
||||
//
|
||||
// [1] script's parser document
|
||||
// https://html.spec.whatwg.org/C/#parser-document
|
||||
//
|
||||
// [2] script's preparation-time document
|
||||
// https://html.spec.whatwg.org/C/#preparation-time-document
|
||||
// == script's node document at the beginning of #prepare-a-script
|
||||
//
|
||||
// [3] script's node document at the beginning of
|
||||
// #execute-the-script-block
|
||||
//
|
||||
// This helper is for tests where [1]/[2]/[3] are different.
|
||||
|
||||
// In the spec, scripts are not executed only if [1]/[2]/[3] are all the same
|
||||
// (or [1] is null and [2]==[3]).
|
||||
//
|
||||
// A check for [1]==[2] is in #prepare-a-script and
|
||||
// a check for [1]==[3] is in #execute-the-script-block,
|
||||
// but these are under debate: https://github.com/whatwg/html/issues/2137
|
||||
//
|
||||
// A check for [2]==[3] is in #execute-the-script-block, which is added by
|
||||
// https://github.com/whatwg/html/pull/2673
|
||||
|
||||
// timing:
|
||||
// "before-prepare":
|
||||
// A <script> is moved during parsing before #prepare-a-script.
|
||||
// [1] != [2] == [3]
|
||||
//
|
||||
// "after-prepare":
|
||||
// A <script> is moved after parsing/#prepare-a-script but
|
||||
// before #execute-the-script-block.
|
||||
// [1] == [2] != [3]
|
||||
//
|
||||
// To move such scripts, #has-a-style-sheet-that-is-blocking-scripts
|
||||
// is utilized to block inline scripts after #prepare-a-script.
|
||||
// Note: this is a corner case in the spec which might be removed
|
||||
// from the spec in the future, e.g.
|
||||
// https://github.com/whatwg/html/issues/1349
|
||||
// https://github.com/chrishtr/rendering/blob/master/stylesheet-loading-proposal.md
|
||||
//
|
||||
// "parsing but moved back"
|
||||
// A <script> is moved before #prepare-a-script, but moved back again
|
||||
// to the original Document after #prepare-a-script.
|
||||
// [1] == [3] != [2]
|
||||
//
|
||||
// destType: "iframe" or "createHTMLDocument".
|
||||
// result: "fetch-error", "parse-error", or "success".
|
||||
// inlineOrExternal: "inline" or "external".
|
||||
// type: "classic" or "module".
|
||||
async function runTest(timing, destType, result, inlineOrExternal, type) {
|
||||
if (result === "fetch-error" && inlineOrExternal === "inline") {
|
||||
return;
|
||||
}
|
||||
|
||||
const description =
|
||||
`Move ${result} ${inlineOrExternal} ${type} script ` +
|
||||
`to ${destType} ${timing}`;
|
||||
|
||||
const t = async_test("Eval: " + description);
|
||||
const tScriptLoadEvent = async_test("<script> load: " + description);
|
||||
const tScriptErrorEvent = async_test("<script> error: " + description);
|
||||
const tWindowErrorEvent = async_test("window error: " + description);
|
||||
|
||||
// If scripts should be moved after #prepare-a-script before
|
||||
// #execute-the-script-block, we add a style sheet that is
|
||||
// blocking scripts.
|
||||
const hasBlockingStylesheet =
|
||||
timing === "after-prepare" || timing === "move-back";
|
||||
|
||||
const [sourceWindow, sourceDocument] = await createDocument(
|
||||
"iframe", result, inlineOrExternal, type, hasBlockingStylesheet);
|
||||
|
||||
// Due to https://crbug.com/1034176, Chromium needs
|
||||
// blocking stylesheets also in the destination Documents.
|
||||
const [destWindow, destDocument] = await createDocument(
|
||||
destType, null, null, null, hasBlockingStylesheet);
|
||||
|
||||
let scriptErrorEventFired = false;
|
||||
const scriptOnError = (event) => {
|
||||
// For Firefox: Prevent window.onerror is fired due to propagation
|
||||
// from <script>'s error event.
|
||||
event.stopPropagation();
|
||||
|
||||
tScriptErrorEvent.unreached_func("Event fired unexpectedly")();
|
||||
};
|
||||
|
||||
sourceWindow.didExecute = false;
|
||||
sourceWindow.t = t;
|
||||
sourceWindow.tScriptLoadEvent = tScriptLoadEvent;
|
||||
sourceWindow.tScriptErrorEvent = tScriptErrorEvent;
|
||||
sourceWindow.scriptOnError = scriptOnError;
|
||||
sourceWindow.onerror = tWindowErrorEvent.unreached_func(
|
||||
"Window error event shouldn't fired on source window");
|
||||
sourceWindow.readyToEvaluate = false;
|
||||
|
||||
destWindow.didExecute = false;
|
||||
destWindow.t = t;
|
||||
destWindow.tScriptLoadEvent = tScriptLoadEvent;
|
||||
destWindow.tScriptErrorEvent = tScriptErrorEvent;
|
||||
destWindow.scriptOnError = scriptOnError;
|
||||
destWindow.onerror = tWindowErrorEvent.unreached_func(
|
||||
"Window error event shouldn't fired on destination window");
|
||||
destWindow.readyToEvaluate = false;
|
||||
|
||||
// t=0 sec: Move between documents before #prepare-a-script.
|
||||
// At this time, the script element is not yet inserted to the DOM.
|
||||
if (timing === "before-prepare" || timing === "move-back") {
|
||||
destDocument.body.appendChild(
|
||||
sourceDocument.querySelector("streaming-element"));
|
||||
}
|
||||
if (timing === "before-prepare") {
|
||||
sourceWindow.readyToEvaluate = true;
|
||||
destWindow.readyToEvaluate = true;
|
||||
}
|
||||
|
||||
// t=1 sec: the script element is inserted to the DOM, i.e.
|
||||
// #prepare-a-script is triggered (see monving-between-documents-iframe.py).
|
||||
// In the case of `before-prepare`, the script can be evaluated.
|
||||
// In other cases, the script evaluation is blocked by a style sheet.
|
||||
await new Promise(resolve => step_timeout(resolve, 2000));
|
||||
|
||||
// t=2 sec: Move between documents after #prepare-a-script.
|
||||
if (timing === "after-prepare") {
|
||||
destDocument.body.appendChild(
|
||||
sourceDocument.querySelector("streaming-element"));
|
||||
}
|
||||
else if (timing === "move-back") {
|
||||
sourceDocument.body.appendChild(
|
||||
destDocument.querySelector("streaming-element"));
|
||||
}
|
||||
sourceWindow.readyToEvaluate = true;
|
||||
destWindow.readyToEvaluate = true;
|
||||
|
||||
// t=3 or 5 sec: Blocking stylesheet and external script are loaded,
|
||||
// and thus script evaulation is unblocked.
|
||||
|
||||
// Note: scripts are expected to be loaded at t=3, because the fetch
|
||||
// is started by #prepare-a-script at t=1, and the script's delay is
|
||||
// 2 seconds. However in Chromium, due to preload scanner, the script
|
||||
// loading might take 4 seconds, because the first request by preload
|
||||
// scanner of the source Document takes 2 seconds (between t=1 and t=3)
|
||||
// which blocks the second request by #prepare-a-script that takes
|
||||
// another 2 seconds (between t=3 and t=5).
|
||||
|
||||
// t=6 sec: After all possible script evaluation points, test whether
|
||||
// the script/events were evaluated/fired or not.
|
||||
// As we have concurrent tests, a single global step_timeout() is
|
||||
// used instead of multiple `t.step_timeout()` etc.,
|
||||
// to avoid potential race conditions between `t.step_timeout()`s.
|
||||
return new Promise(resolve => {
|
||||
step_timeout(() => {
|
||||
tWindowErrorEvent.done();
|
||||
tScriptLoadEvent.done();
|
||||
tScriptErrorEvent.done();
|
||||
|
||||
t.step_func_done(() => {
|
||||
assert_false(sourceWindow.didExecute,
|
||||
"The script must not have executed in source window");
|
||||
assert_false(destWindow.didExecute,
|
||||
"The script must not have executed in destination window");
|
||||
})();
|
||||
resolve();
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
|
||||
async_test(t => {
|
||||
t.step_timeout(() => {
|
||||
assert_equals(window.didExecute, undefined,
|
||||
"The script must not have executed in the top-level window");
|
||||
assert_false(window.scriptErrorEventFired,
|
||||
"Top-level window's scriptErrorEventFired should be untouched");
|
||||
t.done();
|
||||
},
|
||||
4000);
|
||||
}, "Sanity check around top-level Window");
|
|
@ -0,0 +1,92 @@
|
|||
import random
|
||||
import time
|
||||
|
||||
"""
|
||||
This script serves
|
||||
"""
|
||||
|
||||
def main(request, response):
|
||||
inlineOrExternal = request.GET.first("inlineOrExternal", "null")
|
||||
hasBlockingStylesheet = request.GET.first("hasBlockingStylesheet", "true") == "true"
|
||||
result = request.GET.first("result", "success")
|
||||
type = "text/javascript" if request.GET.first("type", "classic") == "classic" else "module"
|
||||
|
||||
response.headers.set("Content-Type", "text/html; charset=utf-8")
|
||||
response.headers.set("Transfer-Encoding", "chunked")
|
||||
response.write_status_headers()
|
||||
|
||||
# Step 1: Start parsing.
|
||||
body = """<!DOCTYPE html>
|
||||
<head>
|
||||
<script>
|
||||
parent.postMessage("fox", "*");
|
||||
</script>
|
||||
"""
|
||||
|
||||
if hasBlockingStylesheet:
|
||||
body += """
|
||||
<link rel="stylesheet" href="slow-flag-setter.py?result=css&cache=%f">
|
||||
""" % random.random()
|
||||
|
||||
body += """
|
||||
</head>
|
||||
<body>
|
||||
"""
|
||||
|
||||
if inlineOrExternal == "inline" or inlineOrExternal == "external":
|
||||
body += """
|
||||
<streaming-element>
|
||||
"""
|
||||
|
||||
# Trigger DOM processing
|
||||
body += "A" * 100000
|
||||
|
||||
response.writer.write("%x\r\n" % len(body))
|
||||
response.writer.write(body)
|
||||
response.writer.write("\r\n")
|
||||
response.writer.flush()
|
||||
|
||||
body = ""
|
||||
|
||||
if inlineOrExternal == "inline":
|
||||
time.sleep(1)
|
||||
body += """
|
||||
<script id="s1" type="%s"
|
||||
onload="tScriptLoadEvent.unreached_func('onload')"
|
||||
onerror="scriptOnError(event)">
|
||||
if (!window.readyToEvaluate) {
|
||||
window.didExecute = "executed too early";
|
||||
} else {
|
||||
window.didExecute = "executed";
|
||||
}
|
||||
""" % (type)
|
||||
if result == "parse-error":
|
||||
body += "1=2 parse error\n"
|
||||
|
||||
body += """
|
||||
</script>
|
||||
</streaming-element>
|
||||
"""
|
||||
elif inlineOrExternal == "external":
|
||||
time.sleep(1)
|
||||
body += """
|
||||
<script id="s1" type="%s"
|
||||
src="slow-flag-setter.py?result=%s&cache=%s"
|
||||
onload="tScriptLoadEvent.unreached_func('onload')"
|
||||
onerror="scriptOnError(event)"></script>
|
||||
</streaming-element>
|
||||
""" % (type, result, random.random())
|
||||
|
||||
# // if readyToEvaluate is false, the script is probably
|
||||
# // wasn't blocked by stylesheets as expected.
|
||||
|
||||
# Trigger DOM processing
|
||||
body += "B" * 100000
|
||||
|
||||
response.writer.write("%x\r\n" % len(body))
|
||||
response.writer.write(body)
|
||||
response.writer.write("\r\n")
|
||||
|
||||
response.writer.write("0\r\n")
|
||||
response.writer.write("\r\n")
|
||||
response.writer.flush()
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
import time
|
||||
|
||||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
|
||||
result = request.GET.first("result", "success")
|
||||
if result == "css":
|
||||
time.sleep(3)
|
||||
headers = [("Content-Type", "text/css")]
|
||||
body = ""
|
||||
else:
|
||||
time.sleep(2)
|
||||
|
||||
body = """
|
||||
fetch('exec');
|
||||
console.log('exec');
|
||||
if (!window.readyToEvaluate) {
|
||||
window.didExecute = "executed too early";
|
||||
} else {
|
||||
window.didExecute = "executed";
|
||||
}
|
||||
"""
|
||||
if result == "parse-error":
|
||||
body = "1=2 parse error;"
|
||||
if result == "fetch-error":
|
||||
return 404, [('Content-Type', 'text/plain')], """window.didExecute = "fetch error";"""
|
||||
|
||||
return headers, body
|
|
@ -0,0 +1,40 @@
|
|||
template = '''<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Moving script elements between documents</title>
|
||||
<!-- This is generated by tools/generate.py. Do not manually edit. -->
|
||||
<link rel="author" href="mailto:d@domenic.me" title="Domenic Denicola">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/moving-between-documents-helper.js"></script>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
runTest("%s", "%s", "%s", "%s", "%s");
|
||||
</script>
|
||||
'''
|
||||
|
||||
n = 0
|
||||
for timing in ["before-prepare", "after-prepare", "move-back"]:
|
||||
for destType in ["iframe", "createHTMLDocument"]:
|
||||
for result in ["fetch-error", "parse-error", "success"]:
|
||||
for inlineOrExternal in ["inline", "external"]:
|
||||
for type in ["classic", "module"]:
|
||||
# No fetch error for inline scripts.
|
||||
if result == "fetch-error" and inlineOrExternal == "inline":
|
||||
continue
|
||||
|
||||
# The current test helper uses
|
||||
# #has-a-style-sheet-that-is-blocking-scripts to block script
|
||||
# evaluation after #prepare-a-script, but in some cases this
|
||||
# doesn't work:
|
||||
# - inline scripts to createHTMLDocument
|
||||
if timing != "before-prepare" and destType == "createHTMLDocument" and inlineOrExternal == "inline":
|
||||
continue
|
||||
# - module inline scripts https://github.com/whatwg/html/issues/3890
|
||||
if timing != "before-prepare" and inlineOrExternal == "inline" and type == "module":
|
||||
continue
|
||||
|
||||
with open('%s-%s-%s-%s-%s.html' % (timing, destType, result, inlineOrExternal, type), 'w') as f:
|
||||
f.write(template % (timing, destType, result, inlineOrExternal, type))
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
window.didExecute = true;
|
Загрузка…
Ссылка в новой задаче