Bug 1330058 - re-enable eslint for toolkit/components/windowcreator|windowwatcher, r=mossop
authorMyk Melez <myk@mykzilla.org>
Thu, 12 Jan 2017 16:41:01 -0800
changeset 376507 0f37bb9f5af0e2e67fe348c814aea5f2884f4765
parent 376506 8cf18e375fdeb9d0e60fd31f9bd3a86b0a4e1a64
child 376508 17a962c65f48643180d586790f1340093d658b32
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1330058
milestone53.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 1330058 - re-enable eslint for toolkit/components/windowcreator|windowwatcher, r=mossop
.eslintignore
toolkit/components/windowcreator/test/browser_bug1204626.js
toolkit/components/windowcreator/test/test_bug293834.html
toolkit/components/windowcreator/test/test_bug449141.html
toolkit/components/windowcreator/test/test_bug499115.html
toolkit/components/windowcreator/test/test_nsFind.html
toolkit/components/windowcreator/test/test_window_open_units.html
toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js
toolkit/components/windowwatcher/test/browser_new_content_window_from_chrome_principal.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -192,18 +192,16 @@ toolkit/components/help/**
 # Intentionally invalid JS
 toolkit/components/workerloader/tests/moduleF-syntax-error.js
 
 # Tests old non-star function generators
 toolkit/modules/tests/xpcshell/test_task.js
 
 # Not yet updated
 toolkit/components/osfile/**
-toolkit/components/windowcreator/**
-toolkit/components/windowwatcher/**
 
 # External code:
 toolkit/components/microformats/test/**
 toolkit/components/reader/Readability.js
 toolkit/components/reader/JSDOMParser.js
 
 # Uses preprocessing
 toolkit/content/widgets/wizard.xml
--- a/toolkit/components/windowcreator/test/browser_bug1204626.js
+++ b/toolkit/components/windowcreator/test/browser_bug1204626.js
@@ -11,25 +11,25 @@ function one_test(delay, continuation) {
 
   BrowserTestUtils.openNewForegroundTab(gBrowser, testPageURL).then((tab) => {
     browser = tab.linkedBrowser;
     let persistable = browser.QueryInterface(Ci.nsIFrameLoaderOwner)
                              .frameLoader
                              .QueryInterface(Ci.nsIWebBrowserPersistable);
     persistable.startPersistence(/* outer window ID: */ 0, {
       onDocumentReady,
-      onError: function(status) {
+      onError(status) {
         ok(false, new Components.Exception("startPersistence failed", status));
         continuation();
       }
     });
   });
 
   function onDocumentReady(doc) {
-    const nameStem="test_bug1204626_" + Date.now();
+    const nameStem = "test_bug1204626_" + Date.now();
     let wbp = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
               .createInstance(Ci.nsIWebBrowserPersist);
     let tmp = Cc["@mozilla.org/file/directory_service;1"]
               .getService(Ci.nsIProperties)
               .get("TmpD", Ci.nsIFile);
     let tmpFile = tmp.clone();
     tmpFile.append(nameStem + "_saved.html");
     let tmpDir = tmp.clone();
@@ -40,21 +40,21 @@ function one_test(delay, continuation) {
         tmpFile.remove(/* recursive: */ false);
       }
       if (tmpDir.exists()) {
         tmpDir.remove(/* recursive: */ true);
       }
     });
 
     wbp.progressListener = {
-      onProgressChange: function(){},
-      onLocationChange: function(){},
-      onStatusChange: function(){},
-      onSecurityChange: function(){},
-      onStateChange: function wbp_stateChange(_wbp, _req, state, _status) {
+      onProgressChange() {},
+      onLocationChange() {},
+      onStatusChange() {},
+      onSecurityChange() {},
+      onStateChange(_wbp, _req, state, _status) {
         if ((state & Ci.nsIWebProgressListener.STATE_STOP) == 0) {
           return;
         }
         ok(true, "Finished save (" + delayStr + ") but might have crashed.");
         continuation();
       }
     }
 
--- a/toolkit/components/windowcreator/test/test_bug293834.html
+++ b/toolkit/components/windowcreator/test/test_bug293834.html
@@ -22,37 +22,37 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">
 <script class="testbody" type="text/javascript">
 /** Test for Bug 293834 **/
 
 var textareas = ["a-textbox", "a-prefilled-textbox"];
 var textboxes = ["a-text", "a-prefilled-text"];
 
 function fillform(doc) {
-    for (var i in textareas) {
+    for (let i in textareas) {
         doc.getElementById(textareas[i]).textContent += "form state";
     }
-    for (var i in textboxes) {
+    for (let i in textboxes) {
         doc.getElementById(textboxes[i]).value += "form state";
     }
     doc.getElementById('a-checkbox').checked = true;
     doc.getElementById("radioa").checked = true;
     doc.getElementById("aselect").selectedIndex = 0;
 }
 
 function checkform(doc) {
-    for (var i in textareas) {
+    for (let i in textareas) {
         var textContent = doc.getElementById(textareas[i]).textContent;
         ok(/form\s+state/m.test(textContent),
-            "Modified textarea "+textareas[i]+" form state not preserved!");
+            "Modified textarea " + textareas[i] + " form state not preserved!");
     }
-    for (var i in textboxes) {
+    for (let i in textboxes) {
         var value = doc.getElementById(textboxes[i]).value;
         ok(/form\s+state/m.test(value),
-            "Modified textbox "+textboxes[i]+" form state not preserved!");
+            "Modified textbox " + textboxes[i] + " form state not preserved!");
     }
     ok(doc.getElementById('a-checkbox').checked,
         "Modified checkbox checked state not preserved!");
     ok(doc.getElementById("radioa").checked,
         "Modified radio checked state not preserved!");
     ok(doc.getElementById("aselect").selectedIndex == 0,
         "Modified select selected index not preserved");
 }
@@ -65,27 +65,27 @@ function getTempDir() {
             .getService(Ci.nsIProperties)
             .get("TmpD", Ci.nsILocalFile);
 }
 
 function getFileContents(aFile) {
     const PR_RDONLY = 0x01;
     var fileStream = Cc["@mozilla.org/network/file-input-stream;1"]
                         .createInstance(Ci.nsIFileInputStream);
-    fileStream.init(aFile, PR_RDONLY, 0400,
+    fileStream.init(aFile, PR_RDONLY, 0o400,
                     Ci.nsIFileInputStream.DELETE_ON_CLOSE
                   | Ci.nsIFileInputStream.CLOSE_ON_EOF);
     var inputStream = Cc["@mozilla.org/scriptableinputstream;1"]
                         .createInstance(Ci.nsIScriptableInputStream);
     inputStream.init(fileStream);
     var data = "";
     do {
         var str = inputStream.read(inputStream.available());
         data += str;
-    } while(str.length > 0);
+    } while (str.length > 0);
 
     return data;
 }
 
 function persistDocument(aDoc) {
     const nsIWBP = Ci.nsIWebBrowserPersist;
     const persistFlags =
                   nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES
--- a/toolkit/components/windowcreator/test/test_bug449141.html
+++ b/toolkit/components/windowcreator/test/test_bug449141.html
@@ -29,35 +29,35 @@ function getTempDir() {
             .getService(Ci.nsIProperties)
             .get("TmpD", Ci.nsILocalFile);
 }
 
 // STATE_STOP from nsIWebProgressListener.idl
 const STATE_STOP = 0x00000010;
 
 var progressListener = {
-  onProgressChange: function() {
+  onProgressChange() {
     /* Ignore progress callback */
   },
-  onStateChange: function(aProgress, aRequest, aStateFlag, aStatus) {
+  onStateChange(aProgress, aRequest, aStateFlag, aStatus) {
     if (aStateFlag & STATE_STOP) {
       var dirExists = false;
       var videoExists = false;
 
       var videoFile = getTempDir();
       videoFile.append(this.dirName);
       dirExists = videoFile.exists();
       videoFile.append("320x240.ogv");
       videoExists = videoFile.exists();
       this.folder.remove(true);
       this.file.remove(false);
       ok(dirExists, 'Directory containing video file should be created');
       ok(videoExists, 'Video should be persisted with document');
       SimpleTest.finish();
-    }    
+    }
   }
 };
 
 function persistDocument(aDoc) {
     const nsIWBP = Ci.nsIWebBrowserPersist;
     const persistFlags =
                   nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES
                 | nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION
--- a/toolkit/components/windowcreator/test/test_bug499115.html
+++ b/toolkit/components/windowcreator/test/test_bug499115.html
@@ -18,17 +18,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <div id="content" style="display: none">
   </div>
   <pre id="test">
     <script type="application/javascript">
 
       /** Test for Bug 499115 **/
       SimpleTest.waitForExplicitFinish();
 
-      const SEARCH_TEXT="minefield";
+      const SEARCH_TEXT = "minefield";
 
       function getMatches() {
         var numMatches = 0;
 
         var searchRange = document.createRange();
         searchRange.selectNodeContents(document.body);
 
         var startPoint = searchRange.cloneRange();
--- a/toolkit/components/windowcreator/test/test_nsFind.html
+++ b/toolkit/components/windowcreator/test/test_nsFind.html
@@ -34,63 +34,63 @@ https://bugzilla.mozilla.org/show_bug.cg
   var endPt = searchRange;
 
   // Check |null| detection on |aPatText| parameter.
   try {
     rf.Find(null, searchRange, startPt, endPt);
 
     ok(false, "Missing NS_ERROR_NULL_POINTER exception");
   } catch (e) {
-    e = SpecialPowers.wrap(e);
-    if (e.result == SpecialPowers.Cr.NS_ERROR_NULL_POINTER) {
+    let wrappedError = SpecialPowers.wrap(e);
+    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_NULL_POINTER) {
       ok(true, null);
     } else {
-      throw e;
+      throw wrappedError;
     }
   }
 
   // Check |null| detection on |aSearchRange| parameter.
   try {
     rf.Find("", null, startPt, endPt);
 
     ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
   } catch (e) {
-    e = SpecialPowers.wrap(e);
-    if (e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+    let wrappedError = SpecialPowers.wrap(e);
+    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
       ok(true, null);
     } else {
-      throw e;
+      throw wrappedError;
     }
   }
 
   // Check |null| detection on |aStartPoint| parameter.
   try {
     rf.Find("", searchRange, null, endPt);
 
     ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
   } catch (e) {
-    e = SpecialPowers.wrap(e);
-    if (e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+    let wrappedError = SpecialPowers.wrap(e);
+    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
       ok(true, null);
     } else {
-      throw e;
+      throw wrappedError;
     }
   }
 
   // Check |null| detection on |aEndPoint| parameter.
   try {
     rf.Find("", searchRange, startPt, null);
 
     ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
   } catch (e) {
-    e = SpecialPowers.wrap(e);
-    if (e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+    let wrappedError = SpecialPowers.wrap(e);
+    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
       ok(true, null);
     } else {
-      throw e;
+      throw wrappedError;
     }
   }
 
   var searchValue, retRange;
 
   rf.findBackwards = false;
 
   rf.caseSensitive = false;
--- a/toolkit/components/windowcreator/test/test_window_open_units.html
+++ b/toolkit/components/windowcreator/test/test_window_open_units.html
@@ -12,17 +12,16 @@
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 SimpleTest.waitForExplicitFinish();
 
 SimpleTest.waitForFocus(function() {
   SpecialPowers.setFullZoom(window, 2);
 
-  var p = window;
   var w = window.open("about:blank", "", "width=200,height=100");
   SimpleTest.waitForFocus(function() {
     ok(w.innerWidth <= 402 && w.innerWidth >= 398,
        "width (" + w.innerWidth + ") should be around twice what was requested (200)");
     ok(w.innerHeight <= 202 && w.innerHeight >= 198,
        "height (" + w.innerHeight + ") should be around twice what was requested (100)");
 
     SpecialPowers.setFullZoom(window, 1);
--- a/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js
+++ b/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js
@@ -238,17 +238,17 @@ add_task(function* test_new_remote_windo
     let b = win.gBrowser.selectedBrowser;
     let contentChromeFlags = yield ContentTask.spawn(b, null, function*() {
       docShell.QueryInterface(Ci.nsIInterfaceRequestor);
       try {
         // This will throw if we're not a remote browser.
         return docShell.getInterface(Ci.nsITabChild)
                        .QueryInterface(Ci.nsIWebBrowserChrome)
                        .chromeFlags;
-      } catch(e) {
+      } catch (e) {
         // This must be a non-remote browser...
         return docShell.QueryInterface(Ci.nsIDocShellTreeItem)
                        .treeOwner
                        .QueryInterface(Ci.nsIWebBrowserChrome)
                        .chromeFlags;
       }
     });
 
--- a/toolkit/components/windowwatcher/test/browser_new_content_window_from_chrome_principal.js
+++ b/toolkit/components/windowwatcher/test/browser_new_content_window_from_chrome_principal.js
@@ -26,9 +26,9 @@ add_task(function* test_chrome_opens_win
     Assert.ok(!content.document.nodePrincipal.isSystemPrincipal,
               "We should not have a system principal.")
     Assert.equal(content.document.nodePrincipal.origin,
                  "http://example.com",
                  "Should have the example.com principal");
   });
 
   yield BrowserTestUtils.closeWindow(win);
-});
\ No newline at end of file
+});