Backed out 3 changesets (bug 1795873, bug 1796539) as req by the dev (arai). CLOSED TREE

Backed out changeset de1917baf71d (bug 1796539)
Backed out changeset 8326cc71c2dd (bug 1795873)
Backed out changeset 292542f833fe (bug 1795873)
This commit is contained in:
Marian-Vasile Laza 2022-10-24 16:05:20 +03:00
parent e6b8e3604b
commit bfba58d8e6
3 changed files with 1 additions and 117 deletions

View File

@ -666,16 +666,6 @@ JSObject* mozJSModuleLoader::GetSharedGlobal(JSContext* aCx) {
nsresult mozJSModuleLoader::LoadSingleModuleScript(
ComponentModuleLoader* aModuleLoader, JSContext* aCx,
JS::loader::ModuleLoadRequest* aRequest, MutableHandleScript aScriptOut) {
nsAutoCString spec;
nsresult rv = aRequest->mURI->GetSpec(spec);
NS_ENSURE_SUCCESS(rv, rv);
AUTO_PROFILER_MARKER_TEXT(
"ChromeUtils.importESModule static import", JS,
MarkerOptions(MarkerStack::Capture(),
MarkerInnerWindowIdFromJSContext(aCx)),
spec);
ModuleLoaderInfo info(aRequest);
nsresult rv = info.EnsureResolvedURI();
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -255,7 +255,6 @@ add_task(async function test_xpcom_graph_wait() {
![
"ChromeUtils.import", // JSMs.
"ChromeUtils.importESModule", // System ESMs.
"ChromeUtils.importESModule static import",
"GetService", // XPCOM services.
].includes(markerName)
) {
@ -265,8 +264,7 @@ add_task(async function test_xpcom_graph_wait() {
let markerData = m[dataCol];
if (
markerName == "ChromeUtils.import" ||
markerName == "ChromeUtils.importESModule" ||
markerName == "ChromeUtils.importESModule static import"
markerName == "ChromeUtils.importESModule"
) {
let module = markerData.name;
if (!markersForAllPhases.modules.includes(module)) {

View File

@ -4,7 +4,6 @@
from __future__ import print_function, absolute_import
import json
import logging
import os
import pathlib
@ -545,31 +544,6 @@ def try_rename_in(command_context, path, target, jsm_name, esm_name, jsm_path):
return True
def try_rename_uri_in(command_context, target, jsm_name, esm_name, jsm_uri, esm_uri):
"""Replace the occurrences of `jsm_uri` with `esm_uri` in `target` file."""
def info(text):
command_context.log(logging.INFO, "esmify", {}, f"[INFO] {text}")
modified = False
content = ""
with open(target, "r") as f:
for line in f:
if jsm_uri in line:
modified = True
line = line.replace(jsm_uri, esm_uri)
content += line
if modified:
info(f" {str(target)}")
info(f" {jsm_name} => {esm_name}")
with open(target, "w", newline="\n") as f:
f.write(content)
return True
def try_rename_components_conf(command_context, path, jsm_name, esm_name):
"""Replace the occurrences of `jsm_name` with `esm_name` in components.conf
file."""
@ -616,44 +590,6 @@ def esmify_path(jsm_path):
return esm_path
path_to_uri_map = None
def load_path_to_uri_map():
global path_to_uri_map
if path_to_uri_map:
return
if "ESMIFY_MAP_JSON" in os.environ:
json_map = pathlib.Path(os.environ["ESMIFY_MAP_JSON"])
else:
json_map = pathlib.Path(__file__).parent / "map.json"
with open(json_map, "r") as f:
uri_to_path_map = json.loads(f.read())
path_to_uri_map = dict()
for uri, paths in uri_to_path_map.items():
if type(paths) is str:
paths = [paths]
for path in paths:
path_to_uri_map[path] = uri
def find_jsm_uri(jsm_path):
load_path_to_uri_map()
path = path_sep_from_native(jsm_path)
if path in path_to_uri_map:
return path_to_uri_map[path]
return None
def rename_single_file(command_context, vcs_utils, jsm_path, summary):
"""Rename `jsm_path` to .sys.mjs, and fix references to the file in build
and test definitions."""
@ -694,46 +630,6 @@ def rename_single_file(command_context, vcs_utils, jsm_path, summary):
if try_rename_components_conf(command_context, jsm_path, jsm_name, esm_name):
renamed = True
uri_target_files = [
pathlib.Path(
"browser", "base", "content", "test", "performance", "browser_startup.js"
),
pathlib.Path(
"browser",
"base",
"content",
"test",
"performance",
"browser_startup_content.js",
),
pathlib.Path(
"browser",
"base",
"content",
"test",
"performance",
"browser_startup_content_subframe.js",
),
pathlib.Path(
"toolkit",
"components",
"backgroundtasks",
"tests",
"browser",
"browser_xpcom_graph_wait.js",
),
]
jsm_uri = find_jsm_uri(jsm_path)
if jsm_uri:
esm_uri = re.sub(r"\.(jsm|js|jsm\.js)$", ".sys.mjs", jsm_uri)
for target in uri_target_files:
if try_rename_uri_in(
command_context, target, jsm_uri, esm_uri, jsm_name, esm_name
):
renamed = True
if not renamed:
summary.no_refs.append([jsm_path, None])