[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 31/483: Fix Thunderbird issues

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.

commit 09969b5807170ddd2307c69b0cea3c608e80b79f
Author: Wladimir Palant <trev at gtchat.de>
Date:   Mon Jan 15 20:22:30 2007 +0000

    Fix Thunderbird issues
    
    --HG--
    extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40631
---
 chrome/content/aardvark.js | 37 ++++++++++++++++++++++---------------
 chrome/content/composer.js |  2 +-
 chrome/content/overlay.js  | 28 ++++++++++++++++++++++------
 3 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/chrome/content/aardvark.js b/chrome/content/aardvark.js
index ad0f1f7..b7a60e8 100644
--- a/chrome/content/aardvark.js
+++ b/chrome/content/aardvark.js
@@ -39,11 +39,7 @@ var ehhAardvark = {
 };
 
 ehhAardvark.start = function(browser) {
-  if (!browser || !browser.contentWindow || !(browser.contentDocument instanceof HTMLDocument) || !browser.contentDocument.body)
-    return;
-
-  var location = browser.contentWindow.location;
-  if (location.href == "about:blank" || location.hostname == "")
+  if (!ehhCanSelect(browser))
     return;
 
   if (!("viewSourceURL" in this)) {
@@ -75,6 +71,8 @@ ehhAardvark.start = function(browser) {
   browser.addEventListener("mousemove", this.mouseMove, false);
   browser.contentWindow.addEventListener("pagehide", this.pageHide, false);
 
+  browser.contentWindow.focus();
+
   this.browser = browser;
 
   if (!this.labelElem)
@@ -201,7 +199,6 @@ ehhAardvark.makeElems = function ()
   {
     d = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
     d.style.display = "none";
-    d.style.overflow = "hidden";
     d.style.position = "absolute";
     d.style.height = "0px";
     d.style.width = "0px";
@@ -246,6 +243,16 @@ ehhAardvark.showBoxAndLabel = function(elem, string) {
 
   this.selectedElem = elem;
 
+  for (var i = 0; i < 4; i++) {
+    try {
+      doc.adoptNode(this.borderElems[i]);
+    }
+    catch (e) {
+      // Gecko 1.8 doesn't implement adoptNode, ignore
+    }
+    doc.body.appendChild(this.borderElems[i]);
+  }
+
   var pos = this.getPos(elem)
   var dims = this.getWindowDimensions (doc);
   var y = pos.y;
@@ -276,13 +283,16 @@ ehhAardvark.showBoxAndLabel = function(elem, string) {
     = this.borderElems[3].style.display
     = "";
   
-  for (var i = 0; i < 4; i++) {
-    doc.adoptNode(this.borderElems[i]);
-    doc.body.appendChild(this.borderElems[i]);
-  }
-
   var y = pos.y + elem.offsetHeight + 1;
   
+  try {
+    doc.adoptNode(this.labelElem);
+  }
+  catch(e) {
+    // Gecko 1.8 doesn't implement adoptNode, ignore
+  }
+  doc.body.appendChild(this.labelElem);
+
   this.labelElem.innerHTML = string;
   this.labelElem.style.display = "";
 
@@ -311,9 +321,6 @@ ehhAardvark.showBoxAndLabel = function(elem, string) {
   }
   this.labelElem.style.left = (pos.x + 2) + "px";
   this.labelElem.style.top = y + "px";
-
-  doc.adoptNode(this.labelElem);
-  doc.body.appendChild(this.labelElem);
 }
 
 ehhAardvark.clearBox = function() {
@@ -661,6 +668,6 @@ ehhAardvark.showMenu = function ()
   }
 
   // Show help box
-  helpBox.showPopup(getBrowser().selectedBrowser, -1, -1, "tooltip", "topleft", "topleft");
+  helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft");
   return true;
 }
diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index 1bb56ae..a560f6e 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -461,7 +461,7 @@ function fillAttributes(nodeData) {
 function togglePreview(preview) {
   if (preview) {
     if (!previewStyle || !previewStyle.parentNode) {
-      previewStyle = doc.createElement("link");
+      previewStyle = doc.createElementNS("http://www.w3.org/1999/xhtml", "link");
       previewStyle.setAttribute("rel", "stylesheet");
       previewStyle.setAttribute("type", "text/css");
       doc.documentElement.appendChild(previewStyle);
diff --git a/chrome/content/overlay.js b/chrome/content/overlay.js
index 8f62c6f..7e51f40 100644
--- a/chrome/content/overlay.js
+++ b/chrome/content/overlay.js
@@ -30,7 +30,7 @@ function ehhInit() {
   if (document.getElementById("abp-toolbar-popup"))
     document.getElementById("abp-toolbar-popup").addEventListener("popupshowing", ehhFillPopup, false);
   window.addEventListener("blur", ehhHideTooltips, true);
-  getBrowser().addEventListener("select", ehhStop, false);
+  ehhGetBrowser().addEventListener("select", ehhStop, false);
 
   // Make sure we configure the shortcut key even if the default pref isn't there
   var prefService = Components.classes["@mozilla.org/preferences-service;1"]
@@ -96,11 +96,7 @@ function ehhFillPopup(event) {
   popup = popup.replace(/popup$/, '');
 
   var browser = ehhGetBrowser();
-  var enabled = (browser && browser.contentWindow &&
-                 browser.contentDocument instanceof HTMLDocument &&
-                 browser.contentDocument.body &&
-                 browser.contentWindow.location.href != "about:blank" &&
-                 browser.contentWindow.location.hostname != "");
+  var enabled = ehhCanSelect(browser);
   var running = (enabled && browser == ehhAardvark.browser);
 
   document.getElementById(popup + "ehh-selectelement").setAttribute("disabled", !enabled);
@@ -108,6 +104,26 @@ function ehhFillPopup(event) {
   document.getElementById(popup + "ehh-stopselection").hidden = !running;
 }
 
+function ehhCanSelect(browser) {
+  if (!browser || !browser.contentWindow || 
+      !(browser.contentDocument instanceof HTMLDocument) ||
+      !browser.contentDocument.body)
+    return false;
+
+  var location = browser.contentWindow.location;
+  if (location.href == "about:blank")
+    return false;
+
+  if (location.hostname == "" &&
+      location.protocol != "mailbox:" &&
+      location.protocol != "imap:" &&
+      location.protocol != "news:" &&
+      location.protocol != "snews:")
+    return false;
+
+  return true;
+}
+
 function ehhSelectElement() {
   var browser = ehhGetBrowser();
   if (!browser.contentWindow || !browser.contentDocument)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git



More information about the Pkg-mozext-commits mailing list