Bug 1591399 - fix nick highlight and emoticons in chat. r=clokep a=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sun, 27 Oct 2019 19:49:13 +0100
changeset 37226 5a596857b17a50819c55844b2e62967998d9b446
parent 37225 bc2d37427ba59cc2f93d32b9b2719b12f6f45d41
child 37227 1f60ef9ee3b3a9a102ce7fd8f2121bd8f27bb1f5
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersclokep, jorgk
bugs1591399
Bug 1591399 - fix nick highlight and emoticons in chat. r=clokep a=jorgk This reverts https://hg.mozilla.org/comm-central/rev/a128f9557e9db7951a9d8d6467e553fdccb8a0f5#l40.1
chat/modules/imContentSink.jsm
--- a/chat/modules/imContentSink.jsm
+++ b/chat/modules/imContentSink.jsm
@@ -234,33 +234,33 @@ function removeGlobalAllowedAttribute(aA
 function addGlobalAllowedStyleRule(aStyle, aRule = true) {
   gGlobalRuleset.styles[aStyle] = aRule;
 }
 function removeGlobalAllowedStyleRule(aStyle) {
   delete gGlobalRuleset.styles[aStyle];
 }
 
 function cleanupNode(aNode, aRules, aTextModifiers) {
-  for (let i = 0; i < aNode.children.length; ++i) {
-    let node = aNode.children[i];
+  for (let i = 0; i < aNode.childNodes.length; ++i) {
+    let node = aNode.childNodes[i];
     if (
       node.nodeType == node.ELEMENT_NODE &&
       node.namespaceURI == "http://www.w3.org/1999/xhtml"
     ) {
       // check if node allowed
       let nodeName = node.localName;
       if (!(nodeName in aRules.tags)) {
         if (nodeName in kForbiddenTags) {
           Cu.reportError(
             "removing a " + nodeName + " tag from a message before display"
           );
         } else {
           // this node is not allowed, replace it with its children
           while (node.hasChildNodes()) {
-            aNode.insertBefore(node.firstElementChild, node);
+            aNode.insertBefore(node.firstChild, node);
           }
         }
         aNode.removeChild(node);
         // We want to process again the node at the index i which is
         // now the first child of the node we removed
         --i;
         continue;
       }