Bug 1311347 - Enable eslint of browser/components/sessionstore/. Initial changes by Sourav, updated by Standard8. r?jaws draft
authorjordan9769 <souravgarg833@gmail.com>
Fri, 28 Oct 2016 02:48:50 +0530
changeset 498149 bb9c73e9f415c99ae1ec2b5044216fc03b6eedc1
parent 497875 6d38ad302429c98115c354d643e81987ecec5d3c
child 498150 f2452eb40bdcd7b9193c33fd33f9e705f8aec7a8
push id49132
push userbmo:standard8@mozilla.com
push dateTue, 14 Mar 2017 12:36:13 +0000
reviewersjaws
bugs1311347
milestone55.0a1
Bug 1311347 - Enable eslint of browser/components/sessionstore/. Initial changes by Sourav, updated by Standard8. r?jaws MozReview-Commit-ID: 4RFxoV8SkIa
.eslintignore
browser/components/sessionstore/ContentRestore.jsm
browser/components/sessionstore/PrivacyFilter.jsm
browser/components/sessionstore/SessionFile.jsm
browser/components/sessionstore/SessionStore.jsm
browser/components/sessionstore/content/aboutSessionRestore.js
browser/components/sessionstore/content/content-sessionStore.js
browser/components/sessionstore/nsSessionStartup.js
browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
browser/components/sessionstore/test/browser_394759_behavior.js
browser/components/sessionstore/test/browser_459906_sample.html
browser/components/sessionstore/test/browser_461743_sample.html
browser/components/sessionstore/test/browser_506482.js
browser/components/sessionstore/test/browser_522545.js
browser/components/sessionstore/test/browser_586147.js
browser/components/sessionstore/test/browser_597071.js
browser/components/sessionstore/test/browser_662743.js
browser/components/sessionstore/test/browser_911547.js
browser/components/sessionstore/test/browser_cleaner.js
browser/components/sessionstore/test/browser_dying_cache.js
browser/components/sessionstore/test/browser_form_restore_events.js
browser/components/sessionstore/test/browser_formdata_format.js
browser/components/sessionstore/test/browser_frame_history.js
browser/components/sessionstore/test/browser_parentProcessRestoreHash.js
browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js
browser/components/sessionstore/test/unit/head.js
browser/components/sessionstore/test/unit/test_startup_nosession_async.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -56,17 +56,19 @@ b2g/locales/en-US/b2g-l10n.js
 browser/app/**
 browser/branding/**/firefox-branding.js
 browser/base/content/nsContextMenu.js
 browser/base/content/sanitizeDialog.js
 browser/base/content/test/general/file_csp_block_all_mixedcontent.html
 browser/base/content/test/urlbar/file_blank_but_not_blank.html
 browser/base/content/newtab/**
 browser/components/downloads/**
-browser/components/sessionstore/**
+# Test files that are really json not js, and don't need to be linted.
+browser/components/sessionstore/test/unit/data/sessionstore_valid.js
+browser/components/sessionstore/test/unit/data/sessionstore_invalid.js
 browser/components/tabview/**
 # generated & special files in cld2
 browser/components/translation/cld2/**
 browser/extensions/pdfjs/content/build**
 browser/extensions/pdfjs/content/web**
 # generated or library files in pocket
 browser/extensions/pocket/content/panels/js/tmpl.js
 browser/extensions/pocket/content/panels/js/vendor/**
--- a/browser/components/sessionstore/ContentRestore.jsm
+++ b/browser/components/sessionstore/ContentRestore.jsm
@@ -238,21 +238,24 @@ ContentRestoreInternal.prototype = {
       } else {
         // If there's nothing to restore, we should still blank the page.
         webNavigation.loadURI("about:blank",
                               Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY,
                               null, null, null);
       }
 
       return true;
-    } catch (ex if ex instanceof Ci.nsIException) {
-      // Ignore page load errors, but return false to signal that the load never
-      // happened.
-      return false;
+    } catch (ex) {
+      if (ex instanceof Ci.nsIException) {
+        // Ignore page load errors, but return false to signal that the load never
+        // happened.
+        return false;
+      }
     }
+    return null;
   },
 
   /**
    * To be called after restoreHistory(). Removes all listeners needed for
    * pending tabs and makes sure to notify when the tab finished loading.
    */
   restoreTabContentStarted(finishCallback) {
     // The reload listener is no longer needed.
--- a/browser/components/sessionstore/PrivacyFilter.jsm
+++ b/browser/components/sessionstore/PrivacyFilter.jsm
@@ -46,17 +46,17 @@ this.PrivacyFilter = Object.freeze({
    * @param data The form data as collected from a tab.
    * @return object
    */
   filterFormData: function (data) {
     // If the given form data object has an associated URL that we are not
     // allowed to store data for, bail out. We explicitly discard data for any
     // children as well even if storing data for those frames would be allowed.
     if (data.url && !PrivacyLevel.check(data.url)) {
-      return;
+      return null;
     }
 
     let retval = {};
 
     for (let key of Object.keys(data)) {
       if (key === "children") {
         let recurse = child => this.filterFormData(child);
         let children = data.children.map(recurse).filter(child => child);
--- a/browser/components/sessionstore/SessionFile.jsm
+++ b/browser/components/sessionstore/SessionFile.jsm
@@ -236,27 +236,29 @@ var SessionFileInternal = {
           source: source,
           parsed: parsed
         };
         Telemetry.getHistogramById("FX_SESSION_RESTORE_CORRUPT_FILE").
           add(false);
         Telemetry.getHistogramById("FX_SESSION_RESTORE_READ_FILE_MS").
           add(Date.now() - startMs);
         break;
-      } catch (ex if ex instanceof OS.File.Error && ex.becauseNoSuchFile) {
-        exists = false;
-      } catch (ex if ex instanceof OS.File.Error) {
-        // The file might be inaccessible due to wrong permissions
-        // or similar failures. We'll just count it as "corrupted".
-        console.error("Could not read session file ", ex, ex.stack);
-        corrupted = true;
-      } catch (ex if ex instanceof SyntaxError) {
-        console.error("Corrupt session file (invalid JSON found) ", ex, ex.stack);
-        // File is corrupted, try next file
-        corrupted = true;
+      } catch (ex) {
+          if (ex instanceof OS.File.Error && ex.becauseNoSuchFile) {
+            exists = false;
+          } else if (ex instanceof OS.File.Error) {
+            // The file might be inaccessible due to wrong permissions
+            // or similar failures. We'll just count it as "corrupted".
+            console.error("Could not read session file ", ex, ex.stack);
+            corrupted = true;
+          } else if (ex instanceof SyntaxError) {
+            console.error("Corrupt session file (invalid JSON found) ", ex, ex.stack);
+            // File is corrupted, try next file
+            corrupted = true;
+          }
       } finally {
         if (exists) {
           noFilesFound = false;
           Telemetry.getHistogramById("FX_SESSION_RESTORE_CORRUPT_FILE").
             add(corrupted);
         }
       }
     }
@@ -377,17 +379,17 @@ var SessionFileInternal = {
     });
   },
 
   wipe: function () {
     return this._postToWorker("wipe");
   },
 
   _recordTelemetry: function(telemetry) {
-    for (let id of Object.keys(telemetry)){
+    for (let id of Object.keys(telemetry)) {
       let value = telemetry[id];
       let samples = [];
       if (Array.isArray(value)) {
         samples.push(...value);
       } else {
         samples.push(value);
       }
       let histogram = Telemetry.getHistogramById(id);
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -953,17 +953,17 @@ var SessionStoreInternal = {
 
   /**
    * Record telemetry measurements stored in an object.
    * @param telemetry
    *        {histogramID: value, ...} An object mapping histogramIDs to the
    *        value to be recorded for that ID,
    */
   recordTelemetry: function (telemetry) {
-    for (let histogramId in telemetry){
+    for (let histogramId in telemetry) {
       Telemetry.getHistogramById(histogramId).add(telemetry[histogramId]);
     }
   },
 
   /* ........ Window Event Handlers .............. */
 
   /**
    * Implement nsIDOMEventListener for handling various window and tab events
@@ -1646,17 +1646,17 @@ var SessionStoreInternal = {
     progress.current = 0;
 
     // We'll iterate through the Promise array, yielding each one, so as to
     // provide useful progress information to AsyncShutdown.
     for (let [win, promise] of windowPromises) {
       yield promise;
       this._collectWindowData(win);
       progress.current++;
-    };
+    }
 
     // We must cache this because _getMostRecentBrowserWindow will always
     // return null by the time quit-application occurs.
     var activeWindow = this._getMostRecentBrowserWindow();
     if (activeWindow)
       this.activeWindowSSiCache = activeWindow.__SSi || "";
     DirtyWindows.clear();
   }),
@@ -2853,16 +2853,17 @@ var SessionStoreInternal = {
       });
     }
 
     // Don't continue if the tab was closed before TabStateFlusher.flush resolves.
     if (tab.linkedBrowser) {
       let tabState = TabState.collect(tab);
       return { index: tabState.index - 1, entries: tabState.entries }
     }
+    return null;
   },
 
   /**
    * See if aWindow is usable for use when restoring a previous session via
    * restoreLastSession. If usable, prepare it for use.
    *
    * @param aWindow
    *        the window to inspect & prepare
--- a/browser/components/sessionstore/content/aboutSessionRestore.js
+++ b/browser/components/sessionstore/content/aboutSessionRestore.js
@@ -236,19 +236,25 @@ function toggleRowChecked(aIx) {
   if (treeView.isContainer(aIx)) {
     // (un)check all tabs of this window as well
     for (let tab of item.tabs) {
       tab.checked = item.checked;
       treeView.treeBox.invalidateRow(gTreeData.indexOf(tab));
     }
   }
   else {
-    // update the window's checkmark as well (0 means "partially checked")
-    item.parent.checked = item.parent.tabs.every(isChecked) ? true :
-                          item.parent.tabs.some(isChecked) ? 0 : false;
+    // Update the window's checkmark as well (0 means "partially checked").
+    let state = false;
+    if (item.parent.tabs.every(isChecked)) {
+      state = true;
+    } else if (item.parent.tabs.some(isChecked)) {
+      state = 0;
+    }
+    item.parent.checked = state;
+
     treeView.treeBox.invalidateRow(gTreeData.indexOf(item.parent));
   }
 
   // we only disable the button when there's no cancel button.
   if (document.getElementById("errorCancel")) {
     document.getElementById("errorTryAgain").disabled = !gTreeData.some(isChecked);
   }
 }
@@ -276,17 +282,17 @@ function restoreSingleTab(aIx, aShifted)
 var treeView = {
   treeBox: null,
   selection: null,
 
   get rowCount()                     { return gTreeData.length; },
   setTree: function(treeBox)         { this.treeBox = treeBox; },
   getCellText: function(idx, column) { return gTreeData[idx].label; },
   isContainer: function(idx)         { return "open" in gTreeData[idx]; },
-  getCellValue: function(idx, column){ return gTreeData[idx].checked; },
+  getCellValue: function(idx, column) { return gTreeData[idx].checked; },
   isContainerOpen: function(idx)     { return gTreeData[idx].open; },
   isContainerEmpty: function(idx)    { return false; },
   isSeparator: function(idx)         { return false; },
   isSorted: function()               { return false; },
   isEditable: function(idx, column)  { return false; },
   canDrop: function(idx, orientation, dt) { return false; },
   getLevel: function(idx)            { return this.isContainer(idx) ? 0 : 1; },
 
--- a/browser/components/sessionstore/content/content-sessionStore.js
+++ b/browser/components/sessionstore/content/content-sessionStore.js
@@ -827,23 +827,25 @@ var MessageQueue = {
 
     try {
       // Send all data to the parent process.
       sendAsyncMessage("SessionStore:update", {
         data, telemetry, flushID,
         isFinal: options.isFinal || false,
         epoch: gCurrentEpoch
       });
-    } catch (ex if ex && ex.result == Cr.NS_ERROR_OUT_OF_MEMORY) {
-      let telemetry = {
-        FX_SESSION_RESTORE_SEND_UPDATE_CAUSED_OOM: 1
-      };
-      sendAsyncMessage("SessionStore:error", {
-        telemetry
-      });
+    } catch (ex) {
+        if (ex && ex.result == Cr.NS_ERROR_OUT_OF_MEMORY) {
+          let telemetry = {
+            FX_SESSION_RESTORE_SEND_UPDATE_CAUSED_OOM: 1
+          };
+          sendAsyncMessage("SessionStore:error", {
+            telemetry
+          });
+        }
     }
   },
 };
 
 EventListener.init();
 MessageListener.init();
 FormDataListener.init();
 PageStyleListener.init();
--- a/browser/components/sessionstore/nsSessionStartup.js
+++ b/browser/components/sessionstore/nsSessionStartup.js
@@ -168,45 +168,40 @@ SessionStartup.prototype = {
 
     let resumeFromCrash = Services.prefs.getBoolPref("browser.sessionstore.resume_from_crash");
 
     CrashMonitor.previousCheckpoints.then(checkpoints => {
       if (checkpoints) {
         // If the previous session finished writing the final state, we'll
         // assume there was no crash.
         this._previousSessionCrashed = !checkpoints["sessionstore-final-state-write-complete"];
-
-      } else {
+      } else if (noFilesFound) {
         // If the Crash Monitor could not load a checkpoints file it will
         // provide null. This could occur on the first run after updating to
         // a version including the Crash Monitor, or if the checkpoints file
         // was removed, or on first startup with this profile, or after Firefox Reset.
 
-        if (noFilesFound) {
-          // There was no checkpoints file and no sessionstore.js or its backups
-          // so we will assume that this was a fresh profile.
-          this._previousSessionCrashed = false;
+        // There was no checkpoints file and no sessionstore.js or its backups
+        // so we will assume that this was a fresh profile.
+        this._previousSessionCrashed = false;
+      } else {
+        // If this is the first run after an update, sessionstore.js should
+        // still contain the session.state flag to indicate if the session
+        // crashed. If it is not present, we will assume this was not the first
+        // run after update and the checkpoints file was somehow corrupted or
+        // removed by a crash.
+        //
+        // If the session.state flag is present, we will fallback to using it
+        // for crash detection - If the last write of sessionstore.js had it
+        // set to "running", we crashed.
+        let stateFlagPresent = (this._initialState.session &&
+                                this._initialState.session.state);
 
-        } else {
-          // If this is the first run after an update, sessionstore.js should
-          // still contain the session.state flag to indicate if the session
-          // crashed. If it is not present, we will assume this was not the first
-          // run after update and the checkpoints file was somehow corrupted or
-          // removed by a crash.
-          //
-          // If the session.state flag is present, we will fallback to using it
-          // for crash detection - If the last write of sessionstore.js had it
-          // set to "running", we crashed.
-          let stateFlagPresent = (this._initialState.session &&
-                                  this._initialState.session.state);
-
-
-          this._previousSessionCrashed = !stateFlagPresent ||
-            (this._initialState.session.state == STATE_RUNNING_STR);
-        }
+        this._previousSessionCrashed = !stateFlagPresent ||
+          (this._initialState.session.state == STATE_RUNNING_STR);
       }
 
       // Report shutdown success via telemetry. Shortcoming here are
       // being-killed-by-OS-shutdown-logic, shutdown freezing after
       // session restore was written, etc.
       Services.telemetry.getHistogramById("SHUTDOWN_OK").add(!this._previousSessionCrashed);
 
       // set the startup type
--- a/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
+++ b/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
@@ -30,17 +30,17 @@ function test() {
     for (let win of windowsToClose) {
       yield BrowserTestUtils.closeWindow(win);
     }
   });
 
   function test(aLambda) {
     try {
       return aLambda() || true;
-    } catch(ex) { }
+    } catch (ex) { }
     return false;
   }
 
   function getElementByXPath(aTab, aQuery) {
     let doc = aTab.linkedBrowser.contentDocument;
     let xptype = Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
     return doc.evaluate(aQuery, doc, null, xptype, null).singleNodeValue;
   }
--- a/browser/components/sessionstore/test/browser_394759_behavior.js
+++ b/browser/components/sessionstore/test/browser_394759_behavior.js
@@ -68,9 +68,9 @@ add_task(function* test_closed_window_st
                         {isPopup: false},
                         {isPopup: false},
                         {isPopup: false},
                         {isPopup: false}];
   let expectedResults2 = {mac: {popup: 0, normal: 3},
                           other: {popup: 0, normal: 3}};
 
   yield testWindows(windowsToOpen2, expectedResults2);
-});
\ No newline at end of file
+});
--- a/browser/components/sessionstore/test/browser_459906_sample.html
+++ b/browser/components/sessionstore/test/browser_459906_sample.html
@@ -31,11 +31,11 @@
         r.overrideMimeType("text/plain");
         r.send(null);
       }
 
       return "on";
     });
 
     frames[1].document.designMode = "on";
-  };
+  }
 </script>
 </body>
--- a/browser/components/sessionstore/test/browser_461743_sample.html
+++ b/browser/components/sessionstore/test/browser_461743_sample.html
@@ -46,11 +46,11 @@
     }
 
     frames[0].document.addEventListener("DOMNodeInserted", loadChrome, true);
     frames[0].document.addEventListener("DOMNodeInserted", delay, true);
     frames[0].document.addEventListener("DOMNodeInserted", loadExploit, true);
     frames[0].document.addEventListener("DOMNodeInserted", done, true);
 
     frames[0].document.designMode = "on";
-  };
+  }
 </script>
 </body>
--- a/browser/components/sessionstore/test/browser_506482.js
+++ b/browser/components/sessionstore/test/browser_506482.js
@@ -14,20 +14,20 @@ function test() {
                     get("ProfD", Ci.nsIFile);
   function getSessionstoreFile() {
     let sessionStoreJS = profilePath.clone();
     sessionStoreJS.append("sessionstore.js");
     return sessionStoreJS;
   }
   function getSessionstorejsModificationTime() {
     let file = getSessionstoreFile();
-    if (file.exists())
+    if (file.exists()) {
       return file.lastModifiedTime;
-    else
-      return -1;
+    }
+    return -1;
   }
 
   // delete existing sessionstore.js, to make sure we're not reading
   // the mtime of an old one initially.
   let sessionStoreJS = getSessionstoreFile();
   if (sessionStoreJS.exists())
     sessionStoreJS.remove(false);
 
--- a/browser/components/sessionstore/test/browser_522545.js
+++ b/browser/components/sessionstore/test/browser_522545.js
@@ -189,17 +189,17 @@ function test() {
       // Make sure this tab isn't loading and state is clear before we test.
       is(browser.userTypedValue, null, "userTypedValue is empty to start");
       ok(!browser.didStartLoadSinceLastUserTyping(),
          "Initially, no load should be ongoing");
 
       let inputText = "example.org";
       gURLBar.focus();
       gURLBar.value = inputText.slice(0, -1);
-      EventUtils.synthesizeKey(inputText.slice(-1) , {});
+      EventUtils.synthesizeKey(inputText.slice(-1), {});
 
       executeSoon(function () {
         is(browser.userTypedValue, "example.org",
            "userTypedValue was set when changing URLBar value");
         ok(!browser.didStartLoadSinceLastUserTyping(),
            "No load started since changing URLBar value");
 
         // Now make sure ss gets these values too
--- a/browser/components/sessionstore/test/browser_586147.js
+++ b/browser/components/sessionstore/test/browser_586147.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function observeOneRestore(callback) {
   let topic = "sessionstore-browser-state-restored";
   Services.obs.addObserver(function onRestore() {
     Services.obs.removeObserver(onRestore, topic);
     callback();
   }, topic, false);
-};
+}
 
 function test() {
   waitForExplicitFinish();
 
   // There should be one tab when we start the test
   let [origTab] = gBrowser.visibleTabs;
   let hiddenTab = gBrowser.addTab();
 
--- a/browser/components/sessionstore/test/browser_597071.js
+++ b/browser/components/sessionstore/test/browser_597071.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Bug 597071 - Closed windows should only be resurrected when there is a single
  * popup window
  */
-add_task(function test_close_last_nonpopup_window() {
+add_task(function* test_close_last_nonpopup_window() {
   // Purge the list of closed windows.
   forgetClosedWindows();
 
   let oldState = ss.getWindowState(window);
 
   let popupState = {windows: [
     {tabs: [{entries: []}], isPopup: true, hidden: "toolbar"}
   ]};
--- a/browser/components/sessionstore/test/browser_662743.js
+++ b/browser/components/sessionstore/test/browser_662743.js
@@ -14,29 +14,29 @@ function test() {
 
   let testTabCount = 0;
   let formData = [
   // default case
     { },
 
   // new format
     // index doesn't match value (testing an option in between (two))
-    { id:{ "select_id": {"selectedIndex":0,"value":"val2"} } },
+    { id:{ "select_id": {"selectedIndex":0, "value":"val2"} } },
     // index doesn't match value (testing an invalid value)
-    { id:{ "select_id": {"selectedIndex":4,"value":"val8"} } },
+    { id:{ "select_id": {"selectedIndex":4, "value":"val8"} } },
     // index doesn't match value (testing an invalid index)
-    { id:{ "select_id": {"selectedIndex":8,"value":"val5"} } },
+    { id:{ "select_id": {"selectedIndex":8, "value":"val5"} } },
     // index and value match position zero
-    { id:{ "select_id": {"selectedIndex":0,"value":"val0"} }, xpath: {} },
+    { id:{ "select_id": {"selectedIndex":0, "value":"val0"} }, xpath: {} },
     // index doesn't match value (testing the last option (seven))
-    { id:{},"xpath":{ "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']": {"selectedIndex":1,"value":"val7"} } },
+    { id:{}, "xpath":{ "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']": {"selectedIndex":1, "value":"val7"} } },
     // index and value match the default option "selectedIndex":3,"value":"val3"
-    { xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":3,"value":"val3"} } },
+    { xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":3, "value":"val3"} } },
     // index matches default option however it doesn't match value
-    { id:{ "select_id": {"selectedIndex":3,"value":"val4"} } },
+    { id:{ "select_id": {"selectedIndex":3, "value":"val4"} } },
   ];
 
   let expectedValues = [
     null,   // default value
     "val2",
     null,   // default value (invalid value)
     "val5", // value is still valid (even it has an invalid index)
     "val0",
--- a/browser/components/sessionstore/test/browser_911547.js
+++ b/browser/components/sessionstore/test/browser_911547.js
@@ -11,17 +11,17 @@ add_task(function* test() {
   let tab = gBrowser.selectedTab = gBrowser.addTab(testURL);
   gBrowser.selectedTab = tab;
 
   let browser = tab.linkedBrowser;
   yield promiseBrowserLoaded(browser);
 
   // this is a baseline to ensure CSP is active
   // attempt to inject and run a script via inline (pre-restore, allowed)
-  injectInlineScript(browser,'document.getElementById("test_id").value = "fail";');
+  injectInlineScript(browser, 'document.getElementById("test_id").value = "fail";');
   is(browser.contentDocument.getElementById("test_id").value, "ok",
      "CSP should block the inline script that modifies test_id");
 
   // attempt to click a link to a data: URI (will inherit the CSP of the
   // origin document) and navigate to the data URI in the link.
   browser.contentDocument.getElementById("test_data_link").click();
   yield promiseBrowserLoaded(browser);
 
--- a/browser/components/sessionstore/test/browser_cleaner.js
+++ b/browser/components/sessionstore/test/browser_cleaner.js
@@ -23,17 +23,17 @@ function isRecent(stamp) {
   is(typeof stamp, "number", "This is a timestamp");
   return Date.now() - stamp <= 60000;
 }
 
 function promiseCleanup () {
   info("Cleaning up browser");
 
   return promiseBrowserState(getClosedState());
-};
+}
 
 function getClosedState() {
   return Cu.cloneInto(CLOSED_STATE, {});
 }
 
 var CLOSED_STATE;
 
 add_task(function* init() {
--- a/browser/components/sessionstore/test/browser_dying_cache.js
+++ b/browser/components/sessionstore/test/browser_dying_cache.js
@@ -58,9 +58,10 @@ function checkWindowState(window) {
 }
 
 function shouldThrow(f) {
   try {
     f();
   } catch (e) {
     return true;
   }
+  return null;
 }
--- a/browser/components/sessionstore/test/browser_form_restore_events.js
+++ b/browser/components/sessionstore/test/browser_form_restore_events.js
@@ -24,17 +24,17 @@ add_task(function*() {
   yield setInputValue(browser, {id: "modify04", value: Date.now()});
 
   // file
   let file = Services.dirsvc.get("TmpD", Ci.nsIFile);
   yield setInputValue(browser, {id: "modify05", value: file.path});
 
   // select
   yield setSelectedIndex(browser, {id: "modify06", index: 1});
-  yield setMultipleSelected(browser, {id: "modify07", indices: [0,1,2]});
+  yield setMultipleSelected(browser, {id: "modify07", indices: [0, 1, 2]});
 
   // checkbox
   yield setInputChecked(browser, {id: "modify08", checked: true});
   yield setInputChecked(browser, {id: "modify09", checked: false});
 
   // radio
   yield setInputChecked(browser, {id: "modify10", checked: true});
   yield setInputChecked(browser, {id: "modify11", checked: true});
--- a/browser/components/sessionstore/test/browser_formdata_format.js
+++ b/browser/components/sessionstore/test/browser_formdata_format.js
@@ -26,17 +26,17 @@ function test() {
     { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value17", id: { "input1" : "value18" } },
     { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value19", id: { "input1" : "value20" }, xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value21" } },
     { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value22", xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value23" } },
     { "#input1" : "value24", "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value25", id: { "input1" : "value26" } },
     { "#input1" : "value27", "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value28", id: { "input1" : "value29" }, xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value30" } },
     { "#input1" : "value31", "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value32", xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value33" } }
   ]
   let expectedValues = [
-    [ "" , "" ],
+    [ "", "" ],
     // old format
     [ "value0", "" ],
     [ "value1", "value2" ],
     [ "", "value3" ],
     // new format
     [ "value4", "" ],
     [ "value5", "" ],
     [ "value6", "value7" ],
--- a/browser/components/sessionstore/test/browser_frame_history.js
+++ b/browser/components/sessionstore/test/browser_frame_history.js
@@ -137,17 +137,17 @@ add_task(function*() {
   info("dynamic: Clicking on link 2, 1 load should take place");
   promise = waitForLoadsInBrowser(tab.linkedBrowser, 1);
   EventUtils.sendMouseEvent({type:"click"}, links[1], browser_b.contentWindow);
   yield promise;
 
   info("Check in the state that we have not stored this history");
   let state = ss.getBrowserState();
   info(JSON.stringify(JSON.parse(state), null, "\t"));
-  is(state.indexOf("c1.html"), -1, "History entry was not stored in the session state");;
+  is(state.indexOf("c1.html"), -1, "History entry was not stored in the session state");
   gBrowser.removeTab(tab);
 });
 
 // helper functions
 function waitForLoadsInBrowser(aBrowser, aLoadCount) {
   let deferred = Promise.defer();
   let loadCount = 0;
   aBrowser.addEventListener("load", function(aEvent) {
--- a/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js
+++ b/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js
@@ -61,17 +61,17 @@ add_task(function* () {
   let resolveLocationChangePromise;
   let locationChangePromise = new Promise(r => resolveLocationChangePromise = r);
   let wpl = {
     onStateChange(wpl, request, state, status) {
       let location = request.QueryInterface(Ci.nsIChannel).originalURI;
       // Ignore about:blank loads.
       let docStop = Ci.nsIWebProgressListener.STATE_STOP |
                     Ci.nsIWebProgressListener.STATE_IS_NETWORK;
-      if (location.spec == "about:blank" || (state & docStop == docStop)) {
+      if (location.spec == "about:blank" || (state & docStop) != docStop) {
         return;
       }
       is(location.spec, TESTURL, "Got the expected URL");
       resolveLocationChangePromise();
     },
   };
   gBrowser.addProgressListener(wpl);
 
--- a/browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js
+++ b/browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js
@@ -5,17 +5,17 @@
 // This test checks that closed private windows can't be restored
 
 function test() {
   waitForExplicitFinish();
 
   // Purging the list of closed windows
   forgetClosedWindows();
 
-  // Load a private window, then close it 
+  // Load a private window, then close it
   // and verify it doesn't get remembered for restoring
   whenNewWindowLoaded({private: true}, function (win) {
     info("The private window got loaded");
     win.addEventListener("SSWindowClosing", function() {
       executeSoon(function () {
         is(ss.getClosedWindowCount(), 0,
             "The private window should not have been stored");
       });
--- a/browser/components/sessionstore/test/unit/head.js
+++ b/browser/components/sessionstore/test/unit/head.js
@@ -24,9 +24,9 @@ function afterSessionStartupInitializati
 
   // Start sessionstartup initialization.
   let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
     getService(Ci.nsIObserver);
   Services.obs.addObserver(startup, "final-ui-startup", false);
   Services.obs.addObserver(startup, "quit-application", false);
   Services.obs.notifyObservers(null, "final-ui-startup", "");
   Services.obs.addObserver(observer, "sessionstore-state-finalized", false);
-};
+}
--- a/browser/components/sessionstore/test/unit/test_startup_nosession_async.js
+++ b/browser/components/sessionstore/test/unit/test_startup_nosession_async.js
@@ -14,9 +14,9 @@ function run_test() {
   do_test_pending();
   let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
     getService(Ci.nsISessionStartup);
 
   afterSessionStartupInitialization(function cb() {
     do_check_eq(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
     do_test_finished();
   });
-}
\ No newline at end of file
+}