1340865 - Handle non-parser-created module scripts.

This commit is contained in:
Fedor 2019-12-25 15:40:27 +03:00
parent 67595763d0
commit 394f5416b3
4 changed files with 30 additions and 1 deletions

View File

@ -1601,7 +1601,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
}
return false;
}
if (!aElement->GetParserCreated() && !request->IsModuleRequest()) {
if (!aElement->GetParserCreated()) {
// Violate the HTML5 spec in order to make LABjs and the "order" plug-in
// for RequireJS work with their Gecko-sniffed code path. See
// http://lists.w3.org/Archives/Public/public-html/2010Oct/0088.html

View File

@ -0,0 +1,2 @@
[create-module-script.html]
prefs: [dom.moduleScripts.enabled:true]

View File

@ -0,0 +1,25 @@
<!doctype html>
<meta charset=utf-8>
<title>Insert non-async module script</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var test = async_test("Create module script")
var moduleRan = false;
function loadModule() {
var script = document.createElement("script");
script.onerror = function() {
test.step(() => assert_unreached("Should not get an error"));
test.done();
};
script.onload = function() {
test.step(() => assert_equals(moduleRan, true));
test.done();
};
script.type = "module";
script.src = "support/module.js";
script.async = false;
document.documentElement.appendChild(script);
}
</script>
<body onload='loadModule()'></body>

View File

@ -0,0 +1,2 @@
export default 42;
moduleRan = true;