| OLD | NEW |
| (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> |
| OLD | NEW |