Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/nomodule-set-on-async-classic-script.html

Issue 2665073003: Import wpt@cd5cce9780f84cee679919679b8199084ea96d54 (Closed)
Patch Set: Update test expectations and baselines. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>External classic scripts with nomodule content attribute must not run</ti tle>
5 <link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
6 <link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <!-- Load this script synchronously to ensure test cases below can load it in 20 0ms -->
10 <script src="resources/set-script-executed.js"></script>
11 </head>
12 <body>
13 <script>
14
15 waitForLoadEvent = new Promise((resolve) => {
16 window.onload = resolve;
17 });
18
19 waitForAsyncScript = () => {
20 return new Promise((resolve) => {
21 waitForLoadEvent.then(() => setTimeout(resolve, 200));
22 });
23 }
24
25 let readyForSecondTest;
26 promise_test(() => {
27 window.executed = false;
28 let loaded = false;
29 let errored = false;
30
31 let script = document.createElement('script');
32 script.src = './resources/set-script-executed.js';
33 script.onload = () => loaded = true;
34 script.onerror = () => errored = true;
35 script.noModule = false;
36 document.body.appendChild(script);
37
38 return waitForAsyncScript().then(() => {
39 assert_true(executed);
40 assert_true(loaded);
41 assert_false(errored);
42 });
43 }, 'An asynchronously loaded classic script with noModule set to false must run' );
44
45 promise_test(() => {
46 window.executed = false;
47 let loaded = false;
48 let errored = false;
49
50 let script = document.createElement('script');
51 script.src = './resources/set-script-executed.js';
52 script.onload = () => loaded = true;
53 script.onerror = () => errored = true;
54 script.noModule = true;
55 document.body.appendChild(script);
56
57 return waitForAsyncScript().then(() => {
58 assert_false(executed);
59 assert_false(loaded);
60 assert_false(errored);
61 });
62 }, 'An asynchronously loaded classic script with noModule set to true must not r un');
63
64 </script>
65 </body>
66 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698