forked from mirrors/gecko-dev
For the print preview documents, they are cloned from the original document in Document::CreateStaticClone[1]. But the cloned document isn't attched to any nsIContentViewer yet so it won't have any global object. The document is attached to the nsIContentViewer later when the cloning is done[2]. Also, the script elements from the cloned document are also cloned from the original document, so they won't be processed in the cloned document. Therefore we simply bail out if the module loader isn't initialized yet. [1]: https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/dom/base/Document.cpp#13240 [2]: https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/dom/base/Document.cpp#13295 Differential Revision: https://phabricator.services.mozilla.com/D151105
21 lines
569 B
JavaScript
21 lines
569 B
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
const TEST_PATH = getRootDirectory(gTestPath).replace(
|
|
"chrome://mochitests/content",
|
|
"https://example.com"
|
|
);
|
|
|
|
add_task(async function testLinkModulePreload() {
|
|
await SpecialPowers.pushPrefEnv({
|
|
set: [["dom.importMaps.enabled", true]],
|
|
});
|
|
|
|
await PrintHelper.withTestPage(async helper => {
|
|
await helper.startPrint();
|
|
ok(true, "We did not crash.");
|
|
await helper.closeDialog();
|
|
}, "file_link_modulepreload.html");
|
|
});
|