Bug 1568510. Pass an nsIInterfaceRequestor, not nsISupports, as context to helper app dialog methods. r=mossop

Differential Revision: https://phabricator.services.mozilla.com/D39181
This commit is contained in:
Boris Zbarsky
2019-07-24 15:44:34 +00:00
parent 42d3ac1b1d
commit a8c6f6f579
2 changed files with 6 additions and 10 deletions

View File

@@ -150,9 +150,7 @@ nsUnknownContentTypeDialog.prototype = {
// Cache some information in case this context goes away: // Cache some information in case this context goes away:
try { try {
let parent = aContext let parent = aContext.getInterface(Ci.nsIDOMWindow);
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
this._mDownloadDir = new downloadModule.DownloadLastDir(parent); this._mDownloadDir = new downloadModule.DownloadLastDir(parent);
} catch (ex) { } catch (ex) {
Cu.reportError( Cu.reportError(
@@ -172,8 +170,7 @@ nsUnknownContentTypeDialog.prototype = {
// activate the OK button. So we wait a bit before doing opening it. // activate the OK button. So we wait a bit before doing opening it.
reallyShow() { reallyShow() {
try { try {
let ir = this.mContext.QueryInterface(Ci.nsIInterfaceRequestor); let docShell = this.mContext.getInterface(Ci.nsIDocShell);
let docShell = ir.getInterface(Ci.nsIDocShell);
let rootWin = docShell.rootTreeItem.domWindow; let rootWin = docShell.rootTreeItem.domWindow;
this.mDialog = Services.ww.openWindow( this.mDialog = Services.ww.openWindow(
rootWin, rootWin,
@@ -235,9 +232,7 @@ nsUnknownContentTypeDialog.prototype = {
let parent; let parent;
let gDownloadLastDir; let gDownloadLastDir;
try { try {
parent = aContext parent = aContext.getInterface(Ci.nsIDOMWindow);
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
} catch (ex) {} } catch (ex) {}
if (parent) { if (parent) {

View File

@@ -7,6 +7,7 @@
interface nsIHelperAppLauncher; interface nsIHelperAppLauncher;
interface nsIFile; interface nsIFile;
interface nsIInterfaceRequestor;
/** /**
* This interface is used to display a confirmation dialog before * This interface is used to display a confirmation dialog before
@@ -54,7 +55,7 @@ interface nsIHelperAppLauncherDialog : nsISupports {
* REASON_CANTHANDLE. * REASON_CANTHANDLE.
*/ */
void show(in nsIHelperAppLauncher aLauncher, void show(in nsIHelperAppLauncher aLauncher,
in nsISupports aWindowContext, in nsIInterfaceRequestor aWindowContext,
in unsigned long aReason); in unsigned long aReason);
/** /**
@@ -77,7 +78,7 @@ interface nsIHelperAppLauncherDialog : nsISupports {
* prompted. * prompted.
*/ */
void promptForSaveToFileAsync(in nsIHelperAppLauncher aLauncher, void promptForSaveToFileAsync(in nsIHelperAppLauncher aLauncher,
in nsISupports aWindowContext, in nsIInterfaceRequestor aWindowContext,
in wstring aDefaultFileName, in wstring aDefaultFileName,
in wstring aSuggestedFileExtension, in wstring aSuggestedFileExtension,
in boolean aForcePrompt); in boolean aForcePrompt);