summaryrefslogtreecommitdiffstats
path: root/devtools/shared/DevToolsUtils.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/shared/DevToolsUtils.js')
-rw-r--r--devtools/shared/DevToolsUtils.js28
1 files changed, 18 insertions, 10 deletions
diff --git a/devtools/shared/DevToolsUtils.js b/devtools/shared/DevToolsUtils.js
index 77a6ec447c..9a38e4eed5 100644
--- a/devtools/shared/DevToolsUtils.js
+++ b/devtools/shared/DevToolsUtils.js
@@ -16,12 +16,18 @@ var {
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
- NetworkHelper:
- "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
- ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
-});
+if (!isWorker) {
+ ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
+ NetworkHelper:
+ "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
+ ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
+ },
+ { global: "contextual" }
+ );
+}
// Native getters which are considered to be side effect free.
ChromeUtils.defineLazyGetter(lazy, "sideEffectFreeGetters", () => {
@@ -459,7 +465,8 @@ DevToolsUtils.defineLazyGetter(this, "AppConstants", () => {
return {};
}
return ChromeUtils.importESModule(
- "resource://gre/modules/AppConstants.sys.mjs"
+ "resource://gre/modules/AppConstants.sys.mjs",
+ { global: "contextual" }
).AppConstants;
});
@@ -508,8 +515,9 @@ Object.defineProperty(exports, "assert", {
});
DevToolsUtils.defineLazyGetter(this, "NetUtil", () => {
- return ChromeUtils.importESModule("resource://gre/modules/NetUtil.sys.mjs")
- .NetUtil;
+ return ChromeUtils.importESModule("resource://gre/modules/NetUtil.sys.mjs", {
+ global: "contextual",
+ }).NetUtil;
});
/**
@@ -893,7 +901,7 @@ exports.showSaveFileDialog = function (
fp.defaultString = suggestedFilename;
}
- fp.init(parentWindow, null, fp.modeSave);
+ fp.init(parentWindow.browsingContext, null, fp.modeSave);
if (Array.isArray(filters) && filters.length) {
for (const { pattern, label } of filters) {
fp.appendFilter(label, pattern);