From e6a62ce582290c14d5c336b66b8c12d86b495a9a Mon Sep 17 00:00:00 2001 From: "reed%reedloden.com" Date: Tue, 8 Apr 2008 18:48:35 +0000 Subject: [PATCH] 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+] --- browser/base/content/nsContextMenu.js | 14 +++++++------- browser/base/content/test/Makefile.in | 1 + browser/base/content/test/browser_bug423833.js | 14 +++++++------- browser/base/content/utilityOverlay.js | 10 +++++----- layout/reftests/bugs/398289-1-ref.html | 0 layout/reftests/bugs/398289-1.html | 0 layout/reftests/bugs/398289-resource.xul | 0 7 files changed, 20 insertions(+), 19 deletions(-) delete mode 100644 layout/reftests/bugs/398289-1-ref.html delete mode 100644 layout/reftests/bugs/398289-1.html delete mode 100644 layout/reftests/bugs/398289-resource.xul diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index a7bd2312ede..f1d11082279 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -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); diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index fbae5dca52d..0a8ab1be28d 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -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 \ diff --git a/browser/base/content/test/browser_bug423833.js b/browser/base/content/test/browser_bug423833.js index e64bc10b09a..7980502f5ce 100644 --- a/browser/base/content/test/browser_bug423833.js +++ b/browser/base/content/test/browser_bug423833.js @@ -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" diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index e99db0a1ba2..82271b959cd 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -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); } /** diff --git a/layout/reftests/bugs/398289-1-ref.html b/layout/reftests/bugs/398289-1-ref.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/layout/reftests/bugs/398289-1.html b/layout/reftests/bugs/398289-1.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/layout/reftests/bugs/398289-resource.xul b/layout/reftests/bugs/398289-resource.xul deleted file mode 100644 index e69de29bb2d..00000000000