--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -348,32 +348,32 @@ nsBrowserContentHandler.prototype = {
// already running.
if (cmdLine.handleFlag("remote", true)) {
throw NS_ERROR_ABORT;
}
var uriparam;
try {
while ((uriparam = cmdLine.handleFlagWithParam("new-window", false))) {
- var uri = resolveURIInternal(cmdLine, uriparam);
+ let uri = resolveURIInternal(cmdLine, uriparam);
if (!shouldLoadURI(uri))
continue;
openWindow(null, this.chromeURL, "_blank",
"chrome,dialog=no,all" + this.getFeatures(cmdLine),
uri.spec);
cmdLine.preventDefault = true;
}
}
catch (e) {
Components.utils.reportError(e);
}
try {
while ((uriparam = cmdLine.handleFlagWithParam("new-tab", false))) {
- var uri = resolveURIInternal(cmdLine, uriparam);
+ let uri = resolveURIInternal(cmdLine, uriparam);
handURIToExistingBrowser(uri, nsIBrowserDOMWindow.OPEN_NEWTAB, cmdLine);
cmdLine.preventDefault = true;
}
}
catch (e) {
Components.utils.reportError(e);
}
@@ -381,28 +381,28 @@ nsBrowserContentHandler.prototype = {
if (chromeParam) {
// Handle old preference dialog URLs.
if (chromeParam == "chrome://browser/content/pref/pref.xul" ||
chromeParam == "chrome://browser/content/preferences/preferences.xul") {
openPreferences();
cmdLine.preventDefault = true;
} else try {
- var uri = resolveURIInternal(cmdLine, chromeParam);
- let isLocal = (uri) => {
+ let resolvedURI = resolveURIInternal(cmdLine, chromeParam);
+ let isLocal = uri => {
let localSchemes = new Set(["chrome", "file", "resource"]);
if (uri instanceof Components.interfaces.nsINestedURI) {
uri = uri.QueryInterface(Components.interfaces.nsINestedURI).innerMostURI;
}
return localSchemes.has(uri.scheme);
};
- if (isLocal(uri)) {
+ if (isLocal(resolvedURI)) {
// If the URI is local, we are sure it won't wrongly inherit chrome privs
var features = "chrome,dialog=no,all" + this.getFeatures(cmdLine);
- openWindow(null, uri.spec, "_blank", features);
+ openWindow(null, resolvedURI.spec, "_blank", features);
cmdLine.preventDefault = true;
} else {
dump("*** Preventing load of web URI as chrome\n");
dump(" If you're trying to load a webpage, do not pass --chrome.\n");
}
}
catch (e) {
Components.utils.reportError(e);
@@ -413,21 +413,24 @@ nsBrowserContentHandler.prototype = {
cmdLine.preventDefault = true;
}
if (cmdLine.handleFlag("silent", false))
cmdLine.preventDefault = true;
try {
var privateWindowParam = cmdLine.handleFlagWithParam("private-window", false);
if (privateWindowParam) {
- var uri = resolveURIInternal(cmdLine, privateWindowParam);
- handURIToExistingBrowser(uri, nsIBrowserDOMWindow.OPEN_NEWTAB, cmdLine, true);
+ let resolvedURI = resolveURIInternal(cmdLine, privateWindowParam);
+ handURIToExistingBrowser(resolvedURI, nsIBrowserDOMWindow.OPEN_NEWTAB, cmdLine, true);
cmdLine.preventDefault = true;
}
- } catch (e if e.result == Components.results.NS_ERROR_INVALID_ARG) {
+ } catch (e) {
+ if (e.result != Components.results.NS_ERROR_INVALID_ARG) {
+ throw e;
+ }
// NS_ERROR_INVALID_ARG is thrown when flag exists, but has no param.
if (cmdLine.handleFlag("private-window", false)) {
openWindow(null, this.chromeURL, "_blank",
"chrome,dialog=no,private,all" + this.getFeatures(cmdLine),
"about:privatebrowsing");
cmdLine.preventDefault = true;
}
}
@@ -444,20 +447,20 @@ nsBrowserContentHandler.prototype = {
PrivateBrowsingUtils.enterTemporaryAutoStartMode();
}
var fileParam = cmdLine.handleFlagWithParam("file", false);
if (fileParam) {
var file = cmdLine.resolveFile(fileParam);
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
- var uri = ios.newFileURI(file);
- openWindow(null, this.chromeURL, "_blank",
+ var fileURI = ios.newFileURI(file);
+ openWindow(null, this.chromeURL, "_blank",
"chrome,dialog=no,all" + this.getFeatures(cmdLine),
- uri.spec);
+ fileURI.spec);
cmdLine.preventDefault = true;
}
if (AppConstants.platform == "win") {
// Handle "? searchterm" for Windows Vista start menu integration
for (var i = cmdLine.length - 1; i >= 0; --i) {
var param = cmdLine.getArgument(i);
if (param.match(/^\? /)) {