From 2422df515ea24e970fc16f8910cfc416e57e2dcd Mon Sep 17 00:00:00 2001 From: "mvl%exedo.nl" Date: Tue, 2 Mar 2004 20:00:50 +0000 Subject: [PATCH] Remove duplicates from the menu to manually show blocked popups. Also limit the menu to 100 entries max. bug 235454, r=danm, sr=jag git-svn-id: svn://10.0.0.236/trunk@153438 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpfe/browser/resources/content/navigator.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mozilla/xpfe/browser/resources/content/navigator.js b/mozilla/xpfe/browser/resources/content/navigator.js index 111c18d8183..4f682458dab 100644 --- a/mozilla/xpfe/browser/resources/content/navigator.js +++ b/mozilla/xpfe/browser/resources/content/navigator.js @@ -2154,6 +2154,21 @@ function onPopupBlocked(aEvent) { 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) { + if (browser.popupUrls[i].equals(aEvent.popupWindowURI)) { + browser.popupUrls.splice(i, 1); + browser.popupFeatures.splice(i, 1); + break; + } + } + // Limit the length of the menu to some reasonable size. + // We only add one item every time, so no need for more complex stuff. + if (browser.popupUrls.length >= 100) { + browser.popupUrls.shift(); + browser.popupFeatures.shift(); + } browser.popupUrls.push(aEvent.popupWindowURI); browser.popupFeatures.push(aEvent.popupWindowFeatures); }