Bug 1309842 - Fix eslint/espree parsing errors for ignored directories in browser/. r=jaws
authorMark Banner <standard8@mozilla.com>
Thu, 13 Oct 2016 11:48:35 +0100
changeset 317798 dcfc73c043c01c3185631262605e3511bebe4cca
parent 317797 869a14571e7e58445b0a33723887cf09de5cbc4a
child 317799 dbf37ac1be57edff4569185c2c970165ec4de73d
push id33146
push usermbanner@mozilla.com
push dateThu, 13 Oct 2016 17:12:08 +0000
treeherderautoland@dcfc73c043c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1309842
milestone52.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 1309842 - Fix eslint/espree parsing errors for ignored directories in browser/. r=jaws Change functions definitions to generators where yield is used, and drop of non-standards if statement in catch. List translation/cld2/cld-worker.js as ignored now, as it is a generated file. MozReview-Commit-ID: wbkjx67fox
.eslintignore
browser/components/downloads/test/browser/head.js
browser/components/sessionstore/test/head.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -64,16 +64,18 @@ browser/base/content/test/general/file_c
 browser/base/content/test/urlbar/file_blank_but_not_blank.html
 browser/base/content/newtab/**
 browser/components/downloads/**
 browser/components/feeds/**
 browser/components/privatebrowsing/**
 browser/components/sessionstore/**
 browser/components/tabview/**
 browser/components/translation/**
+# generated files in cld2
+browser/components/translation/cld2/cld-worker.js
 browser/extensions/pdfjs/**
 # generated or library files in pocket
 browser/extensions/pocket/content/panels/js/tmpl.js
 browser/extensions/pocket/content/panels/js/vendor/**
 browser/locales/**
 
 # devtools/ exclusions
 devtools/client/canvasdebugger/**
--- a/browser/components/downloads/test/browser/head.js
+++ b/browser/components/downloads/test/browser/head.js
@@ -136,17 +136,17 @@ function promisePanelOpened()
     // Defer to the next tick of the event loop so that we don't continue
     // processing during the DOM event handler itself.
     setTimeout(deferred.resolve, 0);
   };
 
   return deferred.promise;
 }
 
-function task_resetState()
+function* task_resetState()
 {
   // Remove all downloads.
   let publicList = yield Downloads.getList(Downloads.PUBLIC);
   let downloads = yield publicList.getAll();
   for (let download of downloads) {
     publicList.remove(download);
     yield download.finalize(true);
   }
@@ -180,26 +180,26 @@ function* task_addDownloads(aItems)
     // `"errorObj" in download` must be false when there's no error.
     if (item.errorObj) {
       download.errorObj = item.errorObj;
     }
     yield publicList.add(yield Downloads.createDownload(download));
   }
 }
 
-function task_openPanel()
+function* task_openPanel()
 {
   yield promiseFocus();
 
   let promise = promisePanelOpened();
   DownloadsPanel.showPanel();
   yield promise;
 }
 
-function setDownloadDir() {
+function* setDownloadDir() {
   let tmpDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
   tmpDir.append("testsavedir");
   if (!tmpDir.exists()) {
     tmpDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
     registerCleanupFunction(function () {
       try {
         tmpDir.remove(true);
       } catch (e) {
--- a/browser/components/sessionstore/test/head.js
+++ b/browser/components/sessionstore/test/head.js
@@ -268,19 +268,21 @@ function promiseRecoveryFileContents() {
   });
 }
 
 var promiseForEachSessionRestoreFile = Task.async(function*(cb) {
   for (let key of SessionFile.Paths.loadOrder) {
     let data = "";
     try {
       data = yield OS.File.read(SessionFile.Paths[key], { encoding: "utf-8" });
-    } catch (ex if ex instanceof OS.File.Error
-	     && ex.becauseNoSuchFile) {
+    } catch (ex) {
       // Ignore missing files
+      if (!(ex instanceof OS.File.Error && ex.becauseNoSuchFile)) {
+        throw ex;
+      }
     }
     cb(data, key);
   }
 });
 
 function promiseBrowserLoaded(aBrowser, ignoreSubFrames = true) {
   return BrowserTestUtils.browserLoaded(aBrowser, !ignoreSubFrames);
 }
@@ -297,17 +299,17 @@ function promiseWindowLoaded(aWindow) {
   return new Promise(resolve => whenWindowLoaded(aWindow, resolve));
 }
 
 var gUniqueCounter = 0;
 function r() {
   return Date.now() + "-" + (++gUniqueCounter);
 }
 
-function BrowserWindowIterator() {
+function* BrowserWindowIterator() {
   let windowsEnum = Services.wm.getEnumerator("navigator:browser");
   while (windowsEnum.hasMoreElements()) {
     let currentWindow = windowsEnum.getNext();
     if (!currentWindow.closed) {
       yield currentWindow;
     }
   }
 }
@@ -367,17 +369,17 @@ var gProgressListener = {
       let args = [browser].concat(gProgressListener._countTabs());
       gProgressListener._callback.apply(gProgressListener, args);
     }
   },
 
   _countTabs: function () {
     let needsRestore = 0, isRestoring = 0, wasRestored = 0;
 
-    for (let win in BrowserWindowIterator()) {
+    for (let win of BrowserWindowIterator()) {
       for (let i = 0; i < win.gBrowser.tabs.length; i++) {
         let browser = win.gBrowser.tabs[i].linkedBrowser;
         if (!browser.__SS_restoreState)
           wasRestored++;
         else if (browser.__SS_restoreState == TAB_STATE_RESTORING)
           isRestoring++;
         else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
           needsRestore++;
@@ -389,17 +391,17 @@ var gProgressListener = {
 
 registerCleanupFunction(function () {
   gProgressListener.unsetCallback();
 });
 
 // Close all but our primary window.
 function promiseAllButPrimaryWindowClosed() {
   let windows = [];
-  for (let win in BrowserWindowIterator()) {
+  for (let win of BrowserWindowIterator()) {
     if (win != window) {
       windows.push(win);
     }
   }
 
   return Promise.all(windows.map(BrowserTestUtils.closeWindow));
 }