From d3c534ab226fd3accff2df4276f91cf2dac20f34 Mon Sep 17 00:00:00 2001 From: "martijn.martijn%gmail.com" Date: Wed, 21 Jun 2006 03:10:01 +0000 Subject: [PATCH] Bug 300808 - When content is removed from the document the corresponding tooltip should not appear, r=neil, sr=bzbarsky --- browser/base/content/browser.js | 21 +++++++++++++++++++ .../content/nsBrowserStatusHandler.js | 19 +++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 8b632f425c5d..c4ec1e0aaba7 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -3734,6 +3734,27 @@ nsBrowserStatusHandler.prototype = onLocationChange : function(aWebProgress, aRequest, aLocation) { + + if (document.tooltipNode) { + // Optimise for the common case + if (aWebProgress.DOMWindow == content) { + document.getElementById("aHTMLTooltip").hidePopup(); + document.tooltipNode = null; + } + else { + for (var tooltipWindow = + document.tooltipNode.target.ownerDocument.defaultView; + tooltipWindow != tooltipWindow.parent; + tooltipWindow = tooltipWindow.parent) { + if (tooltipWindow == aWebProgress.DOMWindow) { + document.getElementById("aHTMLTooltip").hidePopup(); + document.tooltipNode = null; + break; + } + } + } + } + // This code here does not compare uris exactly when determining // whether or not the message should be hidden since the message // may be prematurely hidden when an install is invoked by a click diff --git a/xpfe/browser/resources/content/nsBrowserStatusHandler.js b/xpfe/browser/resources/content/nsBrowserStatusHandler.js index 316cd65477f3..bff61535ba27 100644 --- a/xpfe/browser/resources/content/nsBrowserStatusHandler.js +++ b/xpfe/browser/resources/content/nsBrowserStatusHandler.js @@ -271,6 +271,25 @@ nsBrowserStatusHandler.prototype = } } + if (document.tooltipNode) { + // Optimise for the common case + if (aWebProgress.DOMWindow == content) { + document.getElementById("aHTMLTooltip").hidePopup(); + document.tooltipNode = null; + } else { + for (var tooltipWindow = + document.tooltipNode.target.ownerDocument.defaultView; + tooltipWindow != tooltipWindow.parent; + tooltipWindow = tooltipWindow.parent) { + if (tooltipWindow == aWebProgress.DOMWindow) { + document.getElementById("aHTMLTooltip").hidePopup(); + document.tooltipNode = null; + break; + } + } + } + } + // XXX temporary hack for bug 104532. // Depends heavily on setOverLink implementation if (!aRequest)