Bug 521264 - Don't use file.exists() when not necessary - browser/base part; r=dietrich

This commit is contained in:
Marco Castelluccio 2011-08-30 22:45:31 +01:00
parent 94bbb956a8
commit f04bd3c6d8
2 changed files with 14 additions and 4 deletions

View File

@ -2213,8 +2213,12 @@ var gLastOpenDirectory = {
return this._lastDir;
},
set path(val) {
if (!val || !val.exists() || !val.isDirectory())
try {
if (!val || !val.isDirectory())
return;
} catch(e) {
return;
}
this._lastDir = val.clone();
// Don't save the last open directory pref inside the Private Browsing mode
@ -2239,8 +2243,11 @@ function BrowserOpenFileWindow()
fp.displayDirectory = gLastOpenDirectory.path;
if (fp.show() == nsIFilePicker.returnOK) {
if (fp.file && fp.file.exists())
gLastOpenDirectory.path = fp.file.parent.QueryInterface(Ci.nsILocalFile);
try {
if (fp.file)
gLastOpenDirectory.path = fp.file.parent.QueryInterface(Ci.nsILocalFile);
} catch(e) {
}
openTopWin(fp.fileURL.spec);
}
} catch (ex) {

View File

@ -75,8 +75,11 @@ function deleteLocalstore() {
var directoryService = Components.classes[nsIDirectoryServiceContractID]
.getService(nsIProperties);
var localstoreFile = directoryService.get("LStoreS", Components.interfaces.nsIFile);
if (localstoreFile.exists())
try {
localstoreFile.remove(false);
} catch(e) {
Components.utils.reportError(e);
}
}
function disableAddons() {