Bug 423833 - "Show Only This Frame code uses about: url for error pages, instead of original site url" [p=johnath@mozilla.com (Johnathan Nightingale [johnath]) r=Mano a=blocking-firefox3+]

This commit is contained in:
reed@reedloden.com 2008-04-08 11:45:08 -07:00
parent d8fc078c6c
commit 377a5bb5b8
4 changed files with 20 additions and 19 deletions

View File

@ -654,11 +654,11 @@ nsContextMenu.prototype = {
// Open frame in a new tab.
openFrameInTab: function() {
var doc = this.target.ownerDocument;
var frameURL = doc.documentURIObject.spec;
var frameURL = doc.location.href;
var referrer = doc.referrer;
openNewTabWith(frameURL, null, null, null, false,
referrer ? makeURI(referrer) : null);
return openNewTabWith(frameURL, null, null, null, false,
referrer ? makeURI(referrer) : null);
},
// Reload clicked-in frame.
@ -669,17 +669,17 @@ nsContextMenu.prototype = {
// Open clicked-in frame in its own window.
openFrame: function() {
var doc = this.target.ownerDocument;
var frameURL = doc.documentURIObject.spec;
var frameURL = doc.location.href;
var referrer = doc.referrer;
openNewWindowWith(frameURL, null, null, false,
referrer ? makeURI(referrer) : null);
return openNewWindowWith(frameURL, null, null, false,
referrer ? makeURI(referrer) : null);
},
// Open clicked-in frame in the same window.
showOnlyThisFrame: function() {
var doc = this.target.ownerDocument;
var frameURL = doc.documentURIObject.spec;
var frameURL = doc.location.href;
urlSecurityCheck(frameURL, this.browser.contentPrincipal,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);

View File

@ -54,6 +54,7 @@ _BROWSER_FILES = browser_bug321000.js \
browser_bug409481.js \
browser_autodiscovery.js \
browser_bug420160.js \
browser_bug423833.js \
autodiscovery.html \
moz.png \
browser_getshortcutoruri.js \

View File

@ -27,13 +27,13 @@ function test() {
newBrowser.contentWindow.location = testPage;
}
var loadCount = 0;
function test1Setup() {
if(!loadCount++)
// Wait for both frames to load
if(newBrowser.contentWindow.frames.length < 2 ||
newBrowser.contentWindow.frames[1].document.location != invalidPage)
// The error frame hasn't loaded yet
return;
loadCount = 0;
newBrowser.removeEventListener("load", test1Setup, true);
var badFrame = newBrowser.contentWindow.frames[1];
@ -65,11 +65,11 @@ function testShowOnlyThisFrame() {
}
function test2Setup() {
if(!loadCount++)
// Wait for both frames to load
if(newBrowser.contentWindow.frames.length < 2 ||
newBrowser.contentWindow.frames[1].document.location != invalidPage)
// The error frame hasn't loaded yet
return;
loadCount = 0;
gBrowser.removeEventListener("load", test2Setup, true);
// Now let's do the whole thing again, but this time for "Open frame in new tab"

View File

@ -578,8 +578,8 @@ function openNewTabWith(aURL, aDocument, aPostData, aEvent,
// open link in new tab
var referrerURI = aDocument ? aDocument.documentURIObject : aReferrer;
var browser = top.document.getElementById("content");
browser.loadOneTab(aURL, referrerURI, originCharset, aPostData,
loadInBackground, aAllowThirdPartyFixup || false);
return browser.loadOneTab(aURL, referrerURI, originCharset, aPostData,
loadInBackground, aAllowThirdPartyFixup || false);
}
function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup,
@ -598,9 +598,9 @@ function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup,
charsetArg = "charset=" + window.content.document.characterSet;
var referrerURI = aDocument ? aDocument.documentURIObject : aReferrer;
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
aURL, charsetArg, referrerURI, aPostData,
aAllowThirdPartyFixup);
return window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
aURL, charsetArg, referrerURI, aPostData,
aAllowThirdPartyFixup);
}
/**