Bug 1404706 - Port bug 1389650 (removal of nsIDOMHTMLAnchorElement) to chat and fix misc. JS errors. r=aceman
authorJorg K <jorgk@jorgk.com>
Sun, 01 Oct 2017 21:22:08 +0200
changeset 29073 9dafe6d1a064e8697c7f3d080ceb149453258ff4
parent 29072 94a4ec7dff4b517377987f5ebf4e2b690fbc4e97
child 29074 1689cd570ccf5e9706bc68022fbdfde505de69e6
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1404706, 1389650
Bug 1404706 - Port bug 1389650 (removal of nsIDOMHTMLAnchorElement) to chat and fix misc. JS errors. r=aceman
chat/modules/ToLocaleFormat.jsm
chat/modules/imSmileys.jsm
mail/components/im/modules/index_im.js
--- a/chat/modules/ToLocaleFormat.jsm
+++ b/chat/modules/ToLocaleFormat.jsm
@@ -155,17 +155,18 @@ function ToLocaleFormat(aFormat, aDate) 
   let pattern =
     RegExp(`%#?(\\^)?([0_-]\\d*)?(?:[EO])?([${specifiers}])`, "g");
 
   return aFormat.replace(pattern,
     (matched, upperCaseFlag, fillWidthFlags, specifier) => {
       let result = formatFunctions[specifier]();
       if (upperCaseFlag)
         result = result.toLocaleUpperCase();
-      let {fill = "", width = 0} = padding[specifier] || {};
+      let fill = (specifier in padding) ? padding[specifier].fill : "";
+      let width = (specifier in padding) ? padding[specifier].width : 0;
       if (fillWidthFlags) {
         let newFill = fillWidthFlags[0];
         let newWidth = fillWidthFlags.match(/\d+/);
         if (newFill === "-" && newWidth === null)
           fill = "";
         else {
           fill = newFill === "0" ? "0" : " ";
           width = newWidth !== null ? Number(newWidth) : width;
--- a/chat/modules/imSmileys.jsm
+++ b/chat/modules/imSmileys.jsm
@@ -153,17 +153,17 @@ function smileTextNode(aNode)
    * We must check both the testNode.textContent and the aNode.data since they
    * cover different cases:
    *   textContent: The URL is split over multiple nodes for some reason
    *   data: The URL is not the only content in the link, skip only the one node
    * Check the class name to skip any autolinked nodes from mozTXTToHTMLConv.
    */
   let testNode = aNode;
   while ((testNode = testNode.parentNode)) {
-    if (testNode instanceof Components.interfaces.nsIDOMHTMLAnchorElement &&
+    if (testNode.nodeName.toLowerCase() == "a" &&
         (testNode.getAttribute("href") == testNode.textContent.trim() ||
          testNode.getAttribute("href") == aNode.data.trim() ||
          testNode.className.includes("moz-txt-link-")))
       return 0;
   }
 
   let result = 0;
   let exp = getRegexp();
--- a/mail/components/im/modules/index_im.js
+++ b/mail/components/im/modules/index_im.js
@@ -10,16 +10,17 @@ Cu.import("resource:///modules/gloda/pub
 Cu.import("resource:///modules/gloda/datamodel.js");
 Cu.import("resource:///modules/gloda/indexer.js");
 Cu.import("resource:///modules/imServices.jsm");
 Cu.import("resource:///modules/imXPCOMUtils.jsm");
 Cu.import("resource:///modules/iteratorUtils.jsm");
 Cu.import("resource:///modules/mailServices.js");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
                                   "resource://gre/modules/AsyncShutdown.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "GlodaDatastore",
                                   "resource:///modules/gloda/datastore.js");
 
@@ -383,17 +384,17 @@ var GlodaIMIndexer = {
     }
 
     let conv = this._knownConversations[convId];
     Task.spawn(function* () {
       // We need to get the log files every time, because a new log file might
       // have been started since we last got them.
       let logFiles =
         yield Services.logs.getLogPathsForConversation(aConversation);
-      if (!logFiles.length) {
+      if (!logFiles || !logFiles.length) {
         // No log files exist yet, nothing to do!
         return;
       }
 
       if (conv.logFileCount == undefined) {
         // We initialize the _knownFiles tree path for the current files below in
         // case it doesn't already exist.
         let folder = OS.Path.dirname(logFiles[0]);