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 18:48:35 +00:00
Родитель 7945173f14
Коммит e6a62ce582
7 изменённых файлов: 20 добавлений и 19 удалений

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

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

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

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

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

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

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

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

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

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

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