diff --git a/b2g/components/HelperAppDialog.js b/b2g/components/HelperAppDialog.js index cc5288acee39..6a7bb79ce8d6 100644 --- a/b2g/components/HelperAppDialog.js +++ b/b2g/components/HelperAppDialog.js @@ -33,14 +33,6 @@ HelperAppLauncherDialog.prototype = { aLauncher.saveToDisk(null, false); }, - promptForSaveToFile: function(aLauncher, - aContext, - aDefaultFile, - aSuggestedFileExt, - aForcePrompt) { - throw Cr.NS_ERROR_NOT_AVAILABLE; - }, - promptForSaveToFileAsync: function(aLauncher, aContext, aDefaultFile, diff --git a/browser/metro/components/HelperAppDialog.js b/browser/metro/components/HelperAppDialog.js index 257d15695273..f189db0dd14c 100644 --- a/browser/metro/components/HelperAppDialog.js +++ b/browser/metro/components/HelperAppDialog.js @@ -138,10 +138,6 @@ HelperAppLauncherDialog.prototype = { messageContainer.appendChild(fragment); }, - promptForSaveToFile: function hald_promptForSaveToFile(aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) { - throw new Components.Exception("Async version must be used", Cr.NS_ERROR_NOT_AVAILABLE); - }, - promptForSaveToFileAsync: function hald_promptForSaveToFileAsync(aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) { let file = null; let prefs = Services.prefs; diff --git a/mobile/android/components/HelperAppDialog.js b/mobile/android/components/HelperAppDialog.js index 97d426925a38..d2e2d10708ae 100644 --- a/mobile/android/components/HelperAppDialog.js +++ b/mobile/android/components/HelperAppDialog.js @@ -236,11 +236,6 @@ HelperAppLauncherDialog.prototype = { Services.prefs.clearUserPref(this._getPrefName(mime)); }, - promptForSaveToFile: function () { - throw new Components.Exception("Async version must be used", - Cr.NS_ERROR_NOT_AVAILABLE); - }, - promptForSaveToFileAsync: function (aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) { Task.spawn(function* () { diff --git a/toolkit/components/downloads/test/unit/downloads_manifest.js b/toolkit/components/downloads/test/unit/downloads_manifest.js index a24622a6d265..7bef4117c14c 100644 --- a/toolkit/components/downloads/test/unit/downloads_manifest.js +++ b/toolkit/components/downloads/test/unit/downloads_manifest.js @@ -15,9 +15,7 @@ HelperAppDlg.prototype = { show: function (launcher, ctx, reason) { launcher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.saveToDisk; launcher.launchWithApplication(null, false); - }, - - promptForSaveToFile: function (launcher, ctx, defaultFile, suggestedExtension, forcePrompt) { } + } } diff --git a/toolkit/components/jsdownloads/test/unit/head.js b/toolkit/components/jsdownloads/test/unit/head.js index 8a643f174c7b..33425f11507d 100644 --- a/toolkit/components/jsdownloads/test/unit/head.js +++ b/toolkit/components/jsdownloads/test/unit/head.js @@ -793,15 +793,6 @@ add_task(function test_common_initialize() createInstance: function (aOuter, aIid) { return { QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]), - promptForSaveToFile: function (aLauncher, aWindowContext, - aDefaultFileName, - aSuggestedFileExtension, - aForcePrompt) - { - throw new Components.Exception( - "Synchronous promptForSaveToFile not implemented.", - Cr.NS_ERROR_NOT_AVAILABLE); - }, promptForSaveToFileAsync: function (aLauncher, aWindowContext, aDefaultFileName, aSuggestedFileExtension, diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js index b90d4619c318..b16561a9ae1c 100644 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js @@ -195,22 +195,6 @@ nsUnknownContentTypeDialog.prototype = { bundle.GetStringFromName("badPermissions")); }, - // promptForSaveToFile: Display file picker dialog and return selected file. - // This is called by the External Helper App Service - // after the ucth dialog calls |saveToDisk| with a null - // target filename (no target, therefore user must pick). - // - // Alternatively, if the user has selected to have all - // files download to a specific location, return that - // location and don't ask via the dialog. - // - // Note - this function is called without a dialog, so it cannot access any part - // of the dialog XUL as other functions on this object do. - - promptForSaveToFile: function(aLauncher, aContext, aDefaultFile, aSuggestedFileExtension, aForcePrompt) { - throw new Components.Exception("Async version must be used", Components.results.NS_ERROR_NOT_AVAILABLE); - }, - promptForSaveToFileAsync: function(aLauncher, aContext, aDefaultFile, aSuggestedFileExtension, aForcePrompt) { var result = null; diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 9e1a237fcdb8..6f87a873f298 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -2237,24 +2237,16 @@ void nsExternalAppHandler::RequestSaveDestination(const nsAFlatString &aDefaultF // picker is up would cause Cancel() to be called, and the dialog would be // released, which would release this object too, which would crash. // See Bug 249143 - nsIFile* fileToUse; nsRefPtr kungFuDeathGrip(this); nsCOMPtr dlg(mDialog); - rv = mDialog->PromptForSaveToFile(this, - GetDialogParent(), - aDefaultFile.get(), - aFileExtension.get(), - mForceSave, &fileToUse); - if (rv == NS_ERROR_NOT_AVAILABLE) { - // we need to use the async version -> nsIHelperAppLauncherDialog.promptForSaveToFileAsync. - rv = mDialog->PromptForSaveToFileAsync(this, - GetDialogParent(), - aDefaultFile.get(), - aFileExtension.get(), - mForceSave); - } else { - SaveDestinationAvailable(rv == NS_OK ? fileToUse : nullptr); + rv = mDialog->PromptForSaveToFileAsync(this, + GetDialogParent(), + aDefaultFile.get(), + aFileExtension.get(), + mForceSave); + if (NS_FAILED(rv)) { + Cancel(NS_BINDING_ABORTED); } } diff --git a/uriloader/exthandler/nsIHelperAppLauncherDialog.idl b/uriloader/exthandler/nsIHelperAppLauncherDialog.idl index d15f13321258..cd87dd766edf 100644 --- a/uriloader/exthandler/nsIHelperAppLauncherDialog.idl +++ b/uriloader/exthandler/nsIHelperAppLauncherDialog.idl @@ -57,32 +57,6 @@ interface nsIHelperAppLauncherDialog : nsISupports { in nsISupports aWindowContext, in unsigned long aReason); - /** - * Invoke a save-to-file dialog instead of the full fledged helper app dialog. - * Returns the a nsIFile for the file name/location selected. - * - * @param aLauncher - * A nsIHelperAppLauncher to be invoked when a file is selected. - * @param aWindowContext - * Window associated with action. - * @param aDefaultFileName - * Default file name to provide (can be null) - * @param aSuggestedFileExtension - * Sugested file extension - * @param aForcePrompt - * Set to true to force prompting the user for thet file - * name/location, otherwise perferences may control if the user is - * prompted. - * - * @throws NS_ERROR_NOT_AVAILABLE if the async version of this function - * should be used. - */ - nsIFile promptForSaveToFile(in nsIHelperAppLauncher aLauncher, - in nsISupports aWindowContext, - in wstring aDefaultFileName, - in wstring aSuggestedFileExtension, - in boolean aForcePrompt); - /** * Async invoke a save-to-file dialog instead of the full fledged helper app * dialog. When the file is chosen (or the dialog is closed), the callback diff --git a/uriloader/exthandler/tests/mochitest/test_unsafeBidiChars.xhtml b/uriloader/exthandler/tests/mochitest/test_unsafeBidiChars.xhtml index 6363e5523de6..3e5fa41c82e5 100644 --- a/uriloader/exthandler/tests/mochitest/test_unsafeBidiChars.xhtml +++ b/uriloader/exthandler/tests/mochitest/test_unsafeBidiChars.xhtml @@ -84,9 +84,6 @@ function load() { "The filename should be correctly sanitized"); gCallback(); }, - promptForSaveToFile: function(aLauncher, aWindowContext, aDefaultFileName, aSuggestedFileExtension, aForcePrompt) { - return null; - }, QueryInterface: function(aIID) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (aIID.equals(SpecialPowers.Ci.nsISupports) || diff --git a/uriloader/exthandler/tests/unit_ipc/test_encoding.js b/uriloader/exthandler/tests/unit_ipc/test_encoding.js index ea6a98192c5f..a46c899445a7 100644 --- a/uriloader/exthandler/tests/unit_ipc/test_encoding.js +++ b/uriloader/exthandler/tests/unit_ipc/test_encoding.js @@ -61,9 +61,7 @@ HelperAppDlg.prototype = { show: function (launcher, ctx, reason, usePrivateUI) { launcher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.saveToFile; launcher.launchWithApplication(null, false); - }, - - promptForSaveToFile: function (launcher, ctx, defaultFile, suggestedExtension, forcePrompt) { } + } } // Stolen from XPCOMUtils, since this handy function is not public there