diff --git a/toolkit/components/aboutmemory/content/aboutMemory.js b/toolkit/components/aboutmemory/content/aboutMemory.js index da2fd560d23c8..049818263f2a8 100644 --- a/toolkit/components/aboutmemory/content/aboutMemory.js +++ b/toolkit/components/aboutmemory/content/aboutMemory.js @@ -2469,7 +2469,11 @@ function saveReportsToFile() { }; try { - fp.init(window, "Save Memory Reports", Ci.nsIFilePicker.modeSave); + fp.init( + window.browsingContext, + "Save Memory Reports", + Ci.nsIFilePicker.modeSave + ); } catch (ex) { // This will fail on Android, since there is no Save as file picker there. // Just save to the default downloads dir if it does. diff --git a/toolkit/components/apppicker/content/appPicker.js b/toolkit/components/apppicker/content/appPicker.js index dc2a97af8cb8a..dd1163d1b47af 100644 --- a/toolkit/components/apppicker/content/appPicker.js +++ b/toolkit/components/apppicker/content/appPicker.js @@ -195,7 +195,11 @@ AppPicker.prototype = { var nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); - fp.init(window, this._incomingParams.title, nsIFilePicker.modeOpen); + fp.init( + window.browsingContext, + this._incomingParams.title, + nsIFilePicker.modeOpen + ); fp.appendFilters(nsIFilePicker.filterApps); var startLocation; diff --git a/toolkit/components/extensions/parent/ext-downloads.js b/toolkit/components/extensions/parent/ext-downloads.js index d6bf9832a1dfc..c047afda87f64 100644 --- a/toolkit/components/extensions/parent/ext-downloads.js +++ b/toolkit/components/extensions/parent/ext-downloads.js @@ -941,7 +941,11 @@ this.downloads = class extends ExtensionAPIPersistent { const picker = Cc["@mozilla.org/filepicker;1"].createInstance( Ci.nsIFilePicker ); - picker.init(window, null, Ci.nsIFilePicker.modeSave); + picker.init( + window.browsingContext, + null, + Ci.nsIFilePicker.modeSave + ); if (lastFilePickerDirectory) { picker.displayDirectory = lastFilePickerDirectory; } else { diff --git a/toolkit/components/printing/content/print.js b/toolkit/components/printing/content/print.js index d08d790522a35..3398b28ace513 100644 --- a/toolkit/components/printing/content/print.js +++ b/toolkit/components/printing/content/print.js @@ -2811,7 +2811,7 @@ async function pickFileName(contentTitle, currentURI) { filename = DownloadPaths.sanitize(filename); picker.init( - window.docShell.chromeEventHandler.ownerGlobal, + window.docShell.chromeEventHandler.ownerGlobal.browsingContext, title, Ci.nsIFilePicker.modeSave ); diff --git a/toolkit/content/aboutwebrtc/aboutWebrtc.mjs b/toolkit/content/aboutwebrtc/aboutWebrtc.mjs index 3c41a4aa66da2..7e2c92a4bdf33 100644 --- a/toolkit/content/aboutwebrtc/aboutWebrtc.mjs +++ b/toolkit/content/aboutwebrtc/aboutWebrtc.mjs @@ -230,7 +230,7 @@ class SavePage extends Control { ]); let FilePicker = makeFilePickerService(); const lazyFileUtils = lazy.FileUtils; - FilePicker.init(window, dialogTitle, FilePicker.modeSave); + FilePicker.init(window.browsingContext, dialogTitle, FilePicker.modeSave); FilePicker.defaultString = LOGFILE_NAME_DEFAULT; const rv = await new Promise(r => FilePicker.open(r)); if (rv != FilePicker.returnOK && rv != FilePicker.returnReplace) { diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index 498265331c1ec..983fd9890d84c 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -688,7 +688,7 @@ function promiseTargetFile( let fp = makeFilePicker(); let titleKey = aFpP.fpTitleKey || "SaveLinkTitle"; fp.init( - window, + window.browsingContext, ContentAreaUtils.stringBundle.GetStringFromName(titleKey), Ci.nsIFilePicker.modeSave ); diff --git a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs index 66f77d38e4ed7..be3dfd350b2fb 100644 --- a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs +++ b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs @@ -309,7 +309,7 @@ nsUnknownContentTypeDialog.prototype = { var picker = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); var windowTitle = bundle.GetStringFromName("saveDialogTitle"); - picker.init(parent, windowTitle, nsIFilePicker.modeSave); + picker.init(parent.browsingContext, windowTitle, nsIFilePicker.modeSave); if (aDefaultFileName) { picker.defaultString = this.getFinalLeafName(aDefaultFileName); } @@ -1270,7 +1270,7 @@ nsUnknownContentTypeDialog.prototype = { var nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); fp.init( - this.mDialog, + this.mDialog.browsingContext, this.dialogElement("strings").getString("chooseAppFilePickerTitle"), nsIFilePicker.modeOpen ); diff --git a/toolkit/mozapps/extensions/content/aboutaddonsCommon.js b/toolkit/mozapps/extensions/content/aboutaddonsCommon.js index 739e7629d7b31..9315e35861c8b 100644 --- a/toolkit/mozapps/extensions/content/aboutaddonsCommon.js +++ b/toolkit/mozapps/extensions/content/aboutaddonsCommon.js @@ -237,7 +237,11 @@ async function installAddonsFromFilePicker() { ]); const nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); - fp.init(window, dialogTitle.value, nsIFilePicker.modeOpenMultiple); + fp.init( + window.browsingContext, + dialogTitle.value, + nsIFilePicker.modeOpenMultiple + ); try { fp.appendFilter(filterName.value, "*.xpi;*.jar;*.zip"); fp.appendFilters(nsIFilePicker.filterAll); diff --git a/toolkit/mozapps/handling/content/appChooser.js b/toolkit/mozapps/handling/content/appChooser.js index 2958ad68b491d..6c0471778319a 100644 --- a/toolkit/mozapps/handling/content/appChooser.js +++ b/toolkit/mozapps/handling/content/appChooser.js @@ -225,7 +225,7 @@ let dialog = { let title = await this.getChooseAppWindowTitle(); var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); - fp.init(window, title, Ci.nsIFilePicker.modeOpen); + fp.init(window.browsingContext, title, Ci.nsIFilePicker.modeOpen); fp.appendFilters(Ci.nsIFilePicker.filterApps); fp.open(rv => { diff --git a/toolkit/profile/content/createProfileWizard.js b/toolkit/profile/content/createProfileWizard.js index 9e87fb42207d6..ece321e6e1af7 100644 --- a/toolkit/profile/content/createProfileWizard.js +++ b/toolkit/profile/content/createProfileWizard.js @@ -127,7 +127,7 @@ function chooseProfileFolder() { I.nsIFilePicker ); dirChooser.init( - window, + window.browsingContext, gProfileManagerBundle.getString("chooseFolder"), I.nsIFilePicker.modeGetFolder );