Bug 1508983 - Enable ESLint for dom/base/test/unit (automatic changes) r=Standard8,mccr8
authormordax <contact@mordax.io>
Tue, 11 Dec 2018 23:01:55 +0000
changeset 450338 dd6e480be25351f9e291575cb1505a297b60f506
parent 450337 61192787a882e30a7c17c3e5b1a7768ee14597b6
child 450339 6b3257019239c944cbb551938375617ab7793dcf
push id110479
push usercsabou@mozilla.com
push dateThu, 13 Dec 2018 04:02:11 +0000
treeherdermozilla-inbound@3ecc407c0cc8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, mccr8
bugs1508983
milestone66.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
Bug 1508983 - Enable ESLint for dom/base/test/unit (automatic changes) r=Standard8,mccr8 Differential Revision: https://phabricator.services.mozilla.com/D13130
dom/base/test/unit/head_utilities.js
dom/base/test/unit/head_xml.js
dom/base/test/unit/test_bug553888.js
dom/base/test/unit/test_bug737966.js
dom/base/test/unit/test_cancelPrefetch.js
dom/base/test/unit/test_chromeutils_base64.js
dom/base/test/unit/test_error_codes.js
dom/base/test/unit/test_generate_xpath.js
dom/base/test/unit/test_isequalnode.js
dom/base/test/unit/test_js_dev_error_interceptor.js
dom/base/test/unit/test_nodelist.js
dom/base/test/unit/test_normalize.js
dom/base/test/unit/test_range.js
dom/base/test/unit/test_thirdpartyutil.js
dom/base/test/unit/test_treewalker.js
dom/base/test/unit/test_xhr_origin_attributes.js
dom/base/test/unit/test_xhr_standalone.js
dom/base/test/unit/test_xml_parser.js
dom/base/test/unit/test_xml_serializer.js
dom/base/test/unit/test_xmlserializer.js
--- a/dom/base/test/unit/head_utilities.js
+++ b/dom/base/test/unit/head_utilities.js
@@ -5,36 +5,36 @@
 
 ChromeUtils.import("resource://testing-common/httpd.js");
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 
 const nsIDocumentEncoder = Ci.nsIDocumentEncoder;
 const replacementChar = Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER;
 
 function loadContentFile(aFile, aCharset) {
-    //if(aAsIso == undefined) aAsIso = false;
-    if(aCharset == undefined)
-        aCharset = 'UTF-8';
+    // if(aAsIso == undefined) aAsIso = false;
+    if (aCharset == undefined)
+        aCharset = "UTF-8";
 
     var file = do_get_file(aFile);
-    var ios = Cc['@mozilla.org/network/io-service;1']
+    var ios = Cc["@mozilla.org/network/io-service;1"]
             .getService(Ci.nsIIOService);
     var chann = NetUtil.newChannel({
       uri: ios.newFileURI(file),
-      loadUsingSystemPrincipal: true
+      loadUsingSystemPrincipal: true,
     });
     chann.contentCharset = aCharset;
 
-    /*var inputStream = Components.classes["@mozilla.org/scriptableinputstream;1"]
+    /* var inputStream = Components.classes["@mozilla.org/scriptableinputstream;1"]
                         .createInstance(Components.interfaces.nsIScriptableInputStream);
     inputStream.init(chann.open2());
     return inputStream.read(file.fileSize);
     */
 
     var inputStream = Cc["@mozilla.org/intl/converter-input-stream;1"]
                        .createInstance(Ci.nsIConverterInputStream);
     inputStream.init(chann.open2(), aCharset, 1024, replacementChar);
-    var str = {}, content = '';
+    var str = {}, content = "";
     while (inputStream.readString(4096, str) != 0) {
         content += str.value;
     }
     return content;
 }
--- a/dom/base/test/unit/head_xml.js
+++ b/dom/base/test/unit/head_xml.js
@@ -32,27 +32,27 @@ function ParseFile(file) {
     file = fileObj;
   }
 
   Assert.equal(file instanceof nsIFile, true);
 
   var fileStr = C["@mozilla.org/network/file-input-stream;1"]
                  .createInstance(nsIFileInputStream);
   // Init for readonly reading
-  fileStr.init(file,  0x01, 0o400, nsIFileInputStream.CLOSE_ON_EOF);
+  fileStr.init(file, 0x01, 0o400, nsIFileInputStream.CLOSE_ON_EOF);
   return ParseXML(fileStr);
 }
 
 function ParseXML(data) {
   if (typeof(data) == "string") {
     return getParser().parseFromString(data, "application/xml");
   }
 
   Assert.equal(data instanceof nsIInputStream, true);
-  
+
   return getParser().parseFromStream(data, "UTF-8", data.available(),
                                      "application/xml");
 }
 
 function DOMSerializer() {
   return new XMLSerializer();
 }
 
--- a/dom/base/test/unit/test_bug553888.js
+++ b/dom/base/test/unit/test_bug553888.js
@@ -18,17 +18,17 @@ function redirectHandler(metadata, respo
   response.setStatusLine(metadata.httpVersion, 302, "Found");
   response.setHeader("Location", headerCheckURL, false);
 }
 
 function headerCheckHandler(metadata, response) {
   try {
     let headerValue = metadata.getHeader("X-Custom-Header");
     Assert.equal(headerValue, "present");
-  } catch(e) {
+  } catch (e) {
     do_throw("No header present after redirect");
   }
   try {
     metadata.getHeader("X-Unwanted-Header");
     do_throw("Unwanted header present after redirect");
   } catch (x) {
   }
   response.setStatusLine(metadata.httpVersion, 200, "OK");
@@ -50,10 +50,10 @@ function run_test() {
       server.stop(do_test_finished);
     }
   });
   request.send();
   try {
     request.setRequestHeader("X-Unwanted-Header", "present");
     do_throw("Shouldn't be able to set a header after send");
   } catch (x) {
-  }    
+  }
 }
--- a/dom/base/test/unit/test_bug737966.js
+++ b/dom/base/test/unit/test_bug737966.js
@@ -1,19 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /* If charset parameter is invalid, the encoding should be detected as UTF-8 */
 
-function run_test()
-{
+function run_test() {
   let body = '<?xml version="1.0"><html>%c3%80</html>';
   let result = '<?xml version="1.0"><html>\u00c0</html>';
 
   let xhr = new XMLHttpRequest();
-  xhr.open('GET',
-           'data:text/xml;charset=abc,' + body,
+  xhr.open("GET",
+           "data:text/xml;charset=abc," + body,
            false);
   xhr.send(null);
 
   Assert.equal(xhr.responseText, result);
 }
--- a/dom/base/test/unit/test_cancelPrefetch.js
+++ b/dom/base/test/unit/test_cancelPrefetch.js
@@ -1,24 +1,24 @@
-//Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+// Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 var prefetch = Cc["@mozilla.org/prefetch-service;1"].
                getService(Ci.nsIPrefetchService);
 var ios = Cc["@mozilla.org/network/io-service;1"].
           getService(Ci.nsIIOService);
 var prefs = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefBranch);
 
 Cu.importGlobalProperties(["DOMParser"]);
 var parser = new DOMParser();
 
 var doc;
 
 var docbody = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' +
               '<link id="node1"/><link id="node2"/>' +
-              '</body></html>';
+              "</body></html>";
 
 var node1;
 var node2;
 
 function run_test() {
   prefs.setBoolPref("network.prefetch-next", true);
 
   doc = parser.parseFromString(docbody, "text/html");
@@ -29,103 +29,103 @@ function run_test() {
   run_next_test();
 }
 
 add_test(function test_cancel1() {
 
   var uri = ios.newURI("http://localhost/1");
   prefetch.prefetchURI(uri, uri, node1, true);
 
-  Assert.ok(prefetch.hasMoreElements(), 'There is a request in the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There is a request in the queue");
 
   // Trying to prefetch again the same uri with the same node will fail.
   var didFail = 0;
 
   try {
     prefetch.prefetchURI(uri, uri, node1, true);
-  } catch(e) {
+  } catch (e) {
     didFail = 1;
   }
 
-  Assert.ok(didFail == 1, 'Prefetching the same request with the same ' +
-                          'node fails.');
+  Assert.ok(didFail == 1, "Prefetching the same request with the same " +
+                          "node fails.");
 
-  Assert.ok(prefetch.hasMoreElements(), 'There is still request in ' +
-                                        'the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There is still request in " +
+                                        "the queue");
 
   prefetch.cancelPrefetchPreloadURI(uri, node1);
 
-  Assert.ok(!prefetch.hasMoreElements(), 'There is no request in the ' +
-                                         'queue');
+  Assert.ok(!prefetch.hasMoreElements(), "There is no request in the " +
+                                         "queue");
   run_next_test();
 });
 
 add_test(function test_cancel2() {
   // Prefetch a uri with 2 different nodes. There should be 2 request
   // in the queue and canceling one will not cancel the other.
 
   var uri = ios.newURI("http://localhost/1");
   prefetch.prefetchURI(uri, uri, node1, true);
   prefetch.prefetchURI(uri, uri, node2, true);
 
-  Assert.ok(prefetch.hasMoreElements(), 'There are requests in the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There are requests in the queue");
 
   prefetch.cancelPrefetchPreloadURI(uri, node1);
 
-  Assert.ok(prefetch.hasMoreElements(), 'There is still one more request ' +
-                                        'in the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There is still one more request " +
+                                        "in the queue");
 
   prefetch.cancelPrefetchPreloadURI(uri, node2);
 
-  Assert.ok(!prefetch.hasMoreElements(), 'There is no request in the queue');
+  Assert.ok(!prefetch.hasMoreElements(), "There is no request in the queue");
   run_next_test();
 });
 
 add_test(function test_cancel3() {
   // Request a prefetch of a uri. Trying to cancel a prefetch for the same uri
   // with a different node will fail.
   var uri = ios.newURI("http://localhost/1");
   prefetch.prefetchURI(uri, uri, node1, true);
 
-  Assert.ok(prefetch.hasMoreElements(), 'There is a request in the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There is a request in the queue");
 
   var didFail = 0;
 
   try {
     prefetch.cancelPrefetchPreloadURI(uri, node2, true);
-  } catch(e) {
+  } catch (e) {
     didFail = 1;
   }
-  Assert.ok(didFail == 1, 'Canceling the request failed');
+  Assert.ok(didFail == 1, "Canceling the request failed");
 
-  Assert.ok(prefetch.hasMoreElements(), 'There is still a request ' +
-                                        'in the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There is still a request " +
+                                        "in the queue");
 
   prefetch.cancelPrefetchPreloadURI(uri, node1);
-  Assert.ok(!prefetch.hasMoreElements(), 'There is no request in the queue');
+  Assert.ok(!prefetch.hasMoreElements(), "There is no request in the queue");
   run_next_test();
 });
 
 add_test(function test_cancel4() {
   // Request a prefetch of a uri. Trying to cancel a prefetch for a different uri
   // with the same node will fail.
   var uri1 = ios.newURI("http://localhost/1");
   var uri2 = ios.newURI("http://localhost/2");
   prefetch.prefetchURI(uri1, uri1, node1, true);
 
-  Assert.ok(prefetch.hasMoreElements(), 'There is a request in the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There is a request in the queue");
 
   var didFail = 0;
 
   try {
     prefetch.cancelPrefetchPreloadURI(uri2, node1);
-  } catch(e) {
+  } catch (e) {
     didFail = 1;
   }
-  Assert.ok(didFail == 1, 'Canceling the request failed');
+  Assert.ok(didFail == 1, "Canceling the request failed");
 
-  Assert.ok(prefetch.hasMoreElements(), 'There is still a request ' +
-                                        'in the queue');
+  Assert.ok(prefetch.hasMoreElements(), "There is still a request " +
+                                        "in the queue");
 
   prefetch.cancelPrefetchPreloadURI(uri1, node1);
-  Assert.ok(!prefetch.hasMoreElements(), 'There is no request in the queue');
+  Assert.ok(!prefetch.hasMoreElements(), "There is no request in the queue");
   run_next_test();
 });
--- a/dom/base/test/unit/test_chromeutils_base64.js
+++ b/dom/base/test/unit/test_chromeutils_base64.js
@@ -9,17 +9,17 @@ function run_test() {
 let textTests = {
   "": "",
   "f": "Zg",
   "fo": "Zm8",
   "foo": "Zm9v",
   "foob": "Zm9vYg",
   "fooba": "Zm9vYmE",
   "foobar": "Zm9vYmFy",
-}
+};
 
 // Examples from RFC 4648, section 9.
 let binaryTests = [{
   decoded: new Uint8Array([0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]),
   encoded: "FPucA9l-",
 }, {
   decoded: new Uint8Array([0x14, 0xfb, 0x9c, 0x03, 0xd9]),
   encoded: "FPucA9k",
--- a/dom/base/test/unit/test_error_codes.js
+++ b/dom/base/test/unit/test_error_codes.js
@@ -5,45 +5,44 @@
 
 var gExpectedStatus = null;
 var gNextTestFunc   = null;
 
 var prefs = Cc["@mozilla.org/preferences-service;1"].
     getService(Ci.nsIPrefBranch);
 
 var asyncXHR = {
-  load: function() {
+  load() {
     var request = new XMLHttpRequest();
     request.open("GET", "http://localhost:4444/test_error_code.xml", true);
 
     var self = this;
     request.addEventListener("error", function(event) { self.onError(event); });
     request.send(null);
   },
   onError: function doAsyncRequest_onError(event) {
     var request = event.target.channel.QueryInterface(Ci.nsIRequest);
     Assert.equal(request.status, gExpectedStatus);
     gNextTestFunc();
-  }
-}
+  },
+};
 
 function run_test() {
   do_test_pending();
   do_timeout(0, run_test_pt1);
 }
 
 // network offline
 function run_test_pt1() {
   var ioService = Cc["@mozilla.org/network/io-service;1"]
                     .getService(Ci.nsIIOService);
 
   try {
     ioService.manageOfflineStatus = false;
-  }
-  catch (e) {
+  } catch (e) {
   }
   ioService.offline = true;
   prefs.setBoolPref("network.dns.offline-localhost", false);
 
   gExpectedStatus = Cr.NS_ERROR_OFFLINE;
   gNextTestFunc = run_test_pt2;
   dump("Testing error returned by async XHR when the network is offline\n");
   asyncXHR.load();
--- a/dom/base/test/unit/test_generate_xpath.js
+++ b/dom/base/test/unit/test_generate_xpath.js
@@ -1,17 +1,15 @@
-function run_test()
-{
+function run_test() {
   test_generate_xpath();
 }
 
 // TEST CODE
 
-function test_generate_xpath()
-{
+function test_generate_xpath() {
   let docString = `
     <html>
     <body>
       <label><input type="checkbox" id="input1" />Input 1</label>
       <label><input type="checkbox" id="input2'" />Input 2</label>
       <label><input type="checkbox" id='"input3"' />Input 3</label>
       <label><input type="checkbox"/>Input 4</label>
       <label><input type="checkbox" />Input 5</label>
--- a/dom/base/test/unit/test_isequalnode.js
+++ b/dom/base/test/unit/test_isequalnode.js
@@ -1,48 +1,45 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 Cu.importGlobalProperties(["NodeFilter"]);
 
-function run_test()
-{
+function run_test() {
   /*
    * NOTE: [i] is not allowed in this test, since it's done via classinfo and
    * we don't have that in xpcshell; the workaround is item(i).  Suck.
    */
   init();
 
   test_isEqualNode_setAttribute();
   test_isEqualNode_clones();
   test_isEqualNode_variety();
   test_isEqualNode_normalization();
   test_isEqualNode_whitespace();
   test_isEqualNode_namespaces();
   test_isEqualNode_wholeDoc();
 
   // XXX should Node.isEqualNode(null) throw or return false?
-  //test_isEqualNode_null();
+  // test_isEqualNode_null();
 
 }
 
 // TEST CODE
 
 var doc, root; // cache for use in all tests
 
-function init()
-{
+function init() {
   doc = ParseFile("isequalnode_data.xml");
   root = doc.documentElement;
 }
 
-function test_isEqualNode_setAttribute()
-{
+function test_isEqualNode_setAttribute() {
   // NOTE: 0, 2 are whitespace
   var test1 = doc.getElementById("test_setAttribute");
   var node1 = test1.childNodes.item(1);
   var node2 = test1.childNodes.item(3);
 
   check_eq_nodes(node1, node2);
 
 
@@ -74,28 +71,25 @@ function test_isEqualNode_setAttribute()
   // this overwrites the namespaced "seamonkey" attribute added to node2
   // earlier, because this simply sets whatever attribute has the fully
   // qualified name "seamonkey" (the setAttributeNS attribute string wasn't
   // prefixed) -- consequently, node1 and node2 are still unequal
   node2.setAttribute("seamonkey", "rheet");
   check_neq_nodes(node1, node2);
 }
 
-function test_isEqualNode_clones()
-{
+function test_isEqualNode_clones() {
   // tests all elements and attributes in the document
   var all_elts = doc.getElementsByTagName("*");
-  for (var i = 0; i < all_elts.length; i++)
-  {
+  for (var i = 0; i < all_elts.length; i++) {
     var elt = all_elts.item(i);
     check_eq_nodes(elt, elt.cloneNode(true));
 
     var attrs = elt.attributes;
-    for (var j = 0; j < attrs.length; j++)
-    {
+    for (var j = 0; j < attrs.length; j++) {
       var attr = attrs.item(j);
       check_eq_nodes(attr, attr.cloneNode(true));
     }
   }
 
   var elm = doc.createElement("foo");
   check_eq_nodes(elm, elm.cloneNode(true));
   check_eq_nodes(elm, elm.cloneNode(false));
@@ -122,50 +116,46 @@ function test_isEqualNode_clones()
   elm2.appendChild(doc.createTextNode(TEXT));
   check_eq_nodes(elm, elm2);
 
   var att = doc.createAttribute("bar");
   check_eq_nodes(att, att.cloneNode(true));
   check_eq_nodes(att, att.cloneNode(false));
 }
 
-function test_isEqualNode_variety()
-{
+function test_isEqualNode_variety() {
   const nodes =
     [
       doc.createElement("foo"),
       doc.createElementNS("http://example.com/", "foo"),
       doc.createElementNS("http://example.org/", "foo"),
       doc.createElementNS("http://example.com/", "FOO"),
       doc.createAttribute("foo", "href='biz'"),
       doc.createAttributeNS("http://example.com/", "foo", "href='biz'"),
       doc.createTextNode("foo"),
       doc.createTextNode("   "),
       doc.createTextNode("    "),
       doc.createComment("foo"),
       doc.createProcessingInstruction("foo", "href='biz'"),
       doc.implementation.createDocumentType("foo", "href='biz'", ""),
       doc.implementation.createDocument("http://example.com/", "foo", null),
-      doc.createDocumentFragment()
+      doc.createDocumentFragment(),
     ];
 
-  for (var i = 0; i < nodes.length; i++)
-  {
-    for (var j = i; j < nodes.length; j++)
-    {
+  for (var i = 0; i < nodes.length; i++) {
+    for (var j = i; j < nodes.length; j++) {
       if (i == j)
         check_eq_nodes(nodes[i], nodes[j]);
       else
         check_neq_nodes(nodes[i], nodes[j]);
     }
   }
 }
 
-function test_isEqualNode_normalization()
-{
+function test_isEqualNode_normalization() {
   var norm = doc.getElementById("test_normalization");
   var node1 = norm.childNodes.item(1);
   var node2 = norm.childNodes.item(3);
 
   check_eq_nodes(node1, node2);
 
   node1.appendChild(doc.createTextNode(""));
   check_neq_nodes(node1, node2);
@@ -192,18 +182,17 @@ function test_isEqualNode_normalization(
 
   // attribute normalization testing
 
   var at1 = doc.createAttribute("foo");
   var at2 = doc.createAttribute("foo");
   check_eq_nodes(at1, at2);
 
   // Attr.appendChild isn't implemented yet (bug 56758), so don't run this yet
-  if (false)
-  {
+  if (false) {
     at1.appendChild(doc.createTextNode("rasp"));
     at2.appendChild(doc.createTextNode("rasp"));
     check_eq_nodes(at1, at2);
 
     at1.appendChild(doc.createTextNode(""));
     check_neq_nodes(at1, at2);
 
     at1.normalize();
@@ -303,18 +292,17 @@ function test_isEqualNode_normalization(
   n2elt.insertBefore(doc.createTextNode(""), typeText1);
   check_neq_nodes(node1, node2);
 
   node1.normalize();
   node2.normalize();
   check_eq_nodes(node1, node2);
 }
 
-function test_isEqualNode_whitespace()
-{
+function test_isEqualNode_whitespace() {
   equality_check_kids("test_pi1", true);
   equality_check_kids("test_pi2", true);
   equality_check_kids("test_pi3", false);
   equality_check_kids("test_pi4", true);
   equality_check_kids("test_pi5", true);
 
   equality_check_kids("test_elt1", false);
   equality_check_kids("test_elt2", false);
@@ -333,98 +321,89 @@ function test_isEqualNode_whitespace()
 
   equality_check_kids("test_cdata1", false);
   equality_check_kids("test_cdata2", true);
   equality_check_kids("test_cdata3", false);
   equality_check_kids("test_cdata4", false);
   equality_check_kids("test_cdata5", false);
 }
 
-function test_isEqualNode_namespaces()
-{
+function test_isEqualNode_namespaces() {
   equality_check_kids("test_ns1", false);
   equality_check_kids("test_ns2", false);
 
   // XXX want more tests here!
 }
 
-function test_isEqualNode_null()
-{
+function test_isEqualNode_null() {
   check_neq_nodes(doc, null);
 
   var elts = doc.getElementsByTagName("*");
-  for (var i = 0; i < elts.length; i++)
-  {
+  for (var i = 0; i < elts.length; i++) {
     var elt = elts.item(i);
     check_neq_nodes(elt, null);
 
     var attrs = elt.attributes;
-    for (var j = 0; j < attrs.length; j++)
-    {
+    for (var j = 0; j < attrs.length; j++) {
       var att = attrs.item(j);
       check_neq_nodes(att, null);
 
-      for (var k = 0; k < att.childNodes.length; k++)
-      {
+      for (var k = 0; k < att.childNodes.length; k++) {
         check_neq_nodes(att.childNodes.item(k), null);
       }
     }
   }
 }
 
-function test_isEqualNode_wholeDoc()
-{
+function test_isEqualNode_wholeDoc() {
   doc = ParseFile("isequalnode_data.xml");
   var doc2 = ParseFile("isequalnode_data.xml");
   var tw1 =
     doc.createTreeWalker(doc, NodeFilter.SHOW_ALL,
                          null);
   var tw2 =
     doc2.createTreeWalker(doc2, NodeFilter.SHOW_ALL,
                           null);
   do {
     check_eq_nodes(tw1.currentNode, tw2.currentNode);
     tw1.nextNode();
-  } while(tw2.nextNode());
+  } while (tw2.nextNode());
 }
 
 // TESTING FUNCTIONS
 
 /**
  * Compares the first and third (zero-indexed) child nodes of the element
  * (typically to allow whitespace) referenced by parentId for isEqualNode
  * equality or inequality based on the value of areEqual.
  *
  * Note that this means that the contents of the element referenced by parentId
  * are whitespace-sensitive, and a stray space introduced during an edit to the
  * file could result in a correct but unexpected (in)equality failure.
  */
-function equality_check_kids(parentId, areEqual)
-{
+function equality_check_kids(parentId, areEqual) {
   var parent = doc.getElementById(parentId);
   var kid1 = parent.childNodes.item(1);
   var kid2 = parent.childNodes.item(3);
 
   if (areEqual)
     check_eq_nodes(kid1, kid2);
   else
     check_neq_nodes(kid1, kid2);
 }
 
-function check_eq_nodes(n1, n2)
-{
+function check_eq_nodes(n1, n2) {
   if (n1 && !n1.isEqualNode(n2))
     do_throw(n1 + " should be equal to " + n2);
   if (n2 && !n2.isEqualNode(n1))
     do_throw(n2 + " should be equal to " + n1);
   if (!n1 && !n2)
     do_throw("nodes both null!");
 }
 
-function check_neq_nodes(n1, n2)
-{
+function check_neq_nodes(n1, n2) {
   if (n1 && n1.isEqualNode(n2))
     do_throw(n1 + " should not be equal to " + n2);
   if (n2 && n2.isEqualNode(n1))
     do_throw(n2 + " should not be equal to " + n1);
   if (!n1 && !n2)
     do_throw("n1 and n2 both null!");
 }
--- a/dom/base/test/unit/test_js_dev_error_interceptor.js
+++ b/dom/base/test/unit/test_js_dev_error_interceptor.js
@@ -14,18 +14,18 @@ function errors() {
         null,
         undefined,
         Math.random(),
         {},
 
         // The following errors MUST be captured.
         new TypeError("This is a TypeError: " + Math.random()),
         new SyntaxError("This is a SyntaxError: " + Math.random()),
-        new ReferenceError("This is a ReferenceError: " + Math.random())
-    ]
+        new ReferenceError("This is a ReferenceError: " + Math.random()),
+    ];
 }
 
 function isDeveloperError(e) {
     if (e == null || typeof e != "object") {
         return false;
     }
 
     return e.constructor == TypeError
@@ -47,10 +47,10 @@ function run_test() {
         if (isDeveloperError(exn)) {
             Assert.equal(ChromeUtils.recentJSDevError.message, "" + exn);
         } else {
             Assert.equal(ChromeUtils.recentJSDevError, undefined);
         }
         ChromeUtils.clearRecentJSDevError();
         Assert.equal(ChromeUtils.recentJSDevError, undefined);
     }
-};
+}
 
--- a/dom/base/test/unit/test_nodelist.js
+++ b/dom/base/test/unit/test_nodelist.js
@@ -1,33 +1,31 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-function run_test()
-{
-  
+function run_test() {
+
   test_getElementsByTagName();
   test_getElementsByTagNameNS();
   test_getElementsByAttribute();
   test_getElementsByAttributeNS();
 
   // What else should we test?
   // XXXbz we need more tests here to test liveness!
 
-}  
+}
 
-function test_getElementsByTagName()
-{
+function test_getElementsByTagName() {
   var doc = ParseFile("nodelist_data_1.xml");
   var root = doc.documentElement;
 
   // Check that getElementsByTagName returns an HTMLCollection.
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagName("*")),
-               "HTMLCollection")
+               "HTMLCollection");
   Assert.ok(ChromeUtils.getClassName(root.getElementsByTagName("*")),
             "HTMLCollection");
-  
+
   // Check that getElementsByTagName excludes the element it's called on.
   Assert.equal(doc.getElementsByTagName("*").length,
                root.getElementsByTagName("*").length + 1);
   Assert.equal(doc.getElementById("test2").getElementsByTagName("*").length,
                8);
   Assert.equal(doc.getElementById("test2").getElementsByTagName("test").length,
                3);
 
@@ -37,52 +35,51 @@ function test_getElementsByTagName()
 
   // Check that we get the right things in the right order
   var numTests = doc.getElementsByTagName("test").length;
   Assert.equal(numTests, 5);
 
   for (var i = 1; i <= numTests; ++i) {
     Assert.ok(Element.isInstance(doc.getElementById("test" + i)));
     Assert.equal(doc.getElementById("test" + i),
-                 doc.getElementsByTagName("test").item(i-1));
+                 doc.getElementsByTagName("test").item(i - 1));
   }
 
   // Check that we handle tagnames containing ':' correctly
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagName("foo:test")),
                "HTMLCollection");
   Assert.equal(doc.getElementsByTagName("foo:test").length, 2);
 
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagName("foo2:test")),
                "HTMLCollection");
   Assert.equal(doc.getElementsByTagName("foo2:test").length, 3);
 
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagName("bar:test")),
                "HTMLCollection");
   Assert.equal(doc.getElementsByTagName("bar:test").length, 4);
 }
 
-function test_getElementsByTagNameNS()
-{
+function test_getElementsByTagNameNS() {
   var doc = ParseFile("nodelist_data_1.xml");
   var root = doc.documentElement;
 
   // Check that getElementsByTagNameNS returns an HTMLCollection.
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagNameNS("*", "*")),
                "HTMLCollection");
   Assert.equal(ChromeUtils.getClassName(root.getElementsByTagNameNS("*", "*")),
                "HTMLCollection");
 
   // Check that passing "" and null for the namespace URI gives the same result
   var list1 = doc.getElementsByTagNameNS("", "test");
   var list2 = doc.getElementsByTagNameNS(null, "test");
   Assert.equal(list1.length, list2.length);
   for (var i = 0; i < list1.length; ++i) {
     Assert.equal(list1.item(i), list2.item(i));
   }
-  
+
   // Check that getElementsByTagNameNS excludes the element it's called on.
   Assert.equal(doc.getElementsByTagNameNS("*", "*").length,
                root.getElementsByTagNameNS("*", "*").length + 1);
   Assert.equal(doc.getElementById("test2")
                   .getElementsByTagNameNS("*", "*").length,
                8);
   Assert.equal(doc.getElementById("test2")
                   .getElementsByTagNameNS("", "test").length,
@@ -93,24 +90,24 @@ function test_getElementsByTagNameNS()
 
   // Check that the first element of getElementsByTagNameNS on the document is
   // the right thing.
   Assert.equal(doc.getElementsByTagNameNS("*", "*").item(0), root);
   Assert.equal(doc.getElementsByTagNameNS(null, "*").item(0), root);
 
   // Check that we get the right things in the right order
 
-     
+
   var numTests = doc.getElementsByTagNameNS("*", "test").length;
   Assert.equal(numTests, 14);
 
   for (var i = 1; i <= numTests; ++i) {
     Assert.ok(Element.isInstance(doc.getElementById("test" + i)));
     Assert.equal(doc.getElementById("test" + i),
-                 doc.getElementsByTagNameNS("*", "test").item(i-1));
+                 doc.getElementsByTagNameNS("*", "test").item(i - 1));
   }
 
   // Check general proper functioning of having a non-wildcard namespace.
   var test2 = doc.getElementById("test2");
   Assert.equal(doc.getElementsByTagNameNS("", "test").length,
                3);
   Assert.equal(test2.getElementsByTagNameNS("", "test").length,
                1);
@@ -129,24 +126,24 @@ function test_getElementsByTagNameNS()
 
   // Check that we handle tagnames containing ':' correctly
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagNameNS(null, "foo:test")),
                "HTMLCollection");
   Assert.equal(doc.getElementsByTagNameNS(null, "foo:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("foo", "foo:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("bar", "foo:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("*", "foo:test").length, 0);
-  
+
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagNameNS(null, "foo2:test")),
                "HTMLCollection");
   Assert.equal(doc.getElementsByTagNameNS(null, "foo2:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("foo2", "foo2:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("bar", "foo2:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("*", "foo2:test").length, 0);
-  
+
   Assert.equal(ChromeUtils.getClassName(doc.getElementsByTagNameNS(null, "bar:test")),
                "HTMLCollection");
   Assert.equal(doc.getElementsByTagNameNS(null, "bar:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("bar", "bar:test").length, 0);
   Assert.equal(doc.getElementsByTagNameNS("*", "bar:test").length, 0);
 
   // Check that previously-unknown namespaces are handled right.  Note that we
   // can just hardcode the strings, since we're running only once in XPCshell.
@@ -157,22 +154,21 @@ function test_getElementsByTagNameNS()
                                                      "foo");
   Assert.notEqual(list1, list2);
   Assert.equal(list1.length, 0);
   Assert.equal(list2.length, 0);
   var newNode = doc.createElementNS("random-bogus-namespace", "foo");
   doc.documentElement.appendChild(newNode);
   var newNode = doc.createElementNS("random-bogus-namespace2", "foo");
   doc.documentElement.appendChild(newNode);
-  Assert.equal(list1.length, 1);  
-  Assert.equal(list2.length, 1);  
+  Assert.equal(list1.length, 1);
+  Assert.equal(list2.length, 1);
 }
 
-function test_getElementsByAttribute()
-{
+function test_getElementsByAttribute() {
   var doc = ParseFile("nodelist_data_2.xul");
   var root = doc.documentElement;
 
   // Sadly, DOMParser can't create XULDocument objects.  But at least we have a
   // XULElement!
 
   Assert.equal(ChromeUtils.getClassName(root), "XULElement");
 
@@ -278,18 +274,17 @@ function test_getElementsByAttribute()
                3);
 
   Assert.equal(root.getElementsByAttribute("foo2:foo", "bar").length,
                0);
   Assert.equal(root.getElementsByAttribute("foo:foo", "baz").length,
                0);
 }
 
-function test_getElementsByAttributeNS()
-{
+function test_getElementsByAttributeNS() {
   var doc = ParseFile("nodelist_data_2.xul");
   var root = doc.documentElement;
 
   // Sadly, DOMParser can't create XULDocument objects.  But at least we have a
   // XULElement!
 
   Assert.equal(ChromeUtils.getClassName(root), "XULElement");
 
@@ -301,17 +296,17 @@ function test_getElementsByAttributeNS()
   var master2 = doc.getElementById("master2");
   var master3 = doc.getElementById("master3");
   var external = doc.getElementById("external");
 
   Assert.equal(ChromeUtils.getClassName(master1), "XULElement");
   Assert.equal(ChromeUtils.getClassName(master2), "XULElement");
   Assert.equal(ChromeUtils.getClassName(master3), "XULElement");
   Assert.equal(ChromeUtils.getClassName(external), "XULElement");
-  
+
   // Test wildcard namespace
   Assert.equal(root.getElementsByAttributeNS("*", "foo", "foo").length,
                38);
   Assert.equal(master1.getElementsByAttributeNS("*", "foo", "foo").length,
                11);
   Assert.equal(master2.getElementsByAttributeNS("*", "foo", "foo").length,
                10);
   Assert.equal(master3.getElementsByAttributeNS("*", "foo", "foo").length,
@@ -348,17 +343,17 @@ function test_getElementsByAttributeNS()
   Assert.equal(root.getElementsByAttributeNS("", "foo", "foo").length,
                root.getElementsByAttribute("foo", "foo").length);
   Assert.equal(master1.getElementsByAttributeNS("", "foo", "foo").length,
                master1.getElementsByAttribute("foo", "foo").length);
   Assert.equal(master2.getElementsByAttributeNS("", "foo", "foo").length,
                master2.getElementsByAttribute("foo", "foo").length);
   Assert.equal(master3.getElementsByAttributeNS("", "foo", "foo").length,
                master3.getElementsByAttribute("foo", "foo").length);
-  
+
   // Test namespace "foo"
   Assert.equal(root.getElementsByAttributeNS("foo", "foo", "foo").length,
                24);
   Assert.equal(master1.getElementsByAttributeNS("foo", "foo", "foo").length,
                7);
   Assert.equal(master2.getElementsByAttributeNS("foo", "foo", "foo").length,
                6);
   Assert.equal(master3.getElementsByAttributeNS("foo", "foo", "foo").length,
--- a/dom/base/test/unit/test_normalize.js
+++ b/dom/base/test/unit/test_normalize.js
@@ -1,15 +1,14 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-function run_test()
-{
+function run_test() {
   /*
    * NOTE: [i] is not allowed in this test, since it's done via classinfo and
    * we don't have that in xpcshell; the workaround is item(i).  Suck.
    */
   init();
 
   test_element();
 
@@ -18,23 +17,21 @@ function run_test()
   // unimplemented or is unlikely to be used all that much within a browser
   // DOM implementation
 }
 
 // TEST CODE
 
 var doc; // cache for use in all tests
 
-function init()
-{
+function init() {
   doc = ParseFile("empty_document.xml");
 }
 
-function test_element()
-{
+function test_element() {
   var x = doc.createElement("funk");
 
   // one empty Text node
   x.appendChild(doc.createTextNode(""));
   Assert.equal(x.childNodes.length, 1);
 
   x.normalize();
   Assert.equal(x.childNodes.length, 0);
@@ -97,13 +94,12 @@ function test_element()
   Assert.equal(x.childNodes.length, 2);
   Assert.equal(x.childNodes.item(0).nodeValue, "Guaraldi");
   Assert.equal(x.childNodes.item(1).childNodes.length, 0);
 }
 
 
 // UTILITY FUNCTIONS
 
-function clearKids(node)
-{
+function clearKids(node) {
   while (node.hasChildNodes())
     node.removeChild(node.childNodes.item(0));
 }
--- a/dom/base/test/unit/test_range.js
+++ b/dom/base/test/unit/test_range.js
@@ -117,17 +117,17 @@ function evalXPathInDocumentFragment(aCo
       }
 
       this.count++;
       if (this.count != childIndex) {
         return NodeFilter.FILTER_SKIP;
       }
 
       return NodeFilter.FILTER_ACCEPT;
-    }
+    },
   };
 
   // Look for the node matching the step from the document fragment.
   var walker = aContextNode.ownerDocument.createTreeWalker(
                  aContextNode,
                  targetType,
                  filter);
   var targetNode = walker.nextNode();
@@ -286,17 +286,17 @@ function do_extract_test(doc) {
       }
 
       if (walker.currentNode == endContainer) {
         // An end container node should not come before the start container node.
         Assert.ok(foundStart);
         foundEnd = true;
         break;
       }
-    } while (walker.nextNode())
+    } while (walker.nextNode());
     Assert.ok(foundEnd);
 
     /* Now, we reset our test for the deleteContents case.  This one differs
        from the extractContents case only in that there is no extracted document
        fragment to compare against.  So we merely compare the starting fragment,
        minus the extracted content, against the result fragment.
      */
     dump("Delete contents test " + i + "\n\n");
@@ -319,17 +319,17 @@ function do_extract_test(doc) {
       }
 
       if (walker.currentNode == endContainer) {
         // An end container node should not come before the start container node.
         Assert.ok(foundStart);
         foundEnd = true;
         break;
       }
-    } while (walker.nextNode())
+    } while (walker.nextNode());
     Assert.ok(foundEnd);
 
     // Clean up after ourselves.
     walker = null;
   }
 }
 
 /**
@@ -384,42 +384,42 @@ function do_miscellaneous_tests(doc) {
 
     // Invalid index
     try {
       baseRange.setStart(startContainer, -1);
       do_throw("Should have thrown IndexSizeError!");
     } catch (e) {
       Assert.equal(e.name, "IndexSizeError");
     }
-  
+
     // Invalid index
     var newOffset = isText(startContainer) ?
                       startContainer.nodeValue.length + 1 :
                       startContainer.childNodes.length + 1;
     try {
       baseRange.setStart(startContainer, newOffset);
       do_throw("Should have thrown IndexSizeError!");
     } catch (e) {
       Assert.equal(e.name, "IndexSizeError");
     }
-  
+
     newOffset--;
     // Valid index
     baseRange.setStart(startContainer, newOffset);
     Assert.equal(baseRange.startContainer, baseRange.endContainer);
     Assert.equal(baseRange.startOffset, newOffset);
     Assert.ok(baseRange.collapsed);
 
     // Valid index
     baseRange.setEnd(startContainer, 0);
     Assert.equal(baseRange.startContainer, baseRange.endContainer);
     Assert.equal(baseRange.startOffset, 0);
     Assert.ok(baseRange.collapsed);
   } else {
-    do_throw("The first test should be a text-only range test.  Test is invalid.")
+    do_throw("The first test should be a text-only range test.  Test is invalid.");
   }
 
   /* See what happens when a range has a startContainer in one fragment, and an
      endContainer in another.  According to the DOM spec, section 2.4, the range
      should collapse to the new container and offset. */
   baseRange = getRange(baseSource, baseFrag);
   startContainer = baseRange.startContainer;
   var startOffset = baseRange.startOffset;
--- a/dom/base/test/unit/test_thirdpartyutil.js
+++ b/dom/base/test/unit/test_thirdpartyutil.js
@@ -12,18 +12,17 @@ var prefs = Cc["@mozilla.org/preferences
 
 // Since this test creates a TYPE_DOCUMENT channel via javascript, it will
 // end up using the wrong LoadInfo constructor. Setting this pref will disable
 // the ContentPolicyType assertion in the constructor.
 prefs.setBoolPref("network.loadinfo.skip_type_assertion", true);
 
 var NS_ERROR_INVALID_ARG = Cr.NS_ERROR_INVALID_ARG;
 
-function do_check_throws(f, result, stack)
-{
+function do_check_throws(f, result, stack) {
   if (!stack) {
     try {
       // We might not have a 'Components' object.
       stack = Components.stack.caller;
     } catch (e) {
     }
   }
 
--- a/dom/base/test/unit/test_treewalker.js
+++ b/dom/base/test/unit/test_treewalker.js
@@ -1,26 +1,24 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 Cu.importGlobalProperties(["NodeFilter"]);
 
-function run_test()
-{
+function run_test() {
   test_treeWalker_currentNode();
 }
 
 // TEST CODE
 
-function test_treeWalker_currentNode()
-{
+function test_treeWalker_currentNode() {
   var XHTMLDocString = '<html xmlns="http://www.w3.org/1999/xhtml">';
-  XHTMLDocString += '<body><input/>input</body></html>';
+  XHTMLDocString += "<body><input/>input</body></html>";
 
   var doc = ParseXML(XHTMLDocString);
 
   var body = doc.getElementsByTagName("body")[0];
   var filter = NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT;
   var walker = doc.createTreeWalker(body, filter, null);
   walker.currentNode = body.firstChild;
   walker.nextNode();
--- a/dom/base/test/unit/test_xhr_origin_attributes.js
+++ b/dom/base/test/unit/test_xhr_origin_attributes.js
@@ -36,11 +36,11 @@ function run_test() {
     xhr2.setOriginAttributes({userContextId: 1});
     xhr2.send(null);
 
     let loadInfo = xhr2.channel.loadInfo;
     Assert.equal(loadInfo.originAttributes.userContextId, 1);
 
     xhr2.onload = function() {
       server.stop(do_test_finished);
-    }
+    };
   };
 }
--- a/dom/base/test/unit/test_xhr_standalone.js
+++ b/dom/base/test/unit/test_xhr_standalone.js
@@ -1,20 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // Test setting .responseType and .withCredentials is allowed
 // in non-window non-Worker context
 
-function run_test()
-{
+function run_test() {
     var xhr = new XMLHttpRequest();
-    xhr.open('GET', 'data:,', false);
+    xhr.open("GET", "data:,", false);
     var exceptionThrown = false;
     try {
-        xhr.responseType = '';
+        xhr.responseType = "";
         xhr.withCredentials = false;
     } catch (e) {
         exceptionThrown = true;
     }
     Assert.equal(false, exceptionThrown);
 }
--- a/dom/base/test/unit/test_xml_parser.js
+++ b/dom/base/test/unit/test_xml_parser.js
@@ -1,48 +1,48 @@
-function run_test () {
+function run_test() {
   for (var i = 0; i < tests.length && tests[i][0]; ++i) {
     if (!tests[i][0].call()) {
       do_throw(tests[i][1]);
     }
   }
 }
 
 var tests = [
   [ test1, "Unable to parse basic XML document" ],
   [ test2, "ParseXML doesn't return Document" ],
   [ test3, "ParseXML return value's documentElement is not Element" ],
   [ test4, "" ],
   [ test5, "" ],
   [ test6, "" ],
-  [ null ]
+  [ null ],
 ];
 
 function test1() {
   return ParseXML("<root/>");
 }
 
 function test2() {
   return (ChromeUtils.getClassName(ParseXML("<root/>")) === "XMLDocument");
 }
 
 function test3() {
   return Element.isInstance(ParseXML("<root/>").documentElement);
 }
 
 function test4() {
   var doc = ParseXML("<root/>");
-  Assert.equal(doc.documentElement.namespaceURI, null); 
+  Assert.equal(doc.documentElement.namespaceURI, null);
   return true;
 }
 
 function test5() {
   var doc = ParseXML("<root xmlns=''/>");
-  Assert.equal(doc.documentElement.namespaceURI, null); 
+  Assert.equal(doc.documentElement.namespaceURI, null);
   return true;
 }
 
 function test6() {
   var doc = ParseXML("<root xmlns='ns1'/>");
-  Assert.notEqual(doc.documentElement.namespaceURI, null); 
-  Assert.equal(doc.documentElement.namespaceURI, 'ns1'); 
+  Assert.notEqual(doc.documentElement.namespaceURI, null);
+  Assert.equal(doc.documentElement.namespaceURI, "ns1");
   return true;
 }
--- a/dom/base/test/unit/test_xml_serializer.js
+++ b/dom/base/test/unit/test_xml_serializer.js
@@ -24,38 +24,38 @@ var tests = [
   test3,
   test4,
   test5,
   test6,
   test7,
   test8,
   test9,
   test10,
-  null
+  null,
 ];
 
 function testString(str) {
   Assert.equal(roundtrip(str), str);
 }
 
 function test1() {
   // Basic round-tripping which we expect to hand back the same text
   // as we passed in (not strictly required for correctness in some of
   // those cases, but best for readability of serializer output)
-  testString('<root/>');
-  testString('<root><child/></root>');
+  testString("<root/>");
+  testString("<root><child/></root>");
   testString('<root xmlns=""/>');
   testString('<root xml:lang="en"/>');
-  testString('<root xmlns="ns1"><child xmlns="ns2"/></root>')
-  testString('<root xmlns="ns1"><child xmlns=""/></root>')
-  testString('<a:root xmlns:a="ns1"><child/></a:root>')
-  testString('<a:root xmlns:a="ns1"><a:child/></a:root>')
-  testString('<a:root xmlns:a="ns1"><b:child xmlns:b="ns1"/></a:root>')
-  testString('<a:root xmlns:a="ns1"><a:child xmlns:a="ns2"/></a:root>')
-  testString('<a:root xmlns:a="ns1"><b:child xmlns:b="ns1" b:attr=""/></a:root>')
+  testString('<root xmlns="ns1"><child xmlns="ns2"/></root>');
+  testString('<root xmlns="ns1"><child xmlns=""/></root>');
+  testString('<a:root xmlns:a="ns1"><child/></a:root>');
+  testString('<a:root xmlns:a="ns1"><a:child/></a:root>');
+  testString('<a:root xmlns:a="ns1"><b:child xmlns:b="ns1"/></a:root>');
+  testString('<a:root xmlns:a="ns1"><a:child xmlns:a="ns2"/></a:root>');
+  testString('<a:root xmlns:a="ns1"><b:child xmlns:b="ns1" b:attr=""/></a:root>');
 }
 
 function test2() {
   // Test setting of "xmlns" attribute in the null namespace
 
   // XXXbz are these tests needed?  What should happen here?  These
   // may be bogus.
 
@@ -85,18 +85,18 @@ function test3() {
                '<root xmlns="ns1"><prefix:child xmlns:prefix="ns2"/></root>');
 
   doc = ParseXML('<prefix:root xmlns:prefix="ns1"/>');
   root = doc.documentElement;
   child = doc.createElementNS("ns2", "prefix:child");
   root.appendChild(child);
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
-               '<prefix:root xmlns:prefix="ns1"><a0:child xmlns:a0="ns2"/>'+
-               '</prefix:root>');
+               '<prefix:root xmlns:prefix="ns1"><a0:child xmlns:a0="ns2"/>' +
+               "</prefix:root>");
 
 }
 
 function test4() {
   // setAttributeNS tests
 
   var doc = ParseXML('<root xmlns="ns1"/>');
   var root = doc.documentElement;
@@ -125,19 +125,19 @@ function test4() {
   doc = ParseXML('<root xmlns="ns1"/>');
   root = doc.documentElement;
   root.setAttributeNS("ns1", "local", "val");
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
                  '<root xmlns="ns1" a0:local="val" xmlns:a0="ns1"/>');
 
   // Tree-walking test
-  doc = ParseXML('<root xmlns="ns1" xmlns:a="ns2">'+
-                 '<child xmlns:b="ns2" xmlns:a="ns3">'+
-                 '<child2/></child></root>');
+  doc = ParseXML('<root xmlns="ns1" xmlns:a="ns2">' +
+                 '<child xmlns:b="ns2" xmlns:a="ns3">' +
+                 "<child2/></child></root>");
   root = doc.documentElement;
   var node = root.firstChild.firstChild;
   node.setAttributeNS("ns4", "l1", "v1");
   node.setAttributeNS("ns4", "p2:l2", "v2");
   node.setAttributeNS("", "l3", "v3");
   node.setAttributeNS("ns3", "l4", "v4");
   node.setAttributeNS("ns3", "p5:l5", "v5");
   node.setAttributeNS("ns3", "a:l6", "v6");
@@ -148,18 +148,18 @@ function test4() {
   node.setAttributeNS("ns1", "a:l11", "v11");
   node.setAttributeNS("ns1", "b:l12", "v12");
   node.setAttributeNS("ns1", "l13", "v13");
   do_check_serialize(doc);
   //  Note: we end up with "a2" as the prefix on "l11" and "l12" because we use
   //  "a1" earlier, and discard it in favor of something we get off the
   //  namespace stack, apparently
   Assert.equal(SerializeXML(doc),
-               '<root xmlns="ns1" xmlns:a="ns2">'+
-               '<child xmlns:b="ns2" xmlns:a="ns3">'+
+               '<root xmlns="ns1" xmlns:a="ns2">' +
+               '<child xmlns:b="ns2" xmlns:a="ns3">' +
                '<child2 a0:l1="v1" xmlns:a0="ns4"' +
                ' a0:l2="v2"' +
                ' l3="v3"' +
                ' a:l4="v4"' +
                ' a:l5="v5"' +
                ' a:l6="v6"' +
                ' b:l7="v7"' +
                ' b:l8="v8"' +
@@ -168,18 +168,18 @@ function test4() {
                ' a2:l11="v11" xmlns:a2="ns1"' +
                ' a2:l12="v12"' +
                ' a2:l13="v13"/></child></root>');
 }
 
 function test5() {
   // Handling of kids in the null namespace when the default is a
   // different namespace (bug 301260).
-  var doc = ParseXML('<root xmlns="ns1"/>')
-  var child = doc.createElement('child');
+  var doc = ParseXML('<root xmlns="ns1"/>');
+  var child = doc.createElement("child");
   doc.documentElement.appendChild(child);
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
                '<root xmlns="ns1"><child xmlns=""/></root>');
 }
 
 function test6() {
   // Handling of not using a namespace prefix (or default namespace!)
@@ -187,102 +187,102 @@ function test6() {
   var doc = ParseXML('<prefix:root xmlns:prefix="ns1"/>');
   var root = doc.documentElement;
   var child1 = doc.createElementNS("ns2", "prefix:child1");
   var child2 = doc.createElementNS("ns1", "prefix:child2");
   child1.appendChild(child2);
   root.appendChild(child1);
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
-               '<prefix:root xmlns:prefix="ns1"><a0:child1 xmlns:a0="ns2">'+
-               '<prefix:child2/></a0:child1></prefix:root>');
+               '<prefix:root xmlns:prefix="ns1"><a0:child1 xmlns:a0="ns2">' +
+               "<prefix:child2/></a0:child1></prefix:root>");
 
   doc = ParseXML('<root xmlns="ns1"><prefix:child1 xmlns:prefix="ns2"/></root>');
   root = doc.documentElement;
   child1 = root.firstChild;
   child2 = doc.createElementNS("ns1", "prefix:child2");
   child1.appendChild(child2);
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
-               '<root xmlns="ns1"><prefix:child1 xmlns:prefix="ns2">'+
-               '<child2/></prefix:child1></root>');
+               '<root xmlns="ns1"><prefix:child1 xmlns:prefix="ns2">' +
+               "<child2/></prefix:child1></root>");
 
-  doc = ParseXML('<prefix:root xmlns:prefix="ns1">'+
+  doc = ParseXML('<prefix:root xmlns:prefix="ns1">' +
                  '<prefix:child1 xmlns:prefix="ns2"/></prefix:root>');
   root = doc.documentElement;
   child1 = root.firstChild;
   child2 = doc.createElementNS("ns1", "prefix:child2");
   child1.appendChild(child2);
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
-               '<prefix:root xmlns:prefix="ns1"><prefix:child1 xmlns:prefix="ns2">'+
+               '<prefix:root xmlns:prefix="ns1"><prefix:child1 xmlns:prefix="ns2">' +
                '<a0:child2 xmlns:a0="ns1"/></prefix:child1></prefix:root>');
 
 
   doc = ParseXML('<root xmlns="ns1"/>');
   root = doc.documentElement;
   child1 = doc.createElementNS("ns2", "child1");
   child2 = doc.createElementNS("ns1", "child2");
   child1.appendChild(child2);
   root.appendChild(child1);
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
-                 '<root xmlns="ns1"><child1 xmlns="ns2"><child2 xmlns="ns1"/>'+
-                 '</child1></root>');
+                 '<root xmlns="ns1"><child1 xmlns="ns2"><child2 xmlns="ns1"/>' +
+                 "</child1></root>");
 }
 
 function test7() {
   // Handle xmlns attribute declaring a default namespace on a non-namespaced
   // element (bug 326994).
-  var doc = ParseXML('<root xmlns=""/>')
+  var doc = ParseXML('<root xmlns=""/>');
   var root = doc.documentElement;
   root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
                       "http://www.w3.org/1999/xhtml");
   do_check_serialize(doc);
-  Assert.equal(SerializeXML(doc), '<root/>');
+  Assert.equal(SerializeXML(doc), "<root/>");
 
-  doc = ParseXML('<root xmlns=""><child1/></root>')
+  doc = ParseXML('<root xmlns=""><child1/></root>');
   root = doc.documentElement;
   root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
                       "http://www.w3.org/1999/xhtml");
   do_check_serialize(doc);
-  Assert.equal(SerializeXML(doc), '<root><child1/></root>');
+  Assert.equal(SerializeXML(doc), "<root><child1/></root>");
 
   doc = ParseXML('<root xmlns="http://www.w3.org/1999/xhtml">' +
-                 '<child1 xmlns=""><child2/></child1></root>')
+                 '<child1 xmlns=""><child2/></child1></root>');
   root = doc.documentElement;
 
   var child1 = root.firstChild;
   child1.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
                         "http://www.w3.org/1999/xhtml");
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
                '<root xmlns="http://www.w3.org/1999/xhtml"><child1 xmlns="">' +
-               '<child2/></child1></root>');
+               "<child2/></child1></root>");
 
   doc = ParseXML('<root xmlns="http://www.w3.org/1999/xhtml">' +
                  '<child1 xmlns="">' +
                  '<child2 xmlns="http://www.w3.org/1999/xhtml"></child2>' +
-                 '</child1></root>')
+                 "</child1></root>");
   root = doc.documentElement;
   child1 = root.firstChild;
   var child2 = child1.firstChild;
   child1.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
                         "http://www.w3.org/1999/xhtml");
   child2.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "");
   do_check_serialize(doc);
   Assert.equal(SerializeXML(doc),
                '<root xmlns="http://www.w3.org/1999/xhtml"><child1 xmlns="">' +
                '<a0:child2 xmlns:a0="http://www.w3.org/1999/xhtml" xmlns=""></a0:child2></child1></root>');
 }
 
 function test8() {
   // Test behavior of serializing with a given charset.
-  var str1 = '<?xml version="1.0" encoding="windows-1252"?>'+LB+'<root/>';
-  var str2 = '<?xml version="1.0" encoding="UTF-8"?>'+LB+'<root/>';
+  var str1 = '<?xml version="1.0" encoding="windows-1252"?>' + LB + "<root/>";
+  var str2 = '<?xml version="1.0" encoding="UTF-8"?>' + LB + "<root/>";
   var doc1 = ParseXML(str1);
   var doc2 = ParseXML(str2);
 
   var p = Pipe();
   DOMSerializer().serializeToStream(doc1, p.outputStream, "windows-1252");
   p.outputStream.close();
   Assert.equal(ScriptableInput(p).read(-1), str1);
 
@@ -300,22 +300,22 @@ function test8() {
   DOMSerializer().serializeToStream(doc2, p.outputStream, "UTF-8");
   p.outputStream.close();
   Assert.equal(ScriptableInput(p).read(-1), str2);
 }
 
 function test9() {
   // Test behavior of serializing between given charsets, using
   // windows-1252-representable text.
-  var contents = '<root>' +
-                   '\u00BD + \u00BE == \u00BD\u00B2 + \u00BC + \u00BE' +
-                 '</root>';
-  var str1 = '<?xml version="1.0" encoding="windows-1252"?>'+ LB + contents;
-  var str2 = '<?xml version="1.0" encoding="UTF-8"?>'+ LB + contents;
-  var str3 = '<?xml version="1.0" encoding="UTF-16"?>'+ LB + contents;
+  var contents = "<root>" +
+                   "\u00BD + \u00BE == \u00BD\u00B2 + \u00BC + \u00BE" +
+                 "</root>";
+  var str1 = '<?xml version="1.0" encoding="windows-1252"?>' + LB + contents;
+  var str2 = '<?xml version="1.0" encoding="UTF-8"?>' + LB + contents;
+  var str3 = '<?xml version="1.0" encoding="UTF-16"?>' + LB + contents;
   var doc1 = ParseXML(str1);
   var doc2 = ParseXML(str2);
   var doc3 = ParseXML(str3);
 
   checkSerialization(doc1, "windows-1252", str1);
   checkSerialization(doc2, "windows-1252", str1);
   checkSerialization(doc3, "windows-1252", str1);
 
@@ -328,23 +328,23 @@ function test9() {
   checkSerialization(doc3, "UTF-16", str2);
 }
 
 function test10() {
   // Test behavior of serializing between given charsets, using
   // Unicode characters (XXX but only BMP ones because I don't know
   // how to create one with non-BMP characters, either with JS strings
   // or using DOM APIs).
-  var contents = '<root>' +
-                   'AZaz09 \u007F ' +               // U+000000 to U+00007F
-                   '\u0080 \u0398 \u03BB \u0725 ' + // U+000080 to U+0007FF
-                   '\u0964 \u0F5F \u20AC \uFFFB' +  // U+000800 to U+00FFFF
-                 '</root>';
-  var str1 = '<?xml version="1.0" encoding="UTF-8"?>'+ LB + contents;
-  var str2 = '<?xml version="1.0" encoding="UTF-16"?>'+ LB + contents;
+  var contents = "<root>" +
+                   "AZaz09 \u007F " + // U+000000 to U+00007F
+                   "\u0080 \u0398 \u03BB \u0725 " + // U+000080 to U+0007FF
+                   "\u0964 \u0F5F \u20AC \uFFFB" + // U+000800 to U+00FFFF
+                 "</root>";
+  var str1 = '<?xml version="1.0" encoding="UTF-8"?>' + LB + contents;
+  var str2 = '<?xml version="1.0" encoding="UTF-16"?>' + LB + contents;
   var doc1 = ParseXML(str1);
   var doc2 = ParseXML(str2);
 
   checkSerialization(doc1, "UTF8", str1);
   checkSerialization(doc2, "UTF8", str1);
 
   checkSerialization(doc1, "UTF-16", str1);
   checkSerialization(doc2, "UTF-16", str1);
--- a/dom/base/test/unit/test_xmlserializer.js
+++ b/dom/base/test/unit/test_xmlserializer.js
@@ -1,16 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 async function xmlEncode(aFile, aFlags, aCharset) {
-    if(aFlags == undefined) aFlags = 0;
-    if(aCharset == undefined) aCharset = "UTF-8";
+    if (aFlags == undefined) aFlags = 0;
+    if (aCharset == undefined) aCharset = "UTF-8";
 
     var doc = await do_parse_document(aFile, "text/xml");
 
     var encoder = Cu.createDocumentEncoder("text/xml");
     encoder.setCharset(aCharset);
     encoder.init(doc, "text/xml", aFlags);
     return encoder.encodeToString();
 }
@@ -78,20 +78,20 @@ add_task(async function() {
 
     encoder.setNode(doc.documentElement.childNodes[11].childNodes[1]);
     result = encoder.encodeToString();
     expected = loadContentFile("4_result_4.xml");
     Assert.equal(expected, result);
 
     encoder.setCharset("UTF-8");
     // it doesn't support this flags
-    encoder.init(doc, "text/xml",  de.OutputLFLineBreak | de.OutputFormatted | de.OutputWrap);
+    encoder.init(doc, "text/xml", de.OutputLFLineBreak | de.OutputFormatted | de.OutputWrap);
     encoder.setWrapColumn(40);
     result = encoder.encodeToString();
     expected = loadContentFile("4_result_5.xml");
     Assert.equal(expected, result);
 
-    encoder.init(doc, "text/xml",  de.OutputLFLineBreak | de.OutputWrap);
+    encoder.init(doc, "text/xml", de.OutputLFLineBreak | de.OutputWrap);
     encoder.setWrapColumn(40);
     result = encoder.encodeToString();
     expected = loadContentFile("4_result_6.xml");
     Assert.equal(expected, result);
 });