summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base
diff options
context:
space:
mode:
Diffstat (limited to 'application/palemoon/base')
-rw-r--r--application/palemoon/base/content/browser.js112
1 files changed, 57 insertions, 55 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index c1643caa4..c8f287693 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -420,7 +420,8 @@ var gPopupBlockerObserver = {
if (!this._reportButton && gURLBar)
this._reportButton = document.getElementById("page-report-button");
- if (!gBrowser.selectedBrowser.blockedPopups) {
+ if (!gBrowser.selectedBrowser.blockedPopups ||
+ !gBrowser.selectedBrowser.blockedPopups.length) {
// Hide the icon in the location bar (if the location bar exists)
if (gURLBar)
this._reportButton.hidden = true;
@@ -522,65 +523,66 @@ var gPopupBlockerObserver = {
else
blockedPopupAllowSite.removeAttribute("disabled");
- var foundUsablePopupURI = false;
- var blockedPopups = browser.blockedPopups;
- if (blockedPopups) {
- for (let i = 0; i < blockedPopups.length; i++) {
- let blockedPopup = blockedPopups[i];
-
- // popupWindowURI will be null if the file picker popup is blocked.
- // xxxdz this should make the option say "Show file picker" and do it (Bug 590306)
- if (!blockedPopup.popupWindowURI)
- continue;
- var popupURIspec = blockedPopup.popupWindowURI.spec;
-
- // Sometimes the popup URI that we get back from the blockedPopup
- // isn't useful (for instance, netscape.com's popup URI ends up
- // being "http://www.netscape.com", which isn't really the URI of
- // the popup they're trying to show). This isn't going to be
- // useful to the user, so we won't create a menu item for it.
- if (popupURIspec == "" || popupURIspec == "about:blank" ||
- popupURIspec == uri.spec)
- continue;
-
- // Because of the short-circuit above, we may end up in a situation
- // in which we don't have any usable popup addresses to show in
- // the menu, and therefore we shouldn't show the separator. However,
- // since we got past the short-circuit, we must've found at least
- // one usable popup URI and thus we'll turn on the separator later.
- foundUsablePopupURI = true;
-
- var menuitem = document.createElement("menuitem");
- var label = gNavigatorBundle.getFormattedString("popupShowPopupPrefix",
- [popupURIspec]);
- menuitem.setAttribute("label", label);
- menuitem.setAttribute("popupWindowURI", popupURIspec);
- menuitem.setAttribute("popupWindowFeatures", blockedPopup.popupWindowFeatures);
- menuitem.setAttribute("popupWindowName", blockedPopup.popupWindowName);
- menuitem.setAttribute("oncommand", "gPopupBlockerObserver.showBlockedPopup(event);");
- menuitem.setAttribute("popupReportIndex", i);
- menuitem.popupReportBrowser = browser;
- aEvent.target.appendChild(menuitem);
- }
- }
-
- // Show or hide the separator, depending on whether we added any
- // showable popup addresses to the menu.
- var blockedPopupsSeparator =
- document.getElementById("blockedPopupsSeparator");
- if (foundUsablePopupURI)
- blockedPopupsSeparator.removeAttribute("hidden");
- else
- blockedPopupsSeparator.setAttribute("hidden", true);
-
- var blockedPopupDontShowMessage = document.getElementById("blockedPopupDontShowMessage");
- var showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
+ let blockedPopupDontShowMessage = document.getElementById("blockedPopupDontShowMessage");
+ let showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
blockedPopupDontShowMessage.setAttribute("checked", !showMessage);
if (aEvent.target.anchorNode.id == "page-report-button") {
aEvent.target.anchorNode.setAttribute("open", "true");
blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromLocationbar"));
- } else
+ } else {
blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromMessage"));
+ }
+
+ let blockedPopupsSeparator =
+ document.getElementById("blockedPopupsSeparator");
+ blockedPopupsSeparator.setAttribute("hidden", true);
+
+ gBrowser.selectedBrowser.retrieveListOfBlockedPopups().then(blockedPopups => {
+ let foundUsablePopupURI = false;
+ if (blockedPopups) {
+ for (let i = 0; i < blockedPopups.length; i++) {
+ let blockedPopup = blockedPopups[i];
+
+ // popupWindowURI will be null if the file picker popup is blocked.
+ // xxxdz this should make the option say "Show file picker" and do it (Bug 590306)
+ if (!blockedPopup.popupWindowURIspec)
+ continue;
+
+ var popupURIspec = blockedPopup.popupWindowURIspec;
+
+ // Sometimes the popup URI that we get back from the blockedPopup
+ // isn't useful (for instance, netscape.com's popup URI ends up
+ // being "http://www.netscape.com", which isn't really the URI of
+ // the popup they're trying to show). This isn't going to be
+ // useful to the user, so we won't create a menu item for it.
+ if (popupURIspec == "" || popupURIspec == "about:blank" ||
+ popupURIspec == "<self>" ||
+ popupURIspec == uri.spec)
+ continue;
+
+ // Because of the short-circuit above, we may end up in a situation
+ // in which we don't have any usable popup addresses to show in
+ // the menu, and therefore we shouldn't show the separator. However,
+ // since we got past the short-circuit, we must've found at least
+ // one usable popup URI and thus we'll turn on the separator later.
+ foundUsablePopupURI = true;
+
+ var menuitem = document.createElement("menuitem");
+ var label = gNavigatorBundle.getFormattedString("popupShowPopupPrefix",
+ [popupURIspec]);
+ menuitem.setAttribute("label", label);
+ menuitem.setAttribute("oncommand", "gPopupBlockerObserver.showBlockedPopup(event);");
+ menuitem.setAttribute("popupReportIndex", i);
+ menuitem.popupReportBrowser = browser;
+ aEvent.target.appendChild(menuitem);
+ }
+ }
+
+ // Show the separator if we added any
+ // showable popup addresses to the menu.
+ if (foundUsablePopupURI)
+ blockedPopupsSeparator.removeAttribute("hidden");
+ }, null);
},
onPopupHiding: function (aEvent) {