diff --git a/mozilla/suite/browser/nsBrowserStatusHandler.js b/mozilla/suite/browser/nsBrowserStatusHandler.js index 7ade7332e49..54b69ff53b6 100644 --- a/mozilla/suite/browser/nsBrowserStatusHandler.js +++ b/mozilla/suite/browser/nsBrowserStatusHandler.js @@ -261,7 +261,21 @@ nsBrowserStatusHandler.prototype = onLocationChange : function(aWebProgress, aRequest, aLocation) { - document.getElementById("contentAreaContextMenu").hidePopup(); + if (gContextMenu) { + // Optimise for the common case + if (aWebProgress.DOMWindow == content) + gContextMenu.menu.hidePopup(); + else { + for (var contextWindow = gContextMenu.target.ownerDocument.defaultView; + contextWindow != contextWindow.parent; + contextWindow = contextWindow.parent) { + if (contextWindow == aWebProgress.DOMWindow) { + gContextMenu.menu.hidePopup(); + break; + } + } + } + } // XXX temporary hack for bug 104532. // Depends heavily on setOverLink implementation