Bug 1340865 - Handle non-parser-created module scripts r=smaug

This commit is contained in:
Jon Coppeard 2017-02-27 15:04:21 +00:00
Родитель 7fd59c572e
Коммит 2c2e96fdc0
5 изменённых файлов: 49 добавлений и 1 удалений

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

@ -1602,7 +1602,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

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

@ -332,6 +332,11 @@
[
{}
]
],
"html/semantics/scripting-1/the-script-element/support/module.js": [
[
{}
]
]
},
"testharness": {
@ -341,6 +346,12 @@
{}
]
],
"html/semantics/scripting-1/the-script-element/create-module-script.html": [
[
"/_mozilla/html/semantics/scripting-1/the-script-element/create-module-script.html",
{}
]
],
"html/syntax/parsing/math-parse01.html": [
[
"/_mozilla/html/syntax/parsing/math-parse01.html",
@ -722,6 +733,14 @@
"99cbd16b78771f35e075e4012d8dbc5dce3209c0",
"testharness"
],
"html/semantics/scripting-1/the-script-element/create-module-script.html": [
"139c1ae0c7dafc27124dbc648925a3911b54292a",
"testharness"
],
"html/semantics/scripting-1/the-script-element/support/module.js": [
"3de5a5a1fb12e698509ac14ba44d7b2b474330f4",
"support"
],
"html/syntax/parsing/math-parse01.html": [
"9b670028f08b5fab713e19a443b9505cb9de5fd3",
"testharness"

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

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

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

@ -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>

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

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