Bug 576343 - Make sure search provider loads are in a remote browser [r=mbrubeck]

This commit is contained in:
Mark Finkle 2010-07-02 13:48:46 -04:00
parent 8072bd0910
commit d05bda64df
3 changed files with 17 additions and 4 deletions

View File

@ -138,6 +138,10 @@ let Util = {
return this.makeURI(url, null, this.makeURI(base)).spec;
},
isLocalScheme: function isLocalScheme(aURL) {
return (aURL.indexOf("about:") == 0 && aURL != "about:blank") || aURL.indexOf("chrome:") == 0;
},
clamp: function(num, min, max) {
return Math.max(min, Math.min(max, num));
},

View File

@ -516,10 +516,10 @@ var BrowserUI = {
// We need to keep about: pages opening in new "local" tabs. We also want to spawn
// new "remote" tabs if opening web pages from a "local" about: page.
let currentURI = getBrowser().currentURI;
let useLocal = (uri.schemeIs("about") && uri.spec != "about:blank");
let hasLocal = (currentURI.schemeIs("about") && currentURI.spec != "about:blank");
let useLocal = Util.isLocalScheme(uri.spec);
let hasLocal = Util.isLocalScheme(currentURI.spec);
if (useLocal || hasLocal != useLocal) {
BrowserUI.newTab(uri.spec);
Browser.addTab(uri.spec, true);
} else {
let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
getBrowser().loadURIWithFlags(uri.spec, loadFlags, null, null);
@ -568,6 +568,15 @@ var BrowserUI = {
let submission = button.engine.getSubmission(this._edit.value, null);
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let currentURI = getBrowser().currentURI;
let hasLocal = Util.isLocalScheme(currentURI.spec);
if (hasLocal) {
// We are in a local browser, so make a new tab and stop the initial load
let tab = Browser.addTab("about:blank", true);
tab.browser.stop();
}
getBrowser().loadURIWithFlags(submission.uri.spec, flags, null, null, submission.postData);
},

View File

@ -2613,7 +2613,7 @@ Tab.prototype = {
browser.setAttribute("type", "content");
let useRemote = gPrefService.getBoolPref("browser.tabs.remote");
let useLocal = aURI.indexOf("about") == 0 && aURI != "about:blank";
let useLocal = Util.isLocalScheme(aURI);
browser.setAttribute("remote", (!useLocal && useRemote) ? "true" : "false");
// Append the browser to the document, which should start the page load