diff --git a/xpfe/browser/resources/content/navigator.js b/xpfe/browser/resources/content/navigator.js index eb2c4b64f78..f2a879b50f6 100644 --- a/xpfe/browser/resources/content/navigator.js +++ b/xpfe/browser/resources/content/navigator.js @@ -595,9 +595,14 @@ function Startup() if (/^\s*$/.test(uriToLoad)) uriToLoad = "about:blank"; + var browser = getBrowser(); + browser.popupDomain = null; + browser.popupUrls = []; + browser.popupFeatures = []; + if (uriToLoad != "about:blank") { gURLBar.value = uriToLoad; - getBrowser().userTypedValue = uriToLoad; + browser.userTypedValue = uriToLoad; if ("arguments" in window && window.arguments.length >= 3) { loadURI(uriToLoad, window.arguments[2]); } else { @@ -2271,10 +2276,6 @@ function onPopupBlocked(aEvent) { var popupIcon = document.getElementById("popupIcon"); popupIcon.hidden = false; } - if (!browser.popupUrls) { - browser.popupUrls = []; - browser.popupFeatures = []; - } // Check for duplicates, remove the old occurence of this url, // to update the features, and put it at the end of the list. for (var i = 0; i < browser.popupUrls.length; ++i) { @@ -2318,18 +2319,10 @@ function StatusbarViewPopupManager() { } function popupBlockerMenuShowing(event) { - var parent = event.target; - var browser = getBrowser().selectedBrowser; var separator = document.getElementById("popupMenuSeparator"); - if ("popupDomain" in browser) { - createShowPopupsMenu(parent); - if (separator) - separator.hidden = false; - } else { - if (separator) - separator.hidden = true; - } + if (separator) + separator.hidden = !createShowPopupsMenu(event.target); } function createShowPopupsMenu(parent) { @@ -2338,6 +2331,9 @@ function createShowPopupsMenu(parent) { var browser = getBrowser().selectedBrowser; + if (browser.popupUrls.length == 0) + return false; + for (var i = 0; i < browser.popupUrls.length; i++) { var menuitem = document.createElement("menuitem"); menuitem.setAttribute("label", gNavigatorBundle.getFormattedString('popupMenuShow', [browser.popupUrls[i].spec])); diff --git a/xpfe/browser/resources/content/nsBrowserStatusHandler.js b/xpfe/browser/resources/content/nsBrowserStatusHandler.js index beedfcd8eaa..f23e9b2d961 100644 --- a/xpfe/browser/resources/content/nsBrowserStatusHandler.js +++ b/xpfe/browser/resources/content/nsBrowserStatusHandler.js @@ -331,8 +331,8 @@ nsBrowserStatusHandler.prototype = if (blank || !("popupDomain" in browser)) { browser.popupDomain = null; - browser.popupUrls = null; - browser.popupFeatures = null; + browser.popupUrls = []; + browser.popupFeatures = []; } else { var hostPort = ""; @@ -342,8 +342,8 @@ nsBrowserStatusHandler.prototype = catch(ex) { } if (hostPort != browser.popupDomain) { browser.popupDomain = null; - browser.popupUrls = null; - browser.popupFeatures = null; + browser.popupUrls = []; + browser.popupFeatures = []; } }