Backed out changeset 6a71deda9822 (bug 562649) due to browser-chrome orange.

This commit is contained in:
Boris Zbarsky 2010-05-14 13:04:08 -04:00
Родитель f30f8902c0
Коммит 5cf049a38c
4 изменённых файлов: 28 добавлений и 37 удалений

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

@ -4265,6 +4265,17 @@ var XULBrowserWindow = {
gBrowser.selectedBrowser.engines = null;
var uri = aRequest.QueryInterface(Ci.nsIChannel).URI;
// Set the URI now if it isn't already set, so that the user can tell which
// site is loading. Only do this if the content window has no opener, though
// (i.e. the load wasn't triggered by a content-controlled link), to
// minimize spoofing risk.
if (gURLBar &&
gURLBar.value == "" &&
!content.opener &&
getWebNavigation().currentURI.spec == "about:blank")
URLBarSetURI(uri);
try {
Services.obs.notifyObservers(content, "StartDocumentLoad", uri.spec);
} catch (e) {
@ -4452,6 +4463,9 @@ nsBrowserAccess.prototype = {
return null;
}
var loadflags = isExternal ?
Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aWhere == Ci.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW)
aWhere = gPrefService.getIntPref("browser.link.open_newwindow");
switch (aWhere) {
@ -4491,12 +4505,17 @@ nsBrowserAccess.prototype = {
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
// If this is an external load, we need to load a blank tab first,
// because loadflags can't be passed to loadOneTab.
let loadBlankFirst = !aURI || isExternal;
let tab = win.gBrowser.loadOneTab(loadBlankFirst ? "about:blank" : aURI.spec, {
referrerURI: referrer,
fromExternal: isExternal,
inBackground: loadInBackground});
let browser = win.gBrowser.getBrowserForTab(tab);
if (loadBlankFirst && aURI)
browser.loadURIWithFlags(aURI.spec, loadflags, referrer, null, null);
newWindow = browser.contentWindow;
if (needToFocusWin || (!loadInBackground && isExternal))
newWindow.focus();
@ -4505,9 +4524,6 @@ nsBrowserAccess.prototype = {
newWindow = content;
if (aURI) {
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
let loadflags = isExternal ?
Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
gBrowser.loadURIWithFlags(aURI.spec, loadflags, referrer, null, null);
}
if (!gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground"))

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

@ -1043,7 +1043,6 @@
<parameter name="aAllowThirdPartyFixup"/>
<body>
<![CDATA[
var aFromExternal;
var aRelatedToCurrent;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
@ -1054,7 +1053,6 @@
aPostData = params.postData;
aLoadInBackground = params.inBackground;
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
aFromExternal = params.fromExternal;
aRelatedToCurrent = params.relatedToCurrent;
}
@ -1067,7 +1065,6 @@
postData: aPostData,
ownerTab: owner,
allowThirdPartyFixup: aAllowThirdPartyFixup,
fromExternal: aFromExternal,
relatedToCurrent: aRelatedToCurrent});
if (!bgLoad)
this.selectedTab = tab;
@ -1137,7 +1134,6 @@
<parameter name="aAllowThirdPartyFixup"/>
<body>
<![CDATA[
var aFromExternal;
var aRelatedToCurrent;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
@ -1148,7 +1144,6 @@
aPostData = params.postData;
aOwner = params.ownerTab;
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
aFromExternal = params.fromExternal;
aRelatedToCurrent = params.relatedToCurrent;
}
@ -1270,19 +1265,17 @@
// trouble with multiple parallel loads running at once.
b.stop();
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aAllowThirdPartyFixup)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
if (aFromExternal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
// pretend the user typed this so it'll be available till
// the document successfully loads
b.userTypedValue = aURI;
let flags = aAllowThirdPartyFixup ?
Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP :
Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
try {
b.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset, aPostData);
}
catch (ex) { }
// pretend the user typed this so it'll be available till
// the document successfully loads
b.userTypedValue = aURI;
}
// Check if we're opening a tab related to the current tab and

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

@ -119,7 +119,6 @@ _BROWSER_FILES = \
browser_bug537474.js \
browser_bug550565.js \
browser_bug555224.js \
browser_bug562649.js \
browser_bug563588.js \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \

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

@ -1,17 +0,0 @@
function test() {
const URI = "data:text/plain,bug562649";
browserDOMWindow.openURI(makeURI(URI),
null,
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
ok(XULBrowserWindow.isBusy, "window is busy loading a page");
is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI");
is(gURLBar.value, URI, "location bar value matches test URI");
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.removeCurrentTab();
is(gURLBar.value, URI, "location bar value matches test URI after switching tabs");
gBrowser.removeCurrentTab();
}