Bug 442970: revert part of bug 441120 that modified behavior for default params, to ensure that session store code can properly strip out default params when restoring sessions, r=dveditz, a=pending

This commit is contained in:
gavin%gavinsharp.com 2008-07-02 08:50:38 +00:00
Родитель 14ecee7c29
Коммит ea8a79c702
1 изменённых файлов: 22 добавлений и 11 удалений

Просмотреть файл

@ -176,18 +176,26 @@ function copyPrefOverride() {
} }
} }
function splitPipesIntoArray(aSpec) { // Flag used to indicate that the arguments to openWindow can be passed directly.
var specs = aSpec.split("|"); const NO_EXTERNAL_URIS = 1;
if (specs.length > 1)
return specs;
return aSpec; function openWindow(parent, url, target, features, args, noExternalArgs) {
}
function openWindow(parent, url, target, features, args) {
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(nsIWindowWatcher); .getService(nsIWindowWatcher);
if (noExternalArgs == NO_EXTERNAL_URIS) {
// Just pass in the defaultArgs directly
var argstring;
if (args) {
argstring = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(nsISupportsString);
argstring.data = args;
}
return wwatch.openWindow(parent, url, target, features, argstring);
}
// Pass an array to avoid the browser "|"-splitting behavior.
var argArray = Components.classes["@mozilla.org/supports-array;1"] var argArray = Components.classes["@mozilla.org/supports-array;1"]
.createInstance(Components.interfaces.nsISupportsArray); .createInstance(Components.interfaces.nsISupportsArray);
@ -351,9 +359,10 @@ var nsBrowserContentHandler = {
/* nsICommandLineHandler */ /* nsICommandLineHandler */
handle : function bch_handle(cmdLine) { handle : function bch_handle(cmdLine) {
if (cmdLine.handleFlag("browser", false)) { if (cmdLine.handleFlag("browser", false)) {
// Passing defaultArgs, so use NO_EXTERNAL_URIS
openWindow(null, this.chromeURL, "_blank", openWindow(null, this.chromeURL, "_blank",
"chrome,dialog=no,all" + this.getFeatures(cmdLine), "chrome,dialog=no,all" + this.getFeatures(cmdLine),
splitPipesIntoArray(this.defaultArgs)); this.defaultArgs, NO_EXTERNAL_URIS);
cmdLine.preventDefault = true; cmdLine.preventDefault = true;
} }
@ -414,9 +423,10 @@ var nsBrowserContentHandler = {
if (remoteParams[0].toLowerCase() != "openbrowser") if (remoteParams[0].toLowerCase() != "openbrowser")
throw NS_ERROR_ABORT; throw NS_ERROR_ABORT;
// Passing defaultArgs, so use NO_EXTERNAL_URIS
openWindow(null, this.chromeURL, "_blank", openWindow(null, this.chromeURL, "_blank",
"chrome,dialog=no,all" + this.getFeatures(cmdLine), "chrome,dialog=no,all" + this.getFeatures(cmdLine),
splitPipesIntoArray(this.defaultArgs)); this.defaultArgs, NO_EXTERNAL_URIS);
break; break;
default: default:
@ -818,9 +828,10 @@ var nsDefaultCommandLineHandler = {
} }
else if (!cmdLine.preventDefault) { else if (!cmdLine.preventDefault) {
// Passing defaultArgs, so use NO_EXTERNAL_URIS
openWindow(null, nsBrowserContentHandler.chromeURL, "_blank", openWindow(null, nsBrowserContentHandler.chromeURL, "_blank",
"chrome,dialog=no,all" + nsBrowserContentHandler.getFeatures(cmdLine), "chrome,dialog=no,all" + nsBrowserContentHandler.getFeatures(cmdLine),
splitPipesIntoArray(nsBrowserContentHandler.defaultArgs)); nsBrowserContentHandler.defaultArgs, NO_EXTERNAL_URIS);
} }
}, },