Bug 1418085 part 4. Stop using nsIDOMHTMLElement in JS code. r=mystor
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 30 Jan 2018 00:25:36 -0500
changeset 748767 8f73def3b8165ae69b51c811548a3c9862e51cf9
parent 748766 0ff82b4a39e1d27025b561375e69666b38fafde8
child 748768 86ea8b042827ad33c611a4695cf9f6d491eff5e2
push id97228
push usersfraser@mozilla.com
push dateTue, 30 Jan 2018 10:21:04 +0000
reviewersmystor
bugs1418085
milestone60.0a1
Bug 1418085 part 4. Stop using nsIDOMHTMLElement in JS code. r=mystor MozReview-Commit-ID: GsSnXNXGrHg
devtools/server/actors/object.js
dom/html/test/test_bug389797.html
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1848,21 +1848,25 @@ DebuggerServer.ObjectActorPreviewers.Obj
           let actor = hooks.createValueGrip(obj.makeDebuggeeValue(node));
           preview.childNodes.push(actor);
           if (preview.childNodes.length == OBJECT_PREVIEW_MAX_ITEMS) {
             break;
           }
         }
       }
     } else if (rawObj instanceof Ci.nsIDOMElement) {
-      // Add preview for DOM element attributes.
-      if (rawObj instanceof Ci.nsIDOMHTMLElement) {
+      // For HTML elements (in an HTML document, at least), the nodeName is an
+      // uppercased version of the actual element name.  Check for HTML
+      // elements, that is elements in the HTML namespace, and lowercase the
+      // nodeName in that case.
+      if (rawObj.namespaceURI == "http://www.w3.org/1999/xhtml") {
         preview.nodeName = preview.nodeName.toLowerCase();
       }
 
+      // Add preview for DOM element attributes.
       preview.attributes = {};
       preview.attributesLength = rawObj.attributes.length;
       for (let attr of rawObj.attributes) {
         preview.attributes[attr.nodeName] = hooks.createValueGrip(attr.value);
       }
     } else if (obj.class == "Attr") {
       preview.value = hooks.createValueGrip(rawObj.value);
     } else if (rawObj instanceof Ci.nsIDOMText ||
--- a/dom/html/test/test_bug389797.html
+++ b/dom/html/test/test_bug389797.html
@@ -36,20 +36,16 @@ function HTML_TAG(aTagName, aImplClass) 
   // inherit from them do.
   interfacesNonClassinfo[aTagName] =
     [ "nsIDOMNode",
       "nsIDOMElement" ];
 
   var interfaceName = "nsIDOM" + getClassName(aTagName);
   if (interfaceName in SpecialPowers.Ci) {  // no nsIDOMHTMLSpanElement
     interfaces[aTagName].push(interfaceName);
-    interfacesNonClassinfo[aTagName].push("nsIDOMHTMLElement");
-  } else {
-    // Inherits directly from nsIDOMHTMLElement.
-    interfaces[aTagName].push("nsIDOMHTMLElement");
   }
 
   var interfaceNameNS = "nsIDOMNS" + getClassName(aTagName);
   if (interfaceNameNS in SpecialPowers.Ci) {
     interfaces[aTagName].push(interfaceNameNS);
   }
 
   if (arguments.length > 2) {