Fix the "copy as text" function for the new graphics section in about:support. (bug 1263849 part 2, r=milan)
authorDavid Anderson <danderson@mozilla.com>
Mon, 18 Apr 2016 11:57:32 -0400
changeset 331527 bdb163d0ba98209e2a1dde73ac9b923d98553ef7
parent 331526 f5de44ecf07f3cbd369015663b72d452fda6d177
child 331528 9f9838386494ea549f85f364ee750460711faecc
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1263849
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Fix the "copy as text" function for the new graphics section in about:support. (bug 1263849 part 2, r=milan)
toolkit/content/aboutSupport.js
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -721,31 +721,36 @@ Serializer.prototype = {
     }
     this._lines.push("");
   },
 
   _appendText: function (text, lines) {
     this._currentLine += text;
   },
 
+  _isHiddenSubHeading: function (th) {
+    return th.parentNode.parentNode.style.display == "none";
+  },
+
   _serializeTable: function (table) {
     // Collect the table's column headings if in fact there are any.  First
     // check thead.  If there's no thead, check the first tr.
     let colHeadings = {};
     let tableHeadingElem = table.querySelector("thead");
     if (!tableHeadingElem)
       tableHeadingElem = table.querySelector("tr");
     if (tableHeadingElem) {
       let tableHeadingCols = tableHeadingElem.querySelectorAll("th,td");
       // If there's a contiguous run of th's in the children starting from the
       // rightmost child, then consider them to be column headings.
       for (let i = tableHeadingCols.length - 1; i >= 0; i--) {
-        if (tableHeadingCols[i].localName != "th")
+        let col = tableHeadingCols[i];
+        if (col.localName != "th" || col.classList.contains("title-column"))
           break;
-        colHeadings[i] = this._nodeText(tableHeadingCols[i]).trim();
+        colHeadings[i] = this._nodeText(col).trim();
       }
     }
     let hasColHeadings = Object.keys(colHeadings).length > 0;
     if (!hasColHeadings)
       tableHeadingElem = null;
 
     let trs = table.querySelectorAll("table > tr, tbody > tr");
     let startRow =
@@ -779,17 +784,22 @@ Serializer.prototype = {
     // Don't use column headings.  Assume the table has only two columns and
     // print each tr in a single line like:
     //   Column 1 value: Column 2 value
     for (let i = startRow; i < trs.length; i++) {
       if (this._ignoreElement(trs[i]))
         continue;
       let children = trs[i].querySelectorAll("th,td");
       let rowHeading = this._nodeText(children[0]).trim();
-      this._appendText(rowHeading + ": " + this._nodeText(children[1]).trim());
+      if (children[0].classList.contains("title-column")) {
+        if (!this._isHiddenSubHeading(children[0]))
+          this._appendText(rowHeading);
+      } else {
+        this._appendText(rowHeading + ": " + this._nodeText(children[1]).trim());
+      }
       this._startNewLine();
     }
     this._startNewLine();
   },
 
   _ignoreElement: function (elem) {
     return elem.classList.contains("no-copy");
   },