mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-10 18:00:15 +01:00
contentAreaUtils: wrap them with try-catch blocks as they can fail
This commit is contained in:
parent
1f106e1216
commit
d1a5d94f4b
@ -515,9 +515,11 @@ function getTargetFile(aFpP, aSkipPrompt)
|
|||||||
{
|
{
|
||||||
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
|
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||||
.getService(Components.interfaces.nsIProperties);
|
.getService(Components.interfaces.nsIProperties);
|
||||||
|
var dir;
|
||||||
var dir = fileLocator.get(getSpecialFolderKey(aFolder), Components.interfaces.nsILocalFile);
|
try {
|
||||||
|
dir = fileLocator.get(getSpecialFolderKey(aFolder), Components.interfaces.nsILocalFile);
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||||
.getService(Components.interfaces.nsIStringBundleService);
|
.getService(Components.interfaces.nsIStringBundleService);
|
||||||
bundle = bundle.createBundle("chrome://mozapps/locale/downloads/unknownContentType.properties");
|
bundle = bundle.createBundle("chrome://mozapps/locale/downloads/unknownContentType.properties");
|
||||||
@ -544,6 +546,7 @@ function getTargetFile(aFpP, aSkipPrompt)
|
|||||||
if (!aSkipPrompt || !useDownloadDir || !dir) {
|
if (!aSkipPrompt || !useDownloadDir || !dir) {
|
||||||
// If we're asking the user where to save the file, root the Save As...
|
// If we're asking the user where to save the file, root the Save As...
|
||||||
// dialog on they place they last picked.
|
// dialog on they place they last picked.
|
||||||
|
if(!dir) {
|
||||||
try {
|
try {
|
||||||
dir = prefs.getComplexValue("lastDir", nsILocalFile);
|
dir = prefs.getComplexValue("lastDir", nsILocalFile);
|
||||||
}
|
}
|
||||||
@ -552,8 +555,15 @@ function getTargetFile(aFpP, aSkipPrompt)
|
|||||||
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
|
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||||
.getService(Components.interfaces.nsIProperties);
|
.getService(Components.interfaces.nsIProperties);
|
||||||
|
|
||||||
|
try {
|
||||||
dir = fileLocator.get(getSpecialFolderKey("Desktop"), nsILocalFile);
|
dir = fileLocator.get(getSpecialFolderKey("Desktop"), nsILocalFile);
|
||||||
}
|
}
|
||||||
|
catch (r) {
|
||||||
|
// no clue, try current dir
|
||||||
|
dir = '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var fp = makeFilePicker();
|
var fp = makeFilePicker();
|
||||||
var titleKey = aFpP.fpTitleKey || "SaveLinkTitle";
|
var titleKey = aFpP.fpTitleKey || "SaveLinkTitle";
|
||||||
|
Loading…
Reference in New Issue
Block a user