From a13c36f7f8f9411fef027dbf8059696c34eac4c9 Mon Sep 17 00:00:00 2001 From: "mconnor%myrealbox.com" Date: Tue, 27 Apr 2004 04:21:56 +0000 Subject: [PATCH] fix bugs 231442 and 236241, problems opening Options from non-browser windows, r=bryner --- .../prefwindow/content/pref-navigator.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/browser/components/prefwindow/content/pref-navigator.js b/browser/components/prefwindow/content/pref-navigator.js index daad2d13852..8d8fb925d23 100644 --- a/browser/components/prefwindow/content/pref-navigator.js +++ b/browser/components/prefwindow/content/pref-navigator.js @@ -106,16 +106,20 @@ function onOK() } function Startup() -{ - if (top.opener) { - var browser = top.opener.document.getElementById("content"); - var l = browser.mPanelContainer.childNodes.length; +{ + var useButton = document.getElementById("browserUseCurrent"); + + try { + var browser = top.opener.document.getElementById("content"); - if (l > 1) { - var useButton = document.getElementById("browserUseCurrent"); + var l = browser.mPanelContainer.childNodes.length; + if (l > 1) useButton.label = useButton.getAttribute("label2"); - } + } catch (e) { + // prefwindow wasn't opened from a browser window, so no current page + useButton.disabled = true; } + parent.hPrefWindow.registerOKCallbackFunc(onOK); }