Bug 1258797 - Catch error when trying to open save as dialog to invalid path. r=Gijs
☠☠ backed out by 562b8f9ed39c ☠ ☠
authorIan Moody <moz-ian@perix.co.uk>
Sat, 30 Sep 2017 17:51:05 +0100
changeset 383888 e900a3d074b81b7617e6a65bcd18a02450652990
parent 383887 22374473d24f4b4877e50f0b49da3174a70f79ab
child 383889 65a1e4064a52ebd60ec55fdf0380405b97f78a8e
push id52419
push usergijskruitbosch@gmail.com
push dateSat, 30 Sep 2017 21:33:25 +0000
treeherderautoland@e900a3d074b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1258797
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1258797 - Catch error when trying to open save as dialog to invalid path. r=Gijs MozReview-Commit-ID: GbMgcfOgVaq
toolkit/mozapps/downloads/DownloadLastDir.jsm
--- a/toolkit/mozapps/downloads/DownloadLastDir.jsm
+++ b/toolkit/mozapps/downloads/DownloadLastDir.jsm
@@ -138,19 +138,24 @@ DownloadLastDir.prototype = {
                          .getService(Components.interfaces.nsIContentPrefService2);
     let result = null;
     cps2.getByDomainAndName(uri, LAST_DIR_PREF, this.fakeContext, {
       handleResult: aResult => result = aResult,
       handleCompletion(aReason) {
         let file = plainPrefFile;
         if (aReason == Components.interfaces.nsIContentPrefCallback2.COMPLETE_OK &&
            result instanceof Components.interfaces.nsIContentPref) {
-          file = Components.classes["@mozilla.org/file/local;1"]
-                           .createInstance(Components.interfaces.nsIFile);
-          file.initWithPath(result.value);
+          try {
+            file = Components.classes["@mozilla.org/file/local;1"]
+                             .createInstance(Components.interfaces.nsIFile);
+            file.initWithPath(result.value);
+          }
+          catch (e) {
+            file = plainPrefFile;
+          }
         }
         aCallback(file);
       }
     });
   },
 
   setFile(aURI, aFile) {
     if (aURI && isContentPrefEnabled()) {