Backed out changeset 50d5710ae6c0 (bug 1389650) for eslint failure at browser/modules/PluginContent.jsm:684: 'contentWindow' is assigned a value but never used. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 26 Sep 2017 10:48:27 +0200
changeset 670375 590f81062c5f6b6a5df5a0d992fde2d633527257
parent 670374 2a16ec0d0828043aed627f480ef3c316390e83b2
child 670376 f2881b8508abd84066418c42f1413bdc481262b9
push id81612
push userbmo:dharvey@mozilla.com
push dateTue, 26 Sep 2017 10:16:26 +0000
reviewersbackout
bugs1389650
milestone58.0a1
backs out50d5710ae6c0ba262a3c8e58ff392005601e352e
Backed out changeset 50d5710ae6c0 (bug 1389650) for eslint failure at browser/modules/PluginContent.jsm:684: 'contentWindow' is assigned a value but never used. r=backout
browser/modules/PluginContent.jsm
dom/browser-element/BrowserElementChildPreload.js
dom/ipc/remote-test.js
mobile/android/chrome/content/browser.js
--- a/browser/modules/PluginContent.jsm
+++ b/browser/modules/PluginContent.jsm
@@ -170,17 +170,17 @@ PluginContent.prototype = {
   },
 
   getPluginUI(plugin, anonid) {
     return plugin.ownerDocument.
            getAnonymousElementByAttribute(plugin, "anonid", anonid);
   },
 
   _getPluginInfo(pluginElement) {
-    if (ChromeUtils.getClassName(pluginElement) === "HTMLAnchorElement") {
+    if (pluginElement instanceof Ci.nsIDOMHTMLAnchorElement) {
       // Anchor elements are our place holders, and we only have them for Flash
       let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
       return {
         pluginName: "Shockwave Flash",
         mimetype: FLASH_MIME_TYPE,
         permissionString: pluginHost.getPermissionStringForType(FLASH_MIME_TYPE)
       };
     }
@@ -644,17 +644,17 @@ PluginContent.prototype = {
     this.global.content.location.reload();
   },
 
   // Event listener for click-to-play plugins.
   _handleClickToPlayEvent(plugin) {
     let doc = plugin.ownerDocument;
     let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
     let permissionString;
-    if (ChromeUtils.getClassName(plugin) === "HTMLAnchorElement") {
+    if (plugin instanceof Ci.nsIDOMHTMLAnchorElement) {
       // We only have replacement content for Flash installs
       permissionString = pluginHost.getPermissionStringForType(FLASH_MIME_TYPE);
     } else {
       let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
       // guard against giving pluginHost.getPermissionStringForType a type
       // not associated with any known plugin
       if (!this.isKnownPlugin(objLoadingContent))
         return;
@@ -679,17 +679,17 @@ PluginContent.prototype = {
   },
 
   onOverlayClick(event) {
     let document = event.target.ownerDocument;
     let plugin = document.getBindingParent(event.target);
     let contentWindow = plugin.ownerGlobal.top;
     let overlay = this.getPluginUI(plugin, "main");
     // Have to check that the target is not the link to update the plugin
-    if (!(ChromeUtils.getClassName(event.originalTarget) === "HTMLAnchorElement") &&
+    if (!(event.originalTarget instanceof contentWindow.HTMLAnchorElement) &&
         (event.originalTarget.getAttribute("anonid") != "closeIcon") &&
         !overlay.hasAttribute("dismissed") &&
         event.button == 0 &&
         event.isTrusted) {
       this._showClickToPlayNotification(plugin, true);
     event.stopPropagation();
     event.preventDefault();
     }
@@ -725,17 +725,17 @@ PluginContent.prototype = {
     let placeHolderFound = false;
     for (let plugin of plugins) {
       plugin.QueryInterface(Ci.nsIObjectLoadingContent);
       if (!this.isKnownPlugin(plugin)) {
         continue;
       }
       if (pluginInfo.permissionString == pluginHost.getPermissionStringForType(plugin.actualType)) {
         let overlay = this.getPluginUI(plugin, "main");
-        if (ChromeUtils.getClassName(plugin) === "HTMLAnchorElement") {
+        if (plugin instanceof Ci.nsIDOMHTMLAnchorElement) {
           placeHolderFound = true;
         } else {
           pluginFound = true;
         }
         if (newState == "block") {
           if (overlay) {
             overlay.addEventListener("click", this, true);
           }
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -661,17 +661,17 @@ BrowserElementChild.prototype = {
       state: e.state,
     };
     sendAsyncMsg('scrollviewchange', detail);
   },
 
   _ClickHandler: function(e) {
 
     let isHTMLLink = node =>
-      ((ChromeUtils.getClassName(node) === "HTMLAnchorElement" && node.href) ||
+      ((node instanceof Ci.nsIDOMHTMLAnchorElement && node.href) ||
        (node instanceof Ci.nsIDOMHTMLAreaElement && node.href) ||
         node instanceof Ci.nsIDOMHTMLLinkElement);
 
     // Open in a new tab if middle click or ctrl/cmd-click,
     // and e.target is a link or inside a link.
     if ((Services.appinfo.OS == 'Darwin' && e.metaKey) ||
         (Services.appinfo.OS != 'Darwin' && e.ctrlKey) ||
          e.button == 1) {
@@ -850,17 +850,17 @@ BrowserElementChild.prototype = {
     } else {
       this._ctxHandlers = {};
     }
   },
 
   _getSystemCtxMenuData: function(elem) {
     let documentURI =
       docShell.QueryInterface(Ci.nsIWebNavigation).currentURI.spec;
-    if ((ChromeUtils.getClassName(elem) === "HTMLAnchorElement" && elem.href) ||
+    if ((elem instanceof Ci.nsIDOMHTMLAnchorElement && elem.href) ||
         (elem instanceof Ci.nsIDOMHTMLAreaElement && elem.href)) {
       return {uri: elem.href,
               documentURI: documentURI,
               text: elem.textContent.substring(0, kLongestReturnedString)};
     }
     if (elem instanceof Ci.nsIImageLoadingContent && elem.currentURI) {
       return {uri: elem.currentURI.spec, documentURI: documentURI};
     }
--- a/dom/ipc/remote-test.js
+++ b/dom/ipc/remote-test.js
@@ -21,17 +21,17 @@ var dshell = content.QueryInterface(Ci.n
                     .QueryInterface(Ci.nsIDocShellTreeItem)
                     .rootTreeItem
                     .QueryInterface(Ci.nsIDocShell);
 
 
 addEventListener("click",
   function(e) {
     dump(e.target + "\n");
-    if (ChromeUtils.getClassName(e.target) === "HTMLAnchorElement" &&
+    if (e.target instanceof Components.interfaces.nsIDOMHTMLAnchorElement &&
         dshell == docShell) {
       var retval = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
                             getInterface(Components.interfaces.nsIContentFrameMessageManager).
                             sendSyncMessage("linkclick", { href: e.target.href });
       dump(uneval(retval[0]) + "\n");
       // Test here also that both retvals are the same
       sendAsyncMessage("linkclick-reply-object", uneval(retval[0]) == uneval(retval[1]) ? retval[0] : "");
     }
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2730,17 +2730,17 @@ var NativeWindow = {
       return false;
     },
 
     /* Returns a label to be shown in a tabbed ui if there are multiple "contexts". For instance, if this
      * is an image inside an <a> tag, we may have a "link" context and an "image" one.
      */
     _getContextType: function(element) {
       // For anchor nodes, we try to use the scheme to pick a string
-      if (ChromeUtils.getClassName(element) === "HTMLAnchorElement") {
+      if (element instanceof Ci.nsIDOMHTMLAnchorElement) {
         let uri = this.makeURI(this._getLinkURL(element));
         try {
           return Strings.browser.GetStringFromName("browser.menu.context." + uri.scheme);
         } catch(ex) { }
       }
 
       // Otherwise we try the nodeName
       try {
@@ -2815,17 +2815,17 @@ var NativeWindow = {
       if (node.hasAttribute && node.hasAttribute("title")) {
         return node.getAttribute("title");
       }
       return this._getUrl(node);
     },
 
     // Returns a url associated with a node
     _getUrl: function(node) {
-      if ((ChromeUtils.getClassName(node) === "HTMLAnchorElement" && node.href) ||
+      if ((node instanceof Ci.nsIDOMHTMLAnchorElement && node.href) ||
           (node instanceof Ci.nsIDOMHTMLAreaElement && node.href)) {
         return this._getLinkURL(node);
       } else if (node instanceof Ci.nsIImageLoadingContent && node.currentURI) {
         // The image is blocked by Tap-to-load Images
         let originalURL = node.getAttribute("data-ctv-src");
         if (originalURL) {
           return originalURL;
         }
@@ -3046,17 +3046,17 @@ var NativeWindow = {
     },
 
     makeURI: function makeURI(aURL, aOriginCharset, aBaseURI) {
       return Services.io.newURI(aURL, aOriginCharset, aBaseURI);
     },
 
     _getLink: function(aElement) {
       if (aElement.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
-          ((ChromeUtils.getClassName(aElement) === "HTMLAnchorElement" && aElement.href) ||
+          ((aElement instanceof Ci.nsIDOMHTMLAnchorElement && aElement.href) ||
           (aElement instanceof Ci.nsIDOMHTMLAreaElement && aElement.href) ||
           aElement instanceof Ci.nsIDOMHTMLLinkElement ||
           aElement.getAttributeNS(kXLinkNamespace, "type") == "simple")) {
         try {
           let url = this._getLinkURL(aElement);
           return Services.io.newURI(url);
         } catch (e) {}
       }
@@ -4770,17 +4770,17 @@ var BrowserEventHandler = {
                                                                                  null);
       } catch (e) {}
     }
     this._doTapHighlight(target);
   },
 
   _getLinkURI: function(aElement) {
     if (aElement.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
-        ((ChromeUtils.getClassName(aElement) === "HTMLAnchorElement" && aElement.href) ||
+        ((aElement instanceof Ci.nsIDOMHTMLAnchorElement && aElement.href) ||
         (aElement instanceof Ci.nsIDOMHTMLAreaElement && aElement.href))) {
       try {
         return Services.io.newURI(aElement.href);
       } catch (e) {}
     }
     return null;
   },