From 2141ea793c749d544091bca8b0bdb959cd35995c Mon Sep 17 00:00:00 2001 From: "db48x%yahoo.com" Date: Wed, 21 Sep 2005 01:12:29 +0000 Subject: [PATCH] fix bug 217611: Page Info can be opened multiple times patch by Jason Barnabe (np) , r=mconnor git-svn-id: svn://10.0.0.236/trunk@180724 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/browser/base/content/browser.js | 11 ++++---- mozilla/browser/base/content/pageInfo.js | 28 +++++++++---------- .../pki/resources/content/PageInfoOverlay.xul | 6 ++++ mozilla/security/manager/pki/resources/jar.mn | 2 +- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/mozilla/browser/base/content/browser.js b/mozilla/browser/base/content/browser.js index 565c4642aff..cf78b1195f8 100644 --- a/mozilla/browser/base/content/browser.js +++ b/mozilla/browser/base/content/browser.js @@ -1975,14 +1975,16 @@ function BrowserViewSourceOfURL(url, charset, pageCookie) url, charset, pageCookie); } -// doc=null for regular page info, doc=owner document for frame info. -function BrowserPageInfo(doc) +// doc - document to use for source, or null for this window's document +// initialTab - name of the initial tab to display, or null for the first tab +function BrowserPageInfo(doc, initialTab) { + var args = {doc: doc, initialTab: initialTab}; toOpenDialogByTypeAndUrl("Browser:page-info", doc ? doc.location : window.content.document.location, "chrome://browser/content/pageInfo.xul", "chrome,dialog=no", - doc); + args); } #ifdef DEBUG @@ -3770,8 +3772,7 @@ function onViewToolbarCommand(aEvent) function displaySecurityInfo() { - window.openDialog("chrome://browser/content/pageInfo.xul", "_blank", - "dialog=no", null, "securityTab"); + BrowserPageInfo(null, "securityTab"); } function nsBrowserContentListener(toplevelWindow, contentWindow) diff --git a/mozilla/browser/base/content/pageInfo.js b/mozilla/browser/base/content/pageInfo.js index 8ca70b05d01..49b01791b2b 100644 --- a/mozilla/browser/base/content/pageInfo.js +++ b/mozilla/browser/base/content/pageInfo.js @@ -245,9 +245,11 @@ const XHTMLre = RegExp(XHTMLNSre + "|" + XHTML2NSre, ""); var onLoadRegistry = [ ]; /* Called when PageInfo window is loaded. Arguments are: - * window.arguments[0] - document to use for source (null=Page Info, otherwise Frame Info) - * window.arguments[1] - tab name to display first (may be null) -*/ + * window.arguments[0] - (optional) an object consisting of + * - doc: (optional) document to use for source. if not provided, + * the calling window's document will be used + * - initialTab: (optional) id of the inital tab to display + */ function onLoadPageInfo() { //dump("===============================================================================\n"); @@ -274,10 +276,11 @@ function onLoadPageInfo() gStrings.mediaInput = theBundle.getString("mediaInput"); var docTitle = ""; - if ("arguments" in window && window.arguments.length >= 1 && window.arguments[0]) + if ("arguments" in window && window.arguments.length >= 1 && + window.arguments[0] && window.arguments[0].doc) { theWindow = null; - theDocument = window.arguments[0]; + theDocument = window.arguments[0].doc; docTitle = theBundle.getString("frameInfo.title"); } else @@ -309,18 +312,13 @@ function onLoadPageInfo() /* Select the requested tab, if the name is specified */ var tabControl = document.getElementById("tabbox"); - if ("arguments" in window && window.arguments.length > 1) + if ("arguments" in window && window.arguments.length >= 1 && + window.arguments[0] && window.arguments[0].initialTab) { - var tabName = window.arguments[1]; - - if (tabName) + var tab = document.getElementById(window.arguments[0].initialTab); + if (tab) { - var tab = document.getElementById(tabName); - - if (tabControl && tab) - { - tabControl.selectedTab = tab; - } + tabControl.selectedTab = tab; } } tabControl.selectedTab.focus(); diff --git a/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul b/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul index fc4d0708137..94f83abdae9 100644 --- a/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul +++ b/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul @@ -62,9 +62,15 @@ // Get the window for this information var w; +#ifdef MOZ_PHOENIX + if (window.arguments[0] && window.arguments[0].doc) + { + w = window.arguments[0].doc; +#else if ("arguments" in window && window.arguments.length > 0 && window.arguments[0]) { w = window.arguments[0]; +#endif // We don't have separate info for a frame, return null until further notice // (see bug 138479) diff --git a/mozilla/security/manager/pki/resources/jar.mn b/mozilla/security/manager/pki/resources/jar.mn index 8c28654f8a1..ac5a423fc48 100644 --- a/mozilla/security/manager/pki/resources/jar.mn +++ b/mozilla/security/manager/pki/resources/jar.mn @@ -20,7 +20,7 @@ pippki.jar: content/pippki/ssl2ciphers.xul (content/ssl2ciphers.xul) content/pippki/ssl3tlsciphers.xul (content/ssl3tlsciphers.xul) content/pippki/ssl3tlsciphers2.xul (content/ssl3tlsciphers2.xul) - content/pippki/PageInfoOverlay.xul (content/PageInfoOverlay.xul) +* content/pippki/PageInfoOverlay.xul (content/PageInfoOverlay.xul) content/pippki/newserver.js (content/newserver.js) * content/pippki/newserver.xul (content/newserver.xul) content/pippki/downloadcert.js (content/downloadcert.js)