tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 42d9cf09105531b1a0e5c848513fea66f62420bb
parent 466675ab4f8d240c2b068caafad4bf9e1ccd9f44
Author: Tooru Fujisawa <arai_a@mac.com>
Date:   Wed,  5 Nov 2025 04:09:47 +0000

Bug 1853173 - Part 8: Remove old disabled tests. r=nbp

Differential Revision: https://phabricator.services.mozilla.com/D271029

Diffstat:
Ddom/base/test/file_js_cache.html | 10----------
Ddom/base/test/file_js_cache.js | 5-----
Ddom/base/test/file_js_cache_module.html | 13-------------
Ddom/base/test/file_js_cache_save_after_load.html | 10----------
Ddom/base/test/file_js_cache_save_after_load.js | 15---------------
Ddom/base/test/file_js_cache_syntax_error.html | 10----------
Ddom/base/test/file_js_cache_syntax_error.js | 1-
Ddom/base/test/file_js_cache_with_sri.html | 12------------
Ddom/base/test/file_module_js_cache.html | 10----------
Ddom/base/test/file_module_js_cache.mjs | 6------
Ddom/base/test/file_module_js_cache_no_module.html | 10----------
Ddom/base/test/file_module_js_cache_with_sri.html | 12------------
Ddom/base/test/file_script_module_dynamic_and_element.html | 10----------
Ddom/base/test/file_script_module_dynamic_and_element.mjs | 20--------------------
Ddom/base/test/file_script_module_dynamic_and_element_imported_1.mjs | 7-------
Ddom/base/test/file_script_module_dynamic_and_element_imported_2.mjs | 1-
Ddom/base/test/file_script_module_dynamic_and_element_imported_3.mjs | 1-
Ddom/base/test/file_script_module_dynamic_and_static.html | 10----------
Ddom/base/test/file_script_module_dynamic_and_static.mjs | 11-----------
Ddom/base/test/file_script_module_dynamic_and_static_imported_1.mjs | 5-----
Ddom/base/test/file_script_module_dynamic_and_static_imported_2.mjs | 5-----
Ddom/base/test/file_script_module_dynamic_and_static_imported_3.mjs | 1-
Ddom/base/test/file_script_module_dynamic_import.html | 10----------
Ddom/base/test/file_script_module_dynamic_import.mjs | 4----
Ddom/base/test/file_script_module_dynamic_import_imported.mjs | 1-
Ddom/base/test/file_script_module_element_and_dynamic.html | 10----------
Ddom/base/test/file_script_module_element_and_dynamic.mjs | 11-----------
Ddom/base/test/file_script_module_element_and_dynamic_imported_1.mjs | 13-------------
Ddom/base/test/file_script_module_element_and_dynamic_imported_2.mjs | 1-
Ddom/base/test/file_script_module_element_and_dynamic_imported_3.mjs | 1-
Ddom/base/test/file_script_module_element_and_import.html | 10----------
Ddom/base/test/file_script_module_element_and_import.mjs | 9---------
Ddom/base/test/file_script_module_element_and_import_imported_1.mjs | 13-------------
Ddom/base/test/file_script_module_element_and_import_imported_2.mjs | 1-
Ddom/base/test/file_script_module_element_and_import_imported_3.mjs | 1-
Ddom/base/test/file_script_module_frames_dynamic.html | 24------------------------
Ddom/base/test/file_script_module_frames_dynamic_load.html | 19-------------------
Ddom/base/test/file_script_module_frames_dynamic_load.mjs | 4----
Ddom/base/test/file_script_module_frames_dynamic_save.html | 19-------------------
Ddom/base/test/file_script_module_frames_dynamic_save.mjs | 4----
Ddom/base/test/file_script_module_frames_dynamic_shared.mjs | 1-
Ddom/base/test/file_script_module_frames_element.html | 24------------------------
Ddom/base/test/file_script_module_frames_element_load.html | 19-------------------
Ddom/base/test/file_script_module_frames_element_save.html | 19-------------------
Ddom/base/test/file_script_module_frames_element_shared.mjs | 1-
Ddom/base/test/file_script_module_frames_import.html | 24------------------------
Ddom/base/test/file_script_module_frames_import_load.html | 19-------------------
Ddom/base/test/file_script_module_frames_import_load.mjs | 5-----
Ddom/base/test/file_script_module_frames_import_save.html | 19-------------------
Ddom/base/test/file_script_module_frames_import_save.mjs | 5-----
Ddom/base/test/file_script_module_frames_import_shared.mjs | 1-
Ddom/base/test/file_script_module_frames_relay.js | 22----------------------
Ddom/base/test/file_script_module_import.html | 10----------
Ddom/base/test/file_script_module_import.mjs | 5-----
Ddom/base/test/file_script_module_import_and_element.html | 10----------
Ddom/base/test/file_script_module_import_and_element.mjs | 18------------------
Ddom/base/test/file_script_module_import_and_element_imported_1.mjs | 7-------
Ddom/base/test/file_script_module_import_and_element_imported_2.mjs | 1-
Ddom/base/test/file_script_module_import_and_element_imported_3.mjs | 1-
Ddom/base/test/file_script_module_import_imported.mjs | 1-
Ddom/base/test/file_script_module_import_multi.html | 10----------
Ddom/base/test/file_script_module_import_multi.mjs | 7-------
Ddom/base/test/file_script_module_import_multi_elems.html | 10----------
Ddom/base/test/file_script_module_import_multi_elems_1.mjs | 15---------------
Ddom/base/test/file_script_module_import_multi_elems_2.mjs | 7-------
Ddom/base/test/file_script_module_import_multi_elems_imported_once_1.mjs | 1-
Ddom/base/test/file_script_module_import_multi_elems_imported_once_2.mjs | 1-
Ddom/base/test/file_script_module_import_multi_elems_imported_once_3.mjs | 1-
Ddom/base/test/file_script_module_import_multi_elems_imported_twice.mjs | 4----
Ddom/base/test/file_script_module_import_multi_imported_once.mjs | 5-----
Ddom/base/test/file_script_module_import_multi_imported_twice.mjs | 1-
Ddom/base/test/file_script_module_single.html | 10----------
Ddom/base/test/file_script_module_single.mjs | 8--------
Ddom/base/test/file_script_module_sri_basic.html | 11-----------
Ddom/base/test/file_script_module_sri_basic.mjs | 1-
Ddom/base/test/file_script_module_sri_basic_prep.html | 11-----------
Ddom/base/test/file_script_module_sri_dynamic_elem.html | 12------------
Ddom/base/test/file_script_module_sri_dynamic_elem.mjs | 6------
Ddom/base/test/file_script_module_sri_dynamic_elem_imported.mjs | 3---
Ddom/base/test/file_script_module_sri_dynamic_elem_nopreload.html | 10----------
Ddom/base/test/file_script_module_sri_dynamic_elem_nopreload.mjs | 20--------------------
Ddom/base/test/file_script_module_sri_dynamic_elem_nopreload_imported.mjs | 3---
Ddom/base/test/file_script_module_sri_dynamic_elem_nopreload_prep.html | 10----------
Ddom/base/test/file_script_module_sri_dynamic_elem_prep.html | 10----------
Ddom/base/test/file_script_module_sri_elem_dynamic.html | 12------------
Ddom/base/test/file_script_module_sri_elem_dynamic.mjs | 6------
Ddom/base/test/file_script_module_sri_elem_dynamic_imported.mjs | 3---
Ddom/base/test/file_script_module_sri_elem_dynamic_prep.html | 10----------
Ddom/base/test/file_script_module_sri_elem_elem_1.html | 12------------
Ddom/base/test/file_script_module_sri_elem_elem_1.mjs | 1-
Ddom/base/test/file_script_module_sri_elem_elem_1_prep.html | 10----------
Ddom/base/test/file_script_module_sri_elem_elem_2.html | 12------------
Ddom/base/test/file_script_module_sri_elem_elem_2.mjs | 1-
Ddom/base/test/file_script_module_sri_elem_elem_2_prep.html | 10----------
Ddom/base/test/file_script_module_sri_elem_import.html | 12------------
Ddom/base/test/file_script_module_sri_elem_import.mjs | 5-----
Ddom/base/test/file_script_module_sri_elem_import_imported.mjs | 3---
Ddom/base/test/file_script_module_sri_elem_import_prep.html | 10----------
Ddom/base/test/file_script_module_sri_fallback.html | 11-----------
Ddom/base/test/file_script_module_sri_fallback.mjs | 1-
Ddom/base/test/file_script_module_sri_fallback_failure.html | 15---------------
Ddom/base/test/file_script_module_sri_fallback_failure.mjs | 1-
Ddom/base/test/file_script_module_sri_fallback_failure_prep.html | 10----------
Ddom/base/test/file_script_module_sri_fallback_prep.html | 10----------
Ddom/base/test/file_script_module_sri_import_elem.html | 12------------
Ddom/base/test/file_script_module_sri_import_elem.mjs | 5-----
Ddom/base/test/file_script_module_sri_import_elem_imported.mjs | 3---
Ddom/base/test/file_script_module_sri_import_elem_nopreload.html | 10----------
Ddom/base/test/file_script_module_sri_import_elem_nopreload.mjs | 19-------------------
Ddom/base/test/file_script_module_sri_import_elem_nopreload_imported.mjs | 3---
Ddom/base/test/file_script_module_sri_import_elem_nopreload_prep.html | 10----------
Ddom/base/test/file_script_module_sri_import_elem_prep.html | 10----------
Ddom/base/test/file_script_module_static_and_dynamic.html | 10----------
Ddom/base/test/file_script_module_static_and_dynamic.mjs | 9---------
Ddom/base/test/file_script_module_static_and_dynamic_imported_1.mjs | 5-----
Ddom/base/test/file_script_module_static_and_dynamic_imported_2.mjs | 6------
Ddom/base/test/file_script_module_static_and_dynamic_imported_3.mjs | 1-
Mdom/base/test/mochitest.toml | 137-------------------------------------------------------------------------------
Ddom/base/test/test_script_loader_js_cache.html | 264-------------------------------------------------------------------------------
Ddom/base/test/test_script_loader_js_cache_frames.html | 202-------------------------------------------------------------------------------
Ddom/base/test/test_script_loader_js_cache_module.html | 537-------------------------------------------------------------------------------
Ddom/base/test/test_script_loader_js_cache_module_sri.html | 425-------------------------------------------------------------------------------
Mdom/tests/mochitest/script/mochitest.toml | 3---
Ddom/tests/mochitest/script/test_bug1656248.html | 93-------------------------------------------------------------------------------
124 files changed, 0 insertions(+), 2648 deletions(-)

diff --git a/dom/base/test/file_js_cache.html b/dom/base/test/file_js_cache.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Add a tag script to save the bytecode</title> -</head> -<body> - <script id="watchme" src="file_js_cache.js"></script> -</body> -</html> diff --git a/dom/base/test/file_js_cache.js b/dom/base/test/file_js_cache.js @@ -1,5 +0,0 @@ -function baz() {} -function bar() {} -function foo() { bar() } -foo(); - diff --git a/dom/base/test/file_js_cache_module.html b/dom/base/test/file_js_cache_module.html @@ -1,13 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Load the script as a module</title> -</head> -<body> - <!-- crossorigin="use-credentials", because if we do an anonymous load that -- - -- won't use the cache at all --> - <script id="watchme" src="file_js_cache.js" type="module" - crossorigin="use-credentials"></script> -</body> -</html> diff --git a/dom/base/test/file_js_cache_save_after_load.html b/dom/base/test/file_js_cache_save_after_load.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Save the bytecode when all scripts are executed</title> -</head> -<body> - <script id="watchme" src="file_js_cache_save_after_load.js"></script> -</body> -</html> diff --git a/dom/base/test/file_js_cache_save_after_load.js b/dom/base/test/file_js_cache_save_after_load.js @@ -1,15 +0,0 @@ -function send_ping() { - window.dispatchEvent(new Event("ping")); -} -send_ping(); // ping (=1) - -window.addEventListener("load", function () { - send_ping(); // ping (=2) - - // Append a script which should call |foo|, before the encoding of this script - // bytecode. - var script = document.createElement("script"); - script.type = "text/javascript"; - script.innerText = "send_ping();"; // ping (=3) - document.head.appendChild(script); -}); diff --git a/dom/base/test/file_js_cache_syntax_error.html b/dom/base/test/file_js_cache_syntax_error.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Do not save bytecode on compilation errors</title> -</head> -<body> - <script id="watchme" src="file_js_cache_syntax_error.js"></script> -</body> -</html> diff --git a/dom/base/test/file_js_cache_syntax_error.js b/dom/base/test/file_js_cache_syntax_error.js @@ -1 +0,0 @@ -var // SyntaxError: missing variable name. diff --git a/dom/base/test/file_js_cache_with_sri.html b/dom/base/test/file_js_cache_with_sri.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Add a tag script to save the bytecode</title> -</head> -<body> - <script id="watchme" src="file_js_cache.js" - integrity="sha384-8YSwN2ywq1SVThihWhj7uTVZ4UeIDwo3GgdPYnug+C+OS0oa6kH2IXBclwMaDJFb"> - </script> -</body> -</html> diff --git a/dom/base/test/file_module_js_cache.html b/dom/base/test/file_module_js_cache.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Add a tag module script to save the bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_module_js_cache.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_module_js_cache.mjs b/dom/base/test/file_module_js_cache.mjs @@ -1,6 +0,0 @@ -function baz() {} -function bar() {} -function foo() { - bar(); -} -foo(); diff --git a/dom/base/test/file_module_js_cache_no_module.html b/dom/base/test/file_module_js_cache_no_module.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Load the module script as a regular script</title> -</head> -<body> - <script id="watchme" src="file_module_js_cache.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_module_js_cache_with_sri.html b/dom/base/test/file_module_js_cache_with_sri.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Add a tag module script to save the bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_module_js_cache.mjs" - integrity="sha384-1eNjxPXQdMh9pdr8ctqxBCIqiAnwYWzCCIKpcEIWp2MjECaRYx5Iw1TC3p/dx/uj"> - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_dynamic_and_element.html b/dom/base/test/file_script_module_dynamic_and_element.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_dynamic_and_element.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_dynamic_and_element.mjs b/dom/base/test/file_script_module_dynamic_and_element.mjs @@ -1,20 +0,0 @@ -const { f } = await import( - "./file_script_module_dynamic_and_element_imported_1.mjs" -); -import { g } from "./file_script_module_dynamic_and_element_imported_2.mjs"; -import { h } from "./file_script_module_dynamic_and_element_imported_3.mjs"; - -f(); -g(); -h(); - -let script = document.createElement("script"); -script.id = "watchme2"; -script.setAttribute("type", "module"); -script.setAttribute( - "src", - "file_script_module_dynamic_and_element_imported_1.mjs" -); -document.body.appendChild(script); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_dynamic_and_element_imported_1.mjs b/dom/base/test/file_script_module_dynamic_and_element_imported_1.mjs @@ -1,7 +0,0 @@ -import { g } from "./file_script_module_dynamic_and_element_imported_2.mjs"; -import { h } from "./file_script_module_dynamic_and_element_imported_3.mjs"; - -g(); -h(); - -export function f() {} diff --git a/dom/base/test/file_script_module_dynamic_and_element_imported_2.mjs b/dom/base/test/file_script_module_dynamic_and_element_imported_2.mjs @@ -1 +0,0 @@ -export function g() {} diff --git a/dom/base/test/file_script_module_dynamic_and_element_imported_3.mjs b/dom/base/test/file_script_module_dynamic_and_element_imported_3.mjs @@ -1 +0,0 @@ -export function h() {} diff --git a/dom/base/test/file_script_module_dynamic_and_static.html b/dom/base/test/file_script_module_dynamic_and_static.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_dynamic_and_static.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_dynamic_and_static.mjs b/dom/base/test/file_script_module_dynamic_and_static.mjs @@ -1,11 +0,0 @@ -const { f } = await import( - "./file_script_module_dynamic_and_static_imported_1.mjs" -); -import { g } from "./file_script_module_dynamic_and_static_imported_2.mjs"; -import { h } from "./file_script_module_dynamic_and_static_imported_3.mjs"; - -f(); -g(); -h(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_dynamic_and_static_imported_1.mjs b/dom/base/test/file_script_module_dynamic_and_static_imported_1.mjs @@ -1,5 +0,0 @@ -import { h } from "./file_script_module_dynamic_and_static_imported_3.mjs"; - -h(); - -export function f() {} diff --git a/dom/base/test/file_script_module_dynamic_and_static_imported_2.mjs b/dom/base/test/file_script_module_dynamic_and_static_imported_2.mjs @@ -1,5 +0,0 @@ -import { f } from "./file_script_module_dynamic_and_static_imported_1.mjs"; - -f(); - -export function g() {} diff --git a/dom/base/test/file_script_module_dynamic_and_static_imported_3.mjs b/dom/base/test/file_script_module_dynamic_and_static_imported_3.mjs @@ -1 +0,0 @@ -export function h() {} diff --git a/dom/base/test/file_script_module_dynamic_import.html b/dom/base/test/file_script_module_dynamic_import.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_dynamic_import.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_dynamic_import.mjs b/dom/base/test/file_script_module_dynamic_import.mjs @@ -1,4 +0,0 @@ -const { f } = await import("./file_script_module_dynamic_import_imported.mjs"); -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_dynamic_import_imported.mjs b/dom/base/test/file_script_module_dynamic_import_imported.mjs @@ -1 +0,0 @@ -export function f() {} diff --git a/dom/base/test/file_script_module_element_and_dynamic.html b/dom/base/test/file_script_module_element_and_dynamic.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_element_and_dynamic_imported_1.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_element_and_dynamic.mjs b/dom/base/test/file_script_module_element_and_dynamic.mjs @@ -1,11 +0,0 @@ -const { f } = await import( - "./file_script_module_element_and_dynamic_imported_1.mjs" -); -import { g } from "./file_script_module_element_and_dynamic_imported_2.mjs"; -import { h } from "./file_script_module_element_and_dynamic_imported_3.mjs"; - -f(); -g(); -h(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_element_and_dynamic_imported_1.mjs b/dom/base/test/file_script_module_element_and_dynamic_imported_1.mjs @@ -1,13 +0,0 @@ -import { g } from "./file_script_module_element_and_dynamic_imported_2.mjs"; -import { h } from "./file_script_module_element_and_dynamic_imported_3.mjs"; - -g(); -h(); - -export function f() {} - -let script = document.createElement("script"); -script.id = "watchme2"; -script.setAttribute("type", "module"); -script.setAttribute("src", "file_script_module_element_and_dynamic.mjs"); -document.body.appendChild(script); diff --git a/dom/base/test/file_script_module_element_and_dynamic_imported_2.mjs b/dom/base/test/file_script_module_element_and_dynamic_imported_2.mjs @@ -1 +0,0 @@ -export function g() {} diff --git a/dom/base/test/file_script_module_element_and_dynamic_imported_3.mjs b/dom/base/test/file_script_module_element_and_dynamic_imported_3.mjs @@ -1 +0,0 @@ -export function h() {} diff --git a/dom/base/test/file_script_module_element_and_import.html b/dom/base/test/file_script_module_element_and_import.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_element_and_import_imported_1.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_element_and_import.mjs b/dom/base/test/file_script_module_element_and_import.mjs @@ -1,9 +0,0 @@ -import { f } from "./file_script_module_element_and_import_imported_1.mjs"; -import { g } from "./file_script_module_element_and_import_imported_2.mjs"; -import { h } from "./file_script_module_element_and_import_imported_3.mjs"; - -f(); -g(); -h(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_element_and_import_imported_1.mjs b/dom/base/test/file_script_module_element_and_import_imported_1.mjs @@ -1,13 +0,0 @@ -import { g } from "./file_script_module_element_and_import_imported_2.mjs"; -import { h } from "./file_script_module_element_and_import_imported_3.mjs"; - -g(); -h(); - -export function f() {} - -let script = document.createElement("script"); -script.id = "watchme2"; -script.setAttribute("type", "module"); -script.setAttribute("src", "file_script_module_element_and_import.mjs"); -document.body.appendChild(script); diff --git a/dom/base/test/file_script_module_element_and_import_imported_2.mjs b/dom/base/test/file_script_module_element_and_import_imported_2.mjs @@ -1 +0,0 @@ -export function g() {} diff --git a/dom/base/test/file_script_module_element_and_import_imported_3.mjs b/dom/base/test/file_script_module_element_and_import_imported_3.mjs @@ -1 +0,0 @@ -export function h() {} diff --git a/dom/base/test/file_script_module_frames_dynamic.html b/dom/base/test/file_script_module_frames_dynamic.html @@ -1,24 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> - <script type="text/javascript"> -var loadFramePromiseResolve; -var loadFramePromise = new Promise(r => { - loadFramePromiseResolve = r; -}); -function onLoadFrameLoaded() { - loadFramePromiseResolve(); -} - </script> -</head> -<body> - <iframe id="save" name="save" - src="file_script_module_frames_dynamic_save.html" - width="50" height="50"></iframe> - <iframe id="load" name="load" onload="onLoadFrameLoaded()" - src="file_script_module_frames_dynamic_load.html" - width="50" height="50"></iframe> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_dynamic_load.html b/dom/base/test/file_script_module_frames_dynamic_load.html @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> -</head> -<body> - <script type="text/javascript" src="file_script_module_frames_relay.js"></script> - <script type="text/javascript"> -function doLoad() { - const script = document.createElement("script"); - script.id = "watchme"; - script.setAttribute("type", "module"); - script.setAttribute("src", "file_script_module_frames_dynamic_load.mjs"); - document.body.appendChild(script); -} - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_dynamic_load.mjs b/dom/base/test/file_script_module_frames_dynamic_load.mjs @@ -1,4 +0,0 @@ -const { f } = await import("./file_script_module_frames_dynamic_shared.mjs"); -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_frames_dynamic_save.html b/dom/base/test/file_script_module_frames_dynamic_save.html @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> -</head> -<body> - <script type="text/javascript" src="file_script_module_frames_relay.js"></script> - <script type="text/javascript"> -// Dynamically insert the script element so that the load doesn't happen -// before the event relay handler is set up. -const script = document.createElement("script"); -script.id = "watchme"; -script.setAttribute("type", "module"); -script.setAttribute("src", "file_script_module_frames_dynamic_save.mjs"); -document.body.appendChild(script); - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_dynamic_save.mjs b/dom/base/test/file_script_module_frames_dynamic_save.mjs @@ -1,4 +0,0 @@ -const { f } = await import("./file_script_module_frames_dynamic_shared.mjs"); -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_frames_dynamic_shared.mjs b/dom/base/test/file_script_module_frames_dynamic_shared.mjs @@ -1 +0,0 @@ -export function f() {} diff --git a/dom/base/test/file_script_module_frames_element.html b/dom/base/test/file_script_module_frames_element.html @@ -1,24 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> - <script type="text/javascript"> -var loadFramePromiseResolve; -var loadFramePromise = new Promise(r => { - loadFramePromiseResolve = r; -}); -function onLoadFrameLoaded() { - loadFramePromiseResolve(); -} - </script> -</head> -<body> - <iframe id="save" name="save" - src="file_script_module_frames_element_save.html" - width="50" height="50"></iframe> - <iframe id="load" name="load" onload="onLoadFrameLoaded()" - src="file_script_module_frames_element_load.html" - width="50" height="50"></iframe> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_element_load.html b/dom/base/test/file_script_module_frames_element_load.html @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> -</head> -<body> - <script type="text/javascript" src="file_script_module_frames_relay.js"></script> - <script type="text/javascript"> -function doLoad() { - const script = document.createElement("script"); - script.id = "watchme"; - script.setAttribute("type", "module"); - script.setAttribute("src", "file_script_module_frames_element_shared.mjs"); - document.body.appendChild(script); -} - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_element_save.html b/dom/base/test/file_script_module_frames_element_save.html @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> -</head> -<body> - <script type="text/javascript" src="file_script_module_frames_relay.js"></script> - <script type="text/javascript"> -// Dynamically insert the script element so that the load doesn't happen -// before the event relay handler is set up. -const script = document.createElement("script"); -script.id = "watchme"; -script.setAttribute("type", "module"); -script.setAttribute("src", "file_script_module_frames_element_shared.mjs"); -document.body.appendChild(script); - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_element_shared.mjs b/dom/base/test/file_script_module_frames_element_shared.mjs @@ -1 +0,0 @@ -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_frames_import.html b/dom/base/test/file_script_module_frames_import.html @@ -1,24 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> - <script type="text/javascript"> -var loadFramePromiseResolve; -var loadFramePromise = new Promise(r => { - loadFramePromiseResolve = r; -}); -function onLoadFrameLoaded() { - loadFramePromiseResolve(); -} - </script> -</head> -<body> - <iframe id="save" name="save" - src="file_script_module_frames_import_save.html" - width="50" height="50"></iframe> - <iframe id="load" name="load" onload="onLoadFrameLoaded()" - src="file_script_module_frames_import_load.html" - width="50" height="50"></iframe> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_import_load.html b/dom/base/test/file_script_module_frames_import_load.html @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> -</head> -<body> - <script type="text/javascript" src="file_script_module_frames_relay.js"></script> - <script type="text/javascript"> -function doLoad() { - const script = document.createElement("script"); - script.id = "watchme"; - script.setAttribute("type", "module"); - script.setAttribute("src", "file_script_module_frames_import_load.mjs"); - document.body.appendChild(script); -} - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_import_load.mjs b/dom/base/test/file_script_module_frames_import_load.mjs @@ -1,5 +0,0 @@ -import { f } from "./file_script_module_frames_import_shared.mjs"; - -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_frames_import_save.html b/dom/base/test/file_script_module_frames_import_save.html @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode across iframe</title> -</head> -<body> - <script type="text/javascript" src="file_script_module_frames_relay.js"></script> - <script type="text/javascript"> -// Dynamically insert the script element so that the load doesn't happen -// before the event relay handler is set up. -const script = document.createElement("script"); -script.id = "watchme"; -script.setAttribute("type", "module"); -script.setAttribute("src", "file_script_module_frames_import_save.mjs"); -document.body.appendChild(script); - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_frames_import_save.mjs b/dom/base/test/file_script_module_frames_import_save.mjs @@ -1,5 +0,0 @@ -import { f } from "./file_script_module_frames_import_shared.mjs"; - -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_frames_import_shared.mjs b/dom/base/test/file_script_module_frames_import_shared.mjs @@ -1 +0,0 @@ -export function f() {} diff --git a/dom/base/test/file_script_module_frames_relay.js b/dom/base/test/file_script_module_frames_relay.js @@ -1,22 +0,0 @@ -function relay(event) { - if (event.type != "test_evaluated") { - if (!/^watchme/.test(event.target.id)) { - return; - } - } - - const type = `${window.name}_${event.type}`; - - window.parent.dispatchEvent(new window.parent.Event(type)); -} - -window.addEventListener("scriptloader_load_source", relay); -window.addEventListener("scriptloader_load_bytecode", relay); -window.addEventListener("scriptloader_execute", relay); -window.addEventListener("scriptloader_evaluate_module", relay); -window.addEventListener("scriptloader_encode", relay); -window.addEventListener("scriptloader_no_encode", relay); -window.addEventListener("scriptloader_bytecode_saved", relay); -window.addEventListener("scriptloader_bytecode_failed", relay); -window.addEventListener("scriptloader_fallback", relay); -window.addEventListener("test_evaluated", relay); diff --git a/dom/base/test/file_script_module_import.html b/dom/base/test/file_script_module_import.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_import.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_import.mjs b/dom/base/test/file_script_module_import.mjs @@ -1,5 +0,0 @@ -import { f } from "./file_script_module_import_imported.mjs"; - -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_import_and_element.html b/dom/base/test/file_script_module_import_and_element.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_import_and_element.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_import_and_element.mjs b/dom/base/test/file_script_module_import_and_element.mjs @@ -1,18 +0,0 @@ -import { f } from "./file_script_module_import_and_element_imported_1.mjs"; -import { g } from "./file_script_module_import_and_element_imported_2.mjs"; -import { h } from "./file_script_module_import_and_element_imported_3.mjs"; - -f(); -g(); -h(); - -let script = document.createElement("script"); -script.id = "watchme2"; -script.setAttribute("type", "module"); -script.setAttribute( - "src", - "file_script_module_import_and_element_imported_1.mjs" -); -document.body.appendChild(script); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_import_and_element_imported_1.mjs b/dom/base/test/file_script_module_import_and_element_imported_1.mjs @@ -1,7 +0,0 @@ -import { g } from "./file_script_module_import_and_element_imported_2.mjs"; -import { h } from "./file_script_module_import_and_element_imported_3.mjs"; - -g(); -h(); - -export function f() {} diff --git a/dom/base/test/file_script_module_import_and_element_imported_2.mjs b/dom/base/test/file_script_module_import_and_element_imported_2.mjs @@ -1 +0,0 @@ -export function g() {} diff --git a/dom/base/test/file_script_module_import_and_element_imported_3.mjs b/dom/base/test/file_script_module_import_and_element_imported_3.mjs @@ -1 +0,0 @@ -export function h() {} diff --git a/dom/base/test/file_script_module_import_imported.mjs b/dom/base/test/file_script_module_import_imported.mjs @@ -1 +0,0 @@ -export function f() {} diff --git a/dom/base/test/file_script_module_import_multi.html b/dom/base/test/file_script_module_import_multi.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_import_multi.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_import_multi.mjs b/dom/base/test/file_script_module_import_multi.mjs @@ -1,7 +0,0 @@ -import { f } from "./file_script_module_import_multi_imported_once.mjs"; -import { g } from "./file_script_module_import_multi_imported_twice.mjs"; - -f(); -g(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_import_multi_elems.html b/dom/base/test/file_script_module_import_multi_elems.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_import_multi_elems_1.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_import_multi_elems_1.mjs b/dom/base/test/file_script_module_import_multi_elems_1.mjs @@ -1,15 +0,0 @@ -import { f } from "./file_script_module_import_multi_elems_imported_once_1.mjs"; -import { h } from "./file_script_module_import_multi_elems_imported_twice.mjs"; - -f(); -h(); - -// Dynamically insert the element after loading all source, so that -// the module import doesn't race. -const script = document.createElement("script"); -script.id = "watchme2"; -script.setAttribute("type", "module"); -script.setAttribute("src", "file_script_module_import_multi_elems_2.mjs"); -document.body.appendChild(script); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_import_multi_elems_2.mjs b/dom/base/test/file_script_module_import_multi_elems_2.mjs @@ -1,7 +0,0 @@ -import { g } from "./file_script_module_import_multi_elems_imported_once_2.mjs"; -import { h } from "./file_script_module_import_multi_elems_imported_twice.mjs"; - -g(); -h(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_once_1.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_once_1.mjs @@ -1 +0,0 @@ -export function f() {} diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_once_2.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_once_2.mjs @@ -1 +0,0 @@ -export function g() {} diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_once_3.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_once_3.mjs @@ -1 +0,0 @@ -export function i() {} diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_twice.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_twice.mjs @@ -1,4 +0,0 @@ -import { i } from "./file_script_module_import_multi_elems_imported_once_3.mjs"; - -i(); -export function h() {} diff --git a/dom/base/test/file_script_module_import_multi_imported_once.mjs b/dom/base/test/file_script_module_import_multi_imported_once.mjs @@ -1,5 +0,0 @@ -import { g } from "./file_script_module_import_multi_imported_twice.mjs"; - -g(); - -export function f() {} diff --git a/dom/base/test/file_script_module_import_multi_imported_twice.mjs b/dom/base/test/file_script_module_import_multi_imported_twice.mjs @@ -1 +0,0 @@ -export function g() {} diff --git a/dom/base/test/file_script_module_single.html b/dom/base/test/file_script_module_single.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_single.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_single.mjs b/dom/base/test/file_script_module_single.mjs @@ -1,8 +0,0 @@ -function baz() {} -function bar() {} -function foo() { - bar(); -} -foo(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_basic.html b/dom/base/test/file_script_module_sri_basic.html @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_basic.mjs" - integrity="sha384-pZxhwO9umoHSuKzSRL6hi9YhRb70RfGdRnchu/zp5gbUCOC/x7NAWUPxxuv0DJoZ"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_basic.mjs b/dom/base/test/file_script_module_sri_basic.mjs @@ -1 +0,0 @@ -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_basic_prep.html b/dom/base/test/file_script_module_sri_basic_prep.html @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_basic.mjs" - integrity="sha384-pZxhwO9umoHSuKzSRL6hi9YhRb70RfGdRnchu/zp5gbUCOC/x7NAWUPxxuv0DJoZ"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_dynamic_elem.html b/dom/base/test/file_script_module_sri_dynamic_elem.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_sri_dynamic_elem.mjs"></script> - <script id="watchme2" type="module" src="file_script_module_sri_dynamic_elem_imported.mjs" - integrity="sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_dynamic_elem.mjs b/dom/base/test/file_script_module_sri_dynamic_elem.mjs @@ -1,6 +0,0 @@ -const { f } = await import( - "./file_script_module_sri_dynamic_elem_imported.mjs" -); -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_imported.mjs b/dom/base/test/file_script_module_sri_dynamic_elem_imported.mjs @@ -1,3 +0,0 @@ -export function f() {} - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.html b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_dynamic_elem_nopreload.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.mjs b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.mjs @@ -1,20 +0,0 @@ -const { f } = await import( - "./file_script_module_sri_dynamic_elem_nopreload_imported.mjs" -); -f(); - -// Dynamically insert the script element in order to suppress preload. -const script = document.createElement("script"); -script.id = "watchme2"; -script.setAttribute("type", "module"); -script.setAttribute( - "src", - "file_script_module_sri_dynamic_elem_nopreload_imported.mjs" -); -script.setAttribute( - "integrity", - "sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J" -); -document.body.appendChild(script); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_imported.mjs b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_imported.mjs @@ -1,3 +0,0 @@ -export function f() {} - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_prep.html b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_dynamic_elem_nopreload_imported.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_prep.html b/dom/base/test/file_script_module_sri_dynamic_elem_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_dynamic_elem_imported.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_dynamic.html b/dom/base/test/file_script_module_sri_elem_dynamic.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_sri_elem_dynamic_imported.mjs" - integrity="sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J"></script> - <script id="watchme2" type="module" src="file_script_module_sri_elem_dynamic.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_dynamic.mjs b/dom/base/test/file_script_module_sri_elem_dynamic.mjs @@ -1,6 +0,0 @@ -const { f } = await import( - "./file_script_module_sri_elem_dynamic_imported.mjs" -); -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_elem_dynamic_imported.mjs b/dom/base/test/file_script_module_sri_elem_dynamic_imported.mjs @@ -1,3 +0,0 @@ -export function f() {} - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_elem_dynamic_prep.html b/dom/base/test/file_script_module_sri_elem_dynamic_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_elem_dynamic_imported.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_elem_1.html b/dom/base/test/file_script_module_sri_elem_elem_1.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_sri_elem_elem_1.mjs"></script> - <script id="watchme2" type="module" src="file_script_module_sri_elem_elem_1.mjs" - integrity="sha384-pZxhwO9umoHSuKzSRL6hi9YhRb70RfGdRnchu/zp5gbUCOC/x7NAWUPxxuv0DJoZ"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_elem_1.mjs b/dom/base/test/file_script_module_sri_elem_elem_1.mjs @@ -1 +0,0 @@ -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_elem_elem_1_prep.html b/dom/base/test/file_script_module_sri_elem_elem_1_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_elem_elem_1.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_elem_2.html b/dom/base/test/file_script_module_sri_elem_elem_2.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_sri_elem_elem_2.mjs" - integrity="sha384-pZxhwO9umoHSuKzSRL6hi9YhRb70RfGdRnchu/zp5gbUCOC/x7NAWUPxxuv0DJoZ"></script> - <script id="watchme2" type="module" src="file_script_module_sri_elem_elem_2.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_elem_2.mjs b/dom/base/test/file_script_module_sri_elem_elem_2.mjs @@ -1 +0,0 @@ -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_elem_elem_2_prep.html b/dom/base/test/file_script_module_sri_elem_elem_2_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_elem_elem_2.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_import.html b/dom/base/test/file_script_module_sri_elem_import.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_sri_elem_import_imported.mjs" - integrity="sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J"></script> - <script id="watchme2" type="module" src="file_script_module_sri_elem_import.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_elem_import.mjs b/dom/base/test/file_script_module_sri_elem_import.mjs @@ -1,5 +0,0 @@ -import { f } from "./file_script_module_sri_elem_import_imported.mjs"; - -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_elem_import_imported.mjs b/dom/base/test/file_script_module_sri_elem_import_imported.mjs @@ -1,3 +0,0 @@ -export function f() {} - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_elem_import_prep.html b/dom/base/test/file_script_module_sri_elem_import_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_elem_import_imported.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_fallback.html b/dom/base/test/file_script_module_sri_fallback.html @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_fallback.mjs" - integrity="sha384-pZxhwO9umoHSuKzSRL6hi9YhRb70RfGdRnchu/zp5gbUCOC/x7NAWUPxxuv0DJoZ"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_fallback.mjs b/dom/base/test/file_script_module_sri_fallback.mjs @@ -1 +0,0 @@ -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_fallback_failure.html b/dom/base/test/file_script_module_sri_fallback_failure.html @@ -1,15 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_fallback_failure.mjs" - integrity="sha384-wronghash"></script> - <script type="text/javascript"> -// The above script isn't evaluated because of wrong integrity. -window.dispatchEvent(new Event("test_evaluated")); - </script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_fallback_failure.mjs b/dom/base/test/file_script_module_sri_fallback_failure.mjs @@ -1 +0,0 @@ -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_fallback_failure_prep.html b/dom/base/test/file_script_module_sri_fallback_failure_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_fallback_failure.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_fallback_prep.html b/dom/base/test/file_script_module_sri_fallback_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_fallback.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_import_elem.html b/dom/base/test/file_script_module_sri_import_elem.html @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme1" type="module" src="file_script_module_sri_import_elem.mjs"></script> - <script id="watchme2" type="module" src="file_script_module_sri_import_elem_imported.mjs" - integrity="sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_import_elem.mjs b/dom/base/test/file_script_module_sri_import_elem.mjs @@ -1,5 +0,0 @@ -import { f } from "./file_script_module_sri_import_elem_imported.mjs"; - -f(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_import_elem_imported.mjs b/dom/base/test/file_script_module_sri_import_elem_imported.mjs @@ -1,3 +0,0 @@ -export function f() {} - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload.html b/dom/base/test/file_script_module_sri_import_elem_nopreload.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body onload="onLoad()"> - <script id="watchme" type="module" src="file_script_module_sri_import_elem_nopreload.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload.mjs b/dom/base/test/file_script_module_sri_import_elem_nopreload.mjs @@ -1,19 +0,0 @@ -import { f } from "./file_script_module_sri_import_elem_nopreload_imported.mjs"; - -f(); - -// Dynamically insert the script element in order to suppress preload. -const script = document.createElement("script"); -script.id = "watchme2"; -script.setAttribute("type", "module"); -script.setAttribute( - "src", - "file_script_module_sri_import_elem_nopreload_imported.mjs" -); -script.setAttribute( - "integrity", - "sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J" -); -document.body.appendChild(script); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload_imported.mjs b/dom/base/test/file_script_module_sri_import_elem_nopreload_imported.mjs @@ -1,3 +0,0 @@ -export function f() {} - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload_prep.html b/dom/base/test/file_script_module_sri_import_elem_nopreload_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_import_elem_nopreload_imported.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_sri_import_elem_prep.html b/dom/base/test/file_script_module_sri_import_elem_prep.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode fallback</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_sri_import_elem_imported.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_static_and_dynamic.html b/dom/base/test/file_script_module_static_and_dynamic.html @@ -1,10 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Test module script bytecode</title> -</head> -<body> - <script id="watchme" type="module" src="file_script_module_static_and_dynamic.mjs"></script> -</body> -</html> diff --git a/dom/base/test/file_script_module_static_and_dynamic.mjs b/dom/base/test/file_script_module_static_and_dynamic.mjs @@ -1,9 +0,0 @@ -import { f } from "./file_script_module_static_and_dynamic_imported_1.mjs"; -import { g } from "./file_script_module_static_and_dynamic_imported_2.mjs"; -import { h } from "./file_script_module_static_and_dynamic_imported_3.mjs"; - -f(); -g(); -h(); - -window.dispatchEvent(new Event("test_evaluated")); diff --git a/dom/base/test/file_script_module_static_and_dynamic_imported_1.mjs b/dom/base/test/file_script_module_static_and_dynamic_imported_1.mjs @@ -1,5 +0,0 @@ -import { h } from "./file_script_module_static_and_dynamic_imported_3.mjs"; - -h(); - -export function f() {} diff --git a/dom/base/test/file_script_module_static_and_dynamic_imported_2.mjs b/dom/base/test/file_script_module_static_and_dynamic_imported_2.mjs @@ -1,6 +0,0 @@ -const { f } = await import( - "./file_script_module_static_and_dynamic_imported_1.mjs" -); -f(); - -export function g() {} diff --git a/dom/base/test/file_script_module_static_and_dynamic_imported_3.mjs b/dom/base/test/file_script_module_static_and_dynamic_imported_3.mjs @@ -1 +0,0 @@ -export function h() {} diff --git a/dom/base/test/mochitest.toml b/dom/base/test/mochitest.toml @@ -1397,143 +1397,6 @@ support-files = ["file_sandbox_and_document_uri.html"] ["test_script_loader_crossorigin_data_url.html"] -["test_script_loader_js_cache.html"] -disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173" -support-files = [ - "file_js_cache.html", - "file_js_cache_with_sri.html", - "file_js_cache_module.html", - "file_js_cache.js", - "file_module_js_cache.html", - "file_module_js_cache_with_sri.html", - "file_module_js_cache_no_module.html", - "file_module_js_cache.mjs", - "file_js_cache_save_after_load.html", - "file_js_cache_save_after_load.js", - "file_js_cache_syntax_error.html", - "file_js_cache_syntax_error.js", -] - -["test_script_loader_js_cache_frames.html"] -disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173" -support-files = [ - "file_script_module_frames_relay.js", - "file_script_module_frames_element.html", - "file_script_module_frames_element_save.html", - "file_script_module_frames_element_load.html", - "file_script_module_frames_element_shared.mjs", - "file_script_module_frames_import.html", - "file_script_module_frames_import_save.html", - "file_script_module_frames_import_save.mjs", - "file_script_module_frames_import_load.html", - "file_script_module_frames_import_load.mjs", - "file_script_module_frames_import_shared.mjs", - "file_script_module_frames_dynamic.html", - "file_script_module_frames_dynamic_save.html", - "file_script_module_frames_dynamic_save.mjs", - "file_script_module_frames_dynamic_load.html", - "file_script_module_frames_dynamic_load.mjs", - "file_script_module_frames_dynamic_shared.mjs", -] - -["test_script_loader_js_cache_module.html"] -disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173" -support-files = [ - "file_script_module_single.html", - "file_script_module_single.mjs", - "file_script_module_import.html", - "file_script_module_import.mjs", - "file_script_module_import_imported.mjs", - "file_script_module_import_multi.html", - "file_script_module_import_multi.mjs", - "file_script_module_import_multi_imported_once.mjs", - "file_script_module_import_multi_imported_twice.mjs", - "file_script_module_import_multi_elems.html", - "file_script_module_import_multi_elems_1.mjs", - "file_script_module_import_multi_elems_2.mjs", - "file_script_module_import_multi_elems_imported_once_1.mjs", - "file_script_module_import_multi_elems_imported_once_2.mjs", - "file_script_module_import_multi_elems_imported_once_3.mjs", - "file_script_module_import_multi_elems_imported_twice.mjs", - "file_script_module_import_and_element.html", - "file_script_module_import_and_element.mjs", - "file_script_module_import_and_element_imported_1.mjs", - "file_script_module_import_and_element_imported_2.mjs", - "file_script_module_import_and_element_imported_3.mjs", - "file_script_module_element_and_import.html", - "file_script_module_element_and_import.mjs", - "file_script_module_element_and_import_imported_1.mjs", - "file_script_module_element_and_import_imported_2.mjs", - "file_script_module_element_and_import_imported_3.mjs", - "file_script_module_dynamic_import.html", - "file_script_module_dynamic_import.mjs", - "file_script_module_dynamic_import_imported.mjs", - "file_script_module_dynamic_and_element.html", - "file_script_module_dynamic_and_element.mjs", - "file_script_module_dynamic_and_element_imported_1.mjs", - "file_script_module_dynamic_and_element_imported_2.mjs", - "file_script_module_dynamic_and_element_imported_3.mjs", - "file_script_module_element_and_dynamic.html", - "file_script_module_element_and_dynamic.mjs", - "file_script_module_element_and_dynamic_imported_1.mjs", - "file_script_module_element_and_dynamic_imported_2.mjs", - "file_script_module_element_and_dynamic_imported_3.mjs", - "file_script_module_dynamic_and_static.html", - "file_script_module_dynamic_and_static.mjs", - "file_script_module_dynamic_and_static_imported_1.mjs", - "file_script_module_dynamic_and_static_imported_2.mjs", - "file_script_module_dynamic_and_static_imported_3.mjs", - "file_script_module_static_and_dynamic.html", - "file_script_module_static_and_dynamic.mjs", - "file_script_module_static_and_dynamic_imported_1.mjs", - "file_script_module_static_and_dynamic_imported_2.mjs", - "file_script_module_static_and_dynamic_imported_3.mjs", -] - -["test_script_loader_js_cache_module_sri.html"] -disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173" -support-files = [ - "file_script_module_sri_basic.html", - "file_script_module_sri_basic_prep.html", - "file_script_module_sri_basic.mjs", - "file_script_module_sri_fallback.html", - "file_script_module_sri_fallback_prep.html", - "file_script_module_sri_fallback.mjs", - "file_script_module_sri_fallback_failure.html", - "file_script_module_sri_fallback_failure_prep.html", - "file_script_module_sri_fallback_failure.mjs", - "file_script_module_sri_elem_elem_1.html", - "file_script_module_sri_elem_elem_1_prep.html", - "file_script_module_sri_elem_elem_1.mjs", - "file_script_module_sri_elem_elem_2.html", - "file_script_module_sri_elem_elem_2_prep.html", - "file_script_module_sri_elem_elem_2.mjs", - "file_script_module_sri_elem_import.html", - "file_script_module_sri_elem_import_prep.html", - "file_script_module_sri_elem_import.mjs", - "file_script_module_sri_elem_import_imported.mjs", - "file_script_module_sri_import_elem.html", - "file_script_module_sri_import_elem_prep.html", - "file_script_module_sri_import_elem.mjs", - "file_script_module_sri_import_elem_imported.mjs", - "file_script_module_sri_import_elem_nopreload.html", - "file_script_module_sri_import_elem_nopreload_prep.html", - "file_script_module_sri_import_elem_nopreload.mjs", - "file_script_module_sri_import_elem_nopreload_imported.mjs", - "file_script_module_sri_elem_dynamic.html", - "file_script_module_sri_elem_dynamic_prep.html", - "file_script_module_sri_elem_dynamic.mjs", - "file_script_module_sri_elem_dynamic_imported.mjs", - "file_script_module_sri_dynamic_elem.html", - "file_script_module_sri_dynamic_elem_prep.html", - "file_script_module_sri_dynamic_elem.mjs", - "file_script_module_sri_dynamic_elem_imported.mjs", - "file_script_module_sri_dynamic_elem_nopreload.html", - "file_script_module_sri_dynamic_elem_nopreload_prep.html", - "file_script_module_sri_dynamic_elem_nopreload.mjs", - "file_script_module_sri_dynamic_elem_nopreload_imported.mjs", -] - ["test_setInterval_from_start.html"] ["test_setInterval_uncatchable_exception.html"] diff --git a/dom/base/test/test_script_loader_js_cache.html b/dom/base/test/test_script_loader_js_cache.html @@ -1,264 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=900784 --> -<!-- The JS bytecode cache is not supposed to be observable. To make it - observable, the ScriptLoader is instrumented to trigger events on the - script tag. These events are followed to reconstruct the code path taken by - the script loader and associate a simple name which is checked in these - test cases. ---> -<head> - <meta charset="utf-8"> - <title>Test for saving and loading bytecode in/from the necko cache</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script type="application/javascript"> - // This is the state machine of the trace events produced by the - // ScriptLoader. This state machine is used to give a name to each - // code path, such that we can assert each code path with a single word. - var scriptLoaderStateMachine = { - "scriptloader_load_source": { - "scriptloader_execute": { - "scriptloader_encode": { - "scriptloader_bytecode_saved": "bytecode_saved", - "scriptloader_bytecode_failed": "bytecode_failed" - }, - "scriptloader_no_encode": "source_exec" - }, - "scriptloader_evaluate_module": { - "scriptloader_encode": { - "scriptloader_bytecode_saved": "module_bytecode_saved", - "scriptloader_bytecode_failed": "module_bytecode_failed" - }, - "scriptloader_no_encode": "module_source_exec" - }, - }, - "scriptloader_load_bytecode": { - "scriptloader_fallback": { - // Replicate the top-level state machine without - // "scriptloader_load_bytecode" transition. - "scriptloader_load_source": { - "scriptloader_execute": { - "scriptloader_encode": { - "scriptloader_bytecode_saved": "fallback_bytecode_saved", - "scriptloader_bytecode_failed": "fallback_bytecode_failed" - }, - "scriptloader_no_encode": "fallback_source_exec" - }, - "scriptloader_evaluate_module": { - "scriptloader_encode": { - "scriptloader_bytecode_saved": "module_fallback_bytecode_saved", - "scriptloader_bytecode_failed": "module_fallback_bytecode_failed", - }, - "scriptloader_no_encode": "module_fallback_source_exec", - }, - } - }, - "scriptloader_execute": "bytecode_exec", - "scriptloader_evaluate_module": "module_bytecode_exec", - } - }; - - function WaitForScriptTagEvent(url) { - var iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - - var stateMachine = scriptLoaderStateMachine; - var stateHistory = []; - var stateMachineResolve, stateMachineReject; - var statePromise = new Promise((resolve, reject) => { - stateMachineResolve = resolve; - stateMachineReject = reject; - }); - var ping = 0; - - // Walk the script loader state machine with the emitted events. - function log_event(evt) { - // If we have multiple script tags in the loaded source, make sure - // we only watch a single one. - if (evt.target.id != "watchme") - return; - - dump("## ScriptLoader event: " + evt.type + "\n"); - stateHistory.push(evt.type) - if (typeof stateMachine == "object") - stateMachine = stateMachine[evt.type]; - if (typeof stateMachine == "string") { - // We arrived to a final state, report the name of it. - var result = stateMachine; - if (ping) { - result = `${result} & ping(=${ping})`; - } - stateMachineResolve(result); - } else if (stateMachine === undefined) { - // We followed an unknown transition, report the known history. - stateMachineReject(stateHistory); - } - } - - var iwin = iframe.contentWindow; - iwin.addEventListener("scriptloader_load_source", log_event); - iwin.addEventListener("scriptloader_load_bytecode", log_event); - iwin.addEventListener("scriptloader_generate_bytecode", log_event); - iwin.addEventListener("scriptloader_execute", log_event); - iwin.addEventListener("scriptloader_evaluate_module", log_event); - iwin.addEventListener("scriptloader_encode", log_event); - iwin.addEventListener("scriptloader_no_encode", log_event); - iwin.addEventListener("scriptloader_bytecode_saved", log_event); - iwin.addEventListener("scriptloader_bytecode_failed", log_event); - iwin.addEventListener("scriptloader_fallback", log_event); - iwin.addEventListener("ping", (evt) => { - ping += 1; - dump(`## Content event: ${evt.type} (=${ping})\n`); - }); - iframe.src = url; - - statePromise.then(() => { - document.body.removeChild(iframe); - }); - return statePromise; - } - - async function basicTest(isModule) { - const prefix = isModule ? "module_" : ""; - const name = isModule ? "module" : "script"; - - // Setting dom.expose_test_interfaces pref causes the - // nsScriptLoadRequest to fire event on script tags, with information - // about its internal state. The ScriptLoader source send events to - // trace these and resolve a promise with the path taken by the - // script loader. - // - // Setting dom.script_loader.bytecode_cache.strategy to -1 causes the - // nsScriptLoadRequest to force all the conditions necessary to make a - // script be saved as bytecode in the alternate data storage provided - // by the channel (necko cache). - await SpecialPowers.pushPrefEnv({set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ['dom.script_loader.bytecode_cache.strategy', -1] - ]}); - - // Load the test page, and verify that the code path taken by the - // nsScriptLoadRequest corresponds to the code path which is loading a - // source and saving it as bytecode. - var stateMachineResult = WaitForScriptTagEvent(`file_${prefix}js_cache.html`); - assert_equals(await stateMachineResult, `${prefix}bytecode_saved`, - `[1-${name}] ScriptLoadRequest status after the first visit`); - - // Reload the same test page, and verify that the code path taken by - // the nsScriptLoadRequest corresponds to the code path which is - // loading bytecode and executing it. - stateMachineResult = WaitForScriptTagEvent(`file_${prefix}js_cache.html`); - assert_equals(await stateMachineResult, `${prefix}bytecode_exec`, - `[2-${name}] ScriptLoadRequest status after the second visit`); - - // Load another page which loads the same script with an SRI, while - // the cached bytecode does not have any. This should fallback to - // loading the source before saving the bytecode once more. - stateMachineResult = WaitForScriptTagEvent(`file_${prefix}js_cache_with_sri.html`); - assert_equals(await stateMachineResult, `${prefix}fallback_bytecode_saved`, - `[3-${name}] ScriptLoadRequest status after the SRI hash`); - - // Loading a page, which has the same SRI should verify the SRI and - // continue by executing the bytecode. - var stateMachineResult1 = WaitForScriptTagEvent(`file_${prefix}js_cache_with_sri.html`); - - // Loading a page which does not have a SRI while we have one in the - // cache should not change anything. We should also be able to load - // the cache simultanesouly. - var stateMachineResult2 = WaitForScriptTagEvent(`file_${prefix}js_cache.html`); - - assert_equals(await stateMachineResult1, `${prefix}bytecode_exec`, - `[4-${name}] ScriptLoadRequest status after same SRI hash`); - assert_equals(await stateMachineResult2, `${prefix}bytecode_exec`, - `[5-${name}] ScriptLoadRequest status after visit with no SRI`); - - if (!isModule) { - // Load a page that uses the same script as a module and verify that we - // re-parse it from source. - stateMachineResult = WaitForScriptTagEvent("file_js_cache_module.html"); - assert_equals(await stateMachineResult, "module_bytecode_saved", - `[6-${name}] ScriptLoadRequest status for a module`); - } else { - // Load a page that uses the same module script as a regular script and - // verify that we re-parse it from source. - stateMachineResult = WaitForScriptTagEvent("file_module_js_cache_no_module.html"); - assert_equals(await stateMachineResult, "bytecode_saved", - `[6-${name}] ScriptLoadRequest status for a script`); - } - } - - promise_test(async function() { - await basicTest(false); - }, "Check the JS bytecode cache for script"); - - promise_test(async function() { - await basicTest(true); - }, "Check the JS bytecode cache for module"); - - promise_test(async function() { - // (see above) - await SpecialPowers.pushPrefEnv({set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ['dom.script_loader.bytecode_cache.strategy', -1] - ]}); - - // The test page add a new script which generate a "ping" event, which - // should be recorded before the bytecode is stored in the cache. - var stateMachineResult = - WaitForScriptTagEvent("file_js_cache_save_after_load.html"); - assert_equals(await stateMachineResult, "bytecode_saved & ping(=3)", - "Wait on all scripts to be executed"); - - }, "Save bytecode after the initialization of the page"); - - promise_test(async function() { - // (see above) - await SpecialPowers.pushPrefEnv({set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ['dom.script_loader.bytecode_cache.strategy', -1] - ]}); - - // The test page loads a script which contains a syntax error, we should - // not attempt to encode any bytecode for it. - var stateMachineResult = - WaitForScriptTagEvent("file_js_cache_syntax_error.html"); - assert_equals(await stateMachineResult, "source_exec", - "Check the lack of bytecode encoding"); - - }, "Do not save bytecode on compilation errors"); - - promise_test(async function() { - // (see above) - await SpecialPowers.pushPrefEnv({set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ['dom.script_loader.bytecode_cache.strategy', -1], - ['browser.cache.jsbc_compression_level', 2] - ]}); - - // Load the test page, and verify that the code path taken by the - // nsScriptLoadRequest corresponds to the code path which is loading a - // source and saving it as compressed bytecode. - var stateMachineResult = WaitForScriptTagEvent(`file_js_cache.html`); - assert_equals(await stateMachineResult, `bytecode_saved`, - `[1-script] ScriptLoadRequest status after the first visit`); - - // Reload the same test page, and verify that the code path taken by - // the nsScriptLoadRequest corresponds to the code path which is - // loading compressed bytecode, decompressing it, and executing it. - stateMachineResult = WaitForScriptTagEvent(`file_js_cache.html`); - assert_equals(await stateMachineResult, `bytecode_exec`, - `[2-script] ScriptLoadRequest status after the second visit`); - }, "Check the JS bytecode cache can save and load compressed bytecode"); - - done(); - </script> -</head> -<body> - <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=900784">Mozilla Bug 900784</a> -</body> -</html> diff --git a/dom/base/test/test_script_loader_js_cache_frames.html b/dom/base/test/test_script_loader_js_cache_frames.html @@ -1,202 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=1436400 --> -<!-- The JS bytecode cache is not supposed to be observable. To make it - observable, the ScriptLoader is instrumented to trigger events on the - script tag. ---> -<head> - <meta charset="utf-8"> - <title>Test for saving and loading module bytecode in/from the necko cache</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> -</head> -<body> - <script type="application/javascript"> - -// List of testcases -// -// src -// HTML file loaded in iframe -// saveEvents -// Non-ordered multi-set of expected events dispatched during loading the -// "save" iframe in the HTML file -// loadEvents -// Non-ordered multi-set of expected events dispatched during loading the -// "load" iframe in the HTML file -const tests = [ - // Same module is loaded by script element in 2 frames. - { - src: "file_script_module_frames_element.html", - saveEvents: [ - // file_script_module_frames_element_shared.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - loadEvents: [ - // file_script_module_frames_element_shared.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", - "test_evaluated", - ], - }, - - // Same module is imported in 2 frames. - { - src: "file_script_module_frames_import.html", - saveEvents: [ - // file_script_module_frames_import_save.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_frames_import_shared.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - loadEvents: [ - // file_script_module_frames_import_load.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_frames_import_shared.mjs - "scriptloader_load_bytecode", - ], - }, - - // Same module is dynamically imported in 2 frames. - { - src: "file_script_module_frames_dynamic.html", - saveEvents: [ - // file_script_module_frames_dynamic_save.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_frames_dynamic_shared.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - loadEvents: [ - // file_script_module_frames_dynamic_load.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_frames_dynamic_shared.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", - ], - }, -]; - -promise_test(async function() { - await SpecialPowers.pushPrefEnv({set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ['dom.script_loader.bytecode_cache.strategy', -1] - ]}); - - for (const { src, saveEvents, loadEvents } of tests) { - const iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - - const iwin = iframe.contentWindow; - - dump("## Start: " + src + "\n"); - let observedSaveEvents = []; - await new Promise(resolve => { - function logEvent(evt) { - const type = evt.type.replace(/^save_/, ""); - - dump("## ScriptLoader event: " + type + "\n"); - observedSaveEvents.push(type); - if (observedSaveEvents.length == saveEvents.length) { - resolve(); - } - } - iwin.addEventListener("save_scriptloader_load_source", logEvent); - iwin.addEventListener("save_scriptloader_load_bytecode", logEvent); - iwin.addEventListener("save_scriptloader_execute", logEvent); - iwin.addEventListener("save_scriptloader_evaluate_module", logEvent); - iwin.addEventListener("save_scriptloader_encode", logEvent); - iwin.addEventListener("save_scriptloader_no_encode", logEvent); - iwin.addEventListener("save_scriptloader_bytecode_saved", logEvent); - iwin.addEventListener("save_scriptloader_bytecode_failed", logEvent); - iwin.addEventListener("save_scriptloader_fallback", logEvent); - iwin.addEventListener("save_test_evaluated", logEvent); - iframe.src = src; - }); - - // The event order is non-deterministic. - // Just compare them as multi-set. - saveEvents.sort(); - observedSaveEvents.sort(); - assert_equals( - JSON.stringify(observedSaveEvents), - JSON.stringify(saveEvents), - `Expected events should be observed for ${src} while saving`); - - let observedLoadEvents = []; - const loadFrameEventPromise = new Promise(resolve => { - function logEvent(evt) { - const type = evt.type.replace(/^load_/, ""); - - dump("## ScriptLoader event: " + type + "\n"); - observedLoadEvents.push(type); - if (observedLoadEvents.length == loadEvents.length) { - resolve(); - } - } - iwin.addEventListener("load_scriptloader_load_source", logEvent); - iwin.addEventListener("load_scriptloader_load_bytecode", logEvent); - iwin.addEventListener("load_scriptloader_execute", logEvent); - iwin.addEventListener("load_scriptloader_evaluate_module", logEvent); - iwin.addEventListener("load_scriptloader_encode", logEvent); - iwin.addEventListener("load_scriptloader_no_encode", logEvent); - iwin.addEventListener("load_scriptloader_bytecode_saved", logEvent); - iwin.addEventListener("load_scriptloader_bytecode_failed", logEvent); - iwin.addEventListener("load_scriptloader_fallback", logEvent); - iwin.addEventListener("load_test_evaluated", logEvent); - - }); - - // Make sure the "load" iframe is fully loaded. - await iwin.loadFramePromise; - iwin.document.getElementById("load").contentWindow.doLoad(); - - await loadFrameEventPromise; - - // The event order is non-deterministic. - // Just compare them as multi-set. - loadEvents.sort(); - observedLoadEvents.sort(); - assert_equals( - JSON.stringify(observedLoadEvents), - JSON.stringify(loadEvents), - `Expected events should be observed for ${src} while loading`); - - document.body.removeChild(iframe); - } -}, "Test module bytecode save and load"); - -done(); - </script> - <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1436400">Mozilla Bug 1436400</a> -</body> -</html> diff --git a/dom/base/test/test_script_loader_js_cache_module.html b/dom/base/test/test_script_loader_js_cache_module.html @@ -1,537 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=1436400 --> -<!-- The JS bytecode cache is not supposed to be observable. To make it - observable, the ScriptLoader is instrumented to trigger events on the - script tag. ---> -<head> - <meta charset="utf-8"> - <title>Test for saving and loading module bytecode in/from the necko cache</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> -</head> -<body> - <script type="application/javascript"> - -// List of testcases -// -// src -// HTML file loaded twice in an iframe -// encodeEvents -// Non-ordered multi-set of expected events dispatched during loading the -// HTML file at the first time -// decodeEvents -// Non-ordered multi-set of expected events dispatched during loading the -// HTML file at the second time -const tests = [ - // Module without import. - { - src: "file_script_module_single.html", - encodeEvents: [ - // file_script_module_single.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - decodeEvents: [ - // file_script_module_single.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", - "test_evaluated", - ], - }, - - // Module with import. - { - src: "file_script_module_import.html", - encodeEvents: [ - // file_script_module_import.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_import_imported.mjs - "scriptloader_load_source", - "scriptloader_encode", - ], - decodeEvents: [ - // file_script_module_import.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - "test_evaluated", - - // file_script_module_import_imported.mjs - "scriptloader_load_bytecode", - ], - }, - - // Single module is imported twice. - { - src: "file_script_module_import_multi.html", - encodeEvents: [ - // file_script_module_import_multi.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_import_multi_imported_once.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_import_multi_imported_twice.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_import_multi.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - "test_evaluated", - - // file_script_module_import_multi_imported_once.mjs - "scriptloader_load_bytecode", - - // file_script_module_import_multi_imported_twice.mjs - "scriptloader_load_bytecode", - ], - }, - - // Single module is imported twice from different elements. - { - src: "file_script_module_import_multi_elems.html", - encodeEvents: [ - // file_script_module_import_multi_elems_1.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_import_multi_elems_2.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_import_multi_elems_imported_once_1.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_import_multi_elems_imported_once_2.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_import_multi_elems_imported_once_3.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_import_multi_elems_imported_twice.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_import_multi_elems_1.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - "test_evaluated", - - // file_script_module_import_multi_elems_2.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - "test_evaluated", - - // file_script_module_import_multi_elems_imported_once_1.mjs - "scriptloader_load_bytecode", - - // file_script_module_import_multi_elems_imported_once_2.mjs - "scriptloader_load_bytecode", - - // file_script_module_import_multi_elems_imported_once_3.mjs - "scriptloader_load_bytecode", - - // file_script_module_import_multi_elems_imported_twice.mjs - "scriptloader_load_bytecode", - ], - }, - - // Single module is imported, and then loaded by element. - { - src: "file_script_module_import_and_element.html", - encodeEvents: [ - // file_script_module_import_and_element.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_import_and_element_imported_1.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_import_and_element_imported_2.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_import_and_element_imported_3.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_import_and_element.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - "test_evaluated", - - // file_script_module_import_and_element_imported_1.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - - // file_script_module_import_and_element_imported_2.mjs - "scriptloader_load_bytecode", - - // file_script_module_import_and_element_imported_3.mjs - "scriptloader_load_bytecode", - ], - }, - - // Single module is loaded by element, and then imported. - { - src: "file_script_module_element_and_import.html", - encodeEvents: [ - // file_script_module_element_and_import.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_element_and_import_imported_1.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_element_and_import_imported_2.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_element_and_import_imported_3.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_element_and_import.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - "test_evaluated", - - // file_script_module_element_and_import_imported_1.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level - - // file_script_module_element_and_import_imported_2.mjs - "scriptloader_load_bytecode", - - // file_script_module_element_and_import_imported_3.mjs - "scriptloader_load_bytecode", - ], - }, - - // Module with dynamic import. - { - src: "file_script_module_dynamic_import.html", - encodeEvents: [ - // file_script_module_dynamic_import.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_dynamic_import_imported.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_dynamic_import.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "test_evaluated", - - // file_script_module_dynamic_import_imported.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - ], - }, - - // Single module is imported dynamically, and then loaded by element. - { - src: "file_script_module_dynamic_and_element.html", - encodeEvents: [ - // file_script_module_dynamic_and_element.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_dynamic_and_element_imported_1.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_dynamic_and_element_imported_2.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_dynamic_and_element_imported_3.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_dynamic_and_element.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "test_evaluated", - - // file_script_module_dynamic_and_element_imported_1.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - - // file_script_module_dynamic_and_element_imported_2.mjs - "scriptloader_load_bytecode", - - // file_script_module_dynamic_and_element_imported_3.js - "scriptloader_load_bytecode", - ], - }, - - // Single module is loaded by element, and then imported dynamically. - { - src: "file_script_module_element_and_dynamic.html", - encodeEvents: [ - // file_script_module_element_and_dynamic.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_element_and_dynamic_imported_1.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_element_and_dynamic_imported_2.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_element_and_dynamic_imported_3.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_element_and_dynamic.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "test_evaluated", - - // file_script_module_element_and_dynamic_imported_1.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - - // file_script_module_element_and_dynamic_imported_2.mjs - "scriptloader_load_bytecode", - - // file_script_module_element_and_dynamic_imported_3.mjs - "scriptloader_load_bytecode", - ], - }, - - // Single module is imported dynamically, and then statically. - { - src: "file_script_module_dynamic_and_static.html", - encodeEvents: [ - // file_script_module_dynamic_and_static.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_dynamic_and_static_imported_1.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_dynamic_and_static_imported_2.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_dynamic_and_static_imported_3.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_dynamic_and_static.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "test_evaluated", - - // file_script_module_dynamic_and_static_imported_1.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - - // file_script_module_dynamic_and_static_imported_2.mjs - "scriptloader_load_bytecode", - - // file_script_module_dynamic_and_static_imported_3.mjs - "scriptloader_load_bytecode", - ], - }, - - // Single module is imported statically and then dynamically. - { - src: "file_script_module_static_and_dynamic.html", - encodeEvents: [ - // file_script_module_static_and_dynamic.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_static_and_dynamic_imported_1.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_static_and_dynamic_imported_2.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - - // file_script_module_static_and_dynamic_imported_3.mjs - "scriptloader_load_source", - "scriptloader_encode", - "scriptloader_bytecode_saved", - ], - decodeEvents: [ - // file_script_module_static_and_dynamic.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (element) - "test_evaluated", - - // file_script_module_static_and_dynamic_imported_1.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // dispatched only for top-level (dynamic) - - // file_script_module_static_and_dynamic_imported_2.mjs - "scriptloader_load_bytecode", - - // file_script_module_static_and_dynamic_imported_3.mjs - "scriptloader_load_bytecode", - ], - }, -]; - -promise_test(async function() { - await SpecialPowers.pushPrefEnv({set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ['dom.script_loader.bytecode_cache.strategy', -1] - ]}); - - for (const { src, encodeEvents, decodeEvents } of tests) { - for (let i = 0; i < 2; i++) { - const expectedEvents = i == 0 ? encodeEvents : decodeEvents; - - const iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - - const iwin = iframe.contentWindow; - - dump("## Start: " + src + "\n"); - let observedEvents = []; - await new Promise(resolve => { - function logEvent(evt) { - if (evt.type != "test_evaluated") { - if (!/^watchme/.test(evt.target.id)) { - return; - } - } - dump("## ScriptLoader event: " + evt.type + "\n"); - observedEvents.push(evt.type); - if (observedEvents.length == expectedEvents.length) { - resolve(); - } - } - iwin.addEventListener("scriptloader_load_source", logEvent); - iwin.addEventListener("scriptloader_load_bytecode", logEvent); - iwin.addEventListener("scriptloader_execute", logEvent); - iwin.addEventListener("scriptloader_evaluate_module", logEvent); - iwin.addEventListener("scriptloader_encode", logEvent); - iwin.addEventListener("scriptloader_no_encode", logEvent); - iwin.addEventListener("scriptloader_bytecode_saved", logEvent); - iwin.addEventListener("scriptloader_bytecode_failed", logEvent); - iwin.addEventListener("scriptloader_fallback", logEvent); - iwin.addEventListener("test_evaluated", logEvent); - iframe.src = src; - }); - - // The event order is non-deterministic. - // Just compare them as multi-set. - expectedEvents.sort(); - observedEvents.sort(); - assert_equals( - JSON.stringify(observedEvents), - JSON.stringify(expectedEvents), - `Expected events should be observed for ${src} during ${i == 0 ? "encoding" : "decoding"}`); - - document.body.removeChild(iframe); - } - } -}, "Test module bytecode save and load"); - -done(); - </script> - <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1436400">Mozilla Bug 1436400</a> -</body> -</html> diff --git a/dom/base/test/test_script_loader_js_cache_module_sri.html b/dom/base/test/test_script_loader_js_cache_module_sri.html @@ -1,425 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=1436400 --> -<!-- The JS bytecode cache is not supposed to be observable. To make it - observable, the ScriptLoader is instrumented to trigger events on the - script tag. ---> -<head> - <meta charset="utf-8"> - <title>Test for request fallback for SRI mismatch on module bytecode</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> -</head> -<body> - <script type="application/javascript"> - -// List of testcases -// -// prep -// HTML file loaded in iframe that prepares the bytecode cache -// prepEvents -// Non-ordered multi-set of expected events dispatched during loading the -// "prep" HTML file -// src -// HTML file loaded in iframe after preparation finishes -// events -// Non-ordered multi-set of expected events dispatched during loading the -// "src" HTML file -const tests = [ - // 1. Module bytecode is saved with integrity - // 2. Module bytecode is loaded by script element with integrity - { - prep: "file_script_module_sri_basic_prep.html", - prepEvents: [ - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_basic.html", - events: [ - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is loaded by script element with integrity - { - prep: "file_script_module_sri_fallback_prep.html", - prepEvents: [ - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_fallback.html", - events: [ - "scriptloader_load_bytecode", - "scriptloader_fallback", - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is loaded by script element with wrong integrity - // - // The module script is not evaluated - { - prep: "file_script_module_sri_fallback_failure_prep.html", - prepEvents: [ - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_fallback_failure.html", - events: [ - "scriptloader_load_bytecode", - "scriptloader_fallback", - "scriptloader_load_source", - - // This event is dispatched by another script, after the first module - // script load is terminated. - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is loaded by script element without integrity, and then - // loaded by script element with integrity - // - // The integrity attribute is ignored because the first request without - // integrity is shared between them. - { - prep: "file_script_module_sri_elem_elem_1_prep.html", - prepEvents: [ - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_elem_elem_1.html", - events: [ - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", - "test_evaluated", - - // NOTE: scriptloader_evaluate_module is dispatched even if - // the module is already evaluated before and it's evaluation is - // skipped this time. - "scriptloader_evaluate_module", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is loaded by script element with integrity, and then - // loaded by script element without integrity - // - // The request with integrity is shared between them. - { - prep: "file_script_module_sri_elem_elem_2_prep.html", - prepEvents: [ - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_elem_elem_2.html", - events: [ - "scriptloader_load_bytecode", - "scriptloader_fallback", - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - "scriptloader_evaluate_module", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is loaded by script element with integrity, and then - // imported statically. - // - // The request with integrity is shared between them. - { - prep: "file_script_module_sri_elem_import_prep.html", - prepEvents: [ - // file_script_module_sri_elem_import_imported.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_elem_import.html", - events: [ - // file_script_module_sri_elem_import_imported.mjs - "scriptloader_load_bytecode", - "scriptloader_fallback", - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_sri_elem_import.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is imported statically, and - // loaded by script element with integrity - // - // Even if the import is performed first, the script element's request - // with integrity is used because of preload. - { - prep: "file_script_module_sri_import_elem_prep.html", - prepEvents: [ - // file_script_module_sri_import_elem_imported.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_import_elem.html", - events: [ - // file_script_module_sri_import_elem.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_sri_import_elem_imported.mjs - "scriptloader_load_bytecode", - "scriptloader_fallback", - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is imported statically, and - // loaded by script element with integrity, without preload - // - // The request without integrity triggered by import is shared between - // them. - { - prep: "file_script_module_sri_import_elem_nopreload_prep.html", - prepEvents: [ - // file_script_module_sri_import_elem_nopreload_imported.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_import_elem_nopreload.html", - events: [ - // file_script_module_sri_import_elem_nopreload.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_sri_import_elem_nopreload_imported.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is loaded by script element with integrity, and then - // imported dynamically. - // - // The request with integrity is shared between them. - { - prep: "file_script_module_sri_elem_dynamic_prep.html", - prepEvents: [ - // file_script_module_sri_elem_dynamic_imported.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_elem_dynamic.html", - events: [ - // file_script_module_sri_elem_dynamic_imported.mjs - "scriptloader_load_bytecode", - "scriptloader_fallback", - "scriptloader_load_source", - "scriptloader_evaluate_module", // (element) - "scriptloader_evaluate_module", // (dynamic) - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - - // file_script_module_sri_elem_dynamic.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is imported dynamically, and then - // loaded by script element with integrity - // - // Even if the dynamic import is performed first, the script element's - // request with integrity is used because of preload. - { - prep: "file_script_module_sri_dynamic_elem_prep.html", - prepEvents: [ - // file_script_module_sri_dynamic_elem_imported.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_dynamic_elem.html", - events: [ - // file_script_module_sri_dynamic_elem_imported.mjs - "scriptloader_load_bytecode", - "scriptloader_fallback", - "scriptloader_load_source", - "scriptloader_evaluate_module", // (element) - "scriptloader_evaluate_module", // (dynamic) - "scriptloader_encode", - "test_evaluated", - - // file_script_module_sri_dynamic_elem.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - }, - - // 1. Module bytecode is saved without integrity - // 2. Module bytecode is imported dynamically, and then - // loaded by script element with integrity, without preload - // - // The request without integrity triggered by dynamic import is shared - // between them. - { - prep: "file_script_module_sri_dynamic_elem_nopreload_prep.html", - prepEvents: [ - // file_script_module_sri_dynamic_elem_nopreload_imported.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - src: "file_script_module_sri_dynamic_elem_nopreload.html", - events: [ - // file_script_module_sri_dynamic_elem_nopreload_imported.mjs - "scriptloader_load_bytecode", - "scriptloader_evaluate_module", // (element) - "scriptloader_evaluate_module", // (dynamic) - "test_evaluated", - - // file_script_module_sri_dynamic_elem_nopreload.mjs - "scriptloader_load_source", - "scriptloader_evaluate_module", - "scriptloader_encode", - "scriptloader_bytecode_saved", - "test_evaluated", - ], - }, -]; - -promise_test(async function() { - await SpecialPowers.pushPrefEnv({set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ['dom.script_loader.bytecode_cache.strategy', -1] - ]}); - - for (const { prep, prepEvents, src, events } of tests) { - for (let i = 0; i < 2; i++) { - const expectedEvents = i == 0 ? prepEvents : events; - const currentSrc = i == 0 ? prep : src; - - const iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - - const iwin = iframe.contentWindow; - - dump("## Start: " + currentSrc + "\n"); - let observedEvents = []; - await new Promise(resolve => { - function logEvent(evt) { - if (evt.type != "test_evaluated") { - if (!/^watchme/.test(evt.target.id)) { - return; - } - } - dump("## ScriptLoader event: " + evt.type + "\n"); - observedEvents.push(evt.type); - if (observedEvents.length == expectedEvents.length) { - resolve(); - } - } - iwin.addEventListener("scriptloader_load_source", logEvent); - iwin.addEventListener("scriptloader_load_bytecode", logEvent); - iwin.addEventListener("scriptloader_execute", logEvent); - iwin.addEventListener("scriptloader_evaluate_module", logEvent); - iwin.addEventListener("scriptloader_encode", logEvent); - iwin.addEventListener("scriptloader_no_encode", logEvent); - iwin.addEventListener("scriptloader_bytecode_saved", logEvent); - iwin.addEventListener("scriptloader_bytecode_failed", logEvent); - iwin.addEventListener("scriptloader_fallback", logEvent); - iwin.addEventListener("test_evaluated", logEvent); - iframe.src = currentSrc; - }); - - // The event order is non-deterministic. - // Just compare them as multi-set. - expectedEvents.sort(); - observedEvents.sort(); - assert_equals( - JSON.stringify(observedEvents), - JSON.stringify(expectedEvents), - `Expected events should be observed for ${currentSrc}`); - - document.body.removeChild(iframe); - } - } -}, "Test module bytecode save and load"); - -done(); - </script> - <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1436400">Mozilla Bug 1436400</a> -</body> -</html> diff --git a/dom/tests/mochitest/script/mochitest.toml b/dom/tests/mochitest/script/mochitest.toml @@ -11,9 +11,6 @@ support-files = [ ["test_bug1053321.html"] -["test_bug1656248.html"] -disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173" - ["test_bug1788532.html"] ["test_whitespace.html"] diff --git a/dom/tests/mochitest/script/test_bug1656248.html b/dom/tests/mochitest/script/test_bug1656248.html @@ -1,93 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -Repeated reload an iframe. When iframe's script is loaded from the bytecode -cache, dynamic module import should still resolve modules based on the -script's URL. ---> -<head> - <script src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> - - <script> - const iframeId = "test_iframe"; - - var checkResult = null; - - async function startTest() { - SimpleTest.waitForExplicitFinish(); - - // Setting dom.expose_test_interfaces pref causes the - // nsScriptLoadRequest to fire event on script tags, with information - // about its internal state. The ScriptLoader source send events to - // trace these and resolve a promise with the path taken by the - // script loader. - // - // Setting dom.script_loader.bytecode_cache.strategy to -1 causes the - // nsScriptLoadRequest to force all the conditions necessary to make a - // script be saved as bytecode in the alternate data storage provided - // by the channel (necko cache). - await SpecialPowers.pushPrefEnv({ - set: [ - ['dom.script_loader.bytecode_cache.enabled', true], - ['dom.expose_test_interfaces', true], - ["dom.script_loader.bytecode_cache.strategy", -1] - ]}); - - for (let i = 0; i < 3; i++) { - let iframe = document.getElementById(iframeId); - if (iframe) { - document.body.removeChild(iframe); - } - - iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - iframe.id = iframeId; - - let iwin = iframe.contentWindow; - - let eventPromise = new Promise(resolve => { - // Both regular script and imported module scripts are encoded/decoded - // Wait for 2 encode/load events to be fired. - let count = 0; - if (i == 0) { - iwin.addEventListener("scriptloader_bytecode_saved", event => { - count++; - ok(true, "Bytecode encoding succeeded"); - if (count == 2) { - resolve(); - } - }); - } else { - iwin.addEventListener("scriptloader_load_bytecode", event => { - count++; - ok(true, "Script loaded from bytecode"); - if (count == 2) { - resolve(); - } - }); - } - - iwin.addEventListener("scriptloader_bytecode_failed", () => { - ok(false, "Bytecode encoding failed"); - SimpleTest.finish(); - }); - }); - - let resultPromise = new Promise(resolve => { - checkResult = resolve; - }); - - iframe.src = "bug1656248_frame.html"; - - let [_, result] = await Promise.all([eventPromise, resultPromise]); - - is(result, 42, `Module was loaded successfully (${i})`); - } - - SimpleTest.finish(); - } - </script> -</head> - -<body onload="startTest()"></body>