Bug 1345600 - Remove the empty script element workaround in jstests' browser.js. r=sfink
authorAndré Bargull <andre.bargull@gmail.com>
Sat, 11 Nov 2017 04:55:45 -0800
changeset 696877 ab5332419d2f090906270941a77e81ad0b4d40b5
parent 696848 e2dc5d006fc76e2e013d0d07a9707c20c2b3227c
child 696878 d1ce4244570bd03a297131804dc58494e203b736
push id88814
push userbmo:emilio@crisal.io
push dateSun, 12 Nov 2017 15:02:12 +0000
reviewerssfink
bugs1345600
milestone58.0a1
Bug 1345600 - Remove the empty script element workaround in jstests' browser.js. r=sfink
js/src/tests/browser.js
--- a/js/src/tests/browser.js
+++ b/js/src/tests/browser.js
@@ -511,17 +511,18 @@
       // No error is expected.
       expectedError = "Unknown";
     }
 
     if (properties.gczeal) {
       gczeal(Number(properties.gczeal));
     }
 
-    document.write(`<title>${ properties.test }<\/title>`);
+    // Display the test path in the title.
+    document.title = properties.test;
 
     // Output script tags for shell.js, then browser.js, at each level of the
     // test path hierarchy.
     var prepath = "";
     var scripts = [];
     for (var i = 0; i < testpathparts.length - 1; i++) {
       prepath += testpathparts[i] + "/";
 
@@ -532,20 +533,16 @@
     // Output the test script itself.
     var moduleTest = !!properties.module;
     scripts.push({src: prepath + testFileName, module: moduleTest});
 
     // Finally output the driver-end script to advance to the next test.
     scripts.push({src: "js-test-driver-end.js", module: false});
 
     if (!moduleTest) {
-      // XXX bc - the first document.written script is ignored if the protocol
-      // is file:. insert an empty script tag, to work around it.
-      document.write("<script></script>");
-
       var key, value;
       if (properties.language !== "type") {
         key = "language";
         value = "javascript";
         if (properties.version) {
           value += properties.version;
         }
       } else {