Backed out 3 changesets (bug 1803984)

Backed out changeset d6316cfb118d (bug 1803984)
Backed out changeset bcbcbdf4f449 (bug 1803984)
Backed out changeset 3bc8c30ecc25 (bug 1803984)
This commit is contained in:
Cristina Horotan 2023-05-29 12:36:25 +03:00
Родитель 1338e14796
Коммит 0c2945ad47
18 изменённых файлов: 0 добавлений и 140 удалений

Просмотреть файл

@ -1 +0,0 @@
throw "Shouldn't load file bad/module_2.js";

Просмотреть файл

@ -1,7 +0,0 @@
import {} from "../circular_depdendency.js";
export function exportedFunction() {
throw "Wrong version of function called";
}
throw "Shouldn't laod file bad/module_3.js";

Просмотреть файл

@ -12,23 +12,11 @@ support-files =
scope1/module_simpleImportMap.js
scope1/scope2/module_simpleExport.js
scope1/scope2/module_simpleImportMap.js
module_importMap_with_external_script_0.js
module_importMap_with_external_script_1.js
module_importMap_with_external_script_2.js
module_importMap_with_external_script_3.js
bad/module_2.js
bad/module_3.js
good/module_0.js
good/module_1.js
good/module_2.js
good/module_3.js
circular_dependency.js
prefs =
dom.importMaps.enabled=true
[test_dynamic_import_reject_importMap.html]
[test_externalImportMap.html]
[test_importMap_with_external_script.html]
[test_import_meta_resolve_importMap.html]
[test_inline_module_reject_importMap.html]
[test_load_importMap_with_base.html]

Просмотреть файл

@ -1,6 +0,0 @@
// Should be remapped to good/module_3.js.
import { exportedFunction } from "./bad/module_3.js";
if (exportedFunction()) {
success("circular_dependency.js");
}

Просмотреть файл

@ -1 +0,0 @@
success("good/module_0.js");

Просмотреть файл

@ -1 +0,0 @@
success("good/module_1.js");

Просмотреть файл

@ -1 +0,0 @@
success("good/module_2.js");

Просмотреть файл

@ -1,5 +0,0 @@
import {} from "../circular_dependency.js";
export function exportedFunction() {
return true;
}

Просмотреть файл

@ -1,2 +0,0 @@
// Bareword specifier should be mapped to ./good/module_0.js.
import {} from "bare";

Просмотреть файл

@ -1,2 +0,0 @@
// Missing file ./bad/module_1.js should be mapped to ./good/module_1.js.
import {} from "./bad/module_1.js";

Просмотреть файл

@ -1,2 +0,0 @@
// Existing file ./bad/module_2.js should be mapped to ./good/module_2.js.
import {} from "./bad/module_2.js";

Просмотреть файл

@ -1,2 +0,0 @@
// Existing file ./bad/module_3.js should be mapped to ./good/module_3.js.
import {} from "./bad/module_3.js";

Просмотреть файл

@ -1,58 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test speculative preload of external script doesn't conflict with import map</title>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<!--
These tests check that speculative preloading, which could happen before
the import map is installed, doesn't load the wrong modules.
-->
<script type="importmap">
{
"imports": {
"bare": "./good/module_0.js",
"./bad/module_1.js": "./good/module_1.js",
"./bad/module_2.js": "./good/module_2.js",
"./bad/module_3.js": "./good/module_3.js"
}
}
</script>
<!--
Test bareword import (not supported before import map installed).
-->
<script type="module" src="module_importMap_with_external_script_0.js"></script>
<!--
Test mapping from missing resource to existing resource (not found before
import map installed).
-->
<script type="module" src="module_importMap_with_external_script_1.js"></script>
<!--
Test mapping from one existing resource to another (would load wrong resource before
import map installed).
-->
<script type="module" src="module_importMap_with_external_script_2.js"></script>
<!--
Test mapping from one existing resource to another with circular dependency.
-->
<script type="module" src="module_importMap_with_external_script_3.js"></script>
<script>
SimpleTest.waitForExplicitFinish();
let passCount = 0;
const expectedCount = 4;
function success(name) {
ok(true, "Test passed, loaded " + name);
passCount++;
if (passCount == expectedCount) {
SimpleTest.finish();
}
}
</script>
<body></body>

Просмотреть файл

@ -995,17 +995,6 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
return false;
}
// If there are a preloaded request and an import map, we won't use the
// preloaded request and will try to create a new one for this, because the
// import map isn't preloaded, and the preloaded request may have used the
// wrong module specifiers.
if (request && request->IsModuleRequest() &&
mModuleLoader->HasImportMapRegistered()) {
DebugOnly<bool> removed = mModuleLoader->RemoveFetchedModule(request->mURI);
MOZ_ASSERT(removed);
request = nullptr;
}
if (request) {
// Use the preload request.

Просмотреть файл

@ -453,18 +453,6 @@ nsresult ModuleLoaderBase::GetFetchedModuleURLs(nsTArray<nsCString>& aURLs) {
return NS_OK;
}
bool ModuleLoaderBase::RemoveFetchedModule(nsIURI* aURL) {
#if defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
RefPtr<ModuleScript> ms;
MOZ_ALWAYS_TRUE(mFetchedModules.Get(aURL, getter_AddRefs(ms)));
if (ms && ms->ModuleRecord()) {
JS::AssertModuleUnlinked(ms->ModuleRecord());
}
#endif
return mFetchedModules.Remove(aURL);
}
void ModuleLoaderBase::SetModuleFetchStarted(ModuleLoadRequest* aRequest) {
// Update the module map to indicate that a module is currently being fetched.

Просмотреть файл

@ -314,10 +314,6 @@ class ModuleLoaderBase : public nsISupports {
nsresult GetFetchedModuleURLs(nsTArray<nsCString>& aURLs);
// Removed a fetched module from the module map. Asserts that the module is
// unlinked. Extreme care should be taken when calling this method.
bool RemoveFetchedModule(nsIURI* aURL);
// Internal methods.
private:

Просмотреть файл

@ -299,11 +299,6 @@ extern JS_PUBLIC_API JSObject* GetModuleEnvironment(
*/
extern JS_PUBLIC_API void ClearModuleEnvironment(JSObject* moduleObj);
/*
* Diagnostic assert that the module is has status |Unlinked|.
*/
extern JS_PUBLIC_API void AssertModuleUnlinked(JSObject* moduleObj);
} // namespace JS
#endif // js_Modules_h

Просмотреть файл

@ -290,14 +290,6 @@ JS_PUBLIC_API void JS::ClearModuleEnvironment(JSObject* moduleObj) {
}
}
JS_PUBLIC_API void JS::AssertModuleUnlinked(JSObject* moduleObj) {
MOZ_ASSERT(moduleObj);
AssertHeapIsIdle();
MOZ_DIAGNOSTIC_ASSERT(moduleObj->as<ModuleObject>().status() ==
ModuleStatus::Unlinked);
}
////////////////////////////////////////////////////////////////////////////////
// Internal implementation