Skip to content

Commit

Permalink
[embedlite-components] Always save files when dialog requested. Fixes…
Browse files Browse the repository at this point in the history
… JB#49155

This commit adds also placeholder for promptForSaveToFileAsync.
  • Loading branch information
rainemak committed Mar 11, 2020
1 parent ef60d4d commit 156200b
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions jscomps/HelperAppDialog.js
Expand Up @@ -27,30 +27,20 @@ HelperAppLauncherDialog.prototype = {
// Check to see if we can open this file or not
dump("HelperAppLauncherDialog show\n");

if (aLauncher.MIMEInfo.hasDefaultHandler) {
aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useSystemDefault;
aLauncher.launchWithApplication(null, false);
} else {
let wasClicked = false;
let listener = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "alertclickcallback") {
wasClicked = true;
let win = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator).getMostRecentWindow("navigator:browser");
if (win) {
win.BrowserUI.showPanel("downloads-container");
}

aLauncher.saveToDisk(null, false);
} else {
if (!wasClicked) {
aLauncher.cancel(Cr.NS_BINDING_ABORTED);
}
}
}
};
this._notify(aLauncher, listener);
}
// See nsIMIMEInfo.idl, nsIExternalHelperAppService and uriloader/exthandler/nsExternalHelperAppService.cpp
// For now save them all.

// if (aLauncher.MIMEInfo.hasDefaultHandler) {
// aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useSystemDefault;
// aLauncher.launchWithApplication(null, false);
// }
aLauncher.saveToDisk(null, false);
},

promptForSaveToFileAsync: function hald_promptForSaveToFileAsync(aLauncher, aWindowContext, aDefaultFileName,
aSuggestedFileExtension,
aForcePrompt) {
dump("HelperAppLauncherDialog promptForSaveToFileAsync -- not supported\n");
},

promptForSaveToFile: function hald_promptForSaveToFile(aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) {
Expand Down

0 comments on commit 156200b

Please sign in to comment.