Bug 1298559 - Enable eslint for /browser/base/content/test/ r?mattn draft
authorJared Wein <jwein@mozilla.com>
Fri, 26 Aug 2016 22:47:21 -0400
changeset 406357 3f58cb883774eb7f67876066c0b8805c27a510c8
parent 406304 8f489c7364de8e8bd6a2c6ced81186bcd4403813
child 529636 c4d31cce8ee33e3793e46a528f61e25325199934
push id27702
push userjwein@mozilla.com
push dateSat, 27 Aug 2016 02:47:42 +0000
reviewersmattn
bugs1298559
milestone51.0a1
Bug 1298559 - Enable eslint for /browser/base/content/test/ r?mattn MozReview-Commit-ID: BYs7x084lI0
.eslintignore
browser/base/content/test/general/browser_aboutAccounts.js
browser/base/content/test/general/browser_aboutHealthReport.js
browser/base/content/test/general/browser_aboutTabCrashed.js
browser/base/content/test/general/browser_alltabslistener.js
browser/base/content/test/general/browser_audioTabIcon.js
browser/base/content/test/general/browser_backButtonFitts.js
browser/base/content/test/general/browser_blockHPKP.js
browser/base/content/test/general/browser_bookmark_popup.js
browser/base/content/test/general/browser_bug1015721.js
browser/base/content/test/general/browser_bug1261299.js
browser/base/content/test/general/browser_bug321000.js
browser/base/content/test/general/browser_bug386835.js
browser/base/content/test/general/browser_bug416661.js
browser/base/content/test/general/browser_bug417483.js
browser/base/content/test/general/browser_bug419612.js
browser/base/content/test/general/browser_bug441778.js
browser/base/content/test/general/browser_bug460146.js
browser/base/content/test/general/browser_bug479408.js
browser/base/content/test/general/browser_bug517902.js
browser/base/content/test/general/browser_bug553455.js
browser/base/content/test/general/browser_bug555224.js
browser/base/content/test/general/browser_bug555767.js
browser/base/content/test/general/browser_bug559991.js
browser/base/content/test/general/browser_bug561636.js
browser/base/content/test/general/browser_bug575830.js
browser/base/content/test/general/browser_bug577121.js
browser/base/content/test/general/browser_bug579872.js
browser/base/content/test/general/browser_bug580638.js
browser/base/content/test/general/browser_bug585558.js
browser/base/content/test/general/browser_bug585830.js
browser/base/content/test/general/browser_bug590206.js
browser/base/content/test/general/browser_bug592338.js
browser/base/content/test/general/browser_bug597218.js
browser/base/content/test/general/browser_bug655584.js
browser/base/content/test/general/browser_bug719271.js
browser/base/content/test/general/browser_bug749738.js
browser/base/content/test/general/browser_bug822367.js
browser/base/content/test/general/browser_bug882977.js
browser/base/content/test/general/browser_clipboard.js
browser/base/content/test/general/browser_contentAltClick.js
browser/base/content/test/general/browser_contentAreaClick.js
browser/base/content/test/general/browser_contextmenu.js
browser/base/content/test/general/browser_ctrlTab.js
browser/base/content/test/general/browser_datachoices_notification.js
browser/base/content/test/general/browser_decoderDoctor.js
browser/base/content/test/general/browser_discovery.js
browser/base/content/test/general/browser_documentnavigation.js
browser/base/content/test/general/browser_favicon_change.js
browser/base/content/test/general/browser_fullscreen-window-open.js
browser/base/content/test/general/browser_fxa_oauth.html
browser/base/content/test/general/browser_fxa_oauth.js
browser/base/content/test/general/browser_fxa_oauth_with_keys.html
browser/base/content/test/general/browser_fxa_web_channel.html
browser/base/content/test/general/browser_fxa_web_channel.js
browser/base/content/test/general/browser_gZipOfflineChild.js
browser/base/content/test/general/browser_gestureSupport.js
browser/base/content/test/general/browser_menuButtonFitts.js
browser/base/content/test/general/browser_minimize.js
browser/base/content/test/general/browser_mixedContentFramesOnHttp.js
browser/base/content/test/general/browser_mixedContentFromOnunload.js
browser/base/content/test/general/browser_page_style_menu_update.js
browser/base/content/test/general/browser_plainTextLinks.js
browser/base/content/test/general/browser_readerMode.js
browser/base/content/test/general/browser_remoteTroubleshoot.js
browser/base/content/test/general/browser_restore_isAppTab.js
browser/base/content/test/general/browser_sanitize-timespans.js
browser/base/content/test/general/browser_sanitizeDialog.js
browser/base/content/test/general/browser_save_link-perwindowpb.js
browser/base/content/test/general/browser_save_link_when_window_navigates.js
browser/base/content/test/general/browser_selectpopup.js
browser/base/content/test/general/browser_ssl_error_reports.js
browser/base/content/test/general/browser_syncui.js
browser/base/content/test/general/browser_tabfocus.js
browser/base/content/test/general/browser_tabopen_reflows.js
browser/base/content/test/general/browser_tabs_close_beforeunload.js
browser/base/content/test/general/browser_trackingUI_telemetry.js
browser/base/content/test/general/browser_utilityOverlay.js
browser/base/content/test/general/browser_visibleTabs_bookmarkAllTabs.js
browser/base/content/test/general/browser_visibleTabs_contextMenu.js
browser/base/content/test/general/browser_web_channel.html
browser/base/content/test/general/browser_web_channel.js
browser/base/content/test/general/browser_web_channel_iframe.html
browser/base/content/test/general/browser_windowactivation.js
browser/base/content/test/general/close_beforeunload.html
browser/base/content/test/general/contentSearchUI.js
browser/base/content/test/general/file_bug822367_5.html
browser/base/content/test/general/file_bug902156.js
browser/base/content/test/general/file_favicon_change.html
browser/base/content/test/general/head.js
browser/base/content/test/general/test_remoteTroubleshoot.html
browser/base/content/test/newtab/browser_newtab_bug1194895.js
browser/base/content/test/newtab/browser_newtab_perwindow_private_browsing.js
browser/base/content/test/newtab/browser_newtab_search.js
browser/base/content/test/newtab/browser_newtab_undo.js
browser/base/content/test/newtab/head.js
browser/base/content/test/plugins/browser_CTP_context_menu.js
browser/base/content/test/plugins/browser_CTP_crashreporting.js
browser/base/content/test/plugins/browser_CTP_data_urls.js
browser/base/content/test/plugins/browser_CTP_multi_allow.js
browser/base/content/test/plugins/browser_bug744745.js
browser/base/content/test/plugins/browser_bug820497.js
browser/base/content/test/plugins/browser_clearplugindata.js
browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
browser/base/content/test/plugins/browser_pluginnotification.js
browser/base/content/test/plugins/browser_private_clicktoplay.js
browser/base/content/test/popupNotifications/head.js
browser/base/content/test/referrer/browser_referrer_simple_click.js
browser/base/content/test/social/browser_aboutHome_activation.js
browser/base/content/test/social/browser_blocklist.js
browser/base/content/test/social/browser_share.js
browser/base/content/test/social/browser_social_activation.js
browser/base/content/test/social/browser_social_errorPage.js
browser/base/content/test/social/browser_social_marks_context.js
browser/base/content/test/social/browser_social_multiprovider.js
browser/base/content/test/social/browser_social_window.js
browser/base/content/test/social/head.js
browser/base/content/test/social/social_crash_content_helper.js
browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js
browser/base/content/test/urlbar/browser_action_keyword_override.js
browser/base/content/test/urlbar/browser_action_searchengine.js
browser/base/content/test/urlbar/browser_action_searchengine_alias.js
browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
browser/base/content/test/urlbar/browser_bug1024133-switchtab-override-keynav.js
browser/base/content/test/urlbar/browser_bug1104165-switchtab-decodeuri.js
browser/base/content/test/urlbar/browser_canonizeURL.js
browser/base/content/test/urlbar/browser_locationBarCommand.js
browser/base/content/test/urlbar/browser_locationBarExternalLoad.js
browser/base/content/test/urlbar/browser_urlbarDecode.js
browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
browser/base/content/test/urlbar/head.js
browser/base/content/test/webrtc/browser_devices_get_user_media.js
browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js
browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
browser/base/content/test/webrtc/head.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -55,17 +55,18 @@ b2g/app/b2g.js
 b2g/graphene/graphene.js
 b2g/locales/en-US/b2g-l10n.js
 
 # browser/ exclusions
 browser/app/**
 browser/base/content/browser-social.js
 browser/base/content/nsContextMenu.js
 browser/base/content/sanitizeDialog.js
-browser/base/content/test/**
+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/feeds/**
 browser/components/privatebrowsing/**
 browser/components/sessionstore/**
 browser/components/shell/**
 browser/components/tabview/**
 browser/components/translation/**
--- a/browser/base/content/test/general/browser_aboutAccounts.js
+++ b/browser/base/content/test/general/browser_aboutAccounts.js
@@ -61,17 +61,17 @@ var gTests = [
           ok(data.pass, data.info);
           results++;
         } else if (data.type == "testsComplete") {
           is(results, data.count, "Checking number of results received matches the number of tests that should have run");
           mm.removeMessageListener("test:response", responseHandler);
           deferred.resolve();
         }
       });
-    } catch(e) {
+    } catch (e) {
       ok(false, "Failed to get all commands");
       deferred.reject();
     }
     yield deferred.promise;
     yield promisePrefsOpened;
   }
 },
 {
@@ -410,17 +410,17 @@ var gTests = [
   },
 },
 ]; // gTests
 
 function test()
 {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     for (let test of gTests) {
       info(test.desc);
       try {
         yield test.run();
       } finally {
         yield test.teardown();
       }
     }
--- a/browser/base/content/test/general/browser_aboutHealthReport.js
+++ b/browser/base/content/test/general/browser_aboutHealthReport.js
@@ -40,17 +40,17 @@ function fakeTelemetryNow(...args) {
 
   for (let m of modules) {
     m.Policy.now = () => new Date(date);
   }
 
   return date;
 }
 
-function setupPingArchive() {
+function* setupPingArchive() {
   let scope = {};
   Cu.import("resource://gre/modules/TelemetryController.jsm", scope);
   Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
     .loadSubScript(CHROME_BASE + "healthreport_pingData.js", scope);
 
   for (let p of scope.TEST_PINGS) {
     fakeTelemetryNow(p.date);
     p.id = yield scope.TelemetryController.submitExternalPing(p.type, p.payload);
@@ -81,34 +81,34 @@ var gTests = [
         }
         else if (data.type == "testsComplete") {
           is(results, data.count, "Checking number of results received matches the number of tests that should have run");
           iframe.contentWindow.removeEventListener("FirefoxHealthReportTestResponse", evtHandler, true);
           deferred.resolve();
         }
       }, true);
 
-    } catch(e) {
+    } catch (e) {
       ok(false, "Failed to get all commands");
       deferred.reject();
     }
     return deferred.promise;
   }
 },
 
 ]; // gTests
 
 function test()
 {
   waitForExplicitFinish();
 
   // xxxmpc leaving this here until we resolve bug 854038 and bug 854060
   requestLongerTimeout(10);
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     for (let test of gTests) {
       info(test.desc);
       yield test.setup();
 
       let iframe = yield promiseNewTabLoadEvent("about:healthreport");
 
       yield test.run(iframe);
 
--- a/browser/base/content/test/general/browser_aboutTabCrashed.js
+++ b/browser/base/content/test/general/browser_aboutTabCrashed.js
@@ -1,203 +1,203 @@
-"use strict";
-
-const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
-const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
-const COMMENTS = "Here's my test comment!";
-const EMAIL = "foo@privacy.com";
-
-/**
- * Sets up the browser to send crash reports to the local crash report
- * testing server.
- */
-add_task(function* setup() {
-  // The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables crash
-  // reports.  This test needs them enabled.  The test also needs a mock
-  // report server, and fortunately one is already set up by toolkit/
-  // crashreporter/test/Makefile.in.  Assign its URL to MOZ_CRASHREPORTER_URL,
-  // which CrashSubmit.jsm uses as a server override.
-  let env = Cc["@mozilla.org/process/environment;1"]
-              .getService(Components.interfaces.nsIEnvironment);
-  let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
-  let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
-  env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
-  env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
-
-  // On debug builds, crashing tabs results in much thinking, which
-  // slows down the test and results in intermittent test timeouts,
-  // so we'll pump up the expected timeout for this test.
-  requestLongerTimeout(2);
-
-  registerCleanupFunction(function() {
-    env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
-    env.set("MOZ_CRASHREPORTER_URL", serverUrl);
-  });
-});
-
-/**
- * This function returns a Promise that resolves once the following
- * actions have taken place:
- *
- * 1) A new tab is opened up at PAGE
- * 2) The tab is crashed
- * 3) The about:tabcrashed page's fields are set in accordance with
- *    fieldValues
- * 4) The tab is restored
- * 5) A crash report is received from the testing server
- * 6) Any tab crash prefs that were overwritten are reset
- *
- * @param fieldValues
- *        An Object describing how to set the about:tabcrashed
- *        fields. The following properties are accepted:
- *
- *        comments (String)
- *          The comments to put in the comment textarea
- *        email (String)
- *          The email address to put in the email address input
- *        emailMe (bool)
- *          The checked value of the "Email me" checkbox
- *        includeURL (bool)
- *          The checked value of the "Include URL" checkbox
- *
- *        If any of these fields are missing, the defaults from
- *        the user preferences are used.
- * @param expectedExtra
- *        An Object describing the expected values that the submitted
- *        crash report's extra data should contain.
- * @returns Promise
- */
-function crashTabTestHelper(fieldValues, expectedExtra) {
-  return BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: PAGE,
-  }, function*(browser) {
-    let prefs = TabCrashHandler.prefs;
-    let originalSendReport = prefs.getBoolPref("sendReport");
-    let originalEmailMe = prefs.getBoolPref("emailMe");
-    let originalIncludeURL = prefs.getBoolPref("includeURL");
-    let originalEmail = prefs.getCharPref("email");
-
-    let tab = gBrowser.getTabForBrowser(browser);
-    yield BrowserTestUtils.crashBrowser(browser);
-    let doc = browser.contentDocument;
-
-    // Since about:tabcrashed will run in the parent process, we can safely
-    // manipulate its DOM nodes directly
-    let comments = doc.getElementById("comments");
-    let email = doc.getElementById("email");
-    let emailMe = doc.getElementById("emailMe");
-    let includeURL = doc.getElementById("includeURL");
-
-    if (fieldValues.hasOwnProperty("comments")) {
-      comments.value = fieldValues.comments;
-    }
-
-    if (fieldValues.hasOwnProperty("email")) {
-      email.value = fieldValues.email;
-    }
-
-    if (fieldValues.hasOwnProperty("emailMe")) {
-      emailMe.checked = fieldValues.emailMe;
-    }
-
-    if (fieldValues.hasOwnProperty("includeURL")) {
-      includeURL.checked = fieldValues.includeURL;
-    }
-
-    let crashReport = promiseCrashReport(expectedExtra);
-    let restoreTab = browser.contentDocument.getElementById("restoreTab");
-    restoreTab.click();
-    yield BrowserTestUtils.waitForEvent(tab, "SSTabRestored");
-    yield crashReport;
-
-    // Submitting the crash report may have set some prefs regarding how to
-    // send tab crash reports. Let's reset them for the next test.
-    prefs.setBoolPref("sendReport", originalSendReport);
-    prefs.setBoolPref("emailMe", originalEmailMe);
-    prefs.setBoolPref("includeURL", originalIncludeURL);
-    prefs.setCharPref("email", originalEmail);
-  });
-}
-
-/**
- * Tests what we send with the crash report by default. By default, we do not
- * send any comments, the URL of the crashing page, or the email address of
- * the user.
- */
-add_task(function* test_default() {
-  yield crashTabTestHelper({}, {
-    "Comments": null,
-    "URL": "",
-    "Email": null,
-  });
-});
-
-/**
- * Test just sending a comment.
- */
-add_task(function* test_just_a_comment() {
-  yield crashTabTestHelper({
-    comments: COMMENTS,
-  }, {
-    "Comments": COMMENTS,
-    "URL": "",
-    "Email": null,
-  });
-});
-
-/**
- * Test that we don't send email if emailMe is unchecked
- */
-add_task(function* test_no_email() {
-  yield crashTabTestHelper({
-    email: EMAIL,
-    emailMe: false,
-  }, {
-    "Comments": null,
-    "URL": "",
-    "Email": null,
-  });
-});
-
-/**
- * Test that we can send an email address if emailMe is checked
- */
-add_task(function* test_yes_email() {
-  yield crashTabTestHelper({
-    email: EMAIL,
-    emailMe: true,
-  }, {
-    "Comments": null,
-    "URL": "",
-    "Email": EMAIL,
-  });
-});
-
-/**
- * Test that we will send the URL of the page if includeURL is checked.
- */
-add_task(function* test_send_URL() {
-  yield crashTabTestHelper({
-    includeURL: true,
-  }, {
-    "Comments": null,
-    "URL": PAGE,
-    "Email": null,
-  });
-});
-
-/**
- * Test that we can send comments, the email address, and the URL
- */
-add_task(function* test_send_all() {
-  yield crashTabTestHelper({
-    includeURL: true,
-    emailMe: true,
-    email: EMAIL,
-    comments: COMMENTS,
-  }, {
-    "Comments": COMMENTS,
-    "URL": PAGE,
-    "Email": EMAIL,
-  });
-});
-
+"use strict";
+
+const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
+const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
+const COMMENTS = "Here's my test comment!";
+const EMAIL = "foo@privacy.com";
+
+/**
+ * Sets up the browser to send crash reports to the local crash report
+ * testing server.
+ */
+add_task(function* setup() {
+  // The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables crash
+  // reports.  This test needs them enabled.  The test also needs a mock
+  // report server, and fortunately one is already set up by toolkit/
+  // crashreporter/test/Makefile.in.  Assign its URL to MOZ_CRASHREPORTER_URL,
+  // which CrashSubmit.jsm uses as a server override.
+  let env = Cc["@mozilla.org/process/environment;1"]
+              .getService(Components.interfaces.nsIEnvironment);
+  let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
+  let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
+  env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
+  env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
+
+  // On debug builds, crashing tabs results in much thinking, which
+  // slows down the test and results in intermittent test timeouts,
+  // so we'll pump up the expected timeout for this test.
+  requestLongerTimeout(2);
+
+  registerCleanupFunction(function() {
+    env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
+    env.set("MOZ_CRASHREPORTER_URL", serverUrl);
+  });
+});
+
+/**
+ * This function returns a Promise that resolves once the following
+ * actions have taken place:
+ *
+ * 1) A new tab is opened up at PAGE
+ * 2) The tab is crashed
+ * 3) The about:tabcrashed page's fields are set in accordance with
+ *    fieldValues
+ * 4) The tab is restored
+ * 5) A crash report is received from the testing server
+ * 6) Any tab crash prefs that were overwritten are reset
+ *
+ * @param fieldValues
+ *        An Object describing how to set the about:tabcrashed
+ *        fields. The following properties are accepted:
+ *
+ *        comments (String)
+ *          The comments to put in the comment textarea
+ *        email (String)
+ *          The email address to put in the email address input
+ *        emailMe (bool)
+ *          The checked value of the "Email me" checkbox
+ *        includeURL (bool)
+ *          The checked value of the "Include URL" checkbox
+ *
+ *        If any of these fields are missing, the defaults from
+ *        the user preferences are used.
+ * @param expectedExtra
+ *        An Object describing the expected values that the submitted
+ *        crash report's extra data should contain.
+ * @returns Promise
+ */
+function crashTabTestHelper(fieldValues, expectedExtra) {
+  return BrowserTestUtils.withNewTab({
+    gBrowser,
+    url: PAGE,
+  }, function*(browser) {
+    let prefs = TabCrashHandler.prefs;
+    let originalSendReport = prefs.getBoolPref("sendReport");
+    let originalEmailMe = prefs.getBoolPref("emailMe");
+    let originalIncludeURL = prefs.getBoolPref("includeURL");
+    let originalEmail = prefs.getCharPref("email");
+
+    let tab = gBrowser.getTabForBrowser(browser);
+    yield BrowserTestUtils.crashBrowser(browser);
+    let doc = browser.contentDocument;
+
+    // Since about:tabcrashed will run in the parent process, we can safely
+    // manipulate its DOM nodes directly
+    let comments = doc.getElementById("comments");
+    let email = doc.getElementById("email");
+    let emailMe = doc.getElementById("emailMe");
+    let includeURL = doc.getElementById("includeURL");
+
+    if (fieldValues.hasOwnProperty("comments")) {
+      comments.value = fieldValues.comments;
+    }
+
+    if (fieldValues.hasOwnProperty("email")) {
+      email.value = fieldValues.email;
+    }
+
+    if (fieldValues.hasOwnProperty("emailMe")) {
+      emailMe.checked = fieldValues.emailMe;
+    }
+
+    if (fieldValues.hasOwnProperty("includeURL")) {
+      includeURL.checked = fieldValues.includeURL;
+    }
+
+    let crashReport = promiseCrashReport(expectedExtra);
+    let restoreTab = browser.contentDocument.getElementById("restoreTab");
+    restoreTab.click();
+    yield BrowserTestUtils.waitForEvent(tab, "SSTabRestored");
+    yield crashReport;
+
+    // Submitting the crash report may have set some prefs regarding how to
+    // send tab crash reports. Let's reset them for the next test.
+    prefs.setBoolPref("sendReport", originalSendReport);
+    prefs.setBoolPref("emailMe", originalEmailMe);
+    prefs.setBoolPref("includeURL", originalIncludeURL);
+    prefs.setCharPref("email", originalEmail);
+  });
+}
+
+/**
+ * Tests what we send with the crash report by default. By default, we do not
+ * send any comments, the URL of the crashing page, or the email address of
+ * the user.
+ */
+add_task(function* test_default() {
+  yield crashTabTestHelper({}, {
+    "Comments": null,
+    "URL": "",
+    "Email": null,
+  });
+});
+
+/**
+ * Test just sending a comment.
+ */
+add_task(function* test_just_a_comment() {
+  yield crashTabTestHelper({
+    comments: COMMENTS,
+  }, {
+    "Comments": COMMENTS,
+    "URL": "",
+    "Email": null,
+  });
+});
+
+/**
+ * Test that we don't send email if emailMe is unchecked
+ */
+add_task(function* test_no_email() {
+  yield crashTabTestHelper({
+    email: EMAIL,
+    emailMe: false,
+  }, {
+    "Comments": null,
+    "URL": "",
+    "Email": null,
+  });
+});
+
+/**
+ * Test that we can send an email address if emailMe is checked
+ */
+add_task(function* test_yes_email() {
+  yield crashTabTestHelper({
+    email: EMAIL,
+    emailMe: true,
+  }, {
+    "Comments": null,
+    "URL": "",
+    "Email": EMAIL,
+  });
+});
+
+/**
+ * Test that we will send the URL of the page if includeURL is checked.
+ */
+add_task(function* test_send_URL() {
+  yield crashTabTestHelper({
+    includeURL: true,
+  }, {
+    "Comments": null,
+    "URL": PAGE,
+    "Email": null,
+  });
+});
+
+/**
+ * Test that we can send comments, the email address, and the URL
+ */
+add_task(function* test_send_all() {
+  yield crashTabTestHelper({
+    includeURL: true,
+    emailMe: true,
+    email: EMAIL,
+    comments: COMMENTS,
+  }, {
+    "Comments": COMMENTS,
+    "URL": PAGE,
+    "Email": EMAIL,
+  });
+});
+
--- a/browser/base/content/test/general/browser_alltabslistener.js
+++ b/browser/base/content/test/general/browser_alltabslistener.js
@@ -19,17 +19,17 @@ var gFrontProgressListener = {
 
   onLocationChange: function (aWebProgress, aRequest, aLocationURI, aFlags) {
     var state = "onLocationChange";
     info("FrontProgress: " + state + " " + aLocationURI.spec);
     ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
     is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
     gFrontNotificationsPos++;
   },
-  
+
   onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
   },
 
   onSecurityChange: function (aWebProgress, aRequest, aState) {
     var state = "onSecurityChange";
     info("FrontProgress: " + state + " 0x" + aState.toString(16));
     ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
     is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
@@ -57,17 +57,17 @@ var gAllProgressListener = {
                               aFlags) {
     var state = "onLocationChange";
     info("AllProgress: " + state + " " + aLocationURI.spec);
     ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
     ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
     is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
     gAllNotificationsPos++;
   },
-  
+
   onStatusChange: function (aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
     var state = "onStatusChange";
     ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
   },
 
   onSecurityChange: function (aBrowser, aWebProgress, aRequest, aState) {
     var state = "onSecurityChange";
     info("AllProgress: " + state + " 0x" + aState.toString(16));
--- a/browser/base/content/test/general/browser_audioTabIcon.js
+++ b/browser/base/content/test/general/browser_audioTabIcon.js
@@ -1,24 +1,23 @@
 const PAGE = "https://example.com/browser/browser/base/content/test/general/file_mediaPlayback.html";
 
 function* wait_for_tab_playing_event(tab, expectPlaying) {
   if (tab.soundPlaying == expectPlaying) {
     ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
     return true;
-  } else {
-    yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
-      if (event.detail.changed.indexOf("soundplaying") >= 0) {
-        is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
-        is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
-        return true;
-      }
-      return false;
-    });
   }
+  return yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
+    if (event.detail.changed.indexOf("soundplaying") >= 0) {
+      is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
+      is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
+      return true;
+    }
+    return false;
+  });
 }
 
 function* play(tab) {
   let browser = tab.linkedBrowser;
   yield ContentTask.spawn(browser, {}, function* () {
     let audio = content.document.querySelector("audio");
     audio.play();
   });
@@ -225,16 +224,17 @@ function* test_swapped_browser_while_pla
   let receivedSoundPlaying = 0;
   // We need to receive two TabAttrModified events with 'soundplaying'
   // because swapBrowsersAndCloseOther involves nsDocument::OnPageHide and
   // nsDocument::OnPageShow. Each methods lead to TabAttrModified event.
   yield BrowserTestUtils.waitForEvent(newTab, "TabAttrModified", false, event => {
     if (event.detail.changed.indexOf("soundplaying") >= 0) {
       return (++receivedSoundPlaying == 2);
     }
+    return false;
   });
 
   ok(newTab.hasAttribute("muted"), "Expected the correct muted attribute on the new tab");
   is(newTab.muteReason, null, "Expected the correct muteReason property on the new tab");
   ok(newTab.hasAttribute("soundplaying"), "Expected the correct soundplaying attribute on the new tab");
 
   let icon = document.getAnonymousElementByAttribute(newTab, "anonid",
                                                      "soundplaying-icon");
--- a/browser/base/content/test/general/browser_backButtonFitts.js
+++ b/browser/base/content/test/general/browser_backButtonFitts.js
@@ -1,42 +1,42 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-add_task(function* () {
-  let firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
-  yield BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
-
-  yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
-    // Push the state before maximizing the window and clicking below.
-    content.history.pushState("page2", "page2", "page2");
-
-    // While in the child process, add a listener for the popstate event here. This
-    // event will fire when the mouse click happens.
-    content.addEventListener("popstate", function onPopState() {
-      content.removeEventListener("popstate", onPopState, false);
-      sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href });
-    }, false);
-  });
-
-  window.maximize();
-
-  // Find where the nav-bar is vertically.
-  var navBar = document.getElementById("nav-bar");
-  var boundingRect = navBar.getBoundingClientRect();
-  var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
-  var xPixel = 0; // Use the first pixel of the screen since it is maximized.
-
-  let resultLocation = yield new Promise(resolve => {
-    messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
-      messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
-      resolve(message.data.location);
-    });
-
-    EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
-  });
-
-  is(resultLocation, firstLocation, "Clicking the first pixel should have navigated back.");
-  window.restore();
-
-  gBrowser.removeCurrentTab();
-});
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+add_task(function* () {
+  let firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
+  yield BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
+
+  yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
+    // Push the state before maximizing the window and clicking below.
+    content.history.pushState("page2", "page2", "page2");
+
+    // While in the child process, add a listener for the popstate event here. This
+    // event will fire when the mouse click happens.
+    content.addEventListener("popstate", function onPopState() {
+      content.removeEventListener("popstate", onPopState, false);
+      sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href });
+    }, false);
+  });
+
+  window.maximize();
+
+  // Find where the nav-bar is vertically.
+  var navBar = document.getElementById("nav-bar");
+  var boundingRect = navBar.getBoundingClientRect();
+  var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
+  var xPixel = 0; // Use the first pixel of the screen since it is maximized.
+
+  let resultLocation = yield new Promise(resolve => {
+    messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
+      messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
+      resolve(message.data.location);
+    });
+
+    EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
+  });
+
+  is(resultLocation, firstLocation, "Clicking the first pixel should have navigated back.");
+  window.restore();
+
+  gBrowser.removeCurrentTab();
+});
--- a/browser/base/content/test/general/browser_blockHPKP.js
+++ b/browser/base/content/test/general/browser_blockHPKP.js
@@ -76,26 +76,26 @@ function errorPageLoaded() {
     let text = textElement.innerHTML;
     ok(text.indexOf("MOZILLA_PKIX_ERROR_KEY_PINNING_FAILURE") > 0,
        "Got a pinning error page");
   }).then(function() {
     BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "https://" + kPinningDomain + kURLPath + "zeromaxagevalid").then(function() {
       return BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
     }).then(pinningRemovalLoaded);
   });
-};
+}
 
 // After the pinning information has been removed (successful load) proceed
 // to load again with the invalid pin domain.
 function pinningRemovalLoaded() {
   BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "https://" + kBadPinningDomain).then(function() {
     return BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
   }).then(badPinningPageLoaded);
-};
+}
 
 // Finally, we should successfully load
 // https://bad.include-subdomains.pinning-dynamic.example.com.
 function badPinningPageLoaded() {
   BrowserTestUtils.removeTab(gBrowser.selectedTab).then(function() {
     ok(true, "load complete");
     finish();
   });
-};
+}
--- a/browser/base/content/test/general/browser_bookmark_popup.js
+++ b/browser/base/content/test/general/browser_bookmark_popup.js
@@ -1,257 +1,257 @@
-/* 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/. */
-
-"use strict";
-
-/**
- * Test opening and closing the bookmarks panel.
- */
-
-let bookmarkPanel = document.getElementById("editBookmarkPanel");
-let bookmarkStar = document.getElementById("bookmarks-menu-button");
-let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle");
-
-StarUI._closePanelQuickForTesting = true;
-
-function* test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
-                                shouldAutoClose, popupHideFn, isBookmarkRemoved}) {
-  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
-  try {
-    if (!isNewBookmark) {
-      yield PlacesUtils.bookmarks.insert({
-        parentGuid: PlacesUtils.bookmarks.unfiledGuid,
-        url: "about:home",
-        title: "Home Page"
-      });
-    }
-
-    is(bookmarkStar.hasAttribute("starred"), !isNewBookmark,
-       "Page should only be starred prior to popupshown if editing bookmark");
-    is(bookmarkPanel.state, "closed", "Panel should be 'closed' to start test");
-    let shownPromise = promisePopupShown(bookmarkPanel);
-    yield popupShowFn(tab.linkedBrowser);
-    yield shownPromise;
-    is(bookmarkPanel.state, "open", "Panel should be 'open' after shownPromise is resolved");
-
-    if (popupEditFn) {
-      yield popupEditFn();
-    }
-    let bookmarks = [];
-    yield PlacesUtils.bookmarks.fetch({url: "about:home"}, bm => bookmarks.push(bm));
-    is(bookmarks.length, 1, "Only one bookmark should exist");
-    is(bookmarkStar.getAttribute("starred"), "true", "Page is starred");
-    is(bookmarkPanelTitle.value,
-      isNewBookmark ?
-        gNavigatorBundle.getString("editBookmarkPanel.pageBookmarkedTitle") :
-        gNavigatorBundle.getString("editBookmarkPanel.editBookmarkTitle"),
-      "title should match isEditingBookmark state");
-
-    if (!shouldAutoClose) {
-      yield new Promise(resolve => setTimeout(resolve, 400));
-      is(bookmarkPanel.state, "open", "Panel should still be 'open' for non-autoclose");
-    }
-
-    let hiddenPromise = promisePopupHidden(bookmarkPanel);
-    if (popupHideFn) {
-      yield popupHideFn();
-    }
-    yield hiddenPromise;
-    is(bookmarkStar.hasAttribute("starred"), !isBookmarkRemoved,
-       "Page is starred after closing");
-  } finally {
-    let bookmark = yield PlacesUtils.bookmarks.fetch({url: "about:home"});
-    is(!!bookmark, !isBookmarkRemoved,
-       "bookmark should not be present if a panel action should've removed it");
-    if (bookmark) {
-      yield PlacesUtils.bookmarks.remove(bookmark);
-    }
-    gBrowser.removeTab(tab);
-  }
-}
-
-add_task(function* panel_shown_for_new_bookmarks_and_autocloses() {
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    popupShowFn() {
-      bookmarkStar.click();
-    },
-    shouldAutoClose: true,
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* panel_shown_for_once_for_doubleclick_on_new_bookmark_star_and_autocloses() {
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    popupShowFn() {
-      EventUtils.synthesizeMouse(bookmarkStar, 10, 10, { clickCount: 2 },
-                                 window);
-    },
-    shouldAutoClose: true,
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* panel_shown_once_for_slow_doubleclick_on_new_bookmark_star_and_autocloses() {
-  todo(false, "bug 1250267, may need to add some tracking state to " +
-              "browser-places.js for this.");
-  return;
-
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    *popupShowFn() {
-      EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
-      yield new Promise(resolve => setTimeout(resolve, 300));
-      EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
-    },
-    shouldAutoClose: true,
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* panel_shown_for_keyboardshortcut_on_new_bookmark_star_and_autocloses() {
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    popupShowFn() {
-      EventUtils.synthesizeKey("D", {accelKey: true}, window);
-    },
-    shouldAutoClose: true,
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* panel_shown_for_new_bookmarks_mousemove_mouseout() {
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    popupShowFn() {
-      bookmarkStar.click();
-    },
-    *popupEditFn() {
-      let mouseMovePromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mousemove");
-      EventUtils.synthesizeMouseAtCenter(bookmarkPanel, {type: "mousemove"});
-      info("Waiting for mousemove event");
-      yield mouseMovePromise;
-      info("Got mousemove event");
-
-      yield new Promise(resolve => setTimeout(resolve, 400));
-      is(bookmarkPanel.state, "open", "Panel should still be open on mousemove");
-    },
-    *popupHideFn() {
-      let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
-      EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
-      EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
-      info("Waiting for mouseout event");
-      yield mouseOutPromise;
-      info("Got mouseout event, should autoclose now");
-    },
-    shouldAutoClose: false,
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* panel_shown_for_new_bookmark_no_autoclose_close_with_ESC() {
-  yield test_bookmarks_popup({
-    isNewBookmark: false,
-    popupShowFn() {
-      bookmarkStar.click();
-    },
-    shouldAutoClose: false,
-    popupHideFn() {
-      EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
-    },
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* panel_shown_for_editing_no_autoclose_close_with_ESC() {
-  yield test_bookmarks_popup({
-    isNewBookmark: false,
-    popupShowFn() {
-      bookmarkStar.click();
-    },
-    shouldAutoClose: false,
-    popupHideFn() {
-      EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
-    },
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* panel_shown_for_new_bookmark_keypress_no_autoclose() {
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    popupShowFn() {
-      bookmarkStar.click();
-    },
-    popupEditFn() {
-      EventUtils.sendChar("VK_TAB", window);
-    },
-    shouldAutoClose: false,
-    popupHideFn() {
-      bookmarkPanel.hidePopup();
-    },
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* contextmenu_new_bookmark_keypress_no_autoclose() {
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    *popupShowFn(browser) {
-      let contextMenu = document.getElementById("contentAreaContextMenu");
-      let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu,
-                                                          "popupshown");
-      let awaitPopupHidden = BrowserTestUtils.waitForEvent(contextMenu,
-                                                           "popuphidden");
-      yield BrowserTestUtils.synthesizeMouseAtCenter("body", {
-        type: "contextmenu",
-        button: 2
-      }, browser);
-      yield awaitPopupShown;
-      document.getElementById("context-bookmarkpage").click();
-      contextMenu.hidePopup();
-      yield awaitPopupHidden;
-    },
-    popupEditFn() {
-      EventUtils.sendChar("VK_TAB", window);
-    },
-    shouldAutoClose: false,
-    popupHideFn() {
-      bookmarkPanel.hidePopup();
-    },
-    isBookmarkRemoved: false,
-  });
-});
-
-add_task(function* bookmarks_menu_new_bookmark_remove_bookmark() {
-  yield test_bookmarks_popup({
-    isNewBookmark: true,
-    popupShowFn(browser) {
-      document.getElementById("menu_bookmarkThisPage").doCommand();
-    },
-    shouldAutoClose: true,
-    popupHideFn() {
-      document.getElementById("editBookmarkPanelRemoveButton").click();
-    },
-    isBookmarkRemoved: true,
-  });
-});
-
-add_task(function* ctrl_d_edit_bookmark_remove_bookmark() {
-  yield test_bookmarks_popup({
-    isNewBookmark: false,
-    popupShowFn(browser) {
-      EventUtils.synthesizeKey("D", {accelKey: true}, window);
-    },
-    shouldAutoClose: true,
-    popupHideFn() {
-      document.getElementById("editBookmarkPanelRemoveButton").click();
-    },
-    isBookmarkRemoved: true,
-  });
-});
-
-registerCleanupFunction(function() {
-  delete StarUI._closePanelQuickForTesting;
-})
+/* 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/. */
+
+"use strict";
+
+/**
+ * Test opening and closing the bookmarks panel.
+ */
+
+let bookmarkPanel = document.getElementById("editBookmarkPanel");
+let bookmarkStar = document.getElementById("bookmarks-menu-button");
+let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle");
+
+StarUI._closePanelQuickForTesting = true;
+
+function* test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
+                                shouldAutoClose, popupHideFn, isBookmarkRemoved}) {
+  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
+  try {
+    if (!isNewBookmark) {
+      yield PlacesUtils.bookmarks.insert({
+        parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+        url: "about:home",
+        title: "Home Page"
+      });
+    }
+
+    is(bookmarkStar.hasAttribute("starred"), !isNewBookmark,
+       "Page should only be starred prior to popupshown if editing bookmark");
+    is(bookmarkPanel.state, "closed", "Panel should be 'closed' to start test");
+    let shownPromise = promisePopupShown(bookmarkPanel);
+    yield popupShowFn(tab.linkedBrowser);
+    yield shownPromise;
+    is(bookmarkPanel.state, "open", "Panel should be 'open' after shownPromise is resolved");
+
+    if (popupEditFn) {
+      yield popupEditFn();
+    }
+    let bookmarks = [];
+    yield PlacesUtils.bookmarks.fetch({url: "about:home"}, bm => bookmarks.push(bm));
+    is(bookmarks.length, 1, "Only one bookmark should exist");
+    is(bookmarkStar.getAttribute("starred"), "true", "Page is starred");
+    is(bookmarkPanelTitle.value,
+      isNewBookmark ?
+        gNavigatorBundle.getString("editBookmarkPanel.pageBookmarkedTitle") :
+        gNavigatorBundle.getString("editBookmarkPanel.editBookmarkTitle"),
+      "title should match isEditingBookmark state");
+
+    if (!shouldAutoClose) {
+      yield new Promise(resolve => setTimeout(resolve, 400));
+      is(bookmarkPanel.state, "open", "Panel should still be 'open' for non-autoclose");
+    }
+
+    let hiddenPromise = promisePopupHidden(bookmarkPanel);
+    if (popupHideFn) {
+      yield popupHideFn();
+    }
+    yield hiddenPromise;
+    is(bookmarkStar.hasAttribute("starred"), !isBookmarkRemoved,
+       "Page is starred after closing");
+  } finally {
+    let bookmark = yield PlacesUtils.bookmarks.fetch({url: "about:home"});
+    is(!!bookmark, !isBookmarkRemoved,
+       "bookmark should not be present if a panel action should've removed it");
+    if (bookmark) {
+      yield PlacesUtils.bookmarks.remove(bookmark);
+    }
+    gBrowser.removeTab(tab);
+  }
+}
+
+add_task(function* panel_shown_for_new_bookmarks_and_autocloses() {
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    popupShowFn() {
+      bookmarkStar.click();
+    },
+    shouldAutoClose: true,
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* panel_shown_for_once_for_doubleclick_on_new_bookmark_star_and_autocloses() {
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    popupShowFn() {
+      EventUtils.synthesizeMouse(bookmarkStar, 10, 10, { clickCount: 2 },
+                                 window);
+    },
+    shouldAutoClose: true,
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* panel_shown_once_for_slow_doubleclick_on_new_bookmark_star_and_autocloses() {
+  todo(false, "bug 1250267, may need to add some tracking state to " +
+              "browser-places.js for this.");
+  return;
+
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    *popupShowFn() {
+      EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
+      yield new Promise(resolve => setTimeout(resolve, 300));
+      EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
+    },
+    shouldAutoClose: true,
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* panel_shown_for_keyboardshortcut_on_new_bookmark_star_and_autocloses() {
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    popupShowFn() {
+      EventUtils.synthesizeKey("D", {accelKey: true}, window);
+    },
+    shouldAutoClose: true,
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* panel_shown_for_new_bookmarks_mousemove_mouseout() {
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    popupShowFn() {
+      bookmarkStar.click();
+    },
+    *popupEditFn() {
+      let mouseMovePromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mousemove");
+      EventUtils.synthesizeMouseAtCenter(bookmarkPanel, {type: "mousemove"});
+      info("Waiting for mousemove event");
+      yield mouseMovePromise;
+      info("Got mousemove event");
+
+      yield new Promise(resolve => setTimeout(resolve, 400));
+      is(bookmarkPanel.state, "open", "Panel should still be open on mousemove");
+    },
+    *popupHideFn() {
+      let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
+      EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
+      EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
+      info("Waiting for mouseout event");
+      yield mouseOutPromise;
+      info("Got mouseout event, should autoclose now");
+    },
+    shouldAutoClose: false,
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* panel_shown_for_new_bookmark_no_autoclose_close_with_ESC() {
+  yield test_bookmarks_popup({
+    isNewBookmark: false,
+    popupShowFn() {
+      bookmarkStar.click();
+    },
+    shouldAutoClose: false,
+    popupHideFn() {
+      EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
+    },
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* panel_shown_for_editing_no_autoclose_close_with_ESC() {
+  yield test_bookmarks_popup({
+    isNewBookmark: false,
+    popupShowFn() {
+      bookmarkStar.click();
+    },
+    shouldAutoClose: false,
+    popupHideFn() {
+      EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
+    },
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* panel_shown_for_new_bookmark_keypress_no_autoclose() {
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    popupShowFn() {
+      bookmarkStar.click();
+    },
+    popupEditFn() {
+      EventUtils.sendChar("VK_TAB", window);
+    },
+    shouldAutoClose: false,
+    popupHideFn() {
+      bookmarkPanel.hidePopup();
+    },
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* contextmenu_new_bookmark_keypress_no_autoclose() {
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    *popupShowFn(browser) {
+      let contextMenu = document.getElementById("contentAreaContextMenu");
+      let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu,
+                                                          "popupshown");
+      let awaitPopupHidden = BrowserTestUtils.waitForEvent(contextMenu,
+                                                           "popuphidden");
+      yield BrowserTestUtils.synthesizeMouseAtCenter("body", {
+        type: "contextmenu",
+        button: 2
+      }, browser);
+      yield awaitPopupShown;
+      document.getElementById("context-bookmarkpage").click();
+      contextMenu.hidePopup();
+      yield awaitPopupHidden;
+    },
+    popupEditFn() {
+      EventUtils.sendChar("VK_TAB", window);
+    },
+    shouldAutoClose: false,
+    popupHideFn() {
+      bookmarkPanel.hidePopup();
+    },
+    isBookmarkRemoved: false,
+  });
+});
+
+add_task(function* bookmarks_menu_new_bookmark_remove_bookmark() {
+  yield test_bookmarks_popup({
+    isNewBookmark: true,
+    popupShowFn(browser) {
+      document.getElementById("menu_bookmarkThisPage").doCommand();
+    },
+    shouldAutoClose: true,
+    popupHideFn() {
+      document.getElementById("editBookmarkPanelRemoveButton").click();
+    },
+    isBookmarkRemoved: true,
+  });
+});
+
+add_task(function* ctrl_d_edit_bookmark_remove_bookmark() {
+  yield test_bookmarks_popup({
+    isNewBookmark: false,
+    popupShowFn(browser) {
+      EventUtils.synthesizeKey("D", {accelKey: true}, window);
+    },
+    shouldAutoClose: true,
+    popupHideFn() {
+      document.getElementById("editBookmarkPanelRemoveButton").click();
+    },
+    isBookmarkRemoved: true,
+  });
+});
+
+registerCleanupFunction(function() {
+  delete StarUI._closePanelQuickForTesting;
+})
--- a/browser/base/content/test/general/browser_bug1015721.js
+++ b/browser/base/content/test/general/browser_bug1015721.js
@@ -2,31 +2,31 @@
  * 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/. */
 "use strict";
 
 const TEST_PAGE = "http://example.org/browser/browser/base/content/test/general/zoom_test.html";
 
 var gTab1, gTab2, gLevel1;
 
-function test() {
+function* test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     gTab1 = gBrowser.addTab();
     gTab2 = gBrowser.addTab();
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     yield FullZoomHelper.load(gTab1, TEST_PAGE);
     yield FullZoomHelper.load(gTab2, TEST_PAGE);
   }).then(zoomTab1, FullZoomHelper.failAndContinue(finish));
 }
 
 function zoomTab1() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
     FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
     FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
 
     let browser1 = gBrowser.getBrowserForTab(gTab1);
     yield BrowserTestUtils.synthesizeMouse(null, 10, 10, {
       wheel: true, ctrlKey: true, deltaY: -1, deltaMode: WheelEvent.DOM_DELTA_LINE
     }, browser1);
@@ -38,17 +38,17 @@ function zoomTab1() {
     });
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
     FullZoomHelper.zoomTest(gTab2, gLevel1, "Tab 2 should have zoomed along with tab 1");
   }).then(finishTest, FullZoomHelper.failAndContinue(finish));
 }
 
 function finishTest() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     yield FullZoom.reset();
     yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
     yield FullZoom.reset();
     yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab2);
   }).then(finish, FullZoomHelper.failAndContinue(finish));
 }
--- a/browser/base/content/test/general/browser_bug1261299.js
+++ b/browser/base/content/test/general/browser_bug1261299.js
@@ -65,9 +65,9 @@ add_task(function* test_active_selection
   is(selectedText, "Write something here", "The macOS services got the selected content text");
 
   yield BrowserTestUtils.switchTab(gBrowser, tab2);
   selectedText = DOMWindowUtils.GetSelectionAsPlaintext();
   is(selectedText, "Nothing available", "The macOS services got the selected content text");
 
   yield BrowserTestUtils.removeTab(tab1);
   yield BrowserTestUtils.removeTab(tab2);
-});
\ No newline at end of file
+});
--- a/browser/base/content/test/general/browser_bug321000.js
+++ b/browser/base/content/test/general/browser_bug321000.js
@@ -5,22 +5,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const kTestString = "  hello hello  \n  world\nworld  ";
 
 var gTests = [
 
   { desc: "Urlbar strips newlines and surrounding whitespace",
     element: gURLBar,
-    expected: kTestString.replace(/\s*\n\s*/g,'')
+    expected: kTestString.replace(/\s*\n\s*/g, '')
   },
 
   { desc: "Searchbar replaces newlines with spaces",
     element: document.getElementById('searchbar'),
-    expected: kTestString.replace(/\n/g,' ')
+    expected: kTestString.replace(/\n/g, ' ')
   },
 
 ];
 
 // Test for bug 23485 and bug 321000.
 // Urlbar should strip newlines,
 // search bar should replace newlines with spaces.
 function test() {
--- a/browser/base/content/test/general/browser_bug386835.js
+++ b/browser/base/content/test/general/browser_bug386835.js
@@ -3,29 +3,29 @@ var gTestImage = "http://example.org/bro
 var gTab1, gTab2, gTab3;
 var gLevel;
 const BACK = 0;
 const FORWARD = 1;
 
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     gTab1 = gBrowser.addTab(gTestPage);
     gTab2 = gBrowser.addTab();
     gTab3 = gBrowser.addTab();
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     yield FullZoomHelper.load(gTab1, gTestPage);
     yield FullZoomHelper.load(gTab2, gTestPage);
   }).then(secondPageLoaded, FullZoomHelper.failAndContinue(finish));
 }
 
 function secondPageLoaded() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
     FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
     FullZoomHelper.zoomTest(gTab3, 1, "Initial zoom of tab 3 should be 1");
 
     // Now have three tabs, two with the test page, one blank. Tab 1 is selected
     // Zoom tab 1
     FullZoom.enlarge();
     gLevel = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab1));
@@ -34,53 +34,53 @@ function secondPageLoaded() {
     FullZoomHelper.zoomTest(gTab2, 1, "Zooming tab 1 should not affect tab 2");
     FullZoomHelper.zoomTest(gTab3, 1, "Zooming tab 1 should not affect tab 3");
 
     yield FullZoomHelper.load(gTab3, gTestPage);
   }).then(thirdPageLoaded, FullZoomHelper.failAndContinue(finish));
 }
 
 function thirdPageLoaded() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
     FullZoomHelper.zoomTest(gTab2, 1, "Tab 2 should still not be affected");
     FullZoomHelper.zoomTest(gTab3, gLevel, "Tab 3 should have zoomed as it was loading in the background");
 
     // Switching to tab 2 should update its zoom setting.
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
     FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
     FullZoomHelper.zoomTest(gTab2, gLevel, "Tab 2 should be zoomed now");
     FullZoomHelper.zoomTest(gTab3, gLevel, "Tab 3 should still be zoomed");
 
     yield FullZoomHelper.load(gTab1, gTestImage);
   }).then(imageLoaded, FullZoomHelper.failAndContinue(finish));
 }
 
 function imageLoaded() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background");
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     FullZoomHelper.zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
   }).then(imageZoomSwitch, FullZoomHelper.failAndContinue(finish));
 }
 
 function imageZoomSwitch() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     yield FullZoomHelper.navigate(BACK);
     yield FullZoomHelper.navigate(FORWARD);
     FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
     FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should still not be zoomed when deselected");
   }).then(finishTest, FullZoomHelper.failAndContinue(finish));
 }
 
 var finishTestStarted  = false;
 function finishTest() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     ok(!finishTestStarted, "finishTest called more than once");
     finishTestStarted = true;
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     yield FullZoom.reset();
     yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);
     yield FullZoom.reset();
     yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab2);
     yield FullZoom.reset();
--- a/browser/base/content/test/general/browser_bug416661.js
+++ b/browser/base/content/test/general/browser_bug416661.js
@@ -1,43 +1,43 @@
 var tabElm, zoomLevel;
 function start_test_prefNotSet() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(ZoomManager.zoom, 1, "initial zoom level should be 1");
     FullZoom.enlarge();
 
     //capture the zoom level to test later
     zoomLevel = ZoomManager.zoom;
     isnot(zoomLevel, 1, "zoom level should have changed");
 
     yield FullZoomHelper.load(gBrowser.selectedTab, "http://mochi.test:8888/browser/browser/base/content/test/general/moz.png");
   }).then(continue_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
 }
 
 function continue_test_prefNotSet () {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
     yield FullZoom.reset();
 
     yield FullZoomHelper.load(gBrowser.selectedTab, "http://mochi.test:8888/browser/browser/base/content/test/general/zoom_test.html");
   }).then(end_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
 }
 
 function end_test_prefNotSet() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
 
     // Reset the zoom so that other tests have a fresh zoom level
     yield FullZoom.reset();
     yield FullZoomHelper.removeTabAndWaitForLocationChange();
     finish();
   });
 }
 
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     tabElm = gBrowser.addTab();
     yield FullZoomHelper.selectTabAndWaitForLocationChange(tabElm);
     yield FullZoomHelper.load(tabElm, "http://mochi.test:8888/browser/browser/base/content/test/general/zoom_test.html");
   }).then(start_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
 }
--- a/browser/base/content/test/general/browser_bug417483.js
+++ b/browser/base/content/test/general/browser_bug417483.js
@@ -15,16 +15,16 @@ add_task(function* () {
     frame.focus();
   });
 
   let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
 
   let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
   yield BrowserTestUtils.synthesizeMouse("frame", 5, 5,
         { type: "contextmenu", button: 2}, gBrowser.selectedBrowser);
-  yield popupShownPromise;  
+  yield popupShownPromise;
 
   ok(document.getElementById("frame-sep").hidden, "'frame-sep' should be hidden if the selection contains only spaces");
 
   let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
   contentAreaContextMenu.hidePopup();
-  yield popupHiddenPromise;  
+  yield popupHiddenPromise;
 });
--- a/browser/base/content/test/general/browser_bug419612.js
+++ b/browser/base/content/test/general/browser_bug419612.js
@@ -1,12 +1,12 @@
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     let testPage = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
     let tab1 = gBrowser.addTab();
     yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);
     yield FullZoomHelper.load(tab1, testPage);
 
     let tab2 = gBrowser.addTab();
     yield FullZoomHelper.load(tab2, testPage);
 
--- a/browser/base/content/test/general/browser_bug441778.js
+++ b/browser/base/content/test/general/browser_bug441778.js
@@ -8,17 +8,17 @@
  */
 
 function test() {
   waitForExplicitFinish();
 
   const TEST_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>';
   const TEST_IFRAME_URL = "http://test2.example.org/";
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     // Prepare the test tab
     let tab = gBrowser.addTab();
     yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);
 
     let testBrowser = tab.linkedBrowser;
 
     yield FullZoomHelper.load(tab, TEST_PAGE_URL);
 
--- a/browser/base/content/test/general/browser_bug460146.js
+++ b/browser/base/content/test/general/browser_bug460146.js
@@ -1,15 +1,15 @@
 /* Check proper image url retrieval from all kinds of elements/styles */
 
 function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  
+
   gBrowser.selectedBrowser.addEventListener("load", function () {
     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
 
     var doc = gBrowser.contentDocument;
     var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,
                                    "mediaTab");
 
     pageInfo.addEventListener("load", function () {
--- a/browser/base/content/test/general/browser_bug479408.js
+++ b/browser/base/content/test/general/browser_bug479408.js
@@ -1,17 +1,17 @@
 function test() {
   waitForExplicitFinish();
   let tab = gBrowser.selectedTab = gBrowser.addTab(
     "http://mochi.test:8888/browser/browser/base/content/test/general/browser_bug479408_sample.html");
-  
+
   gBrowser.addEventListener("DOMLinkAdded", function(aEvent) {
     gBrowser.removeEventListener("DOMLinkAdded", arguments.callee, true);
-    
+
     executeSoon(function() {
       ok(!tab.linkedBrowser.engines,
          "the subframe's search engine wasn't detected");
-      
+
       gBrowser.removeTab(tab);
       finish();
     });
   }, true);
 }
--- a/browser/base/content/test/general/browser_bug517902.js
+++ b/browser/base/content/test/general/browser_bug517902.js
@@ -1,15 +1,15 @@
 /* Make sure that "View Image Info" loads the correct image data */
 
 function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  
+
   gBrowser.selectedBrowser.addEventListener("load", function () {
     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
 
     var doc = gBrowser.contentDocument;
     var testImg = doc.getElementById("test-image");
     var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,
                                    "mediaTab", testImg);
 
--- a/browser/base/content/test/general/browser_bug553455.js
+++ b/browser/base/content/test/general/browser_bug553455.js
@@ -698,17 +698,17 @@ function test_localfile() {
     });
   }, "addon-install-failed", false);
 
   var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
                      .getService(Components.interfaces.nsIChromeRegistry);
   try {
     var path = cr.convertChromeURL(makeURI(CHROMEROOT + "corrupt.xpi")).spec;
   } catch (ex) {
-    var path = CHROMEROOT + "corrupt.xpi";
+    path = CHROMEROOT + "corrupt.xpi";
   }
   gBrowser.selectedTab = gBrowser.addTab("about:blank");
   BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
     gBrowser.loadURI(path);
   });
 },
 
 function test_tabclose() {
@@ -1128,17 +1128,17 @@ function runNextTest() {
       finish();
       return;
     }
 
     info("Running " + TESTS[0].name);
     gTestStart = Date.now();
     TESTS.shift()();
   });
-};
+}
 
 var XPInstallObserver = {
   observe: function (aSubject, aTopic, aData) {
     var installInfo = aSubject.QueryInterface(Components.interfaces.amIWebInstallInfo);
     info("Observed " + aTopic + " for " + installInfo.installs.length + " installs");
     installInfo.installs.forEach(function(aInstall) {
       info("Install of " + aInstall.sourceURI.spec + " was in state " + aInstall.state);
     });
--- a/browser/base/content/test/general/browser_bug555224.js
+++ b/browser/base/content/test/general/browser_bug555224.js
@@ -1,40 +1,40 @@
 /* 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/. */
 const TEST_PAGE = "/browser/browser/base/content/test/general/dummy_page.html";
 var gTestTab, gBgTab, gTestZoom;
 
 function testBackgroundLoad() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(ZoomManager.zoom, gTestZoom, "opening a background tab should not change foreground zoom");
 
     yield FullZoomHelper.removeTabAndWaitForLocationChange(gBgTab);
 
     yield FullZoom.reset();
     yield FullZoomHelper.removeTabAndWaitForLocationChange(gTestTab);
     finish();
   });
 }
 
 function testInitialZoom() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(ZoomManager.zoom, 1, "initial zoom level should be 1");
     FullZoom.enlarge();
 
     gTestZoom = ZoomManager.zoom;
     isnot(gTestZoom, 1, "zoom level should have changed");
 
     gBgTab = gBrowser.addTab();
     yield FullZoomHelper.load(gBgTab, "http://mochi.test:8888" + TEST_PAGE);
   }).then(testBackgroundLoad, FullZoomHelper.failAndContinue(finish));
 }
 
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     gTestTab = gBrowser.addTab();
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTestTab);
     yield FullZoomHelper.load(gTestTab, "http://example.org" + TEST_PAGE);
   }).then(testInitialZoom, FullZoomHelper.failAndContinue(finish));
 }
--- a/browser/base/content/test/general/browser_bug555767.js
+++ b/browser/base/content/test/general/browser_bug555767.js
@@ -46,9 +46,9 @@
 
       // Add the TabClose, TabSelect event listeners before we press enter
       gBrowser.tabContainer.addEventListener("TabClose", onTabClose, false);
       gBrowser.tabContainer.addEventListener("TabSelect", onTabSelect, false);
 
       // Press enter!
       EventUtils.synthesizeKey("VK_RETURN", {});
     });
- 
\ No newline at end of file
+
--- a/browser/base/content/test/general/browser_bug559991.js
+++ b/browser/base/content/test/general/browser_bug559991.js
@@ -7,31 +7,31 @@ function test() {
 
   waitForExplicitFinish();
 
   gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", true);
   gPrefService.setBoolPref("browser.zoom.siteSpecific", true);
 
   let uri = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     tab = gBrowser.addTab();
     yield FullZoomHelper.load(tab, uri);
 
     // -------------------------------------------------------------------
     // Test - Trigger a tab switch that should update the zoom level
     yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);
     ok(true, "applyPrefToSetting was called");
   }).then(endTest, FullZoomHelper.failAndContinue(endTest));
 }
 
 // -------------
 // Test clean-up
 function endTest() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     yield FullZoomHelper.removeTabAndWaitForLocationChange(tab);
 
     tab = null;
 
     if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
       gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
 
     if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
--- a/browser/base/content/test/general/browser_bug561636.js
+++ b/browser/base/content/test/general/browser_bug561636.js
@@ -29,22 +29,22 @@ function incrementTest()
   testId++;
   info("Starting next part of test");
 }
 
 function getDocHeader()
 {
   return "<html><head><meta charset='utf-8'></head><body>" + getEmptyFrame();
 }
- 
+
 function getDocFooter()
 {
   return "</body></html>";
 }
- 
+
 function getEmptyFrame()
 {
   return "<iframe style='width:100px; height:30px; margin:3px; border:1px solid lightgray;' " +
          "name='t' srcdoc=\"<html><head><meta charset='utf-8'></head><body>form target</body></html>\"></iframe>";
 }
 
 function* openNewTab(uri, background)
 {
--- a/browser/base/content/test/general/browser_bug575830.js
+++ b/browser/base/content/test/general/browser_bug575830.js
@@ -4,17 +4,17 @@
 "use strict";
 
 function test() {
   let tab1, tab2;
   const TEST_IMAGE = "http://example.org/browser/browser/base/content/test/general/moz.png";
 
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     tab1 = gBrowser.addTab();
     tab2 = gBrowser.addTab();
     yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);
     yield FullZoomHelper.load(tab1, TEST_IMAGE);
 
     is(ZoomManager.zoom, 1, "initial zoom level for first should be 1");
 
     FullZoom.enlarge();
--- a/browser/base/content/test/general/browser_bug577121.js
+++ b/browser/base/content/test/general/browser_bug577121.js
@@ -17,13 +17,13 @@ function test() {
   // Now execute "Close other Tabs" on the first manually opened tab (tab1).
   // -> tab2 ist pinned, tab1 should remain open and the initial tab should
   // get closed.
   gBrowser.removeAllTabsBut(testTab1);
 
   is(gBrowser.tabs.length, 2, "there are two remaining tabs open");
   is(gBrowser.tabs[0], testTab2, "pinned tab2 stayed open");
   is(gBrowser.tabs[1], testTab1, "tab1 stayed open");
-  
+
   // Cleanup. Close only one tab because we need an opened tab at the end of
   // the test.
   gBrowser.removeTab(testTab2);
 }
--- a/browser/base/content/test/general/browser_bug579872.js
+++ b/browser/base/content/test/general/browser_bug579872.js
@@ -5,24 +5,24 @@
 function test() {
   let newTab = gBrowser.addTab();
   waitForExplicitFinish();
   BrowserTestUtils.browserLoaded(newTab.linkedBrowser).then(mainPart);
 
   function mainPart() {
     gBrowser.pinTab(newTab);
     gBrowser.selectedTab = newTab;
-    
+
     openUILinkIn("javascript:var x=0;", "current");
     is(gBrowser.tabs.length, 2, "Should open in current tab");
-    
+
     openUILinkIn("http://example.com/1", "current");
     is(gBrowser.tabs.length, 2, "Should open in current tab");
-    
+
     openUILinkIn("http://example.org/", "current");
     is(gBrowser.tabs.length, 3, "Should open in new tab");
-    
+
     gBrowser.removeTab(newTab);
     gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
     finish();
   }
   newTab.linkedBrowser.loadURI("http://example.com");
 }
--- a/browser/base/content/test/general/browser_bug580638.js
+++ b/browser/base/content/test/general/browser_bug580638.js
@@ -36,25 +36,25 @@ function test() {
   testState(false);
 
   // Test updating key state after selecting a tab.
   gBrowser.selectedTab = pinnedTab;
   testState(true);
 
   gBrowser.selectedTab = lastSelectedTab;
   testState(false);
-  
+
   gBrowser.selectedTab = pinnedTab;
   testState(true);
 
   // Test updating the key state after un/pinning the tab.
   gBrowser.unpinTab(pinnedTab);
   testState(false);
 
-  gBrowser.pinTab(pinnedTab);  
+  gBrowser.pinTab(pinnedTab);
   testState(true);
 
   // Test updating the key state after removing the tab.
   gBrowser.removeTab(pinnedTab);
   testState(false);
 
   finish();
 }
--- a/browser/base/content/test/general/browser_bug585558.js
+++ b/browser/base/content/test/general/browser_bug585558.js
@@ -96,17 +96,17 @@ function test_hoverOne() {
   testAttrib(gBrowser.tabs[1], "afterhovered",  false, "Second tab not marked afterhovered!");
   testAttrib(gBrowser.tabs[3], "beforehovered", false, "Fourth tab not marked beforehovered!");
   testAttrib(gBrowser.tabs[3], "afterhovered",  false, "Fourth tab not marked afterhovered!");
   gBrowser.removeTab(tabs.pop());
   executeSoon(test_hoverStatePersistence);
 }
 
 function test_hoverStatePersistence() {
-  // Test that the afterhovered and beforehovered attributes are still there when 
+  // Test that the afterhovered and beforehovered attributes are still there when
   // a tab is selected and then unselected again. See bug 856107.
 
   function assertState() {
     testAttrib(gBrowser.tabs[0], "beforehovered", true,  "First tab still marked beforehovered!");
     testAttrib(gBrowser.tabs[0], "afterhovered",  false, "First tab not marked afterhovered!");
     testAttrib(gBrowser.tabs[2], "afterhovered",  true,  "Third tab still marked afterhovered!");
     testAttrib(gBrowser.tabs[2], "beforehovered", false, "Third tab not marked afterhovered!");
     testAttrib(gBrowser.tabs[1], "beforehovered", false, "Second tab not marked beforehovered!");
--- a/browser/base/content/test/general/browser_bug585830.js
+++ b/browser/base/content/test/general/browser_bug585830.js
@@ -2,24 +2,24 @@
  * 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 test() {
   let tab1 = gBrowser.selectedTab;
   let tab2 = gBrowser.addTab("about:blank", {skipAnimation: true});
   let tab3 = gBrowser.addTab();
   gBrowser.selectedTab = tab2;
-  
+
   gBrowser.removeCurrentTab({animate: true});
   gBrowser.tabContainer.advanceSelectedTab(-1, true);
   is(gBrowser.selectedTab, tab1, "First tab should be selected");
   gBrowser.removeTab(tab2);
-  
+
   // test for "null has no properties" fix. See Bug 585830 Comment 13
   gBrowser.removeCurrentTab({animate: true});
   try {
     gBrowser.tabContainer.advanceSelectedTab(-1, false);
-  } catch(err) {
+  } catch (err) {
     ok(false, "Shouldn't throw");
   }
-  
+
   gBrowser.removeTab(tab1);
 }
--- a/browser/base/content/test/general/browser_bug590206.js
+++ b/browser/base/content/test/general/browser_bug590206.js
@@ -108,50 +108,50 @@ add_task(function* test_file() {
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
 
   gBrowser.selectedTab = newTab;
   is(getConnectionState(), "file", "Connection should be file");
 
   gBrowser.removeTab(newTab);
 });
 
-add_task(function test_resource_uri() {
+add_task(function* test_resource_uri() {
   let oldTab = gBrowser.selectedTab;
   let dataURI = "resource://gre/modules/Services.jsm";
 
   let newTab = yield loadNewTab(dataURI);
 
   is(getConnectionState(), "file", "Connection should be file");
 
   gBrowser.selectedTab = oldTab;
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
 
   gBrowser.selectedTab = newTab;
   is(getConnectionState(), "file", "Connection should be file");
 
   gBrowser.removeTab(newTab);
 });
 
-add_task(function test_data_uri() {
+add_task(function* test_data_uri() {
   let oldTab = gBrowser.selectedTab;
   let dataURI = "data:text/html,hi"
 
   let newTab = yield loadNewTab(dataURI);
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
 
   gBrowser.selectedTab = oldTab;
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
 
   gBrowser.selectedTab = newTab;
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
 
   gBrowser.removeTab(newTab);
 });
 
-add_task(function test_about_uri() {
+add_task(function* test_about_uri() {
   let oldTab = gBrowser.selectedTab;
   let aboutURI = "about:robots"
 
   let newTab = yield loadNewTab(aboutURI);
   is(getConnectionState(), "file", "Connection should be file");
 
   gBrowser.selectedTab = oldTab;
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
--- a/browser/base/content/test/general/browser_bug592338.js
+++ b/browser/base/content/test/general/browser_bug592338.js
@@ -131,17 +131,17 @@ function runNextTest() {
         finish();
       });
       return;
     }
 
     info("Running " + TESTS[0].name);
     TESTS.shift()();
   });
-};
+}
 
 function test() {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref("extensions.logging.enabled", true);
 
   AddonManager.getInstallForURL(TESTROOT + "theme.xpi", function(aInstall) {
     aInstall.addListener({
--- a/browser/base/content/test/general/browser_bug597218.js
+++ b/browser/base/content/test/general/browser_bug597218.js
@@ -2,37 +2,37 @@
  * 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 test() {
   waitForExplicitFinish();
 
   // establish initial state
   is(gBrowser.tabs.length, 1, "we start with one tab");
-  
+
   // create a tab
   let tab = gBrowser.loadOneTab("about:blank");
   ok(!tab.hidden, "tab starts out not hidden");
   is(gBrowser.tabs.length, 2, "we now have two tabs");
 
   // make sure .hidden is read-only
-  tab.hidden = true; 
+  tab.hidden = true;
   ok(!tab.hidden, "can't set .hidden directly");
 
   // hide the tab
   gBrowser.hideTab(tab);
   ok(tab.hidden, "tab is hidden");
-  
+
   // now pin it and make sure it gets unhidden
   gBrowser.pinTab(tab);
   ok(tab.pinned, "tab was pinned");
   ok(!tab.hidden, "tab was unhidden");
-  
+
   // try hiding it now that it's pinned; shouldn't be able to
   gBrowser.hideTab(tab);
   ok(!tab.hidden, "tab did not hide");
-    
+
   // clean up
   gBrowser.removeTab(tab);
   is(gBrowser.tabs.length, 1, "we finish with one tab");
 
   finish();
 }
--- a/browser/base/content/test/general/browser_bug655584.js
+++ b/browser/base/content/test/general/browser_bug655584.js
@@ -11,13 +11,13 @@ add_task(function* () {
   // When urlbar in a new tab is focused, and a tab switch occurs,
   // the urlbar popup should be closed
   yield BrowserTestUtils.switchTab(gBrowser, tab2);
   gURLBar.focus(); // focus the urlbar in the tab we will switch to
   yield BrowserTestUtils.switchTab(gBrowser, tab1);
   gURLBar.openPopup();
   yield BrowserTestUtils.switchTab(gBrowser, tab2);
   ok(!gURLBar.popupOpen, "urlbar focused in tab to switch to, close popup");
-  
+
   // cleanup
   gBrowser.removeCurrentTab();
   gBrowser.removeCurrentTab();
 });
--- a/browser/base/content/test/general/browser_bug719271.js
+++ b/browser/base/content/test/general/browser_bug719271.js
@@ -6,28 +6,28 @@
 const TEST_PAGE = "http://example.org/browser/browser/base/content/test/general/zoom_test.html";
 const TEST_VIDEO = "http://example.org/browser/browser/base/content/test/general/video.ogg";
 
 var gTab1, gTab2, gLevel1, gLevel2;
 
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     gTab1 = gBrowser.addTab();
     gTab2 = gBrowser.addTab();
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     yield FullZoomHelper.load(gTab1, TEST_PAGE);
     yield FullZoomHelper.load(gTab2, TEST_VIDEO);
   }).then(zoomTab1, FullZoomHelper.failAndContinue(finish));
 }
 
 function zoomTab1() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
     FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
     FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
 
     FullZoom.enlarge();
     gLevel1 = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab1));
 
     ok(gLevel1 > 1, "New zoom for tab 1 should be greater than 1");
@@ -35,32 +35,32 @@ function zoomTab1() {
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
     FullZoomHelper.zoomTest(gTab2, 1, "Tab 2 is still unzoomed after it is selected");
     FullZoomHelper.zoomTest(gTab1, gLevel1, "Tab 1 is still zoomed");
   }).then(zoomTab2, FullZoomHelper.failAndContinue(finish));
 }
 
 function zoomTab2() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     is(gBrowser.selectedTab, gTab2, "Tab 2 is selected");
 
     FullZoom.reduce();
     let gLevel2 = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab2));
 
     ok(gLevel2 < 1, "New zoom for tab 2 should be less than 1");
     FullZoomHelper.zoomTest(gTab1, gLevel1, "Zooming tab 2 should not affect tab 1");
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     FullZoomHelper.zoomTest(gTab1, gLevel1, "Tab 1 should have the same zoom after it's selected");
   }).then(testNavigation, FullZoomHelper.failAndContinue(finish));
 }
 
 function testNavigation() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     yield FullZoomHelper.load(gTab1, TEST_VIDEO);
     FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when a video was loaded");
     yield waitForNextTurn(); // trying to fix orange bug 806046
     yield FullZoomHelper.navigate(FullZoomHelper.BACK);
     FullZoomHelper.zoomTest(gTab1, gLevel1, "Zoom should be restored when a page is loaded");
     yield waitForNextTurn(); // trying to fix orange bug 806046
     yield FullZoomHelper.navigate(FullZoomHelper.FORWARD);
     FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 again when navigating back to a video");
@@ -70,17 +70,17 @@ function testNavigation() {
 function waitForNextTurn() {
   let deferred = Promise.defer();
   setTimeout(() => deferred.resolve(), 0);
   return deferred.promise;
 }
 
 var finishTestStarted  = false;
 function finishTest() {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     ok(!finishTestStarted, "finishTest called more than once");
     finishTestStarted = true;
 
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
     yield FullZoom.reset();
     yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);
     yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
     yield FullZoom.reset();
--- a/browser/base/content/test/general/browser_bug749738.js
+++ b/browser/base/content/test/general/browser_bug749738.js
@@ -15,17 +15,17 @@ function test() {
   load(tab, DUMMY_PAGE, function() {
     gFindBar.onFindCommand();
     EventUtils.sendString("Dummy");
     gBrowser.removeTab(tab);
 
     try {
       gFindBar.close();
       ok(true, "findbar.close should not throw an exception");
-    } catch(e) {
+    } catch (e) {
       ok(false, "findbar.close threw exception: " + e);
     }
     finish();
   });
 }
 
 function load(aTab, aUrl, aCallback) {
   aTab.linkedBrowser.addEventListener("load", function onload(aEvent) {
--- a/browser/base/content/test/general/browser_bug822367.js
+++ b/browser/base/content/test/general/browser_bug822367.js
@@ -50,17 +50,17 @@ function MixedTest1A() {
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 function MixedTest1B() {
   waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest1C, "Waited too long for mixed script to run in Test 1");
 }
 function MixedTest1C() {
-  ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 1");
+  ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 1");
   gTestBrowser.removeEventListener("load", MixedTest1B, true);
   MixedTest2();
 }
 
 //Mixed Display Test - Doorhanger should not appear
 function MixedTest2() {
   gTestBrowser.addEventListener("load", MixedTest2A, true);
   var url = gHttpTestRoot2 + "file_bug822367_2.html";
@@ -90,18 +90,18 @@ function MixedTest3A() {
 }
 function MixedTest3B() {
   waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest3C, "Waited too long for mixed script to run in Test 3");
 }
 function MixedTest3C() {
   waitForCondition(() => content.document.getElementById('p2').innerHTML == "bye", MixedTest3D, "Waited too long for mixed image to load in Test 3");
 }
 function MixedTest3D() {
-  ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 3");
-  ok(content.document.getElementById('p2').innerHTML == "bye","Mixed image didn't load in Test 3");
+  ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 3");
+  ok(content.document.getElementById('p2').innerHTML == "bye", "Mixed image didn't load in Test 3");
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: true});
   MixedTest4();
 }
 
 // Location change - User override on one page doesn't propogate to another page after location change.
 function MixedTest4() {
   gTestBrowser.removeEventListener("load", MixedTest3B, true);
   gTestBrowser.addEventListener("load", MixedTest4A, true);
@@ -124,17 +124,17 @@ function MixedTest4C() {
   ok(content.document.location == gHttpTestRoot + "file_bug822367_4B.html", "Location didn't change in test 4");
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   waitForCondition(() => content.document.getElementById('p1').innerHTML == "", MixedTest4D, "Mixed script loaded in test 4 after location change!");
 }
 function MixedTest4D() {
-  ok(content.document.getElementById('p1').innerHTML == "","p1.innerHTML changed; mixed script loaded after location change in Test 4");
+  ok(content.document.getElementById('p1').innerHTML == "", "p1.innerHTML changed; mixed script loaded after location change in Test 4");
   MixedTest5();
 }
 
 // Mixed script attempts to load in a document.open()
 function MixedTest5() {
   gTestBrowser.removeEventListener("load", MixedTest4B, true);
   gTestBrowser.addEventListener("load", MixedTest5A, true);
   var url = gHttpTestRoot + "file_bug822367_5.html";
@@ -148,17 +148,17 @@ function MixedTest5A() {
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 function MixedTest5B() {
   waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest5C, "Waited too long for mixed script to run in Test 5");
 }
 function MixedTest5C() {
-  ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 5");
+  ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 5");
   MixedTest6();
 }
 
 // Mixed script attempts to load in a document.open() that is within an iframe.
 function MixedTest6() {
   gTestBrowser.removeEventListener("load", MixedTest5B, true);
   gTestBrowser.addEventListener("load", MixedTest6A, true);
   var url = gHttpTestRoot2 + "file_bug822367_6.html";
@@ -185,12 +185,12 @@ function MixedTest6C() {
     try {
       return content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello";
     } catch (e) {
       return false;
     }
   }, MixedTest6D, "Waited too long for mixed script to run in Test 6");
 }
 function MixedTest6D() {
-  ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 6");
+  ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 6");
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
   MixedTestsCompleted();
 }
--- a/browser/base/content/test/general/browser_bug882977.js
+++ b/browser/base/content/test/general/browser_bug882977.js
@@ -1,36 +1,36 @@
-"use strict";
-
-/**
- * Tests that the identity-box shows the chromeUI styling
- * when viewing about:home in a new window.
- */
-add_task(function*(){
-  let homepage = "about:home";
-  yield SpecialPowers.pushPrefEnv({
-    "set": [
-      ["browser.startup.homepage", homepage],
-      ["browser.startup.page", 1],
-    ]
-  });
-
-  let win = OpenBrowserWindow();
-  yield BrowserTestUtils.waitForEvent(win, "load");
-
-  let browser = win.gBrowser.selectedBrowser;
-  // If we've finished loading about:home already, we can check
-  // right away - otherwise, we need to wait.
-  if (browser.contentDocument.readyState == "complete" &&
-      browser.currentURI.spec == homepage) {
-    checkIdentityMode(win);
-  } else {
-    yield BrowserTestUtils.browserLoaded(browser, false, homepage);
-    checkIdentityMode(win);
-  }
-
-  yield BrowserTestUtils.closeWindow(win);
-});
-
-function checkIdentityMode(win) {
-  let identityMode = win.document.getElementById("identity-box").className;
-  is(identityMode, "chromeUI", "Identity state should be chromeUI for about:home in a new window");
-}
+"use strict";
+
+/**
+ * Tests that the identity-box shows the chromeUI styling
+ * when viewing about:home in a new window.
+ */
+add_task(function*() {
+  let homepage = "about:home";
+  yield SpecialPowers.pushPrefEnv({
+    "set": [
+      ["browser.startup.homepage", homepage],
+      ["browser.startup.page", 1],
+    ]
+  });
+
+  let win = OpenBrowserWindow();
+  yield BrowserTestUtils.waitForEvent(win, "load");
+
+  let browser = win.gBrowser.selectedBrowser;
+  // If we've finished loading about:home already, we can check
+  // right away - otherwise, we need to wait.
+  if (browser.contentDocument.readyState == "complete" &&
+      browser.currentURI.spec == homepage) {
+    checkIdentityMode(win);
+  } else {
+    yield BrowserTestUtils.browserLoaded(browser, false, homepage);
+    checkIdentityMode(win);
+  }
+
+  yield BrowserTestUtils.closeWindow(win);
+});
+
+function checkIdentityMode(win) {
+  let identityMode = win.document.getElementById("identity-box").className;
+  is(identityMode, "chromeUI", "Identity state should be chromeUI for about:home in a new window");
+}
--- a/browser/base/content/test/general/browser_clipboard.js
+++ b/browser/base/content/test/general/browser_clipboard.js
@@ -60,17 +60,17 @@ add_task(function*() {
       sendKey("c");
     });
 
     selection.modify("move", "right", "line");
 
     yield new Promise((resolve, reject) => {
       addEventListener("paste", function copyEvent(event) {
         removeEventListener("paste", copyEvent, true);
-        let clipboardData = event.clipboardData; 
+        let clipboardData = event.clipboardData;
         Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard");
         Assert.equal(clipboardData.types.length, 2, "Two types on clipboard");
         Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard");
         Assert.equal(clipboardData.types[1], "text/plain", "text/plain on clipboard");
         Assert.equal(clipboardData.getData("text/html"), arg.htmlPrefix +
           "t <b>Bold</b>" + arg.htmlPostfix, "text/html value");
         Assert.equal(clipboardData.getData("text/plain"), "t Bold", "text/plain value");
         resolve();
@@ -96,17 +96,17 @@ add_task(function*() {
       sendKey("x");
     });
 
     selection.modify("move", "left", "line");
 
     yield new Promise((resolve, reject) => {
       addEventListener("paste", function copyEvent(event) {
         removeEventListener("paste", copyEvent, true);
-        let clipboardData = event.clipboardData; 
+        let clipboardData = event.clipboardData;
         Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard 2");
         Assert.equal(clipboardData.types.length, 2, "Two types on clipboard 2");
         Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard 2");
         Assert.equal(clipboardData.types[1], "text/plain", "text/plain on clipboard 2");
         Assert.equal(clipboardData.getData("text/html"), arg.htmlPrefix +
           "<i>Italic</i> " + arg.htmlPostfix, "text/html value 2");
         Assert.equal(clipboardData.getData("text/plain"), "Some text", "text/plain value 2");
         resolve();
--- a/browser/base/content/test/general/browser_contentAltClick.js
+++ b/browser/base/content/test/general/browser_contentAltClick.js
@@ -12,17 +12,17 @@
   */
 "use strict";
 
 XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
                                   "resource://gre/modules/Downloads.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
                                   "resource://testing-common/PlacesTestUtils.jsm");
 
-function setup(){
+function setup() {
   gPrefService.setBoolPref("browser.altClickSave", true);
 
   let testPage =
     'data:text/html,' +
     '<p><a id="commonlink" href="http://mochi.test/moz/">Common link</a></p>' +
     '<p><math id="mathxlink" xmlns="http://www.w3.org/1998/Math/MathML" xlink:type="simple" xlink:href="http://mochi.test/moz/"><mtext>MathML XLink</mtext></math></p>' +
     '<p><svg id="svgxlink" xmlns="http://www.w3.org/2000/svg" width="100px" height="50px" version="1.1"><a xlink:type="simple" xlink:href="http://mochi.test/moz/"><text transform="translate(10, 25)">SVG XLink</text></a></svg></p>';
 
@@ -47,17 +47,17 @@ function* clean_up() {
 add_task(function* test_alt_click()
 {
   yield setup();
 
   let downloadList = yield Downloads.getList(Downloads.ALL);
   let downloads = [];
   let downloadView;
   // When 1 download has been attempted then resolve the promise.
-  let finishedAllDownloads = new Promise( (resolve)=> {
+  let finishedAllDownloads = new Promise( (resolve) => {
     downloadView = {
       onDownloadAdded: function (aDownload) {
         downloads.push(aDownload);
         resolve();
       },
     };
   });
   yield downloadList.addView(downloadView);
@@ -76,17 +76,17 @@ add_task(function* test_alt_click()
 add_task(function* test_alt_click_on_xlinks()
 {
   yield setup();
 
   let downloadList = yield Downloads.getList(Downloads.ALL);
   let downloads = [];
   let downloadView;
   // When all 2 downloads have been attempted then resolve the promise.
-  let finishedAllDownloads = new Promise( (resolve)=> {
+  let finishedAllDownloads = new Promise( (resolve) => {
     downloadView = {
       onDownloadAdded: function (aDownload) {
         downloads.push(aDownload);
         if (downloads.length == 2) {
           resolve();
         }
       },
     };
@@ -99,9 +99,9 @@ add_task(function* test_alt_click_on_xli
   yield finishedAllDownloads;
   yield downloadList.removeView(downloadView);
 
   is(downloads.length, 2, "2 downloads");
   is(downloads[0].source.url, "http://mochi.test/moz/", "Downloaded #mathxlink element");
   is(downloads[1].source.url, "http://mochi.test/moz/", "Downloaded #svgxlink element");
 
   yield* clean_up();
-});
\ No newline at end of file
+});
--- a/browser/base/content/test/general/browser_contentAreaClick.js
+++ b/browser/base/content/test/general/browser_contentAreaClick.js
@@ -1,12 +1,12 @@
 /* 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/. */
- 
+
 /**
  * Test for bug 549340.
  * Test for browser.js::contentAreaClick() util.
  *
  * The test opens a new browser window, then replaces browser.js methods invoked
  * by contentAreaClick with a mock function that tracks which methods have been
  * called.
  * Each sub-test synthesizes a mouse click event on links injected in content,
@@ -40,32 +40,32 @@ var gTests = [
   // The next test was once handling feedService.forcePreview().  Now it should
   // just be like Alt click.
   {
     desc: "Shift+Alt left click",
     setup: function() {
       gPrefService.setBoolPref("browser.altClickSave", true);
     },
     clean: function() {
-      gPrefService.clearUserPref("browser.altClickSave"); 
+      gPrefService.clearUserPref("browser.altClickSave");
     },
     event: { shiftKey: true,
              altKey: true },
     targets: [ "commonlink", "maplink" ],
     expectedInvokedMethods: [ "gatherTextUnder", "saveURL" ],
     preventDefault: true,
   },
 
   {
     desc: "Shift+Alt left click on XLinks",
     setup: function() {
       gPrefService.setBoolPref("browser.altClickSave", true);
     },
     clean: function() {
-      gPrefService.clearUserPref("browser.altClickSave"); 
+      gPrefService.clearUserPref("browser.altClickSave");
     },
     event: { shiftKey: true,
              altKey: true },
     targets: [ "mathxlink", "svgxlink"],
     expectedInvokedMethods: [ "saveURL" ],
     preventDefault: true,
   },
 
@@ -80,31 +80,31 @@ var gTests = [
   },
 
   {
     desc: "Alt click",
     setup: function() {
       gPrefService.setBoolPref("browser.altClickSave", true);
     },
     clean: function() {
-      gPrefService.clearUserPref("browser.altClickSave"); 
+      gPrefService.clearUserPref("browser.altClickSave");
     },
     event: { altKey: true },
     targets: [ "commonlink", "maplink" ],
     expectedInvokedMethods: [ "gatherTextUnder", "saveURL" ],
     preventDefault: true,
   },
 
   {
     desc: "Alt click on XLinks",
     setup: function() {
       gPrefService.setBoolPref("browser.altClickSave", true);
     },
     clean: function() {
-      gPrefService.clearUserPref("browser.altClickSave"); 
+      gPrefService.clearUserPref("browser.altClickSave");
     },
     event: { altKey: true },
     targets: [ "mathxlink", "svgxlink" ],
     expectedInvokedMethods: [ "saveURL" ],
     preventDefault: true,
   },
 
   {
@@ -210,17 +210,17 @@ var gClickHandler = {
     is(prevent, gCurrentTest.preventDefault,
        gCurrentTest.desc + ": event.defaultPrevented is correct (" + prevent + ")")
 
     // Check that all required methods have been called.
     gCurrentTest.expectedInvokedMethods.forEach(function(aExpectedMethodName) {
       isnot(gInvokedMethods.indexOf(aExpectedMethodName), -1,
             gCurrentTest.desc + ":" + aExpectedMethodName + " was invoked");
     });
-    
+
     if (gInvokedMethods.length != gCurrentTest.expectedInvokedMethods.length) {
       ok(false, "Wrong number of invoked methods");
       gInvokedMethods.forEach(method => info(method + " was invoked"));
     }
 
     event.preventDefault();
     event.stopPropagation();
 
--- a/browser/base/content/test/general/browser_contextmenu.js
+++ b/browser/base/content/test/general/browser_contextmenu.js
@@ -1,953 +1,953 @@
-"use strict";
-
-let contextMenu;
-let LOGIN_FILL_ITEMS = [
-  "---", null,
-  "fill-login", null,
-    [
-      "fill-login-no-logins", false,
-      "---", null,
-      "fill-login-saved-passwords", true
-    ], null,
-];
-
-let hasPocket = Services.prefs.getBoolPref("extensions.pocket.enabled");
-let hasContainers = Services.prefs.getBoolPref("privacy.userContext.enabled");
-
-add_task(function* test_setup() {
-  const example_base = "http://example.com/browser/browser/base/content/test/general/";
-  const url = example_base + "subtst_contextmenu.html";
-  yield BrowserTestUtils.openNewForegroundTab(gBrowser, url);
-
-  const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
-  const contextmenu_common = chrome_base + "contextmenu_common.js";
-  Services.scriptloader.loadSubScript(contextmenu_common, this);
-
-  yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-    let doc = content.document;
-    let videoIframe = doc.querySelector("#test-video-in-iframe");
-    let video = videoIframe.contentDocument.querySelector("video");
-    let awaitPause = ContentTaskUtils.waitForEvent(video, "pause");
-    video.pause();
-    yield awaitPause;
-
-    let audioIframe = doc.querySelector("#test-audio-in-iframe");
-    // media documents always use a <video> tag.
-    let audio = audioIframe.contentDocument.querySelector("video");
-    awaitPause = ContentTaskUtils.waitForEvent(audio, "pause");
-    audio.pause();
-    yield awaitPause;
-  });
-});
-
-let plainTextItems;
-add_task(function* test_plaintext() {
-  plainTextItems = ["context-navigation",   null,
-                        ["context-back",         false,
-                         "context-forward",      false,
-                         "context-reload",       true,
-                         "context-bookmarkpage", true], null,
-                    "---",                  null,
-                    "context-savepage",     true,
-                    ...(hasPocket ? ["context-pocket", true] : []),
-                    "---",                  null,
-                    "context-viewbgimage",  false,
-                    "context-selectall",    true,
-                    "---",                  null,
-                    "context-viewsource",   true,
-                    "context-viewinfo",     true
-                   ];
-  yield test_contextmenu("#test-text", plainTextItems);
-});
-
-add_task(function* test_link() {
-  yield test_contextmenu("#test-link",
-    ["context-openlinkintab", true,
-     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
-     // We need a blank entry here because the containers submenu is
-     // dynamically generated with no ids.
-     ...(hasContainers ? ["", null] : []),
-     "context-openlink",      true,
-     "context-openlinkprivate", true,
-     "---",                   null,
-     "context-bookmarklink",  true,
-     "context-savelink",      true,
-     ...(hasPocket ? ["context-savelinktopocket", true] : []),
-     "context-copylink",      true,
-     "context-searchselect",  true
-    ]
-  );
-});
-
-add_task(function* test_mailto() {
-  yield test_contextmenu("#test-mailto",
-    ["context-copyemail", true,
-     "context-searchselect", true
-    ]
-  );
-});
-
-add_task(function* test_image() {
-  yield test_contextmenu("#test-image",
-    ["context-viewimage",            true,
-     "context-copyimage-contents",   true,
-     "context-copyimage",            true,
-     "---",                          null,
-     "context-saveimage",            true,
-     "context-sendimage",            true,
-     "context-setDesktopBackground", true,
-     "context-viewimageinfo",        true
-    ]
-  );
-});
-
-add_task(function* test_canvas() {
-  yield test_contextmenu("#test-canvas",
-    ["context-viewimage",    true,
-     "context-saveimage",    true,
-     "context-selectall",    true
-    ]
-  );
-});
-
-add_task(function* test_video_ok() {
-  yield test_contextmenu("#test-video-ok",
-    ["context-media-play",         true,
-     "context-media-mute",         true,
-     "context-media-playbackrate", null,
-         ["context-media-playbackrate-050x", true,
-          "context-media-playbackrate-100x", true,
-          "context-media-playbackrate-125x", true,
-          "context-media-playbackrate-150x", true,
-          "context-media-playbackrate-200x", true], null,
-     "context-media-loop",         true,
-     "context-media-hidecontrols", true,
-     "context-video-fullscreen",   true,
-     "---",                        null,
-     "context-viewvideo",          true,
-     "context-copyvideourl",       true,
-     "---",                        null,
-     "context-savevideo",          true,
-     "context-video-saveimage",    true,
-     "context-sendvideo",          true,
-     "context-castvideo",          null,
-       [], null
-    ]
-  );
-});
-
-add_task(function* test_audio_in_video() {
-  yield test_contextmenu("#test-audio-in-video",
-    ["context-media-play",         true,
-     "context-media-mute",         true,
-     "context-media-playbackrate", null,
-         ["context-media-playbackrate-050x", true,
-          "context-media-playbackrate-100x", true,
-          "context-media-playbackrate-125x", true,
-          "context-media-playbackrate-150x", true,
-          "context-media-playbackrate-200x", true], null,
-     "context-media-loop",         true,
-     "context-media-showcontrols", true,
-     "---",                        null,
-     "context-copyaudiourl",       true,
-     "---",                        null,
-     "context-saveaudio",          true,
-     "context-sendaudio",          true
-    ]
-  );
-});
-
-add_task(function* test_video_bad() {
-  yield test_contextmenu("#test-video-bad",
-    ["context-media-play",         false,
-     "context-media-mute",         false,
-     "context-media-playbackrate", null,
-         ["context-media-playbackrate-050x", false,
-          "context-media-playbackrate-100x", false,
-          "context-media-playbackrate-125x", false,
-          "context-media-playbackrate-150x", false,
-          "context-media-playbackrate-200x", false], null,
-     "context-media-loop",         true,
-     "context-media-hidecontrols", false,
-     "context-video-fullscreen",   false,
-     "---",                        null,
-     "context-viewvideo",          true,
-     "context-copyvideourl",       true,
-     "---",                        null,
-     "context-savevideo",          true,
-     "context-video-saveimage",    false,
-     "context-sendvideo",          true,
-     "context-castvideo",          null,
-       [], null
-    ]
-  );
-});
-
-add_task(function* test_video_bad2() {
-  yield test_contextmenu("#test-video-bad2",
-    ["context-media-play",         false,
-     "context-media-mute",         false,
-     "context-media-playbackrate", null,
-         ["context-media-playbackrate-050x", false,
-          "context-media-playbackrate-100x", false,
-          "context-media-playbackrate-125x", false,
-          "context-media-playbackrate-150x", false,
-          "context-media-playbackrate-200x", false], null,
-     "context-media-loop",         true,
-     "context-media-hidecontrols", false,
-     "context-video-fullscreen",   false,
-     "---",                        null,
-     "context-viewvideo",          false,
-     "context-copyvideourl",       false,
-     "---",                        null,
-     "context-savevideo",          false,
-     "context-video-saveimage",    false,
-     "context-sendvideo",          false,
-     "context-castvideo",          null,
-       [], null
-    ]
-  );
-});
-
-add_task(function* test_iframe() {
-  yield test_contextmenu("#test-iframe",
-    ["context-navigation", null,
-         ["context-back",         false,
-          "context-forward",      false,
-          "context-reload",       true,
-          "context-bookmarkpage", true], null,
-     "---",                  null,
-     "context-savepage",     true,
-     ...(hasPocket ? ["context-pocket", true] : []),
-     "---",                  null,
-     "context-viewbgimage",  false,
-     "context-selectall",    true,
-     "frame",                null,
-         ["context-showonlythisframe", true,
-          "context-openframeintab",    true,
-          "context-openframe",         true,
-          "---",                       null,
-          "context-reloadframe",       true,
-          "---",                       null,
-          "context-bookmarkframe",     true,
-          "context-saveframe",         true,
-          "---",                       null,
-          "context-printframe",        true,
-          "---",                       null,
-          "context-viewframesource",   true,
-          "context-viewframeinfo",     true], null,
-     "---",                  null,
-     "context-viewsource",   true,
-     "context-viewinfo",     true
-    ]
-  );
-});
-
-add_task(function* test_video_in_iframe() {
-  yield test_contextmenu("#test-video-in-iframe",
-    ["context-media-play",         true,
-     "context-media-mute",         true,
-     "context-media-playbackrate", null,
-         ["context-media-playbackrate-050x", true,
-          "context-media-playbackrate-100x", true,
-          "context-media-playbackrate-125x", true,
-          "context-media-playbackrate-150x", true,
-          "context-media-playbackrate-200x", true], null,
-     "context-media-loop",         true,
-     "context-media-hidecontrols", true,
-     "context-video-fullscreen",   true,
-     "---",                        null,
-     "context-viewvideo",          true,
-     "context-copyvideourl",       true,
-     "---",                        null,
-     "context-savevideo",          true,
-     "context-video-saveimage",    true,
-     "context-sendvideo",          true,
-     "context-castvideo",          null,
-       [], null,
-     "frame",                null,
-         ["context-showonlythisframe", true,
-          "context-openframeintab",    true,
-          "context-openframe",         true,
-          "---",                       null,
-          "context-reloadframe",       true,
-          "---",                       null,
-          "context-bookmarkframe",     true,
-          "context-saveframe",         true,
-          "---",                       null,
-          "context-printframe",        true,
-          "---",                       null,
-          "context-viewframeinfo",     true], null]
-  );
-});
-
-add_task(function* test_audio_in_iframe() {
-  yield test_contextmenu("#test-audio-in-iframe",
-    ["context-media-play",         true,
-     "context-media-mute",         true,
-     "context-media-playbackrate", null,
-         ["context-media-playbackrate-050x", true,
-          "context-media-playbackrate-100x", true,
-          "context-media-playbackrate-125x", true,
-          "context-media-playbackrate-150x", true,
-          "context-media-playbackrate-200x", true], null,
-     "context-media-loop",         true,
-     "---",                        null,
-     "context-copyaudiourl",       true,
-     "---",                        null,
-     "context-saveaudio",          true,
-     "context-sendaudio",          true,
-     "frame",                null,
-         ["context-showonlythisframe", true,
-          "context-openframeintab",    true,
-          "context-openframe",         true,
-          "---",                       null,
-          "context-reloadframe",       true,
-          "---",                       null,
-          "context-bookmarkframe",     true,
-          "context-saveframe",         true,
-          "---",                       null,
-          "context-printframe",        true,
-          "---",                       null,
-          "context-viewframeinfo",     true], null]
-  );
-});
-
-add_task(function* test_image_in_iframe() {
-  yield test_contextmenu("#test-image-in-iframe",
-    ["context-viewimage",            true,
-     "context-copyimage-contents",   true,
-     "context-copyimage",            true,
-     "---",                          null,
-     "context-saveimage",            true,
-     "context-sendimage",            true,
-     "context-setDesktopBackground", true,
-     "context-viewimageinfo",        true,
-     "frame",                null,
-         ["context-showonlythisframe", true,
-          "context-openframeintab",    true,
-          "context-openframe",         true,
-          "---",                       null,
-          "context-reloadframe",       true,
-          "---",                       null,
-          "context-bookmarkframe",     true,
-          "context-saveframe",         true,
-          "---",                       null,
-          "context-printframe",        true,
-          "---",                       null,
-          "context-viewframeinfo",     true], null]
-  );
-});
-
-add_task(function* test_textarea() {
-  // Disabled since this is seeing spell-check-enabled
-  // instead of spell-add-dictionaries-main
-  todo(false, "spell checker tests are failing, bug 1246296");
-  return;
-
-  yield test_contextmenu("#test-textarea",
-    ["context-undo",                false,
-     "---",                         null,
-     "context-cut",                 true,
-     "context-copy",                true,
-     "context-paste",               null,
-     "context-delete",              false,
-     "---",                         null,
-     "context-selectall",           true,
-     "---",                         null,
-     "spell-add-dictionaries-main", true,
-    ],
-    {
-      skipFocusChange: true,
-    }
-  );
-});
-
-add_task(function* test_textarea_spellcheck() {
-  todo(false, "spell checker tests are failing, bug 1246296");
-  return;
-
-  yield test_contextmenu("#test-textarea",
-    ["*chubbiness",         true, // spelling suggestion
-     "spell-add-to-dictionary", true,
-     "---",                 null,
-     "context-undo",        false,
-     "---",                 null,
-     "context-cut",         true,
-     "context-copy",        true,
-     "context-paste",       null, // ignore clipboard state
-     "context-delete",      false,
-     "---",                 null,
-     "context-selectall",   true,
-     "---",                 null,
-     "spell-check-enabled", true,
-     "spell-dictionaries",  true,
-         ["spell-check-dictionary-en-US", true,
-          "---",                          null,
-          "spell-add-dictionaries",       true], null
-    ],
-    {
-      waitForSpellCheck: true,
-      offsetX: 6,
-      offsetY: 6,
-      postCheckContextMenuFn() {
-        document.getElementById("spell-add-to-dictionary").doCommand();
-      }
-    }
-  );
-});
-
-add_task(function* test_plaintext2() {
-  yield test_contextmenu("#test-text", plainTextItems);
-});
-
-add_task(function* test_undo_add_to_dictionary() {
-  todo(false, "spell checker tests are failing, bug 1246296");
-  return;
-
-  yield test_contextmenu("#test-textarea",
-    ["spell-undo-add-to-dictionary", true,
-     "---",                 null,
-     "context-undo",        false,
-     "---",                 null,
-     "context-cut",         true,
-     "context-copy",        true,
-     "context-paste",       null, // ignore clipboard state
-     "context-delete",      false,
-     "---",                 null,
-     "context-selectall",   true,
-     "---",                 null,
-     "spell-check-enabled", true,
-     "spell-dictionaries",  true,
-         ["spell-check-dictionary-en-US", true,
-          "---",                          null,
-          "spell-add-dictionaries",       true], null
-    ],
-    {
-      waitForSpellCheck: true,
-      postCheckContextMenuFn() {
-        document.getElementById("spell-undo-add-to-dictionary")
-                .doCommand();
-      }
-    }
-  );
-});
-
-add_task(function* test_contenteditable() {
-  todo(false, "spell checker tests are failing, bug 1246296");
-  return;
-
-  yield test_contextmenu("#test-contenteditable",
-    ["spell-no-suggestions", false,
-     "spell-add-to-dictionary", true,
-     "---",                 null,
-     "context-undo",        false,
-     "---",                 null,
-     "context-cut",         true,
-     "context-copy",        true,
-     "context-paste",       null, // ignore clipboard state
-     "context-delete",      false,
-     "---",                 null,
-     "context-selectall",   true,
-     "---",                 null,
-     "spell-check-enabled", true,
-     "spell-dictionaries",  true,
-         ["spell-check-dictionary-en-US", true,
-          "---",                          null,
-          "spell-add-dictionaries",       true], null
-    ],
-    {waitForSpellCheck: true}
-  );
-});
-
-add_task(function* test_copylinkcommand() {
-  yield test_contextmenu("#test-link", null, {
-    postCheckContextMenuFn: function*() {
-      document.commandDispatcher
-              .getControllerForCommand("cmd_copyLink")
-              .doCommand("cmd_copyLink");
-
-      // The easiest way to check the clipboard is to paste the contents
-      // into a textbox.
-      yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-        let doc = content.document;
-        let input = doc.getElementById("test-input");
-        input.focus();
-        input.value = "";
-      });
-      document.commandDispatcher
-              .getControllerForCommand("cmd_paste")
-              .doCommand("cmd_paste");
-      yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-        let doc = content.document;
-        let input = doc.getElementById("test-input");
-        Assert.equal(input.value, "http://mozilla.com/", "paste for command cmd_paste");
-      });
-    }
-  });
-});
-
-add_task(function* test_pagemenu() {
-  yield test_contextmenu("#test-pagemenu",
-    ["context-navigation",   null,
-         ["context-back",         false,
-          "context-forward",      false,
-          "context-reload",       true,
-          "context-bookmarkpage", true], null,
-     "---",                  null,
-     "+Plain item",          {type: "", icon: "", checked: false, disabled: false},
-     "+Disabled item",       {type: "", icon: "", checked: false, disabled: true},
-     "+Item w/ textContent", {type: "", icon: "", checked: false, disabled: false},
-     "---",                  null,
-     "+Checkbox",            {type: "checkbox", icon: "", checked: true, disabled: false},
-     "---",                  null,
-     "+Radio1",              {type: "checkbox", icon: "", checked: true, disabled: false},
-     "+Radio2",              {type: "checkbox", icon: "", checked: false, disabled: false},
-     "+Radio3",              {type: "checkbox", icon: "", checked: false, disabled: false},
-     "---",                  null,
-     "+Item w/ icon",        {type: "", icon: "favicon.ico", checked: false, disabled: false},
-     "+Item w/ bad icon",    {type: "", icon: "", checked: false, disabled: false},
-     "---",                  null,
-     "generated-submenu-1",  true,
-         ["+Radio1",             {type: "checkbox", icon: "", checked: false, disabled: false},
-          "+Radio2",             {type: "checkbox", icon: "", checked: true, disabled: false},
-          "+Radio3",             {type: "checkbox", icon: "", checked: false, disabled: false},
-          "---",                 null,
-          "+Checkbox",           {type: "checkbox", icon: "", checked: false, disabled: false}], null,
-     "---",                  null,
-     "context-savepage",     true,
-     ...(hasPocket ? ["context-pocket", true] : []),
-     "---",                  null,
-     "context-viewbgimage",  false,
-     "context-selectall",    true,
-     "---",                  null,
-     "context-viewsource",   true,
-     "context-viewinfo",     true
-    ],
-    {postCheckContextMenuFn: function*() {
-      let item = contextMenu.getElementsByAttribute("generateditemid", "1")[0];
-      ok(item, "Got generated XUL menu item");
-      item.doCommand();
-      yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-        let pagemenu = content.document.getElementById("test-pagemenu");
-        Assert.ok(!pagemenu.hasAttribute("hopeless"), "attribute got removed");
-      });
-    }
-  });
-});
-
-add_task(function* test_dom_full_screen() {
-  yield test_contextmenu("#test-dom-full-screen",
-    ["context-navigation",           null,
-         ["context-back",            false,
-          "context-forward",         false,
-          "context-reload",          true,
-          "context-bookmarkpage",    true], null,
-     "---",                          null,
-     "context-leave-dom-fullscreen", true,
-     "---",                          null,
-     "context-savepage",             true,
-     ...(hasPocket ? ["context-pocket", true] : []),
-     "---",                          null,
-     "context-viewbgimage",          false,
-     "context-selectall",            true,
-     "---",                          null,
-     "context-viewsource",           true,
-     "context-viewinfo",             true
-    ],
-    {
-      shiftkey: true,
-      *preCheckContextMenuFn() {
-        yield pushPrefs(["full-screen-api.allow-trusted-requests-only", false],
-                        ["full-screen-api.transition-duration.enter", "0 0"],
-                        ["full-screen-api.transition-duration.leave", "0 0"])
-        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-          let doc = content.document;
-          let win = doc.defaultView;
-          let full_screen_element = doc.getElementById("test-dom-full-screen");
-          let awaitFullScreenChange =
-            ContentTaskUtils.waitForEvent(win, "fullscreenchange");
-          full_screen_element.requestFullscreen();
-          yield awaitFullScreenChange;
-        });
-      },
-      *postCheckContextMenuFn() {
-        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-          let win = content.document.defaultView;
-          let awaitFullScreenChange =
-            ContentTaskUtils.waitForEvent(win, "fullscreenchange");
-          content.document.exitFullscreen();
-          yield awaitFullScreenChange;
-        });
-      }
-    }
-  );
-});
-
-add_task(function* test_pagemenu2() {
-  yield test_contextmenu("#test-text",
-    ["context-navigation", null,
-         ["context-back",         false,
-          "context-forward",      false,
-          "context-reload",       true,
-          "context-bookmarkpage", true], null,
-     "---",                  null,
-     "context-savepage",     true,
-     ...(hasPocket ? ["context-pocket", true] : []),
-     "---",                  null,
-     "context-viewbgimage",  false,
-     "context-selectall",    true,
-     "---",                  null,
-     "context-viewsource",   true,
-     "context-viewinfo",     true
-    ],
-    {shiftkey: true}
-  );
-});
-
-add_task(function* test_select_text() {
-  yield test_contextmenu("#test-select-text",
-    ["context-copy",                        true,
-     "context-selectall",                   true,
-     "---",                                 null,
-     "context-searchselect",                true,
-     "context-viewpartialsource-selection", true
-    ],
-    {
-      offsetX: 6,
-      offsetY: 6,
-      *preCheckContextMenuFn() {
-        yield selectText("#test-select-text");
-      }
-    }
-  );
-});
-
-add_task(function* test_select_text_link() {
-  yield test_contextmenu("#test-select-text-link",
-    ["context-openlinkincurrent",           true,
-     "context-openlinkintab",               true,
-     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
-     // We need a blank entry here because the containers submenu is
-     // dynamically generated with no ids.
-     ...(hasContainers ? ["", null] : []),
-     "context-openlink",                    true,
-     "context-openlinkprivate",             true,
-     "---",                                 null,
-     "context-bookmarklink",                true,
-     "context-savelink",                    true,
-     "context-copy",                        true,
-     "context-selectall",                   true,
-     "---",                                 null,
-     "context-searchselect",                true,
-     "context-viewpartialsource-selection", true
-    ],
-    {
-      offsetX: 6,
-      offsetY: 6,
-      *preCheckContextMenuFn() {
-        yield selectText("#test-select-text-link");
-      },
-      *postCheckContextMenuFn() {
-        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-          let win = content.document.defaultView;
-          win.getSelection().removeAllRanges();
-        });
-      }
-    }
-  );
-});
-
-add_task(function* test_imagelink() {
-  yield test_contextmenu("#test-image-link",
-    ["context-openlinkintab", true,
-     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
-     // We need a blank entry here because the containers submenu is
-     // dynamically generated with no ids.
-     ...(hasContainers ? ["", null] : []),
-     "context-openlink",      true,
-     "context-openlinkprivate", true,
-     "---",                   null,
-     "context-bookmarklink",  true,
-     "context-savelink",      true,
-     ...(hasPocket ? ["context-savelinktopocket", true] : []),
-     "context-copylink",      true,
-     "---",                   null,
-     "context-viewimage",            true,
-     "context-copyimage-contents",   true,
-     "context-copyimage",            true,
-     "---",                          null,
-     "context-saveimage",            true,
-     "context-sendimage",            true,
-     "context-setDesktopBackground", true,
-     "context-viewimageinfo",        true
-    ]
-  );
-});
-
-add_task(function* test_select_input_text() {
-  todo(false, "spell checker tests are failing, bug 1246296");
-  return;
-
-  yield test_contextmenu("#test-select-input-text",
-    ["context-undo",        false,
-     "---",                 null,
-     "context-cut",         true,
-     "context-copy",        true,
-     "context-paste",       null, // ignore clipboard state
-     "context-delete",      true,
-     "---",                 null,
-     "context-selectall",   true,
-     "context-searchselect",true,
-     "---",                 null,
-     "spell-check-enabled", true
-    ].concat(LOGIN_FILL_ITEMS),
-    {
-      *preCheckContextMenuFn() {
-        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-          let doc = content.document;
-          let win = doc.defaultView;
-          win.getSelection().removeAllRanges();
-          let element = doc.querySelector("#test-select-input-text");
-          element.select();
-        });
-      }
-    }
-  );
-});
-
-add_task(function* test_select_input_text_password() {
-  todo(false, "spell checker tests are failing, bug 1246296");
-  return;
-
-  yield test_contextmenu("#test-select-input-text-type-password",
-    ["context-undo",        false,
-     "---",                 null,
-     "context-cut",         true,
-     "context-copy",        true,
-     "context-paste",       null, // ignore clipboard state
-     "context-delete",      true,
-     "---",                 null,
-     "context-selectall",   true,
-     "---",                 null,
-     "spell-check-enabled", true,
-     //spell checker is shown on input[type="password"] on this testcase
-     "spell-dictionaries",  true,
-         ["spell-check-dictionary-en-US", true,
-          "---",                          null,
-          "spell-add-dictionaries",       true], null
-    ].concat(LOGIN_FILL_ITEMS),
-    {
-      *preCheckContextMenuFn() {
-        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-          let doc = content.document;
-          let win = doc.defaultView;
-          win.getSelection().removeAllRanges();
-          let element = doc.querySelector("#test-select-input-text-type-password");
-          element.select();
-        });
-      },
-      *postCheckContextMenuFn() {
-        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
-          let win = content.document.defaultView;
-          win.getSelection().removeAllRanges();
-        });
-      }
-    }
-  );
-});
-
-add_task(function* test_click_to_play_blocked_plugin() {
-  yield test_contextmenu("#test-plugin",
-    ["context-navigation", null,
-         ["context-back",         false,
-          "context-forward",      false,
-          "context-reload",       true,
-          "context-bookmarkpage", true], null,
-     "---",                  null,
-     "context-ctp-play",     true,
-     "context-ctp-hide",     true,
-     "---",                  null,
-     "context-savepage",     true,
-     ...(hasPocket ? ["context-pocket", true] : []),
-     "---",                  null,
-     "context-viewbgimage",  false,
-     "context-selectall",    true,
-     "---",                  null,
-     "context-viewsource",   true,
-     "context-viewinfo",     true
-    ],
-    {
-      preCheckContextMenuFn: function*() {
-        pushPrefs(["plugins.click_to_play", true]);
-        setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-      },
-      postCheckContextMenuFn: function*() {
-        getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
-      }
-    }
-  );
-});
-
-add_task(function* test_longdesc() {
-  yield test_contextmenu("#test-longdesc",
-    ["context-viewimage",            true,
-     "context-copyimage-contents",   true,
-     "context-copyimage",            true,
-     "---",                          null,
-     "context-saveimage",            true,
-     "context-sendimage",            true,
-     "context-setDesktopBackground", true,
-     "context-viewimageinfo",        true,
-     "context-viewimagedesc",        true
-    ]
-  );
-});
-
-add_task(function* test_srcdoc() {
-  yield test_contextmenu("#test-srcdoc",
-    ["context-navigation", null,
-         ["context-back",         false,
-          "context-forward",      false,
-          "context-reload",       true,
-          "context-bookmarkpage", true], null,
-     "---",                  null,
-     "context-savepage",     true,
-     ...(hasPocket ? ["context-pocket", true] : []),
-     "---",                  null,
-     "context-viewbgimage",  false,
-     "context-selectall",    true,
-     "frame",                null,
-         ["context-reloadframe",       true,
-          "---",                       null,
-          "context-saveframe",         true,
-          "---",                       null,
-          "context-printframe",        true,
-          "---",                       null,
-          "context-viewframesource",   true,
-          "context-viewframeinfo",     true], null,
-     "---",                  null,
-     "context-viewsource",   true,
-     "context-viewinfo",     true
-    ]
-  );
-});
-
-add_task(function* test_input_spell_false() {
-  todo(false, "spell checker tests are failing, bug 1246296");
-  return;
-
-  yield test_contextmenu("#test-contenteditable-spellcheck-false",
-    ["context-undo",        false,
-     "---",                 null,
-     "context-cut",         true,
-     "context-copy",        true,
-     "context-paste",       null, // ignore clipboard state
-     "context-delete",      false,
-     "---",                 null,
-     "context-selectall",   true,
-     "---",                 null,
-     "spell-add-dictionaries-main",  true,
-    ]
-  );
-});
-
-const remoteClientsFixture = [ { id: 1, name: "Foo"}, { id: 2, name: "Bar"} ];
-
-add_task(function* test_plaintext_sendpagetodevice() {
-  if (!gFxAccounts.sendTabToDeviceEnabled) {
-    return;
-  }
-  const oldGetter = setupRemoteClientsFixture(remoteClientsFixture);
-
-  let plainTextItems = ["context-navigation",   null,
-                        ["context-back",         false,
-                         "context-forward",      false,
-                         "context-reload",       true,
-                         "context-bookmarkpage", true], null,
-                    "---",                  null,
-                    "context-savepage",     true,
-                    ...(hasPocket ? ["context-pocket", true] : []),
-                    "---",                  null,
-                    "context-sendpagetodevice", true,
-                      ["*Foo", true,
-                       "*Bar", true,
-                       "---", null,
-                       "*All Devices", true], null,
-                    "---",                  null,
-                    "context-viewbgimage",  false,
-                    "context-selectall",    true,
-                    "---",                  null,
-                    "context-viewsource",   true,
-                    "context-viewinfo",     true
-                   ];
-  yield test_contextmenu("#test-text", plainTextItems, {
-      *onContextMenuShown() {
-        yield openMenuItemSubmenu("context-sendpagetodevice");
-      }
-    });
-
-  restoreRemoteClients(oldGetter);
-});
-
-add_task(function* test_link_sendlinktodevice() {
-  if (!gFxAccounts.sendTabToDeviceEnabled) {
-    return;
-  }
-  const oldGetter = setupRemoteClientsFixture(remoteClientsFixture);
-
-  yield test_contextmenu("#test-link",
-    ["context-openlinkintab", true,
-     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
-     // We need a blank entry here because the containers submenu is
-     // dynamically generated with no ids.
-     ...(hasContainers ? ["", null] : []),
-     "context-openlink",      true,
-     "context-openlinkprivate", true,
-     "---",                   null,
-     "context-bookmarklink",  true,
-     "context-savelink",      true,
-     ...(hasPocket ? ["context-savelinktopocket", true] : []),
-     "context-copylink",      true,
-     "context-searchselect",  true,
-     "---",                  null,
-     "context-sendlinktodevice", true,
-      ["*Foo", true,
-       "*Bar", true,
-       "---", null,
-       "*All Devices", true], null,
-    ],
-    {
-      *onContextMenuShown() {
-        yield openMenuItemSubmenu("context-sendlinktodevice");
-      }
-    });
-
-  restoreRemoteClients(oldGetter);
-});
-
-add_task(function* test_cleanup() {
-  gBrowser.removeCurrentTab();
-});
-
-/**
- * Selects the text of the element that matches the provided `selector`
- *
- * @param {String} selector
- *        A selector passed to querySelector to find
- *        the element that will be referenced.
- */
-function* selectText(selector) {
-  yield ContentTask.spawn(gBrowser.selectedBrowser, selector, function*(selector) {
-    info(`Selecting text of ${selector}`);
-    let doc = content.document;
-    let win = doc.defaultView;
-    win.getSelection().removeAllRanges();
-    let div = doc.createRange();
-    let element = doc.querySelector(selector);
-    Assert.ok(element, "Found element to select text from");
-    div.setStartBefore(element);
-    div.setEndAfter(element);
-    win.getSelection().addRange(div);
-  });
-}
+"use strict";
+
+let contextMenu;
+let LOGIN_FILL_ITEMS = [
+  "---", null,
+  "fill-login", null,
+    [
+      "fill-login-no-logins", false,
+      "---", null,
+      "fill-login-saved-passwords", true
+    ], null,
+];
+
+let hasPocket = Services.prefs.getBoolPref("extensions.pocket.enabled");
+let hasContainers = Services.prefs.getBoolPref("privacy.userContext.enabled");
+
+add_task(function* test_setup() {
+  const example_base = "http://example.com/browser/browser/base/content/test/general/";
+  const url = example_base + "subtst_contextmenu.html";
+  yield BrowserTestUtils.openNewForegroundTab(gBrowser, url);
+
+  const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
+  const contextmenu_common = chrome_base + "contextmenu_common.js";
+  Services.scriptloader.loadSubScript(contextmenu_common, this);
+
+  yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+    let doc = content.document;
+    let videoIframe = doc.querySelector("#test-video-in-iframe");
+    let video = videoIframe.contentDocument.querySelector("video");
+    let awaitPause = ContentTaskUtils.waitForEvent(video, "pause");
+    video.pause();
+    yield awaitPause;
+
+    let audioIframe = doc.querySelector("#test-audio-in-iframe");
+    // media documents always use a <video> tag.
+    let audio = audioIframe.contentDocument.querySelector("video");
+    awaitPause = ContentTaskUtils.waitForEvent(audio, "pause");
+    audio.pause();
+    yield awaitPause;
+  });
+});
+
+let plainTextItems;
+add_task(function* test_plaintext() {
+  plainTextItems = ["context-navigation",   null,
+                        ["context-back",         false,
+                         "context-forward",      false,
+                         "context-reload",       true,
+                         "context-bookmarkpage", true], null,
+                    "---",                  null,
+                    "context-savepage",     true,
+                    ...(hasPocket ? ["context-pocket", true] : []),
+                    "---",                  null,
+                    "context-viewbgimage",  false,
+                    "context-selectall",    true,
+                    "---",                  null,
+                    "context-viewsource",   true,
+                    "context-viewinfo",     true
+                   ];
+  yield test_contextmenu("#test-text", plainTextItems);
+});
+
+add_task(function* test_link() {
+  yield test_contextmenu("#test-link",
+    ["context-openlinkintab", true,
+     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
+     // We need a blank entry here because the containers submenu is
+     // dynamically generated with no ids.
+     ...(hasContainers ? ["", null] : []),
+     "context-openlink",      true,
+     "context-openlinkprivate", true,
+     "---",                   null,
+     "context-bookmarklink",  true,
+     "context-savelink",      true,
+     ...(hasPocket ? ["context-savelinktopocket", true] : []),
+     "context-copylink",      true,
+     "context-searchselect",  true
+    ]
+  );
+});
+
+add_task(function* test_mailto() {
+  yield test_contextmenu("#test-mailto",
+    ["context-copyemail", true,
+     "context-searchselect", true
+    ]
+  );
+});
+
+add_task(function* test_image() {
+  yield test_contextmenu("#test-image",
+    ["context-viewimage",            true,
+     "context-copyimage-contents",   true,
+     "context-copyimage",            true,
+     "---",                          null,
+     "context-saveimage",            true,
+     "context-sendimage",            true,
+     "context-setDesktopBackground", true,
+     "context-viewimageinfo",        true
+    ]
+  );
+});
+
+add_task(function* test_canvas() {
+  yield test_contextmenu("#test-canvas",
+    ["context-viewimage",    true,
+     "context-saveimage",    true,
+     "context-selectall",    true
+    ]
+  );
+});
+
+add_task(function* test_video_ok() {
+  yield test_contextmenu("#test-video-ok",
+    ["context-media-play",         true,
+     "context-media-mute",         true,
+     "context-media-playbackrate", null,
+         ["context-media-playbackrate-050x", true,
+          "context-media-playbackrate-100x", true,
+          "context-media-playbackrate-125x", true,
+          "context-media-playbackrate-150x", true,
+          "context-media-playbackrate-200x", true], null,
+     "context-media-loop",         true,
+     "context-media-hidecontrols", true,
+     "context-video-fullscreen",   true,
+     "---",                        null,
+     "context-viewvideo",          true,
+     "context-copyvideourl",       true,
+     "---",                        null,
+     "context-savevideo",          true,
+     "context-video-saveimage",    true,
+     "context-sendvideo",          true,
+     "context-castvideo",          null,
+       [], null
+    ]
+  );
+});
+
+add_task(function* test_audio_in_video() {
+  yield test_contextmenu("#test-audio-in-video",
+    ["context-media-play",         true,
+     "context-media-mute",         true,
+     "context-media-playbackrate", null,
+         ["context-media-playbackrate-050x", true,
+          "context-media-playbackrate-100x", true,
+          "context-media-playbackrate-125x", true,
+          "context-media-playbackrate-150x", true,
+          "context-media-playbackrate-200x", true], null,
+     "context-media-loop",         true,
+     "context-media-showcontrols", true,
+     "---",                        null,
+     "context-copyaudiourl",       true,
+     "---",                        null,
+     "context-saveaudio",          true,
+     "context-sendaudio",          true
+    ]
+  );
+});
+
+add_task(function* test_video_bad() {
+  yield test_contextmenu("#test-video-bad",
+    ["context-media-play",         false,
+     "context-media-mute",         false,
+     "context-media-playbackrate", null,
+         ["context-media-playbackrate-050x", false,
+          "context-media-playbackrate-100x", false,
+          "context-media-playbackrate-125x", false,
+          "context-media-playbackrate-150x", false,
+          "context-media-playbackrate-200x", false], null,
+     "context-media-loop",         true,
+     "context-media-hidecontrols", false,
+     "context-video-fullscreen",   false,
+     "---",                        null,
+     "context-viewvideo",          true,
+     "context-copyvideourl",       true,
+     "---",                        null,
+     "context-savevideo",          true,
+     "context-video-saveimage",    false,
+     "context-sendvideo",          true,
+     "context-castvideo",          null,
+       [], null
+    ]
+  );
+});
+
+add_task(function* test_video_bad2() {
+  yield test_contextmenu("#test-video-bad2",
+    ["context-media-play",         false,
+     "context-media-mute",         false,
+     "context-media-playbackrate", null,
+         ["context-media-playbackrate-050x", false,
+          "context-media-playbackrate-100x", false,
+          "context-media-playbackrate-125x", false,
+          "context-media-playbackrate-150x", false,
+          "context-media-playbackrate-200x", false], null,
+     "context-media-loop",         true,
+     "context-media-hidecontrols", false,
+     "context-video-fullscreen",   false,
+     "---",                        null,
+     "context-viewvideo",          false,
+     "context-copyvideourl",       false,
+     "---",                        null,
+     "context-savevideo",          false,
+     "context-video-saveimage",    false,
+     "context-sendvideo",          false,
+     "context-castvideo",          null,
+       [], null
+    ]
+  );
+});
+
+add_task(function* test_iframe() {
+  yield test_contextmenu("#test-iframe",
+    ["context-navigation", null,
+         ["context-back",         false,
+          "context-forward",      false,
+          "context-reload",       true,
+          "context-bookmarkpage", true], null,
+     "---",                  null,
+     "context-savepage",     true,
+     ...(hasPocket ? ["context-pocket", true] : []),
+     "---",                  null,
+     "context-viewbgimage",  false,
+     "context-selectall",    true,
+     "frame",                null,
+         ["context-showonlythisframe", true,
+          "context-openframeintab",    true,
+          "context-openframe",         true,
+          "---",                       null,
+          "context-reloadframe",       true,
+          "---",                       null,
+          "context-bookmarkframe",     true,
+          "context-saveframe",         true,
+          "---",                       null,
+          "context-printframe",        true,
+          "---",                       null,
+          "context-viewframesource",   true,
+          "context-viewframeinfo",     true], null,
+     "---",                  null,
+     "context-viewsource",   true,
+     "context-viewinfo",     true
+    ]
+  );
+});
+
+add_task(function* test_video_in_iframe() {
+  yield test_contextmenu("#test-video-in-iframe",
+    ["context-media-play",         true,
+     "context-media-mute",         true,
+     "context-media-playbackrate", null,
+         ["context-media-playbackrate-050x", true,
+          "context-media-playbackrate-100x", true,
+          "context-media-playbackrate-125x", true,
+          "context-media-playbackrate-150x", true,
+          "context-media-playbackrate-200x", true], null,
+     "context-media-loop",         true,
+     "context-media-hidecontrols", true,
+     "context-video-fullscreen",   true,
+     "---",                        null,
+     "context-viewvideo",          true,
+     "context-copyvideourl",       true,
+     "---",                        null,
+     "context-savevideo",          true,
+     "context-video-saveimage",    true,
+     "context-sendvideo",          true,
+     "context-castvideo",          null,
+       [], null,
+     "frame",                null,
+         ["context-showonlythisframe", true,
+          "context-openframeintab",    true,
+          "context-openframe",         true,
+          "---",                       null,
+          "context-reloadframe",       true,
+          "---",                       null,
+          "context-bookmarkframe",     true,
+          "context-saveframe",         true,
+          "---",                       null,
+          "context-printframe",        true,
+          "---",                       null,
+          "context-viewframeinfo",     true], null]
+  );
+});
+
+add_task(function* test_audio_in_iframe() {
+  yield test_contextmenu("#test-audio-in-iframe",
+    ["context-media-play",         true,
+     "context-media-mute",         true,
+     "context-media-playbackrate", null,
+         ["context-media-playbackrate-050x", true,
+          "context-media-playbackrate-100x", true,
+          "context-media-playbackrate-125x", true,
+          "context-media-playbackrate-150x", true,
+          "context-media-playbackrate-200x", true], null,
+     "context-media-loop",         true,
+     "---",                        null,
+     "context-copyaudiourl",       true,
+     "---",                        null,
+     "context-saveaudio",          true,
+     "context-sendaudio",          true,
+     "frame",                null,
+         ["context-showonlythisframe", true,
+          "context-openframeintab",    true,
+          "context-openframe",         true,
+          "---",                       null,
+          "context-reloadframe",       true,
+          "---",                       null,
+          "context-bookmarkframe",     true,
+          "context-saveframe",         true,
+          "---",                       null,
+          "context-printframe",        true,
+          "---",                       null,
+          "context-viewframeinfo",     true], null]
+  );
+});
+
+add_task(function* test_image_in_iframe() {
+  yield test_contextmenu("#test-image-in-iframe",
+    ["context-viewimage",            true,
+     "context-copyimage-contents",   true,
+     "context-copyimage",            true,
+     "---",                          null,
+     "context-saveimage",            true,
+     "context-sendimage",            true,
+     "context-setDesktopBackground", true,
+     "context-viewimageinfo",        true,
+     "frame",                null,
+         ["context-showonlythisframe", true,
+          "context-openframeintab",    true,
+          "context-openframe",         true,
+          "---",                       null,
+          "context-reloadframe",       true,
+          "---",                       null,
+          "context-bookmarkframe",     true,
+          "context-saveframe",         true,
+          "---",                       null,
+          "context-printframe",        true,
+          "---",                       null,
+          "context-viewframeinfo",     true], null]
+  );
+});
+
+add_task(function* test_textarea() {
+  // Disabled since this is seeing spell-check-enabled
+  // instead of spell-add-dictionaries-main
+  todo(false, "spell checker tests are failing, bug 1246296");
+  return;
+
+  yield test_contextmenu("#test-textarea",
+    ["context-undo",                false,
+     "---",                         null,
+     "context-cut",                 true,
+     "context-copy",                true,
+     "context-paste",               null,
+     "context-delete",              false,
+     "---",                         null,
+     "context-selectall",           true,
+     "---",                         null,
+     "spell-add-dictionaries-main", true,
+    ],
+    {
+      skipFocusChange: true,
+    }
+  );
+});
+
+add_task(function* test_textarea_spellcheck() {
+  todo(false, "spell checker tests are failing, bug 1246296");
+  return;
+
+  yield test_contextmenu("#test-textarea",
+    ["*chubbiness",         true, // spelling suggestion
+     "spell-add-to-dictionary", true,
+     "---",                 null,
+     "context-undo",        false,
+     "---",                 null,
+     "context-cut",         true,
+     "context-copy",        true,
+     "context-paste",       null, // ignore clipboard state
+     "context-delete",      false,
+     "---",                 null,
+     "context-selectall",   true,
+     "---",                 null,
+     "spell-check-enabled", true,
+     "spell-dictionaries",  true,
+         ["spell-check-dictionary-en-US", true,
+          "---",                          null,
+          "spell-add-dictionaries",       true], null
+    ],
+    {
+      waitForSpellCheck: true,
+      offsetX: 6,
+      offsetY: 6,
+      postCheckContextMenuFn() {
+        document.getElementById("spell-add-to-dictionary").doCommand();
+      }
+    }
+  );
+});
+
+add_task(function* test_plaintext2() {
+  yield test_contextmenu("#test-text", plainTextItems);
+});
+
+add_task(function* test_undo_add_to_dictionary() {
+  todo(false, "spell checker tests are failing, bug 1246296");
+  return;
+
+  yield test_contextmenu("#test-textarea",
+    ["spell-undo-add-to-dictionary", true,
+     "---",                 null,
+     "context-undo",        false,
+     "---",                 null,
+     "context-cut",         true,
+     "context-copy",        true,
+     "context-paste",       null, // ignore clipboard state
+     "context-delete",      false,
+     "---",                 null,
+     "context-selectall",   true,
+     "---",                 null,
+     "spell-check-enabled", true,
+     "spell-dictionaries",  true,
+         ["spell-check-dictionary-en-US", true,
+          "---",                          null,
+          "spell-add-dictionaries",       true], null
+    ],
+    {
+      waitForSpellCheck: true,
+      postCheckContextMenuFn() {
+        document.getElementById("spell-undo-add-to-dictionary")
+                .doCommand();
+      }
+    }
+  );
+});
+
+add_task(function* test_contenteditable() {
+  todo(false, "spell checker tests are failing, bug 1246296");
+  return;
+
+  yield test_contextmenu("#test-contenteditable",
+    ["spell-no-suggestions", false,
+     "spell-add-to-dictionary", true,
+     "---",                 null,
+     "context-undo",        false,
+     "---",                 null,
+     "context-cut",         true,
+     "context-copy",        true,
+     "context-paste",       null, // ignore clipboard state
+     "context-delete",      false,
+     "---",                 null,
+     "context-selectall",   true,
+     "---",                 null,
+     "spell-check-enabled", true,
+     "spell-dictionaries",  true,
+         ["spell-check-dictionary-en-US", true,
+          "---",                          null,
+          "spell-add-dictionaries",       true], null
+    ],
+    {waitForSpellCheck: true}
+  );
+});
+
+add_task(function* test_copylinkcommand() {
+  yield test_contextmenu("#test-link", null, {
+    postCheckContextMenuFn: function*() {
+      document.commandDispatcher
+              .getControllerForCommand("cmd_copyLink")
+              .doCommand("cmd_copyLink");
+
+      // The easiest way to check the clipboard is to paste the contents
+      // into a textbox.
+      yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+        let doc = content.document;
+        let input = doc.getElementById("test-input");
+        input.focus();
+        input.value = "";
+      });
+      document.commandDispatcher
+              .getControllerForCommand("cmd_paste")
+              .doCommand("cmd_paste");
+      yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+        let doc = content.document;
+        let input = doc.getElementById("test-input");
+        Assert.equal(input.value, "http://mozilla.com/", "paste for command cmd_paste");
+      });
+    }
+  });
+});
+
+add_task(function* test_pagemenu() {
+  yield test_contextmenu("#test-pagemenu",
+    ["context-navigation",   null,
+         ["context-back",         false,
+          "context-forward",      false,
+          "context-reload",       true,
+          "context-bookmarkpage", true], null,
+     "---",                  null,
+     "+Plain item",          {type: "", icon: "", checked: false, disabled: false},
+     "+Disabled item",       {type: "", icon: "", checked: false, disabled: true},
+     "+Item w/ textContent", {type: "", icon: "", checked: false, disabled: false},
+     "---",                  null,
+     "+Checkbox",            {type: "checkbox", icon: "", checked: true, disabled: false},
+     "---",                  null,
+     "+Radio1",              {type: "checkbox", icon: "", checked: true, disabled: false},
+     "+Radio2",              {type: "checkbox", icon: "", checked: false, disabled: false},
+     "+Radio3",              {type: "checkbox", icon: "", checked: false, disabled: false},
+     "---",                  null,
+     "+Item w/ icon",        {type: "", icon: "favicon.ico", checked: false, disabled: false},
+     "+Item w/ bad icon",    {type: "", icon: "", checked: false, disabled: false},
+     "---",                  null,
+     "generated-submenu-1",  true,
+         ["+Radio1",             {type: "checkbox", icon: "", checked: false, disabled: false},
+          "+Radio2",             {type: "checkbox", icon: "", checked: true, disabled: false},
+          "+Radio3",             {type: "checkbox", icon: "", checked: false, disabled: false},
+          "---",                 null,
+          "+Checkbox",           {type: "checkbox", icon: "", checked: false, disabled: false}], null,
+     "---",                  null,
+     "context-savepage",     true,
+     ...(hasPocket ? ["context-pocket", true] : []),
+     "---",                  null,
+     "context-viewbgimage",  false,
+     "context-selectall",    true,
+     "---",                  null,
+     "context-viewsource",   true,
+     "context-viewinfo",     true
+    ],
+    {postCheckContextMenuFn: function*() {
+      let item = contextMenu.getElementsByAttribute("generateditemid", "1")[0];
+      ok(item, "Got generated XUL menu item");
+      item.doCommand();
+      yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+        let pagemenu = content.document.getElementById("test-pagemenu");
+        Assert.ok(!pagemenu.hasAttribute("hopeless"), "attribute got removed");
+      });
+    }
+  });
+});
+
+add_task(function* test_dom_full_screen() {
+  yield test_contextmenu("#test-dom-full-screen",
+    ["context-navigation",           null,
+         ["context-back",            false,
+          "context-forward",         false,
+          "context-reload",          true,
+          "context-bookmarkpage",    true], null,
+     "---",                          null,
+     "context-leave-dom-fullscreen", true,
+     "---",                          null,
+     "context-savepage",             true,
+     ...(hasPocket ? ["context-pocket", true] : []),
+     "---",                          null,
+     "context-viewbgimage",          false,
+     "context-selectall",            true,
+     "---",                          null,
+     "context-viewsource",           true,
+     "context-viewinfo",             true
+    ],
+    {
+      shiftkey: true,
+      *preCheckContextMenuFn() {
+        yield pushPrefs(["full-screen-api.allow-trusted-requests-only", false],
+                        ["full-screen-api.transition-duration.enter", "0 0"],
+                        ["full-screen-api.transition-duration.leave", "0 0"])
+        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+          let doc = content.document;
+          let win = doc.defaultView;
+          let full_screen_element = doc.getElementById("test-dom-full-screen");
+          let awaitFullScreenChange =
+            ContentTaskUtils.waitForEvent(win, "fullscreenchange");
+          full_screen_element.requestFullscreen();
+          yield awaitFullScreenChange;
+        });
+      },
+      *postCheckContextMenuFn() {
+        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+          let win = content.document.defaultView;
+          let awaitFullScreenChange =
+            ContentTaskUtils.waitForEvent(win, "fullscreenchange");
+          content.document.exitFullscreen();
+          yield awaitFullScreenChange;
+        });
+      }
+    }
+  );
+});
+
+add_task(function* test_pagemenu2() {
+  yield test_contextmenu("#test-text",
+    ["context-navigation", null,
+         ["context-back",         false,
+          "context-forward",      false,
+          "context-reload",       true,
+          "context-bookmarkpage", true], null,
+     "---",                  null,
+     "context-savepage",     true,
+     ...(hasPocket ? ["context-pocket", true] : []),
+     "---",                  null,
+     "context-viewbgimage",  false,
+     "context-selectall",    true,
+     "---",                  null,
+     "context-viewsource",   true,
+     "context-viewinfo",     true
+    ],
+    {shiftkey: true}
+  );
+});
+
+add_task(function* test_select_text() {
+  yield test_contextmenu("#test-select-text",
+    ["context-copy",                        true,
+     "context-selectall",                   true,
+     "---",                                 null,
+     "context-searchselect",                true,
+     "context-viewpartialsource-selection", true
+    ],
+    {
+      offsetX: 6,
+      offsetY: 6,
+      *preCheckContextMenuFn() {
+        yield selectText("#test-select-text");
+      }
+    }
+  );
+});
+
+add_task(function* test_select_text_link() {
+  yield test_contextmenu("#test-select-text-link",
+    ["context-openlinkincurrent",           true,
+     "context-openlinkintab",               true,
+     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
+     // We need a blank entry here because the containers submenu is
+     // dynamically generated with no ids.
+     ...(hasContainers ? ["", null] : []),
+     "context-openlink",                    true,
+     "context-openlinkprivate",             true,
+     "---",                                 null,
+     "context-bookmarklink",                true,
+     "context-savelink",                    true,
+     "context-copy",                        true,
+     "context-selectall",                   true,
+     "---",                                 null,
+     "context-searchselect",                true,
+     "context-viewpartialsource-selection", true
+    ],
+    {
+      offsetX: 6,
+      offsetY: 6,
+      *preCheckContextMenuFn() {
+        yield selectText("#test-select-text-link");
+      },
+      *postCheckContextMenuFn() {
+        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+          let win = content.document.defaultView;
+          win.getSelection().removeAllRanges();
+        });
+      }
+    }
+  );
+});
+
+add_task(function* test_imagelink() {
+  yield test_contextmenu("#test-image-link",
+    ["context-openlinkintab", true,
+     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
+     // We need a blank entry here because the containers submenu is
+     // dynamically generated with no ids.
+     ...(hasContainers ? ["", null] : []),
+     "context-openlink",      true,
+     "context-openlinkprivate", true,
+     "---",                   null,
+     "context-bookmarklink",  true,
+     "context-savelink",      true,
+     ...(hasPocket ? ["context-savelinktopocket", true] : []),
+     "context-copylink",      true,
+     "---",                   null,
+     "context-viewimage",            true,
+     "context-copyimage-contents",   true,
+     "context-copyimage",            true,
+     "---",                          null,
+     "context-saveimage",            true,
+     "context-sendimage",            true,
+     "context-setDesktopBackground", true,
+     "context-viewimageinfo",        true
+    ]
+  );
+});
+
+add_task(function* test_select_input_text() {
+  todo(false, "spell checker tests are failing, bug 1246296");
+  return;
+
+  yield test_contextmenu("#test-select-input-text",
+    ["context-undo",         false,
+     "---",                  null,
+     "context-cut",          true,
+     "context-copy",         true,
+     "context-paste",        null, // ignore clipboard state
+     "context-delete",       true,
+     "---",                  null,
+     "context-selectall",    true,
+     "context-searchselect", true,
+     "---",                  null,
+     "spell-check-enabled",  true
+    ].concat(LOGIN_FILL_ITEMS),
+    {
+      *preCheckContextMenuFn() {
+        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+          let doc = content.document;
+          let win = doc.defaultView;
+          win.getSelection().removeAllRanges();
+          let element = doc.querySelector("#test-select-input-text");
+          element.select();
+        });
+      }
+    }
+  );
+});
+
+add_task(function* test_select_input_text_password() {
+  todo(false, "spell checker tests are failing, bug 1246296");
+  return;
+
+  yield test_contextmenu("#test-select-input-text-type-password",
+    ["context-undo",        false,
+     "---",                 null,
+     "context-cut",         true,
+     "context-copy",        true,
+     "context-paste",       null, // ignore clipboard state
+     "context-delete",      true,
+     "---",                 null,
+     "context-selectall",   true,
+     "---",                 null,
+     "spell-check-enabled", true,
+     //spell checker is shown on input[type="password"] on this testcase
+     "spell-dictionaries",  true,
+         ["spell-check-dictionary-en-US", true,
+          "---",                          null,
+          "spell-add-dictionaries",       true], null
+    ].concat(LOGIN_FILL_ITEMS),
+    {
+      *preCheckContextMenuFn() {
+        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+          let doc = content.document;
+          let win = doc.defaultView;
+          win.getSelection().removeAllRanges();
+          let element = doc.querySelector("#test-select-input-text-type-password");
+          element.select();
+        });
+      },
+      *postCheckContextMenuFn() {
+        yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+          let win = content.document.defaultView;
+          win.getSelection().removeAllRanges();
+        });
+      }
+    }
+  );
+});
+
+add_task(function* test_click_to_play_blocked_plugin() {
+  yield test_contextmenu("#test-plugin",
+    ["context-navigation", null,
+         ["context-back",         false,
+          "context-forward",      false,
+          "context-reload",       true,
+          "context-bookmarkpage", true], null,
+     "---",                  null,
+     "context-ctp-play",     true,
+     "context-ctp-hide",     true,
+     "---",                  null,
+     "context-savepage",     true,
+     ...(hasPocket ? ["context-pocket", true] : []),
+     "---",                  null,
+     "context-viewbgimage",  false,
+     "context-selectall",    true,
+     "---",                  null,
+     "context-viewsource",   true,
+     "context-viewinfo",     true
+    ],
+    {
+      preCheckContextMenuFn: function*() {
+        pushPrefs(["plugins.click_to_play", true]);
+        setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
+      },
+      postCheckContextMenuFn: function*() {
+        getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
+      }
+    }
+  );
+});
+
+add_task(function* test_longdesc() {
+  yield test_contextmenu("#test-longdesc",
+    ["context-viewimage",            true,
+     "context-copyimage-contents",   true,
+     "context-copyimage",            true,
+     "---",                          null,
+     "context-saveimage",            true,
+     "context-sendimage",            true,
+     "context-setDesktopBackground", true,
+     "context-viewimageinfo",        true,
+     "context-viewimagedesc",        true
+    ]
+  );
+});
+
+add_task(function* test_srcdoc() {
+  yield test_contextmenu("#test-srcdoc",
+    ["context-navigation", null,
+         ["context-back",         false,
+          "context-forward",      false,
+          "context-reload",       true,
+          "context-bookmarkpage", true], null,
+     "---",                  null,
+     "context-savepage",     true,
+     ...(hasPocket ? ["context-pocket", true] : []),
+     "---",                  null,
+     "context-viewbgimage",  false,
+     "context-selectall",    true,
+     "frame",                null,
+         ["context-reloadframe",       true,
+          "---",                       null,
+          "context-saveframe",         true,
+          "---",                       null,
+          "context-printframe",        true,
+          "---",                       null,
+          "context-viewframesource",   true,
+          "context-viewframeinfo",     true], null,
+     "---",                  null,
+     "context-viewsource",   true,
+     "context-viewinfo",     true
+    ]
+  );
+});
+
+add_task(function* test_input_spell_false() {
+  todo(false, "spell checker tests are failing, bug 1246296");
+  return;
+
+  yield test_contextmenu("#test-contenteditable-spellcheck-false",
+    ["context-undo",        false,
+     "---",                 null,
+     "context-cut",         true,
+     "context-copy",        true,
+     "context-paste",       null, // ignore clipboard state
+     "context-delete",      false,
+     "---",                 null,
+     "context-selectall",   true,
+     "---",                 null,
+     "spell-add-dictionaries-main",  true,
+    ]
+  );
+});
+
+const remoteClientsFixture = [ { id: 1, name: "Foo"}, { id: 2, name: "Bar"} ];
+
+add_task(function* test_plaintext_sendpagetodevice() {
+  if (!gFxAccounts.sendTabToDeviceEnabled) {
+    return;
+  }
+  const oldGetter = setupRemoteClientsFixture(remoteClientsFixture);
+
+  let plainTextItems = ["context-navigation",   null,
+                        ["context-back",         false,
+                         "context-forward",      false,
+                         "context-reload",       true,
+                         "context-bookmarkpage", true], null,
+                    "---",                  null,
+                    "context-savepage",     true,
+                    ...(hasPocket ? ["context-pocket", true] : []),
+                    "---",                  null,
+                    "context-sendpagetodevice", true,
+                      ["*Foo", true,
+                       "*Bar", true,
+                       "---", null,
+                       "*All Devices", true], null,
+                    "---",                  null,
+                    "context-viewbgimage",  false,
+                    "context-selectall",    true,
+                    "---",                  null,
+                    "context-viewsource",   true,
+                    "context-viewinfo",     true
+                   ];
+  yield test_contextmenu("#test-text", plainTextItems, {
+      *onContextMenuShown() {
+        yield openMenuItemSubmenu("context-sendpagetodevice");
+      }
+    });
+
+  restoreRemoteClients(oldGetter);
+});
+
+add_task(function* test_link_sendlinktodevice() {
+  if (!gFxAccounts.sendTabToDeviceEnabled) {
+    return;
+  }
+  const oldGetter = setupRemoteClientsFixture(remoteClientsFixture);
+
+  yield test_contextmenu("#test-link",
+    ["context-openlinkintab", true,
+     ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []),
+     // We need a blank entry here because the containers submenu is
+     // dynamically generated with no ids.
+     ...(hasContainers ? ["", null] : []),
+     "context-openlink",      true,
+     "context-openlinkprivate", true,
+     "---",                   null,
+     "context-bookmarklink",  true,
+     "context-savelink",      true,
+     ...(hasPocket ? ["context-savelinktopocket", true] : []),
+     "context-copylink",      true,
+     "context-searchselect",  true,
+     "---",                  null,
+     "context-sendlinktodevice", true,
+      ["*Foo", true,
+       "*Bar", true,
+       "---", null,
+       "*All Devices", true], null,
+    ],
+    {
+      *onContextMenuShown() {
+        yield openMenuItemSubmenu("context-sendlinktodevice");
+      }
+    });
+
+  restoreRemoteClients(oldGetter);
+});
+
+add_task(function* test_cleanup() {
+  gBrowser.removeCurrentTab();
+});
+
+/**
+ * Selects the text of the element that matches the provided `selector`
+ *
+ * @param {String} selector
+ *        A selector passed to querySelector to find
+ *        the element that will be referenced.
+ */
+function* selectText(selector) {
+  yield ContentTask.spawn(gBrowser.selectedBrowser, selector, function*(selector) {
+    info(`Selecting text of ${selector}`);
+    let doc = content.document;
+    let win = doc.defaultView;
+    win.getSelection().removeAllRanges();
+    let div = doc.createRange();
+    let element = doc.querySelector(selector);
+    Assert.ok(element, "Found element to select text from");
+    div.setStartBefore(element);
+    div.setEndAfter(element);
+    win.getSelection().addRange(div);
+  });
+}
--- a/browser/base/content/test/general/browser_ctrlTab.js
+++ b/browser/base/content/test/general/browser_ctrlTab.js
@@ -2,19 +2,19 @@ add_task(function* () {
   gPrefService.setBoolPref("browser.ctrlTab.previews", true);
 
   gBrowser.addTab();
   gBrowser.addTab();
   gBrowser.addTab();
 
   checkTabs(4);
 
-  yield ctrlTabTest([2]      , 1, 0);
+  yield ctrlTabTest([2],       1, 0);
   yield ctrlTabTest([2, 3, 1], 2, 2);
-  yield ctrlTabTest([]       , 4, 2);
+  yield ctrlTabTest([],        4, 2);
 
   {
     let selectedIndex = gBrowser.tabContainer.selectedIndex;
     yield pressCtrlTab();
     yield pressCtrlTab(true);
     yield releaseCtrl();
     is(gBrowser.tabContainer.selectedIndex, selectedIndex,
        "Ctrl+Tab -> Ctrl+Shift+Tab keeps the selected tab");
--- a/browser/base/content/test/general/browser_datachoices_notification.js
+++ b/browser/base/content/test/general/browser_datachoices_notification.js
@@ -91,17 +91,17 @@ var checkInfobarButton = Task.async(func
   // Click on the button.
   button.click();
 
   // Wait for the preferences panel to open.
   let preferenceWindow = yield paneLoadedPromise;
   yield promiseNextTick();
 });
 
-add_task(function* setup(){
+add_task(function* setup() {
   const bypassNotification = Preferences.get(PREF_BYPASS_NOTIFICATION, true);
   const currentPolicyVersion = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1);
 
   // Register a cleanup function to reset our preferences.
   registerCleanupFunction(() => {
     Preferences.set(PREF_BYPASS_NOTIFICATION, bypassNotification);
     Preferences.set(PREF_CURRENT_POLICY_VERSION, currentPolicyVersion);
 
@@ -115,17 +115,17 @@ add_task(function* setup(){
 });
 
 function clearAcceptedPolicy() {
   // Reset the accepted policy.
   Preferences.reset(PREF_ACCEPTED_POLICY_VERSION);
   Preferences.reset(PREF_ACCEPTED_POLICY_DATE);
 }
 
-add_task(function* test_single_window(){
+add_task(function* test_single_window() {
   clearAcceptedPolicy();
 
   // Close all the notifications, then try to trigger the data choices infobar.
   yield closeAllNotifications();
 
   let notificationBox = document.getElementById("global-notificationbox");
 
   // Make sure that we have a coherent initial state.
@@ -159,17 +159,17 @@ add_task(function* test_single_window(){
   Assert.equal(TelemetryReportingPolicy.testIsUserNotified(), true,
                "User notified about datareporting policy.");
   Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), TEST_POLICY_VERSION,
                "Version pref set.");
   Assert.greater(parseInt(Preferences.get(PREF_ACCEPTED_POLICY_DATE, null), 10), -1,
                  "Date pref set.");
 });
 
-add_task(function* test_multiple_windows(){
+add_task(function* test_multiple_windows() {
   clearAcceptedPolicy();
 
   // Close all the notifications, then try to trigger the data choices infobar.
   yield closeAllNotifications();
 
   // Ensure we see the notification on all windows and that action on one window
   // results in dismiss on every window.
   let otherWindow = yield BrowserTestUtils.openNewBrowserWindow();
@@ -206,16 +206,16 @@ add_task(function* test_multiple_windows
   ];
   notificationBoxes[0].currentNotification.close();
   yield Promise.all(closeAlertPromises);
 
   // Close the second window we opened.
   yield BrowserTestUtils.closeWindow(otherWindow);
 
   // Check that we are clear to upload and that the policy data us saved.
-  Assert.ok(TelemetryReportingPolicy.canUpload(),"User should be allowed to upload now.");
+  Assert.ok(TelemetryReportingPolicy.canUpload(), "User should be allowed to upload now.");
   Assert.equal(TelemetryReportingPolicy.testIsUserNotified(), true,
                "User notified about datareporting policy.");
   Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), TEST_POLICY_VERSION,
                "Version pref set.");
   Assert.greater(parseInt(Preferences.get(PREF_ACCEPTED_POLICY_DATE, null), 10), -1,
                  "Date pref set.");
 });
--- a/browser/base/content/test/general/browser_decoderDoctor.js
+++ b/browser/base/content/test/general/browser_decoderDoctor.js
@@ -1,97 +1,97 @@
-"use strict";
-
-function* test_decoder_doctor_notification(type, notificationMessage, options) {
-  yield BrowserTestUtils.withNewTab({ gBrowser }, function*(browser) {
-    let awaitNotificationBar =
-      BrowserTestUtils.waitForNotificationBar(gBrowser, browser, "decoder-doctor-notification");
-
-    yield ContentTask.spawn(browser, type, function*(type) {
-      Services.obs.notifyObservers(content.window,
-                                   "decoder-doctor-notification",
-                                   JSON.stringify({type: type,
-                                                   isSolved: false,
-                                                   decoderDoctorReportId: "test",
-                                                   formats: "test"}));
-    });
-
-    let notification;
-    try {
-      notification = yield awaitNotificationBar;
-    } catch (ex) {
-      ok(false, ex);
-      return;
-    }
-    ok(notification, "Got decoder-doctor-notification notification");
-
-    is(notification.getAttribute("label"), notificationMessage,
-      "notification message should match expectation");
-    let button = notification.childNodes[0];
-    if (options && options.noLearnMoreButton) {
-      ok(!button, "There should not be a Learn More button");
-      return;
-    }
-
-    is(button.getAttribute("label"), gNavigatorBundle.getString("decoder.noCodecs.button"),
-      "notification button should be 'Learn more'");
-    is(button.getAttribute("accesskey"), gNavigatorBundle.getString("decoder.noCodecs.accesskey"),
-      "notification button should have accesskey");
-
-    let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
-    let url = baseURL + "fix-video-audio-problems-firefox-windows";
-    let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, url);
-    button.click();
-    let sumoTab = yield awaitNewTab;
-    yield BrowserTestUtils.removeTab(sumoTab);
-  });
-}
-
-add_task(function* test_adobe_cdm_not_found() {
-  // This is only sent on Windows.
-  if (AppConstants.platform != "win") {
-    return;
-  }
-
-  let message;
-  if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
-    message = gNavigatorBundle.getFormattedString("emeNotifications.drmContentDisabled.message", [""]);
-  } else {
-    message = gNavigatorBundle.getString("decoder.noCodecs.message");
-  }
-
-  yield test_decoder_doctor_notification("adobe-cdm-not-found", message);
-});
-
-add_task(function* test_adobe_cdm_not_activated() {
-  // This is only sent on Windows.
-  if (AppConstants.platform != "win") {
-    return;
-  }
-
-  let message;
-  if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
-    message = gNavigatorBundle.getString("decoder.noCodecsXP.message");
-  } else {
-    message = gNavigatorBundle.getString("decoder.noCodecs.message");
-  }
-
-  yield test_decoder_doctor_notification("adobe-cdm-not-activated", message);
-});
-
-add_task(function* test_platform_decoder_not_found() {
-  // Not sent on Windows XP.
-  if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
-    return;
-  }
-
-  let message;
-  let isLinux = AppConstants.platform == "linux";
-  if (isLinux) {
-    message = gNavigatorBundle.getString("decoder.noCodecsLinux.message");
-  } else {
-    message = gNavigatorBundle.getString("decoder.noHWAcceleration.message");
-  }
-
-  yield test_decoder_doctor_notification("platform-decoder-not-found",
-                                         message,
-                                         {noLearnMoreButton: isLinux});
-});
+"use strict";
+
+function* test_decoder_doctor_notification(type, notificationMessage, options) {
+  yield BrowserTestUtils.withNewTab({ gBrowser }, function*(browser) {
+    let awaitNotificationBar =
+      BrowserTestUtils.waitForNotificationBar(gBrowser, browser, "decoder-doctor-notification");
+
+    yield ContentTask.spawn(browser, type, function*(type) {
+      Services.obs.notifyObservers(content.window,
+                                   "decoder-doctor-notification",
+                                   JSON.stringify({type: type,
+                                                   isSolved: false,
+                                                   decoderDoctorReportId: "test",
+                                                   formats: "test"}));
+    });
+
+    let notification;
+    try {
+      notification = yield awaitNotificationBar;
+    } catch (ex) {
+      ok(false, ex);
+      return;
+    }
+    ok(notification, "Got decoder-doctor-notification notification");
+
+    is(notification.getAttribute("label"), notificationMessage,
+      "notification message should match expectation");
+    let button = notification.childNodes[0];
+    if (options && options.noLearnMoreButton) {
+      ok(!button, "There should not be a Learn More button");
+      return;
+    }
+
+    is(button.getAttribute("label"), gNavigatorBundle.getString("decoder.noCodecs.button"),
+      "notification button should be 'Learn more'");
+    is(button.getAttribute("accesskey"), gNavigatorBundle.getString("decoder.noCodecs.accesskey"),
+      "notification button should have accesskey");
+
+    let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
+    let url = baseURL + "fix-video-audio-problems-firefox-windows";
+    let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, url);
+    button.click();
+    let sumoTab = yield awaitNewTab;
+    yield BrowserTestUtils.removeTab(sumoTab);
+  });
+}
+
+add_task(function* test_adobe_cdm_not_found() {
+  // This is only sent on Windows.
+  if (AppConstants.platform != "win") {
+    return;
+  }
+
+  let message;
+  if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
+    message = gNavigatorBundle.getFormattedString("emeNotifications.drmContentDisabled.message", [""]);
+  } else {
+    message = gNavigatorBundle.getString("decoder.noCodecs.message");
+  }
+
+  yield test_decoder_doctor_notification("adobe-cdm-not-found", message);
+});
+
+add_task(function* test_adobe_cdm_not_activated() {
+  // This is only sent on Windows.
+  if (AppConstants.platform != "win") {
+    return;
+  }
+
+  let message;
+  if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
+    message = gNavigatorBundle.getString("decoder.noCodecsXP.message");
+  } else {
+    message = gNavigatorBundle.getString("decoder.noCodecs.message");
+  }
+
+  yield test_decoder_doctor_notification("adobe-cdm-not-activated", message);
+});
+
+add_task(function* test_platform_decoder_not_found() {
+  // Not sent on Windows XP.
+  if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
+    return;
+  }
+
+  let message;
+  let isLinux = AppConstants.platform == "linux";
+  if (isLinux) {
+    message = gNavigatorBundle.getString("decoder.noCodecsLinux.message");
+  } else {
+    message = gNavigatorBundle.getString("decoder.noHWAcceleration.message");
+  }
+
+  yield test_decoder_doctor_notification("platform-decoder-not-found",
+                                         message,
+                                         {noLearnMoreButton: isLinux});
+});
--- a/browser/base/content/test/general/browser_discovery.js
+++ b/browser/base/content/test/general/browser_discovery.js
@@ -120,43 +120,43 @@ function runMultipleEnginesTestAndFinali
   is(browser.engines.length, 1, "only one engine");
   is(browser.engines[0].uri, "http://first.mozilla.com/search.xml", "first engine wins");
 
   gBrowser.removeCurrentTab();
   finish();
 }
 
 function searchDiscovery() {
-  var head = doc().getElementById("linkparent");
+  let head = doc().getElementById("linkparent");
 
   if (searchDiscoveryTests.length) {
     setHandlerFunc(runSearchDiscoveryTest);
-    var test = searchDiscoveryTests[0];
-    var link = doc().createElement("link");
+    let test = searchDiscoveryTests[0];
+    let link = doc().createElement("link");
 
-    var rel = test.rel || "search";
-    var href = test.href || "http://so.not.here.mozilla.com/search.xml";
-    var type = test.type || "application/opensearchdescription+xml";
-    var title = test.title || searchDiscoveryTests.length;
+    let rel = test.rel || "search";
+    let href = test.href || "http://so.not.here.mozilla.com/search.xml";
+    let type = test.type || "application/opensearchdescription+xml";
+    let title = test.title || searchDiscoveryTests.length;
     if (test.pass == undefined)
       test.pass = true;
 
     link.rel = rel;
     link.href = href;
     link.type = type;
     link.title = title;
     head.appendChild(link);
   } else {
     setHandlerFunc(runMultipleEnginesTestAndFinalize);
     setHandlerFunc(runMultipleEnginesTestAndFinalize);
     // Test multiple engines with the same title
-    var link = doc().createElement("link");
+    let link = doc().createElement("link");
     link.rel = "search";
     link.href = "http://first.mozilla.com/search.xml";
     link.type = "application/opensearchdescription+xml";
     link.title = "Test Engine";
-    var link2 = link.cloneNode(false);
+    let link2 = link.cloneNode(false);
     link2.href = "http://second.mozilla.com/search.xml";
 
     head.appendChild(link);
     head.appendChild(link2);
   }
 }
--- a/browser/base/content/test/general/browser_documentnavigation.js
+++ b/browser/base/content/test/general/browser_documentnavigation.js
@@ -80,17 +80,17 @@ function* expectFocusOnF6(backward, expe
   is(fm.focusedWindow.document.documentElement.id, expectedDocument, desc + " document matches");
   is(fm.focusedElement, expectedElement, desc + " element matches");
 
   if (onContent) {
     messageManager.removeMessageListener("BrowserTest:FocusChanged", focusChangedListener);
   }
 }
 
-// Load a page and navigate between it and the chrome window. 
+// Load a page and navigate between it and the chrome window.
 add_task(function* ()
 {
   let page1Promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
   gBrowser.selectedBrowser.loadURI(testPage1);
   yield page1Promise;
 
   // When the urlbar is focused, pressing F6 should focus the root of the content page.
   gURLBar.focus();
@@ -151,17 +151,17 @@ add_task(function* ()
 add_task(function* ()
 {
   let sidebar = document.getElementById("sidebar");
 
   let loadPromise = BrowserTestUtils.waitForEvent(sidebar, "load", true);
   SidebarUI.toggle('viewBookmarksSidebar');
   yield loadPromise;
 
-  
+
   gURLBar.focus();
   yield* expectFocusOnF6(false, "bookmarksPanel",
                                 sidebar.contentDocument.getElementById("search-box").inputField,
                                 false, "focus with sidebar open sidebar");
   yield* expectFocusOnF6(false, "html1", "html1",
                                 true, "focus with sidebar open content");
   yield* expectFocusOnF6(false, "main-window", gURLBar.inputField,
                                 false, "focus with sidebar urlbar");
--- a/browser/base/content/test/general/browser_favicon_change.js
+++ b/browser/base/content/test/general/browser_favicon_change.js
@@ -1,40 +1,40 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const TEST_URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_favicon_change.html"
-
-add_task(function*() {
-  let extraTab = gBrowser.selectedTab = gBrowser.addTab();
-  let tabLoaded = promiseTabLoaded(extraTab);
-  extraTab.linkedBrowser.loadURI(TEST_URL);
-  let expectedFavicon = "http://example.org/one-icon";
-  let haveChanged = new Promise.defer();
-  let observer = new MutationObserver(function(mutations) {
-    for (let mut of mutations) {
-      if (mut.attributeName != "image") {
-        continue;
-      }
-      let imageVal = extraTab.getAttribute("image").replace(/#.*$/, "");
-      if (!imageVal) {
-        // The value gets removed because it doesn't load.
-        continue;
-      }
-      is(imageVal, expectedFavicon, "Favicon image should correspond to expected image.");
-      haveChanged.resolve();
-    }
-  });
-  observer.observe(extraTab, {attributes: true});
-  yield tabLoaded;
-  yield haveChanged.promise;
-  haveChanged = new Promise.defer();
-  expectedFavicon = "http://example.org/other-icon";
-  let contentWin = extraTab.linkedBrowser.contentWindow;
-  let ev = new contentWin.CustomEvent("PleaseChangeFavicon", {});
-  contentWin.dispatchEvent(ev);
-  yield haveChanged.promise;
-  observer.disconnect();
-  gBrowser.removeTab(extraTab);
-});
-
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_favicon_change.html"
+
+add_task(function*() {
+  let extraTab = gBrowser.selectedTab = gBrowser.addTab();
+  let tabLoaded = promiseTabLoaded(extraTab);
+  extraTab.linkedBrowser.loadURI(TEST_URL);
+  let expectedFavicon = "http://example.org/one-icon";
+  let haveChanged = new Promise.defer();
+  let observer = new MutationObserver(function(mutations) {
+    for (let mut of mutations) {
+      if (mut.attributeName != "image") {
+        continue;
+      }
+      let imageVal = extraTab.getAttribute("image").replace(/#.*$/, "");
+      if (!imageVal) {
+        // The value gets removed because it doesn't load.
+        continue;
+      }
+      is(imageVal, expectedFavicon, "Favicon image should correspond to expected image.");
+      haveChanged.resolve();
+    }
+  });
+  observer.observe(extraTab, {attributes: true});
+  yield tabLoaded;
+  yield haveChanged.promise;
+  haveChanged = new Promise.defer();
+  expectedFavicon = "http://example.org/other-icon";
+  let contentWin = extraTab.linkedBrowser.contentWindow;
+  let ev = new contentWin.CustomEvent("PleaseChangeFavicon", {});
+  contentWin.dispatchEvent(ev);
+  yield haveChanged.promise;
+  observer.disconnect();
+  gBrowser.removeTab(extraTab);
+});
+
--- a/browser/base/content/test/general/browser_fullscreen-window-open.js
+++ b/browser/base/content/test/general/browser_fullscreen-window-open.js
@@ -22,17 +22,17 @@ function test () {
   whenTabLoaded(newTab, function () {
     // Enter browser fullscreen mode.
     BrowserFullScreen();
 
     runNextTest();
   });
 }
 
-registerCleanupFunction(function(){
+registerCleanupFunction(function() {
   // Exit browser fullscreen mode.
   BrowserFullScreen();
 
   gBrowser.removeCurrentTab();
 
   Services.prefs.clearUserPref(PREF_DISABLE_OPEN_NEW_WINDOW);
 });
 
@@ -326,17 +326,17 @@ WindowListener.prototype = {
       if (this.callback_onSuccess) {
         this.callback_onSuccess();
       }
 
       domwindow.removeEventListener("load", onLoad, true);
 
       // wait for trasition to fullscreen on OSX Lion later
       if (isOSX) {
-        setTimeout(function(){
+        setTimeout(function() {
           domwindow.close();
           executeSoon(this.callBack_onFinalize);
         }.bind(this), 3000);
       }
       else {
         domwindow.close();
         executeSoon(this.callBack_onFinalize);
       }
--- a/browser/base/content/test/general/browser_fxa_oauth.html
+++ b/browser/base/content/test/general/browser_fxa_oauth.html
@@ -1,17 +1,17 @@
 <!DOCTYPE html>
 <html>
 <head>
   <meta charset="utf-8">
   <title>fxa_oauth_test</title>
 </head>
 <body>
 <script>
-  window.onload = function(){
+  window.onload = function() {
     var event = new window.CustomEvent("WebChannelMessageToChrome", {
       // Note: This intentionally sends an object instead of a string, to ensure both work
       // (see browser_fxa_oauth_with_keys.html for the other test)
       detail: {
         id: "oauth_client_id",
         message: {
           command: "oauth_complete",
           data: {
--- a/browser/base/content/test/general/browser_fxa_oauth.js
+++ b/browser/base/content/test/general/browser_fxa_oauth.js
@@ -303,17 +303,17 @@ function waitForTab(aCallback) {
       aCallback(tab);
     }, true);
   }, false);
 }
 
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     const webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
     let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
     let newWhitelist = origWhitelist + " http://example.com";
     Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist);
     try {
       for (let test of gTests) {
         info("Running: " + test.desc);
         yield test.run();
--- a/browser/base/content/test/general/browser_fxa_oauth_with_keys.html
+++ b/browser/base/content/test/general/browser_fxa_oauth_with_keys.html
@@ -1,17 +1,17 @@
 <!DOCTYPE html>
 <html>
 <head>
   <meta charset="utf-8">
   <title>fxa_oauth_test</title>
 </head>
 <body>
 <script>
-  window.onload = function(){
+  window.onload = function() {
     var event = new window.CustomEvent("WebChannelMessageToChrome", {
       // Note: This intentionally sends a string instead of an object, to ensure both work
       // (see browser_fxa_oauth.html for the other test)
       detail: JSON.stringify({
         id: "oauth_client_id",
         message: {
           command: "oauth_complete",
           data: {
--- a/browser/base/content/test/general/browser_fxa_web_channel.html
+++ b/browser/base/content/test/general/browser_fxa_web_channel.html
@@ -3,20 +3,20 @@
 <head>
   <meta charset="utf-8">
   <title>fxa_web_channel_test</title>
 </head>
 <body>
 <script>
   var webChannelId = "account_updates_test";
 
-  window.onload = function(){
+  window.onload = function() {
     var testName = window.location.search.replace(/^\?/, "");
 
-    switch(testName) {
+    switch (testName) {
       case "profile_change":
         test_profile_change();
         break;
       case "login":
         test_login();
         break;
       case "can_link_account":
         test_can_link_account();
--- a/browser/base/content/test/general/browser_fxa_web_channel.js
+++ b/browser/base/content/test/general/browser_fxa_web_channel.js
@@ -193,17 +193,17 @@ function makeObserver(aObserveTopic, aOb
 
   Services.obs.addObserver(callback, aObserveTopic, false);
   return removeMe;
 }
 
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     for (let test of gTests) {
       info("Running: " + test.desc);
       yield test.run();
     }
   }).then(finish, ex => {
     Assert.ok(false, "Unexpected Exception: " + ex);
     finish();
   });
--- a/browser/base/content/test/general/browser_gZipOfflineChild.js
+++ b/browser/base/content/test/general/browser_gZipOfflineChild.js
@@ -36,17 +36,17 @@ function handleMessageEvents(event) {
       // in the iframe, as in the case of bug 501422.
       intervalID = setInterval(function() {
         // Sometimes document.body may not exist, and trying to access
         // it will throw an exception, so handle this case.
         try {
           var bodyInnerHTML = event.source.document.body.innerHTML;
         }
         catch (e) {
-          var bodyInnerHTML = "";
+          bodyInnerHTML = "";
         }
         if (cacheCount == 2 || bodyInnerHTML.includes("error")) {
           clearInterval(intervalID);
           is(cacheCount, 2, "frame not reloaded successfully");
           if (cacheCount != 2) {
             finish();
           }
         }
--- a/browser/base/content/test/general/browser_gestureSupport.js
+++ b/browser/base/content/test/general/browser_gestureSupport.js
@@ -150,17 +150,17 @@ function test_TestEventListeners()
   e("MozMagnifyGestureUpdate", 0, 5.0, 0);
   e("MozMagnifyGesture", 0, 30.0, 0);
 
   // rotate gesture events
   e("MozRotateGestureStart", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
   e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE, -13.0, 0);
   e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_CLOCKWISE, 13.0, 0);
   e("MozRotateGesture", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
-  
+
   // Tap and presstap gesture events
   test_clicks("MozTapGesture", 1);
   test_clicks("MozTapGesture", 2);
   test_clicks("MozTapGesture", 3);
   test_clicks("MozPressTapGesture", 1);
 
   // simple delivery test for edgeui gestures
   e("MozEdgeUIStarted", 0, 0, 0);
--- a/browser/base/content/test/general/browser_menuButtonFitts.js
+++ b/browser/base/content/test/general/browser_menuButtonFitts.js
@@ -1,32 +1,32 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function test () {
-  waitForExplicitFinish();
-  window.maximize();
-
-  // Find where the nav-bar is vertically.
-  var navBar = document.getElementById("nav-bar");
-  var boundingRect = navBar.getBoundingClientRect();
-  var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
-  var xPixel = boundingRect.width - 1; // Use the last pixel of the screen since it is maximized.
-
-  function onPopupHidden() {
-    PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
-    window.restore();
-    finish();
-  }
-  function onPopupShown() {
-    PanelUI.panel.removeEventListener("popupshown", onPopupShown);
-    ok(true, "Clicking at the far edge of the window opened the menu popup.");
-    PanelUI.panel.addEventListener("popuphidden", onPopupHidden);
-    PanelUI.hide();
-  }
-  registerCleanupFunction(function() {
-    PanelUI.panel.removeEventListener("popupshown", onPopupShown);
-    PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
-  });
-  PanelUI.panel.addEventListener("popupshown", onPopupShown);
-  EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
-}
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+function test () {
+  waitForExplicitFinish();
+  window.maximize();
+
+  // Find where the nav-bar is vertically.
+  var navBar = document.getElementById("nav-bar");
+  var boundingRect = navBar.getBoundingClientRect();
+  var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
+  var xPixel = boundingRect.width - 1; // Use the last pixel of the screen since it is maximized.
+
+  function onPopupHidden() {
+    PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
+    window.restore();
+    finish();
+  }
+  function onPopupShown() {
+    PanelUI.panel.removeEventListener("popupshown", onPopupShown);
+    ok(true, "Clicking at the far edge of the window opened the menu popup.");
+    PanelUI.panel.addEventListener("popuphidden", onPopupHidden);
+    PanelUI.hide();
+  }
+  registerCleanupFunction(function() {
+    PanelUI.panel.removeEventListener("popupshown", onPopupShown);
+    PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
+  });
+  PanelUI.panel.addEventListener("popupshown", onPopupShown);
+  EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
+}
--- a/browser/base/content/test/general/browser_minimize.js
+++ b/browser/base/content/test/general/browser_minimize.js
@@ -10,9 +10,9 @@ add_task(function *() {
     yield promiseWaitForCondition(waitForActive);
     is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, true, "Docshell should be active");
     window.minimize();
     yield promiseWaitForCondition(waitForInactive);
     is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, false, "Docshell should be Inactive");
     window.restore();
     yield promiseWaitForCondition(waitForActive);
     is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, true, "Docshell should be active again");
-});
\ No newline at end of file
+});
--- a/browser/base/content/test/general/browser_mixedContentFramesOnHttp.js
+++ b/browser/base/content/test/general/browser_mixedContentFramesOnHttp.js
@@ -19,16 +19,16 @@ add_task(function *() {
     SpecialPowers.pushPrefEnv({
       "set": [
         ["security.mixed_content.block_active_content", true],
         ["security.mixed_content.block_display_content", false]
       ]
     }, resolve);
   });
   let url = gHttpTestUrl
-  yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(){
+  yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
     gTestBrowser = gBrowser.selectedBrowser;
     // check security state is insecure
     isSecurityState("insecure");
     assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: false, passiveLoaded: true});
   });
 });
 
--- a/browser/base/content/test/general/browser_mixedContentFromOnunload.js
+++ b/browser/base/content/test/general/browser_mixedContentFromOnunload.js
@@ -11,17 +11,17 @@
 const gHttpTestRoot1 = "http://example.com/browser/browser/base/content/test/general/";
 const gHttpsTestRoot1 = "https://test1.example.com/browser/browser/base/content/test/general/";
 const gHttpTestRoot2 = "http://example.net/browser/browser/base/content/test/general/";
 const gHttpsTestRoot2 = "https://test2.example.com/browser/browser/base/content/test/general/";
 
 var gTestBrowser = null;
 add_task(function *() {
   let url = gHttpTestRoot1 + "file_mixedContentFromOnunload.html";
-  yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(){
+  yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
     yield new Promise(resolve => {
       SpecialPowers.pushPrefEnv({
         "set": [
           ["security.mixed_content.block_active_content", true],
           ["security.mixed_content.block_display_content", false]
         ]
       }, resolve);
     });
--- a/browser/base/content/test/general/browser_page_style_menu_update.js
+++ b/browser/base/content/test/general/browser_page_style_menu_update.js
@@ -60,9 +60,9 @@ add_task(function*() {
 
   gPageStyleMenu.fillPopup(menupopup);
   // gPageStyleMenu empties out the menu between opens, so we need
   // to get a new reference to the selected menuitem
   selected = menupopup.querySelector("menuitem[checked='true']");
   is(selected.getAttribute("label"), "1", "Should now have stylesheet 1 selected");
 
   yield BrowserTestUtils.removeTab(tab);
-});
\ No newline at end of file
+});
--- a/browser/base/content/test/general/browser_plainTextLinks.js
+++ b/browser/base/content/test/general/browser_plainTextLinks.js
@@ -133,14 +133,14 @@ add_task(function *() {
     yield BrowserTestUtils.synthesizeMouseAtPoint(menuPosition[0], menuPosition[1],
           { type: "contextmenu", button: 2 }, gBrowser.selectedBrowser);
     yield popupShownPromise;
 
     checks[testid]();
 
     let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
     contentAreaContextMenu.hidePopup();
-    yield popupHiddenPromise;  
+    yield popupHiddenPromise;
   }
 
   gBrowser.removeCurrentTab();
 });
 
--- a/browser/base/content/test/general/browser_readerMode.js
+++ b/browser/base/content/test/general/browser_readerMode.js
@@ -113,33 +113,33 @@ add_task(function* test_reader_view_elem
   });
 
   function observeAttribute(element, attribute, triggerFn, checkFn) {
     let initValue = element.getAttribute(attribute);
     return new Promise(resolve => {
       let observer = new MutationObserver((mutations) => {
         mutations.forEach( mu => {
           let muValue = element.getAttribute(attribute);
-          if(element.getAttribute(attribute) !== mu.oldValue) {
+          if (element.getAttribute(attribute) !== mu.oldValue) {
             checkFn();
             resolve();
             observer.disconnect();
           }
         });
       });
 
       observer.observe(element, {
         attributes: true,
         attributeOldValue: true,
         attributeFilter: [attribute]
       });
 
       triggerFn();
     });
-  };
+  }
 
   let command = document.getElementById("View:ReaderView");
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser);
   is(command.hidden, true, "Command element should have the hidden attribute");
 
   info("Navigate a reader-able page");
   let waitForPageshow = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
   yield observeAttribute(command, "hidden",
--- a/browser/base/content/test/general/browser_remoteTroubleshoot.js
+++ b/browser/base/content/test/general/browser_remoteTroubleshoot.js
@@ -1,93 +1,93 @@
-/* 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/. */
-
-var {WebChannel} = Cu.import("resource://gre/modules/WebChannel.jsm", {});
-
-const TEST_URL_TAIL = "example.com/browser/browser/base/content/test/general/test_remoteTroubleshoot.html"
-const TEST_URI_GOOD = Services.io.newURI("https://" + TEST_URL_TAIL, null, null);
-const TEST_URI_BAD = Services.io.newURI("http://" + TEST_URL_TAIL, null, null);
-const TEST_URI_GOOD_OBJECT = Services.io.newURI("https://" + TEST_URL_TAIL + "?object", null, null);
-
-// Creates a one-shot web-channel for the test data to be sent back from the test page.
-function promiseChannelResponse(channelID, originOrPermission) {
-  return new Promise((resolve, reject) => {
-    let channel = new WebChannel(channelID, originOrPermission);
-    channel.listen((id, data, target) => {
-      channel.stopListening();
-      resolve(data);
-    });
-  });
-};
-
-// Loads the specified URI in a new tab and waits for it to send us data on our
-// test web-channel and resolves with that data.
-function promiseNewChannelResponse(uri) {
-  let channelPromise = promiseChannelResponse("test-remote-troubleshooting-backchannel",
-                                              uri);
-  let tab = gBrowser.loadOneTab(uri.spec, { inBackground: false });
-  return promiseTabLoaded(tab).then(
-    () => channelPromise
-  ).then(data => {
-    gBrowser.removeTab(tab);
-    return data;
-  });
-}
-
-add_task(function*() {
-  // We haven't set a permission yet - so even the "good" URI should fail.
-  let got = yield promiseNewChannelResponse(TEST_URI_GOOD);
-  // Should have no data.
-  Assert.ok(got.message === undefined, "should have failed to get any data");
-
-  // Add a permission manager entry for our URI.
-  Services.perms.add(TEST_URI_GOOD,
-                     "remote-troubleshooting",
-                     Services.perms.ALLOW_ACTION);
-  registerCleanupFunction(() => {
-    Services.perms.remove(TEST_URI_GOOD, "remote-troubleshooting");
-  });
-
-  // Try again - now we are expecting a response with the actual data.
-  got = yield promiseNewChannelResponse(TEST_URI_GOOD);
-
-  // Check some keys we expect to always get.
-  Assert.ok(got.message.extensions, "should have extensions");
-  Assert.ok(got.message.graphics, "should have graphics");
-
-  // Check we have channel and build ID info:
-  Assert.equal(got.message.application.buildID, Services.appinfo.appBuildID,
-               "should have correct build ID");
-
-  let updateChannel = null;
-  try {
-    updateChannel = Cu.import("resource://gre/modules/UpdateUtils.jsm", {}).UpdateUtils.UpdateChannel;
-  } catch (ex) {}
-  if (!updateChannel) {
-    Assert.ok(!('updateChannel' in got.message.application),
-                "should not have update channel where not available.");
-  } else {
-    Assert.equal(got.message.application.updateChannel, updateChannel,
-                 "should have correct update channel.");
-  }
-
-
-  // And check some keys we know we decline to return.
-  Assert.ok(!got.message.modifiedPreferences, "should not have a modifiedPreferences key");
-  Assert.ok(!got.message.crashes, "should not have crash info");
-
-  // Now a http:// URI - should get nothing even with the permission setup.
-  got = yield promiseNewChannelResponse(TEST_URI_BAD);
-  Assert.ok(got.message === undefined, "should have failed to get any data");
-
-  // Check that the page can send an object as well if it's in the whitelist
-  let webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
-  let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
-  let newWhitelist = origWhitelist + " https://example.com";
-  Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist);
-  registerCleanupFunction(() => {
-    Services.prefs.clearUserPref(webchannelWhitelistPref);
-  });
-  got = yield promiseNewChannelResponse(TEST_URI_GOOD_OBJECT);
-  Assert.ok(got.message, "should have gotten some data back");
-});
+/* 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/. */
+
+var {WebChannel} = Cu.import("resource://gre/modules/WebChannel.jsm", {});
+
+const TEST_URL_TAIL = "example.com/browser/browser/base/content/test/general/test_remoteTroubleshoot.html"
+const TEST_URI_GOOD = Services.io.newURI("https://" + TEST_URL_TAIL, null, null);
+const TEST_URI_BAD = Services.io.newURI("http://" + TEST_URL_TAIL, null, null);
+const TEST_URI_GOOD_OBJECT = Services.io.newURI("https://" + TEST_URL_TAIL + "?object", null, null);
+
+// Creates a one-shot web-channel for the test data to be sent back from the test page.
+function promiseChannelResponse(channelID, originOrPermission) {
+  return new Promise((resolve, reject) => {
+    let channel = new WebChannel(channelID, originOrPermission);
+    channel.listen((id, data, target) => {
+      channel.stopListening();
+      resolve(data);
+    });
+  });
+}
+
+// Loads the specified URI in a new tab and waits for it to send us data on our
+// test web-channel and resolves with that data.
+function promiseNewChannelResponse(uri) {
+  let channelPromise = promiseChannelResponse("test-remote-troubleshooting-backchannel",
+                                              uri);
+  let tab = gBrowser.loadOneTab(uri.spec, { inBackground: false });
+  return promiseTabLoaded(tab).then(
+    () => channelPromise
+  ).then(data => {
+    gBrowser.removeTab(tab);
+    return data;
+  });
+}
+
+add_task(function*() {
+  // We haven't set a permission yet - so even the "good" URI should fail.
+  let got = yield promiseNewChannelResponse(TEST_URI_GOOD);
+  // Should have no data.
+  Assert.ok(got.message === undefined, "should have failed to get any data");
+
+  // Add a permission manager entry for our URI.
+  Services.perms.add(TEST_URI_GOOD,
+                     "remote-troubleshooting",
+                     Services.perms.ALLOW_ACTION);
+  registerCleanupFunction(() => {
+    Services.perms.remove(TEST_URI_GOOD, "remote-troubleshooting");
+  });
+
+  // Try again - now we are expecting a response with the actual data.
+  got = yield promiseNewChannelResponse(TEST_URI_GOOD);
+
+  // Check some keys we expect to always get.
+  Assert.ok(got.message.extensions, "should have extensions");
+  Assert.ok(got.message.graphics, "should have graphics");
+
+  // Check we have channel and build ID info:
+  Assert.equal(got.message.application.buildID, Services.appinfo.appBuildID,
+               "should have correct build ID");
+
+  let updateChannel = null;
+  try {
+    updateChannel = Cu.import("resource://gre/modules/UpdateUtils.jsm", {}).UpdateUtils.UpdateChannel;
+  } catch (ex) {}
+  if (!updateChannel) {
+    Assert.ok(!('updateChannel' in got.message.application),
+                "should not have update channel where not available.");
+  } else {
+    Assert.equal(got.message.application.updateChannel, updateChannel,
+                 "should have correct update channel.");
+  }
+
+
+  // And check some keys we know we decline to return.
+  Assert.ok(!got.message.modifiedPreferences, "should not have a modifiedPreferences key");
+  Assert.ok(!got.message.crashes, "should not have crash info");
+
+  // Now a http:// URI - should get nothing even with the permission setup.
+  got = yield promiseNewChannelResponse(TEST_URI_BAD);
+  Assert.ok(got.message === undefined, "should have failed to get any data");
+
+  // Check that the page can send an object as well if it's in the whitelist
+  let webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
+  let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
+  let newWhitelist = origWhitelist + " https://example.com";
+  Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist);
+  registerCleanupFunction(() => {
+    Services.prefs.clearUserPref(webchannelWhitelistPref);
+  });
+  got = yield promiseNewChannelResponse(TEST_URI_GOOD_OBJECT);
+  Assert.ok(got.message, "should have gotten some data back");
+});
--- a/browser/base/content/test/general/browser_restore_isAppTab.js
+++ b/browser/base/content/test/general/browser_restore_isAppTab.js
@@ -80,17 +80,17 @@ function isBrowserAppTab(browser) {
     });
   });
 }
 
 // Restarts the child process by crashing it then reloading the tab
 var restart = Task.async(function*(browser) {
   // If the tab isn't remote this would crash the main process so skip it
   if (!browser.isRemoteBrowser)
-    return browser;
+    return;
 
   // Make sure the main process has all of the current tab state before crashing
   yield TabStateFlusher.flush(browser);
 
   browser.messageManager.sendAsyncMessage("Test:Crash");
   yield promiseWaitForEvent(browser, "AboutTabCrashedLoad", false, true);
 
   let tab = gBrowser.getTabForBrowser(browser);
--- a/browser/base/content/test/general/browser_sanitize-timespans.js
+++ b/browser/base/content/test/general/browser_sanitize-timespans.js
@@ -74,17 +74,17 @@ function countEntries(name, message, che
 }
 
 function* onHistoryReady() {
   var hoursSinceMidnight = new Date().getHours();
   var minutesSinceMidnight = hoursSinceMidnight * 60 + new Date().getMinutes();
 
   // Should test cookies here, but nsICookieManager/nsICookieService
   // doesn't let us fake creation times.  bug 463127
-  
+
   let s = new Sanitizer();
   s.ignoreTimespan = false;
   s.prefDomain = "privacy.cpd.";
   var itemPrefs = gPrefService.getBranch(s.prefDomain);
   itemPrefs.setBoolPref("history", true);
   itemPrefs.setBoolPref("downloads", true);
   itemPrefs.setBoolPref("cache", false);
   itemPrefs.setBoolPref("cookies", false);
@@ -197,17 +197,17 @@ function* onHistoryReady() {
   ok((yield downloadExists(publicList, "fakefile-old")), "Year old download should still be present");
   ok((yield downloadExists(publicList, "fakefile-2-hour")), "<2 hour old download should still be present");
   ok((yield downloadExists(publicList, "fakefile-2-hour-10-minutes")), "2 hour 10 minute download should still be present");
   ok((yield downloadExists(publicList, "fakefile-4-hour")), "<4 hour old download should still be present");
   ok((yield downloadExists(publicList, "fakefile-4-hour-10-minutes")), "4 hour 10 minute download should still be present");
 
   if (hoursSinceMidnight > 1)
     ok((yield downloadExists(publicList, "fakefile-today")), "'Today' download should still be present");
-  
+
   downloadPromise = promiseDownloadRemoved(publicList);
   formHistoryPromise = promiseFormHistoryRemoved();
 
   // Clear 1 hour 10 minutes
   s.range = [now_uSec - 70*60*1000000, now_uSec];
   yield s.sanitize();
   s.range = null;
 
@@ -380,17 +380,17 @@ function* onHistoryReady() {
   }
   ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
     "Pretend visit to before-today.com should still exist");
 
   yield countEntries("4hour10minutes", "4hour10minutes form entry should be deleted", checkZero);
   if (minutesSinceMidnight > 250)
     yield countEntries("today", "today form entry should still exist", checkOne);
   yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-  
+
   ok(!(yield downloadExists(publicList, "fakefile-4-hour-10-minutes")), "4 hour 10 minute download should now be deleted");
   ok((yield downloadExists(publicList, "fakefile-old")), "Year old download should still be present");
   if (minutesSinceMidnight > 250)
     ok((yield downloadExists(publicList, "fakefile-today")), "'Today' download should still be present");
 
   // The 'Today' download might have been already deleted, in which case we
   // should not wait for a download removal notification.
   if (minutesSinceMidnight > 250) {
@@ -481,17 +481,17 @@ function setupHistory() {
     handleError: () => ok(false, "Unexpected error in adding visit."),
     handleResult: () => { },
     handleCompletion: () => deferred.resolve()
   });
 
   return deferred.promise;
 }
 
-function setupFormHistory() {
+function* setupFormHistory() {
 
   function searchEntries(terms, params) {
     let deferred = Promise.defer();
 
     let results = [];
     FormHistory.search(terms, params, { handleResult: result => results.push(result),
                                         handleError: function (error) {
                                           do_throw("Error occurred searching form history: " + error);
@@ -611,17 +611,17 @@ function setupFormHistory() {
   yield countEntries("2hour10minutes", "Checking for 2hour10minutes form history entry creation", checkOne);
   yield countEntries("4hour", "Checking for 4hour form history entry creation", checkOne);
   yield countEntries("4hour10minutes", "Checking for 4hour10minutes form history entry creation", checkOne);
   yield countEntries("today", "Checking for today form history entry creation", checkOne);
   yield countEntries("b4today", "Checking for b4today form history entry creation", checkOne);
   is(checks, 9, "9 checks made");
 }
 
-function setupDownloads() {
+function* setupDownloads() {
 
   let publicList = yield Downloads.getList(Downloads.PUBLIC);
 
   let download = yield Downloads.createDownload({
     source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
     target: "fakefile-10-minutes"
   });
   download.startTime = new Date(now_mSec - 10 * kMsecPerMin), // 10 minutes ago
@@ -684,29 +684,29 @@ function setupDownloads() {
 
   download = yield Downloads.createDownload({
     source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
     target: "fakefile-today"
   });
   download.startTime = today, // 12:00:01 AM this morning
   download.canceled = true;
   yield publicList.add(download);
-  
+
   // Add "before today" download
   let lastYear = new Date();
   lastYear.setFullYear(lastYear.getFullYear() - 1);
 
   download = yield Downloads.createDownload({
     source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
     target: "fakefile-old"
   });
   download.startTime = lastYear,
   download.canceled = true;
   yield publicList.add(download);
-  
+
   // Confirm everything worked
   let downloads = yield publicList.getAll();
   is(downloads.length, 9, "9 Pretend downloads added");
 
   ok((yield downloadExists(publicList, "fakefile-old")), "Pretend download for everything case should exist");
   ok((yield downloadExists(publicList, "fakefile-10-minutes")), "Pretend download for 10-minutes case should exist");
   ok((yield downloadExists(publicList, "fakefile-1-hour")), "Pretend download for 1-hour case should exist");
   ok((yield downloadExists(publicList, "fakefile-1-hour-10-minutes")), "Pretend download for 1-hour-10-minutes case should exist");
@@ -720,17 +720,17 @@ function setupDownloads() {
 /**
  * Checks to see if the downloads with the specified id exists.
  *
  * @param aID
  *        The ids of the downloads to check.
  */
 function downloadExists(list, path)
 {
-  return Task.spawn(function() {
+  return Task.spawn(function*() {
     let listArray = yield list.getAll();
     throw new Task.Result(listArray.some(i => i.target.path == path));
   });
 }
 
 function isToday(aDate) {
   return aDate.getDate() == new Date().getDate();
 }
--- a/browser/base/content/test/general/browser_sanitizeDialog.js
+++ b/browser/base/content/test/general/browser_sanitizeDialog.js
@@ -299,17 +299,17 @@ add_task(function* test_everything() {
  * Ensures that the "Everything" warning is visible on dialog open after
  * the previous test.
  */
 add_task(function* test_everything_warning() {
   // Add history.
   let uris = [];
   let places = [];
   let pURI;
-  // within past hour, within past two hours, within past four hours and 
+  // within past hour, within past two hours, within past four hours and
   // outside past four hours
   [10, 70, 130, 250].forEach(function(aValue) {
     pURI = makeURI("http://" + aValue + "-minutes-ago.com/");
     places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(aValue)});
     uris.push(pURI);
   });
 
   let promiseSanitized = promiseSanitizationComplete();
@@ -356,17 +356,17 @@ add_task(function* test_cannot_clear_his
   let wh = new WindowHelper();
   wh.onload = function() {
     // Check that the relevant checkboxes are enabled
     var cb = this.win.document.querySelectorAll(
                "#itemList > [preference='privacy.cpd.formdata']");
     ok(cb.length == 1 && !cb[0].disabled, "There is formdata, checkbox to " +
        "clear formdata should be enabled.");
 
-    var cb = this.win.document.querySelectorAll(
+    cb = this.win.document.querySelectorAll(
                "#itemList > [preference='privacy.cpd.history']");
     ok(cb.length == 1 && !cb[0].disabled, "There is history, checkbox to " +
        "clear history should be enabled.");
 
     this.checkAllCheckboxes();
     this.acceptDialog();
   };
   wh.onunload = function* () {
@@ -639,17 +639,17 @@ var now_uSec = now_mSec * 1000;
  * This wraps the dialog and provides some convenience methods for interacting
  * with it.
  *
  * @param aWin
  *        The dialog's nsIDOMWindow
  */
 function WindowHelper(aWin) {
   this.win = aWin;
-  this.promiseClosed = new Promise(resolve => {this._resolveClosed = resolve});
+  this.promiseClosed = new Promise(resolve => { this._resolveClosed = resolve });
 }
 
 WindowHelper.prototype = {
   /**
    * "Presses" the dialog's OK button.
    */
   acceptDialog: function () {
     is(this.win.document.documentElement.getButton("accept").disabled, false,
--- a/browser/base/content/test/general/browser_save_link-perwindowpb.js
+++ b/browser/base/content/test/general/browser_save_link-perwindowpb.js
@@ -113,17 +113,17 @@ function test() {
   registerCleanupFunction(function () {
     info("Running the cleanup code");
     mockTransferRegisterer.unregister();
     MockFilePicker.cleanup();
     Services.obs.removeObserver(observer, "http-on-modify-request");
     Services.obs.removeObserver(observer, "http-on-examine-response");
     info("Finished running the cleanup code");
   });
- 
+
   function observer(subject, topic, state) {
     info("observer called with " + topic);
     if (topic == "http-on-modify-request") {
       onModifyRequest(subject);
     } else if (topic == "http-on-examine-response") {
       onExamineResponse(subject);
     }
   }
@@ -137,40 +137,44 @@ function test() {
     }
     try {
       let cookies = channel.getResponseHeader("set-cookie");
       // From browser/base/content/test/general/bug792715.sjs, we receive a Set-Cookie
       // header with foopy=1 when there are no cookies for that domain.
       is(cookies, "foopy=1", "Cookie should be foopy=1");
       gNumSet += 1;
       info("gNumSet = " + gNumSet);
-    } catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
-      info("onExamineResponse caught NOTAVAIL" + ex);
     } catch (ex) {
-      info("ionExamineResponse caught " + ex);
+      if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
+        info("onExamineResponse caught NOTAVAIL" + ex);
+      } else {
+        info("ionExamineResponse caught " + ex);
+      }
     }
   }
 
   function onModifyRequest(subject) {
     let channel = subject.QueryInterface(Ci.nsIHttpChannel);
     info("onModifyRequest with " + channel.URI.spec);
     if (channel.URI.spec != "http://mochi.test:8888/browser/browser/base/content/test/general/bug792517.sjs") {
       return;
     }
     try {
       let cookies = channel.getRequestHeader("cookie");
       info("cookies: " + cookies);
       // From browser/base/content/test/general/bug792715.sjs, we should never send a
       // cookie because we are making only 2 requests: one in public mode, and
       // one in private mode.
       throw "We should never send a cookie in this test";
-    } catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
-      info("onModifyRequest caught NOTAVAIL" + ex);
     } catch (ex) {
-      info("ionModifyRequest caught " + ex);
+      if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
+        info("onModifyRequest caught NOTAVAIL" + ex);
+      } else {
+        info("ionModifyRequest caught " + ex);
+      }
     }
   }
 
   Services.obs.addObserver(observer, "http-on-modify-request", false);
   Services.obs.addObserver(observer, "http-on-examine-response", false);
 
   testOnWindow(undefined, function(win) {
     // The first save from a regular window sets a cookie.
--- a/browser/base/content/test/general/browser_save_link_when_window_navigates.js
+++ b/browser/base/content/test/general/browser_save_link_when_window_navigates.js
@@ -150,17 +150,17 @@ function test() {
     info("Running the cleanup code");
     mockTransferRegisterer.unregister();
     MockFilePicker.cleanup();
     Services.ww.unregisterNotification(windowObserver);
     Services.prefs.clearUserPref(ALWAYS_DOWNLOAD_DIR_PREF);
     Services.prefs.clearUserPref(SAVE_PER_SITE_PREF);
     info("Finished running the cleanup code");
   });
- 
+
   Services.prefs.setBoolPref(ALWAYS_DOWNLOAD_DIR_PREF, false);
   testOnWindow(undefined, function(win) {
     let windowGonePromise = promiseWindowWillBeClosed(win);
     Services.prefs.setBoolPref(SAVE_PER_SITE_PREF, true);
     triggerSave(win, function() {
       windowGonePromise.then(function() {
         Services.prefs.setBoolPref(SAVE_PER_SITE_PREF, false);
         testOnWindow(undefined, function(win) {
--- a/browser/base/content/test/general/browser_selectpopup.js
+++ b/browser/base/content/test/general/browser_selectpopup.js
@@ -86,17 +86,17 @@ function getInputEvents()
 
 function getChangeEvents()
 {
   return ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
     return content.wrappedJSObject.gChangeEvents;
   });
 }
 
-function doSelectTests(contentType, dtd)
+function* doSelectTests(contentType, dtd)
 {
   const pageUrl = "data:" + contentType + "," + escape(dtd + "\n" + PAGECONTENT);
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
 
   let menulist = document.getElementById("ContentSelectDropdown");
   let selectPopup = menulist.menupopup;
 
   yield openSelectPopup(selectPopup);
--- a/browser/base/content/test/general/browser_ssl_error_reports.js
+++ b/browser/base/content/test/general/browser_ssl_error_reports.js
@@ -72,17 +72,17 @@ function* testSendReportAutomatically(te
      "SSL error report submitted successfully");
 
   // Check that we loaded the right error page.
   yield checkErrorPage(browser, errorURISuffix);
 
   // Cleanup.
   gBrowser.removeTab(tab);
   cleanup();
-};
+}
 
 function* testSetAutomatic(testURL, suffix, errorURISuffix) {
   Services.prefs.setBoolPref(PREF_REPORT_ENABLED, true);
   Services.prefs.setBoolPref(PREF_REPORT_AUTOMATIC, false);
   Services.prefs.setCharPref(PREF_REPORT_URL, URL_REPORTS + suffix);
 
   // Add a tab and wait until it's loaded.
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
--- a/browser/base/content/test/general/browser_syncui.js
+++ b/browser/base/content/test/general/browser_syncui.js
@@ -132,17 +132,17 @@ add_task(function* testSyncLoginError() 
 function checkButtonsStatus(shouldBeActive) {
   for (let eid of [
     "sync-status", // the broadcaster itself.
     "sync-button", // the main sync button which observes the broadcaster
     "PanelUI-fxa-icon", // the sync icon in the fxa footer that observes it.
     ]) {
     let elt = document.getElementById(eid);
     if (shouldBeActive) {
-      Assert.equal(elt.getAttribute("syncstatus"), "active", `${eid} should be active`);;
+      Assert.equal(elt.getAttribute("syncstatus"), "active", `${eid} should be active`);
     } else {
       Assert.ok(!elt.hasAttribute("syncstatus"), `${eid} should have no status attr`);
     }
   }
 }
 
 function* testButtonActions(startNotification, endNotification, expectActive = true) {
   checkButtonsStatus(false);
--- a/browser/base/content/test/general/browser_tabfocus.js
+++ b/browser/base/content/test/general/browser_tabfocus.js
@@ -7,17 +7,17 @@ var testPage2 = "<html id='html2'><body 
 var testPage3 = "<html id='html3'><body id='body3'><button id='button3'>Tab 3</button></body></html>";
 
 const fm = Services.focus;
 
 function EventStore() {
   this["main-window"] = [];
   this["window1"] = [];
   this["window2"] = [];
-};
+}
 
 EventStore.prototype = {
   "push": function (event) {
     if (event.indexOf("1") > -1) {
       this["window1"].push(event);
     } else if (event.indexOf("2") > -1) {
       this["window2"].push(event);
     } else {
@@ -51,21 +51,19 @@ function* getFocusedElementForBrowser(br
 
       // The dontCheckExtraFocus flag is used to indicate not to check some
       // additional focus related properties. This is needed as both URLs are
       // loaded using the same child process and share focus managers.
       browser.messageManager.sendAsyncMessage("Browser:GetFocusedElement",
         { dontCheckExtraFocus : dontCheckExtraFocus });
     });
   }
-  else {
-    var focusedWindow = {};
-    var node = fm.getFocusedElementForWindow(browser.contentWindow, false, focusedWindow);
-    return "Focus is " + (node ? node.id : "<none>");
-  }
+  var focusedWindow = {};
+  var node = fm.getFocusedElementForWindow(browser.contentWindow, false, focusedWindow);
+  return "Focus is " + (node ? node.id : "<none>");
 }
 
 function focusInChild()
 {
   var fm = Components.classes["@mozilla.org/focus-manager;1"].
                       getService(Components.interfaces.nsIFocusManager);
 
   function getWindowDocId(target)
--- a/browser/base/content/test/general/browser_tabopen_reflows.js
+++ b/browser/base/content/test/general/browser_tabopen_reflows.js
@@ -67,17 +67,17 @@ add_task(function*() {
           NewTabUtils.allPages.update();
           deferred.resolve();
         }, true);
       }
     };
     observer.onDownloadFail = observer.onManyLinksChanged;
     DirectoryLinksProvider.addObserver(observer);
     return deferred.promise;
-  };
+  }
 
   let gOrigDirectorySource = Services.prefs.getCharPref(PREF_NEWTAB_DIRECTORYSOURCE);
   registerCleanupFunction(() => {
     Services.prefs.clearUserPref(PREF_PRELOAD);
     Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, gOrigDirectorySource);
     return watchLinksChangeOnce();
   });
 
--- a/browser/base/content/test/general/browser_tabs_close_beforeunload.js
+++ b/browser/base/content/test/general/browser_tabs_close_beforeunload.js
@@ -1,49 +1,49 @@
-"use strict";
-
-SimpleTest.requestCompleteLog();
-
-SpecialPowers.pushPrefEnv({"set": [["dom.require_user_interaction_for_beforeunload", false]]});
-
-const FIRST_TAB = getRootDirectory(gTestPath) + "close_beforeunload_opens_second_tab.html";
-const SECOND_TAB = getRootDirectory(gTestPath) + "close_beforeunload.html";
-
-add_task(function*() {
-  info("Opening first tab");
-  let firstTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, FIRST_TAB);
-  let secondTabLoadedPromise;
-  let secondTab;
-  let tabOpened = new Promise(resolve => {
-    info("Adding tabopen listener");
-    gBrowser.tabContainer.addEventListener("TabOpen", function tabOpenListener(e) {
-      info("Got tabopen, removing listener and waiting for load");
-      gBrowser.tabContainer.removeEventListener("TabOpen", tabOpenListener, false, false);
-      secondTab = e.target;
-      secondTabLoadedPromise = BrowserTestUtils.browserLoaded(secondTab.linkedBrowser, false, SECOND_TAB);
-      resolve();
-    }, false, false);
-  });
-  info("Opening second tab using a click");
-  yield ContentTask.spawn(firstTab.linkedBrowser, "", function*() {
-    content.document.getElementsByTagName("a")[0].click();
-  });
-  info("Waiting for the second tab to be opened");
-  yield tabOpened;
-  info("Waiting for the load in that tab to finish");
-  yield secondTabLoadedPromise;
-
-  let closeBtn = document.getAnonymousElementByAttribute(secondTab, "anonid", "close-button");
-  let closePromise = BrowserTestUtils.removeTab(secondTab, {dontRemove: true});
-  info("closing second tab (which will self-close in beforeunload)");
-  closeBtn.click();
-  ok(secondTab.closing, "Second tab should be marked as closing synchronously.");
-  yield closePromise;
-  ok(secondTab.closing, "Second tab should still be marked as closing");
-  ok(!secondTab.linkedBrowser, "Second tab's browser should be dead");
-  ok(!firstTab.closing, "First tab should not be closing");
-  ok(firstTab.linkedBrowser, "First tab's browser should be alive");
-  info("closing first tab");
-  yield BrowserTestUtils.removeTab(firstTab);
-
-  ok(firstTab.closing, "First tab should be marked as closing");
-  ok(!firstTab.linkedBrowser, "First tab's browser should be dead");
-});
+"use strict";
+
+SimpleTest.requestCompleteLog();
+
+SpecialPowers.pushPrefEnv({"set": [["dom.require_user_interaction_for_beforeunload", false]]});
+
+const FIRST_TAB = getRootDirectory(gTestPath) + "close_beforeunload_opens_second_tab.html";
+const SECOND_TAB = getRootDirectory(gTestPath) + "close_beforeunload.html";
+
+add_task(function*() {
+  info("Opening first tab");
+  let firstTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, FIRST_TAB);
+  let secondTabLoadedPromise;
+  let secondTab;
+  let tabOpened = new Promise(resolve => {
+    info("Adding tabopen listener");
+    gBrowser.tabContainer.addEventListener("TabOpen", function tabOpenListener(e) {
+      info("Got tabopen, removing listener and waiting for load");
+      gBrowser.tabContainer.removeEventListener("TabOpen", tabOpenListener, false, false);
+      secondTab = e.target;
+      secondTabLoadedPromise = BrowserTestUtils.browserLoaded(secondTab.linkedBrowser, false, SECOND_TAB);
+      resolve();
+    }, false, false);
+  });
+  info("Opening second tab using a click");
+  yield ContentTask.spawn(firstTab.linkedBrowser, "", function*() {
+    content.document.getElementsByTagName("a")[0].click();
+  });
+  info("Waiting for the second tab to be opened");
+  yield tabOpened;
+  info("Waiting for the load in that tab to finish");
+  yield secondTabLoadedPromise;
+
+  let closeBtn = document.getAnonymousElementByAttribute(secondTab, "anonid", "close-button");
+  let closePromise = BrowserTestUtils.removeTab(secondTab, {dontRemove: true});
+  info("closing second tab (which will self-close in beforeunload)");
+  closeBtn.click();
+  ok(secondTab.closing, "Second tab should be marked as closing synchronously.");
+  yield closePromise;
+  ok(secondTab.closing, "Second tab should still be marked as closing");
+  ok(!secondTab.linkedBrowser, "Second tab's browser should be dead");
+  ok(!firstTab.closing, "First tab should not be closing");
+  ok(firstTab.linkedBrowser, "First tab's browser should be alive");
+  info("closing first tab");
+  yield BrowserTestUtils.removeTab(firstTab);
+
+  ok(firstTab.closing, "First tab should be marked as closing");
+  ok(!firstTab.linkedBrowser, "First tab's browser should be dead");
+});
--- a/browser/base/content/test/general/browser_trackingUI_telemetry.js
+++ b/browser/base/content/test/general/browser_trackingUI_telemetry.js
@@ -132,14 +132,14 @@ add_task(function* testPrivateBrowsing()
   let tabReloadPromise = promiseTabLoadEvent(tab);
   privateWin.document.querySelector("#tracking-action-unblock").doCommand();
   yield tabReloadPromise;
   tabReloadPromise = promiseTabLoadEvent(tab);
   privateWin.document.querySelector("#tracking-action-block").doCommand();
   yield tabReloadPromise;
 
   // Sum up all the counts to make sure that nothing got logged
-  is(getEnabledCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
-  is(getEventCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
-  is(getShieldCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
+  is(getEnabledCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
+  is(getEventCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
+  is(getShieldCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
 
   yield promiseWindowClosed(privateWin);
 });
--- a/browser/base/content/test/general/browser_utilityOverlay.js
+++ b/browser/base/content/test/general/browser_utilityOverlay.js
@@ -67,17 +67,17 @@ function test_eventMatchesKey() {
     keyset.appendChild(key);
     EventUtils.synthesizeKey("VK_DELETE", {accelKey: true});
     is(eventMatchResult, false, "eventMatchesKey: mismatch modifiers");
     keyset.removeChild(key);
   } finally {
     // Make sure to remove the event listener so future tests don't
     // fail when they simulate key presses.
     document.removeEventListener("keypress", checkEvent);
-  };
+  }
 
   runNextTest();
 }
 
 function test_getTopWin() {
   is(getTopWin(), window, "got top window");
   runNextTest();
 }
--- a/browser/base/content/test/general/browser_visibleTabs_bookmarkAllTabs.js
+++ b/browser/base/content/test/general/browser_visibleTabs_bookmarkAllTabs.js
@@ -2,17 +2,17 @@
  * 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 test() {
   waitForExplicitFinish();
 
   // There should be one tab when we start the test
   let [origTab] = gBrowser.visibleTabs;
-  is(gBrowser.visibleTabs.length, 1, "1 tab should be open");  
+  is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
   is(Disabled(), true, "Bookmark All Tabs should be disabled");
 
   // Add a tab
   let testTab1 = gBrowser.addTab();
   is(gBrowser.visibleTabs.length, 2, "2 tabs should be open");
   is(Disabled(), true, "Bookmark All Tabs should be disabled since there are two tabs with the same address");
 
   let testTab2 = gBrowser.addTab("about:mozilla");
@@ -20,34 +20,34 @@ function test() {
   // Wait for tab load, the code checks for currentURI.
   testTab2.linkedBrowser.addEventListener("load", function () {
     testTab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
     is(Disabled(), false, "Bookmark All Tabs should be enabled since there are two tabs with different addresses");
 
     // Hide the original tab
     gBrowser.selectedTab = testTab2;
     gBrowser.showOnlyTheseTabs([testTab2]);
-    is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");  
+    is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");
     is(Disabled(), true, "Bookmark All Tabs should be disabled as there is only one visible tab");
 
     // Add a tab that will get pinned
     let pinned = gBrowser.addTab();
     is(gBrowser.visibleTabs.length, 2, "2 tabs should be visible now");
     is(Disabled(), false, "Bookmark All Tabs should be available as there are two visible tabs");
     gBrowser.pinTab(pinned);
     is(Hidden(), false, "Bookmark All Tabs should be visible on a normal tab");
     is(Disabled(), true, "Bookmark All Tabs should not be available since one tab is pinned");
     gBrowser.selectedTab = pinned;
     is(Hidden(), true, "Bookmark All Tabs should be hidden on a pinned tab");
 
     // Show all tabs
     let allTabs = Array.from(gBrowser.tabs);
     gBrowser.showOnlyTheseTabs(allTabs);
 
-    // reset the environment  
+    // reset the environment
     gBrowser.removeTab(testTab2);
     gBrowser.removeTab(testTab1);
     gBrowser.removeTab(pinned);
     is(gBrowser.visibleTabs.length, 1, "only orig is left and visible");
     is(gBrowser.tabs.length, 1, "sanity check that it matches");
     is(Disabled(), true, "Bookmark All Tabs should be hidden");
     is(gBrowser.selectedTab, origTab, "got the orig tab");
     is(origTab.hidden, false, "and it's not hidden -- visible!");
--- a/browser/base/content/test/general/browser_visibleTabs_contextMenu.js
+++ b/browser/base/content/test/general/browser_visibleTabs_contextMenu.js
@@ -30,22 +30,22 @@ add_task(function* test() {
     is(targets[3].getAttribute("label"), "All Devices", "All Devices target is present");
     restoreRemoteClients(oldGetter);
   }
 
   // Hide the original tab.
   gBrowser.selectedTab = testTab;
   gBrowser.showOnlyTheseTabs([testTab]);
   is(gBrowser.visibleTabs.length, 1, "now there is only one visible tab");
-  
+
   // Check the context menu with one tab.
   updateTabContextMenu(testTab);
   is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
   is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
-  
+
   // Add a tab that will get pinned
   // So now there's one pinned tab, one visible unpinned tab, and one hidden tab
   let pinned = gBrowser.addTab();
   gBrowser.pinTab(pinned);
   is(gBrowser.visibleTabs.length, 2, "now there are two visible tabs");
 
   // Check the context menu on the unpinned visible tab
   updateTabContextMenu(testTab);
@@ -55,17 +55,17 @@ add_task(function* test() {
   // Show all tabs
   let allTabs = Array.from(gBrowser.tabs);
   gBrowser.showOnlyTheseTabs(allTabs);
 
   // Check the context menu now
   updateTabContextMenu(testTab);
   is(document.getElementById("context_closeOtherTabs").disabled, false, "Close Other Tabs is enabled");
   is(document.getElementById("context_closeTabsToTheEnd").disabled, true, "Close Tabs To The End is disabled");
-  
+
   // Check the context menu of the original tab
   // Close Tabs To The End should now be enabled
   updateTabContextMenu(origTab);
   is(document.getElementById("context_closeTabsToTheEnd").disabled, false, "Close Tabs To The End is enabled");
 
   gBrowser.removeTab(testTab);
   gBrowser.removeTab(pinned);
 });
--- a/browser/base/content/test/general/browser_web_channel.html
+++ b/browser/base/content/test/general/browser_web_channel.html
@@ -6,17 +6,17 @@
 </head>
 <body>
 <script>
    var IFRAME_SRC_ROOT = "http://mochi.test:8888/browser/browser/base/content/test/general/browser_web_channel_iframe.html";
 
   window.onload = function() {
     var testName = window.location.search.replace(/^\?/, "");
 
-    switch(testName) {
+    switch (testName) {
       case "generic":
         test_generic();
         break;
       case "twoway":
         test_twoWay();
         break;
       case "multichannel":
         test_multichannel();
--- a/browser/base/content/test/general/browser_web_channel.js
+++ b/browser/base/content/test/general/browser_web_channel.js
@@ -397,17 +397,17 @@ var gTests = [
       });
     }
   }
 ]; // gTests
 
 function test() {
   waitForExplicitFinish();
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     for (let test of gTests) {
       info("Running: " + test.desc);
       yield test.run();
     }
   }).then(finish, ex => {
     ok(false, "Unexpected Exception: " + ex);
     finish();
   });
--- a/browser/base/content/test/general/browser_web_channel_iframe.html
+++ b/browser/base/content/test/general/browser_web_channel_iframe.html
@@ -5,17 +5,17 @@
   <title>web_channel_test (iframe)</title>
 </head>
 <body>
 <script>
   var REDIRECTED_IFRAME_SRC_ROOT = "http://example.org/browser/browser/base/content/test/general/browser_web_channel_iframe.html";
 
   window.onload = function() {
     var testName = window.location.search.replace(/^\?/, "");
-    switch(testName) {
+    switch (testName) {
       case "iframe":
         test_iframe();
         break;
       case "iframe_pre_redirect":
         test_iframe_pre_redirect();
         break;
       case "iframe_post_redirect":
         test_iframe_post_redirect();
--- a/browser/base/content/test/general/browser_windowactivation.js
+++ b/browser/base/content/test/general/browser_windowactivation.js
@@ -145,25 +145,25 @@ function childFunction()
   }, false);
 
   var windowGotActivate = false;
   var windowGotDeactivate = false;
   addEventListener("activate", function() {
       sendAsyncMessage("Test:ActivateEvent", { ok: !windowGotActivate });
       windowGotActivate = false;
     });
-  
+
   addEventListener("deactivate", function() {
       sendAsyncMessage("Test:DeactivateEvent", { ok: !windowGotDeactivate });
       windowGotDeactivate = false;
     });
   content.addEventListener("activate", function() {
-      windowGotActivate = true;;
+      windowGotActivate = true;
     });
-  
+
   content.addEventListener("deactivate", function() {
       windowGotDeactivate = true;
     });
 
   content.setInterval(function () {
     if (!expectingResponse) {
       return;
     }
--- a/browser/base/content/test/general/close_beforeunload.html
+++ b/browser/base/content/test/general/close_beforeunload.html
@@ -1,8 +1,8 @@
-<body>
-  <p>I will close myself if you close me.</p>
-  <script>
-    window.onbeforeunload = function() {
-      window.close();
-    };
-  </script>
-</body>
+<body>
+  <p>I will close myself if you close me.</p>
+  <script>
+    window.onbeforeunload = function() {
+      window.close();
+    };
+  </script>
+</body>
--- a/browser/base/content/test/general/contentSearchUI.js
+++ b/browser/base/content/test/general/contentSearchUI.js
@@ -93,17 +93,17 @@ var messageHandlers = {
       row = allElts[itemIndex];
     }
     let event = {
       type: "mousemove",
       clickcount: 0,
     }
     row.addEventListener("mousemove", function handler() {
       row.removeEventListener("mousemove", handler);
-      ack("mousemove"); 
+      ack("mousemove");
     });
     content.synthesizeMouseAtCenter(row, event);
   },
 
   click: function (arg) {
     let eltIdx = typeof(arg) == "object" ? arg.eltIdx : arg;
     let row;
     if (eltIdx == -1) {
--- a/browser/base/content/test/general/file_bug822367_5.html
+++ b/browser/base/content/test/general/file_bug822367_5.html
@@ -5,17 +5,17 @@ Test 5 for Mixed Content Blocker User Ov
 https://bugzilla.mozilla.org/show_bug.cgi?id=822367
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 5 for Bug 822367</title>
   <script>
     function createDoc()
     {
-      var doc=document.open("text/html","replace");
+      var doc=document.open("text/html", "replace");
       doc.write('<!DOCTYPE html><html><body><p id="p1">This is some content</p><script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">\<\/script\>\<\/body>\<\/html>');
       doc.close();
     }
   </script>
 </head>
 <body>
   <div id="testContent">
     <img src="https://example.com/tests/image/test/mochitest/blue.png" onload="createDoc()">
--- a/browser/base/content/test/general/file_bug902156.js
+++ b/browser/base/content/test/general/file_bug902156.js
@@ -1,5 +1,5 @@
-/* 
+/*
  * Once the mixed content blocker is disabled for the page, this scripts loads
  * and updates the text inside the div container.
  */
 document.getElementById("mctestdiv").innerHTML = "Mixed Content Blocker disabled";
--- a/browser/base/content/test/general/file_favicon_change.html
+++ b/browser/base/content/test/general/file_favicon_change.html
@@ -1,13 +1,13 @@
-<!DOCTYPE html>
-<html><head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8">
-  <link rel="icon" href="http://example.org/one-icon" type="image/ico" id="i">
-</head>
-<body>
-  <script>
-  window.addEventListener("PleaseChangeFavicon", function() {
-    var ico = document.getElementById("i");
-    ico.setAttribute("href", "http://example.org/other-icon");
-  });
-  </script>
-</body></html>
+<!DOCTYPE html>
+<html><head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <link rel="icon" href="http://example.org/one-icon" type="image/ico" id="i">
+</head>
+<body>
+  <script>
+  window.addEventListener("PleaseChangeFavicon", function() {
+    var ico = document.getElementById("i");
+    ico.setAttribute("href", "http://example.org/other-icon");
+  });
+  </script>
+</body></html>
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -70,19 +70,19 @@ function updateTabContextMenu(tab, onOpe
   menu.openPopup(tab, "end_after", 0, 0, true, false, evt);
   is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
   const onFinished = () => menu.hidePopup();
   if (onOpened) {
     return Task.spawn(function*() {
       yield onOpened();
       onFinished();
     });
-  } else {
-    onFinished();
   }
+  onFinished();
+  return Promise.resolve();
 }
 
 function openToolbarCustomizationUI(aCallback, aBrowserWin) {
   if (!aBrowserWin)
     aBrowserWin = window;
 
   aBrowserWin.gCustomizeMode.enter();
 
@@ -687,17 +687,17 @@ function waitForNewTabEvent(aTabBrowser)
  * @resolves When the operation has finished and the identity panel has closed.
  */
 function assertMixedContentBlockingState(tabbrowser, states = {}) {
   if (!tabbrowser || !("activeLoaded" in states) ||
       !("activeBlocked" in states) || !("passiveLoaded" in states))  {
     throw new Error("assertMixedContentBlockingState requires a browser and a states object");
   }
 
-  let {passiveLoaded,activeLoaded,activeBlocked} = states;
+  let {passiveLoaded, activeLoaded, activeBlocked} = states;
   let {gIdentityHandler} = tabbrowser.ownerGlobal;
   let doc = tabbrowser.ownerDocument;
   let identityBox = gIdentityHandler._identityBox;
   let classList = identityBox.classList;
   let connectionIcon = doc.getElementById("connection-icon");
   let connectionIconImage = tabbrowser.ownerGlobal.getComputedStyle(connectionIcon).
                          getPropertyValue("list-style-image");
 
@@ -832,17 +832,17 @@ function assertMixedContentBlockingState
 
 function is_hidden(element) {
   var style = element.ownerGlobal.getComputedStyle(element);
   if (style.display == "none")
     return true;
   if (style.visibility != "visible")
     return true;
   if (style.display == "-moz-popup")
-    return ["hiding","closed"].indexOf(element.state) != -1;
+    return ["hiding", "closed"].indexOf(element.state) != -1;
 
   // Hiding a parent element will hide all its children
   if (element.parentNode != element.ownerDocument)
     return is_hidden(element.parentNode);
 
   return false;
 }
 
@@ -1018,17 +1018,21 @@ function promiseOnBookmarkItemAdded(aExp
  * @returns The value corresponding to the key from the bag,
  *          or null if the value could not be retrieved (for
  *          example, if no value is set at that key).
 */
 function getPropertyBagValue(bag, key) {
   try {
     let val = bag.getProperty(key);
     return val;
-  } catch(e if e.result == Cr.NS_ERROR_FAILURE) {}
+  } catch (e) {
+    if (e.result != Cr.NS_ERROR_FAILURE) {
+      throw e;
+    }
+  }
 
   return null;
 }
 
 /**
  * Returns a Promise that resolves once a crash report has
  * been submitted. This function will also test the crash
  * reports extra data to see if it matches expectedExtra.
@@ -1160,16 +1164,17 @@ function getCertExceptionDialog(aLocatio
                                   .contentViewer
                                   .DOMDocument;
 
       if (childDoc.location.href == aLocation) {
         return childDoc;
       }
     }
   }
+  return undefined;
 }
 
 function setupRemoteClientsFixture(fixture) {
   let oldRemoteClientsGetter =
     Object.getOwnPropertyDescriptor(gFxAccounts, "remoteClients").get;
 
   Object.defineProperty(gFxAccounts, "remoteClients", {
     get: function() { return fixture; }
--- a/browser/base/content/test/general/test_remoteTroubleshoot.html
+++ b/browser/base/content/test/general/test_remoteTroubleshoot.html
@@ -1,50 +1,50 @@
-<!DOCTYPE HTML>
-<html>
-<script>
-// This test is run multiple times, once with only strings allowed through the
-// WebChannel, and once with objects allowed. This function allows us to handle
-// both cases without too much pain.
-function makeDetails(object) {
-  if (window.location.search.indexOf("object") >= 0) {
-    return object;
-  }
-  return JSON.stringify(object)
-}
-// Add a listener for responses to our remote requests.
-window.addEventListener("WebChannelMessageToContent", function (event) {
-  if (event.detail.id == "remote-troubleshooting") {
-    // Send what we got back to the test.
-    var backEvent = new window.CustomEvent("WebChannelMessageToChrome", {
-      detail: makeDetails({
-        id: "test-remote-troubleshooting-backchannel",
-        message: {
-          message: event.detail.message,
-        },
-      }),
-    });
-    window.dispatchEvent(backEvent);
-    // and stick it in our DOM just for good measure/diagnostics.
-    document.getElementById("troubleshooting").textContent =
-      JSON.stringify(event.detail.message, null, 2);
-  }
-});
-
-// Make a request for the troubleshooting data as we load.
-window.onload = function() {
-  var event = new window.CustomEvent("WebChannelMessageToChrome", {
-    detail: makeDetails({
-      id: "remote-troubleshooting",
-      message: {
-        command: "request",
-      },
-    }),
-  });
-  window.dispatchEvent(event);
-}
-</script>
-
-<body>
-  <pre id="troubleshooting"/>
-</body>
-
-</html>
+<!DOCTYPE HTML>
+<html>
+<script>
+// This test is run multiple times, once with only strings allowed through the
+// WebChannel, and once with objects allowed. This function allows us to handle
+// both cases without too much pain.
+function makeDetails(object) {
+  if (window.location.search.indexOf("object") >= 0) {
+    return object;
+  }
+  return JSON.stringify(object)
+}
+// Add a listener for responses to our remote requests.
+window.addEventListener("WebChannelMessageToContent", function (event) {
+  if (event.detail.id == "remote-troubleshooting") {
+    // Send what we got back to the test.
+    var backEvent = new window.CustomEvent("WebChannelMessageToChrome", {
+      detail: makeDetails({
+        id: "test-remote-troubleshooting-backchannel",
+        message: {
+          message: event.detail.message,
+        },
+      }),
+    });
+    window.dispatchEvent(backEvent);
+    // and stick it in our DOM just for good measure/diagnostics.
+    document.getElementById("troubleshooting").textContent =
+      JSON.stringify(event.detail.message, null, 2);
+  }
+});
+
+// Make a request for the troubleshooting data as we load.
+window.onload = function() {
+  var event = new window.CustomEvent("WebChannelMessageToChrome", {
+    detail: makeDetails({
+      id: "remote-troubleshooting",
+      message: {
+        command: "request",
+      },
+    }),
+  });
+  window.dispatchEvent(event);
+}
+</script>
+
+<body>
+  <pre id="troubleshooting"/>
+</body>
+
+</html>
--- a/browser/base/content/test/newtab/browser_newtab_bug1194895.js
+++ b/browser/base/content/test/newtab/browser_newtab_bug1194895.js
@@ -120,24 +120,20 @@ add_task(function* () {
 
   // Test well-populated user history - newtab has highly-frecent history sites
   // redefine compareLinks to always choose history tiles first
   NewTabUtils.links.compareLinks = function (aLink1, aLink2) {
     if (aLink1.type == aLink2.type) {
       return aLink2.frecency - aLink1.frecency ||
              aLink2.lastVisitDate - aLink1.lastVisitDate;
     }
-    else {
-      if (aLink2.type == "history") {
-        return 1;
-      }
-      else {
-        return -1;
-      }
+    if (aLink2.type == "history") {
+      return 1;
     }
+    return -1;
   };
 
   // add a row of history tiles, directory tiles will be clipped off, hence no scrollbar
   yield setLinks("31,32,33");
   yield* addNewTabPageTab();
   scrolling = yield hasScrollbar();
   ok(!scrolling, "no scrollbar when directory tiles follow history tiles");
 
--- a/browser/base/content/test/newtab/browser_newtab_perwindow_private_browsing.js
+++ b/browser/base/content/test/newtab/browser_newtab_perwindow_private_browsing.js
@@ -34,17 +34,17 @@ add_task(function* () {
   yield testOnWindow(undefined);
 
   // check that the grid is the same as before entering pb mode
   yield* addNewTabPageTab();
   yield* checkGrid("0,2,3,4,5,6,7,8")
 });
 
 var windowsToClose = [];
-function testOnWindow(options) {
+function* testOnWindow(options) {
   let newWindowPromise = BrowserTestUtils.waitForNewWindow();
   var win = OpenBrowserWindow(options);
   windowsToClose.push(win);
   gWindow = win;
   yield newWindowPromise;
 }
 
 registerCleanupFunction(function () {
--- a/browser/base/content/test/newtab/browser_newtab_search.js
+++ b/browser/base/content/test/newtab/browser_newtab_search.js
@@ -209,17 +209,17 @@ add_task(function* () {
   // Test that Ctrl/Cmd + K will focus the search bar from a new about:home page if
   // the newtab is disabled from `NewTabUtils.allPages.enabled`.
   let tab = yield* addNewTabPageTab();
   // Remove the search bar from toolbar
   CustomizableUI.removeWidgetFromArea("search-container");
   NewTabUtils.allPages.enabled = false;
   EventUtils.synthesizeKey("k", { accelKey: true });
 
-  
+
   let aboutHomeLoaded = new Promise(resolve => {
     tab.linkedBrowser.addEventListener("AboutHomeLoadSnippetsCompleted", function loadListener(event) {
       tab.linkedBrowser.removeEventListener("AboutHomeLoadSnippetsCompleted", loadListener, true);
       resolve();
     }, true, true);
   });
 
   tab.linkedBrowser.loadURI("about:home");
--- a/browser/base/content/test/newtab/browser_newtab_undo.js
+++ b/browser/base/content/test/newtab/browser_newtab_undo.js
@@ -32,16 +32,16 @@ add_task(function* () {
 
   yield* undoAll();
   yield* checkGrid("5p,0,1,2,3,4,6,7,8");
 });
 
 function* undo() {
   let updatedPromise = whenPagesUpdated();
   yield BrowserTestUtils.synthesizeMouseAtCenter("#newtab-undo-button", {}, gBrowser.selectedBrowser);
-  yield updatedPromise; 
+  yield updatedPromise;
 }
 
 function* undoAll() {
   let updatedPromise = whenPagesUpdated();
   yield BrowserTestUtils.synthesizeMouseAtCenter("#newtab-undo-restore-button", {}, gBrowser.selectedBrowser);
-  yield updatedPromise; 
-}
\ No newline at end of file
+  yield updatedPromise;
+}
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -104,17 +104,17 @@ function watchLinksChangeOnce() {
       onManyLinksChanged: () => {
         DirectoryLinksProvider.removeObserver(observer);
         resolve();
       }
     };
     observer.onDownloadFail = observer.onManyLinksChanged;
     DirectoryLinksProvider.addObserver(observer);
   });
-};
+}
 
 add_task(function* setup() {
   registerCleanupFunction(function() {
     return new Promise(resolve => {
       function cleanupAndFinish() {
         PlacesTestUtils.clearHistory().then(() => {
           whenPagesUpdated().then(resolve);
           NewTabUtils.restore();
@@ -245,16 +245,17 @@ function setPinnedLinks(aLinks) {
   let links = aLinks;
 
   if (typeof links == "string") {
     links = aLinks.split(/\s*,\s*/).map(function (id) {
       if (id)
         return {url: "http://example" + (id != "-1" ? id : "") + ".com/",
                 title: "site#" + id,
                 type: "history"};
+      return undefined;
     });
   }
 
   let string = Cc["@mozilla.org/supports-string;1"]
                  .createInstance(Ci.nsISupportsString);
   string.data = JSON.stringify(links);
   Services.prefs.setComplexValue("browser.newtabpage.pinned",
                                  Ci.nsISupportsString, string);
--- a/browser/base/content/test/plugins/browser_CTP_context_menu.js
+++ b/browser/base/content/test/plugins/browser_CTP_context_menu.js
@@ -27,17 +27,17 @@ add_task(function* () {
   yield bindingPromise;
 
   let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
   ok(popupNotification, "Test 1, Should have a click-to-play notification");
 
   // check plugin state
   let pluginInfo = yield promiseForPluginInfo("test", gBrowser.selectedBrowser);
   ok(!pluginInfo.activated, "plugin should not be activated");
-   
+
   // Display a context menu on the test plugin so we can test
   // activation menu options.
   yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
     let plugin = content.document.getElementById("test");
     let bounds = plugin.getBoundingClientRect();
     let left = (bounds.left + bounds.right) / 2;
     let top = (bounds.top + bounds.bottom) / 2;
     let utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
--- a/browser/base/content/test/plugins/browser_CTP_crashreporting.js
+++ b/browser/base/content/test/plugins/browser_CTP_crashreporting.js
@@ -13,17 +13,17 @@ const PLUGIN_SMALL_PAGE = gTestRoot + "p
  *        The nsIPropertyBag to convert.
  * @return Object
  *        Keyed on the names of the nsIProperty's within the nsIPropertyBag,
  *        and mapping to their values.
  */
 function convertPropertyBag(aBag) {
   let result = {};
   let enumerator = aBag.enumerator;
-  while(enumerator.hasMoreElements()) {
+  while (enumerator.hasMoreElements()) {
     let { name, value } = enumerator.getNext().QueryInterface(Ci.nsIProperty);
     if (value instanceof Ci.nsIPropertyBag) {
       value = convertPropertyBag(value);
     }
     result[name] = value;
   }
   return result;
 }
@@ -90,17 +90,17 @@ add_task(function*() {
       plugin.QueryInterface(Ci.nsIObjectLoadingContent);
 
       yield ContentTaskUtils.waitForCondition(() => {
         return plugin.activated;
       }, "Waited too long for plugin to activate.");
 
       try {
         Components.utils.waiveXrays(plugin).crash();
-      } catch(e) {
+      } catch (e) {
       }
 
       let doc = plugin.ownerDocument;
 
       let getUI = (anonid) => {
         return doc.getAnonymousElementByAttribute(plugin, "anonid", anonid);
       };
 
@@ -111,26 +111,26 @@ add_task(function*() {
       yield ContentTaskUtils.waitForCondition(() => {
         statusDiv = getUI("submitStatus");
         return statusDiv.getAttribute("status") == "please";
       }, "Waited too long for plugin to show crash report UI");
 
       // Make sure the UI matches our expectations...
       let style = content.getComputedStyle(getUI("pleaseSubmit"));
       if (style.display != "block") {
-        return Promise.reject(`Submission UI visibility is not correct. ` +
-                              `Expected block style, got ${style.display}.`);
+        throw new Error(`Submission UI visibility is not correct. ` +
+                        `Expected block style, got ${style.display}.`);
       }
 
       // Fill the crash report in with some test values that we'll test for in
       // the parent.
       getUI("submitComment").value = "a test comment";
       let optIn = getUI("submitURLOptIn");
       if (!optIn.checked) {
-        return Promise.reject("URL opt-in should default to true.");
+        throw new Error("URL opt-in should default to true.");
       }
 
       // Submit the report.
       optIn.click();
       getUI("submitButton").click();
 
       // And wait for the parent to say that the crash report was submitted
       // successfully.
@@ -192,17 +192,17 @@ add_task(function*() {
       plugin.QueryInterface(Ci.nsIObjectLoadingContent);
 
       yield ContentTaskUtils.waitForCondition(() => {
         return plugin.activated;
       }, "Waited too long for plugin to activate.");
 
       try {
         Components.utils.waiveXrays(plugin).crash();
-      } catch(e) {}
+      } catch (e) {}
     });
 
     // Wait for the notification bar to be displayed.
     let notification = yield waitForNotificationBar("plugin-crashed", browser);
 
     // Then click the button to submit the crash report.
     let buttons = notification.querySelectorAll(".notification-button");
     is(buttons.length, 2, "Should have two buttons.");
--- a/browser/base/content/test/plugins/browser_CTP_data_urls.js
+++ b/browser/base/content/test/plugins/browser_CTP_data_urls.js
@@ -247,9 +247,9 @@ add_task(function* () {
     PopupNotifications.panel.firstChild;
   yield promiseForCondition(condition);
   PopupNotifications.panel.firstChild._primaryButton.click();
 
   // check plugin state
   pluginInfo = yield promiseForPluginInfo("test");
   ok(pluginInfo.activated, "Test 4a, plugin should be activated");
 });
-*/
\ No newline at end of file
+*/
--- a/browser/base/content/test/plugins/browser_CTP_multi_allow.js
+++ b/browser/base/content/test/plugins/browser_CTP_multi_allow.js
@@ -49,17 +49,17 @@ add_task(function* () {
 
   let pluginItem = null;
   for (let item of PopupNotifications.panel.firstChild.childNodes) {
     is(item.value, "block", "Test 1a, all plugins should start out blocked");
     if (item.action.pluginName == "Test") {
       pluginItem = item;
     }
   }
-  
+
   // Choose "Allow now" for the test plugin
   pluginItem.value = "allownow";
   PopupNotifications.panel.firstChild._primaryButton.click();
 
   pluginInfo = yield promiseForPluginInfo("test", gBrowser.selectedBrowser);
   ok(pluginInfo.activated, "plugin should be activated");
 
   notification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
--- a/browser/base/content/test/plugins/browser_bug744745.js
+++ b/browser/base/content/test/plugins/browser_bug744745.js
@@ -36,15 +36,15 @@ add_task(function* () {
   yield promiseTabLoadEvent(gBrowser.selectedTab, testRoot + "plugin_bug744745.html");
 
   yield promiseForCondition(function () { return gNumPluginBindingsAttached == 1; });
 
   yield ContentTask.spawn(gTestBrowser, {}, function* () {
     let plugin = content.document.getElementById("test");
     if (!plugin) {
       Assert.ok(false, "plugin element not available.");
-      return false;
+      return;
     }
     // We can't use MochiKit's routine
     let style = content.getComputedStyle(plugin);
     Assert.ok(("opacity" in style) && style.opacity == 1, "plugin style properly configured.");
   });
 });
--- a/browser/base/content/test/plugins/browser_bug820497.js
+++ b/browser/base/content/test/plugins/browser_bug820497.js
@@ -22,17 +22,17 @@ add_task(function* () {
 
   setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
   setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
 
   gTestBrowser.addEventListener("PluginBindingAttached", function () { gNumPluginBindingsAttached++ }, true, true);
 
   yield promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_bug820497.html");
 
-  yield promiseForCondition(function () { return gNumPluginBindingsAttached == 1; });  
+  yield promiseForCondition(function () { return gNumPluginBindingsAttached == 1; });
 
   // cpows
   {
     // Note we add the second plugin in the code farther down, so there's
     // no way we got here with anything but one plugin loaded.
     let doc = gTestBrowser.contentDocument;
     let testplugin = doc.getElementById("test");
     ok(testplugin, "should have test plugin");
@@ -47,17 +47,17 @@ add_task(function* () {
   yield promiseForNotificationShown(notification);
 
   is(notification.options.pluginData.size, 1, "should be 1 type of plugin in the popup notification");
 
   yield ContentTask.spawn(gTestBrowser, {}, function* () {
     XPCNativeWrapper.unwrap(content).addSecondPlugin();
   });
 
-  yield promiseForCondition(function () { return gNumPluginBindingsAttached == 2; });  
+  yield promiseForCondition(function () { return gNumPluginBindingsAttached == 2; });
 
   // cpows
   {
     let doc = gTestBrowser.contentDocument;
     let testplugin = doc.getElementById("test");
     ok(testplugin, "should have test plugin");
     let secondtestplugin = doc.getElementById("secondtest");
     ok(secondtestplugin, "should have second test plugin");
--- a/browser/base/content/test/plugins/browser_clearplugindata.js
+++ b/browser/base/content/test/plugins/browser_clearplugindata.js
@@ -73,25 +73,25 @@ add_task(function* () {
   // Load page to set data for the plugin.
   gBrowser.selectedTab = gBrowser.addTab();
   gTestBrowser = gBrowser.selectedBrowser;
 
   yield promiseTabLoadEvent(gBrowser.selectedTab, testURL1);
 
   yield promiseUpdatePluginBindings(gTestBrowser);
 
-  ok(stored(["foo.com","bar.com","baz.com","qux.com"]),
+  ok(stored(["foo.com", "bar.com", "baz.com", "qux.com"]),
     "Data stored for sites");
 
   // Clear 20 seconds ago
   let now_uSec = Date.now() * 1000;
   sanitizer.range = [now_uSec - 20*1000000, now_uSec];
   yield sanitizer.sanitize();
 
-  ok(stored(["bar.com","qux.com"]), "Data stored for sites");
+  ok(stored(["bar.com", "qux.com"]), "Data stored for sites");
   ok(!stored(["foo.com"]), "Data cleared for foo.com");
   ok(!stored(["baz.com"]), "Data cleared for baz.com");
 
   // Clear everything
   sanitizer.range = null;
   yield sanitizer.sanitize();
 
   ok(!stored(null), "All data cleared");
@@ -104,17 +104,17 @@ add_task(function* () {
   // Load page to set data for the plugin.
   gBrowser.selectedTab = gBrowser.addTab();
   gTestBrowser = gBrowser.selectedBrowser;
 
   yield promiseTabLoadEvent(gBrowser.selectedTab, testURL2);
 
   yield promiseUpdatePluginBindings(gTestBrowser);
 
-  ok(stored(["foo.com","bar.com","baz.com","qux.com"]),
+  ok(stored(["foo.com", "bar.com", "baz.com", "qux.com"]),
     "Data stored for sites");
 
   // Attempt to clear 20 seconds ago. The plugin will throw
   // NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED, which should result in us
   // clearing all data regardless of age.
   let now_uSec = Date.now() * 1000;
   sanitizer.range = [now_uSec - 20*1000000, now_uSec];
   yield sanitizer.sanitize();
--- a/browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
+++ b/browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
@@ -193,11 +193,15 @@ function onSubmitStatus(aSubject, aData)
 
   return true;
 }
 
 function getPropertyBagValue(bag, key) {
   try {
     var val = bag.getProperty(key);
   }
-  catch (e if e.result == Cr.NS_ERROR_FAILURE) {}
+  catch (e) {
+    if (e.result != Cr.NS_ERROR_FAILURE) {
+      throw e;
+    }
+  }
   return val;
 }
--- a/browser/base/content/test/plugins/browser_pluginnotification.js
+++ b/browser/base/content/test/plugins/browser_pluginnotification.js
@@ -476,17 +476,17 @@ add_task(function* () {
   for (let id of ids) {
     yield ContentTask.spawn(gTestBrowser, { id }, function* (args) {
       let doc = content.document;
       let plugin = doc.getElementById(args.id);
       let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
       Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
         "Test 21c, plugin " + args.id + " should have click-to-play overlay with zero dims");
     });
-    
+
 
     let pluginInfo = yield promiseForPluginInfo(id);
     ok(!pluginInfo.activated, "Test 21c, Plugin with id=" + id + " should not be activated");
   }
 
   centerAction = null;
   for (let action of notification.options.pluginData.values()) {
     if (action.pluginName == "Second Test") {
--- a/browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -18,17 +18,17 @@ function pageLoad(aEvent) {
   gNextTest = null;
 }
 
 function prepareTest(nextTest, url, browser) {
   gNextTest = nextTest;
   if (!browser)
     browser = gTestBrowser;
 
-  ContentTask.spawn(browser, url, function(url){
+  ContentTask.spawn(browser, url, function(url) {
     content.location = url;
   });
 }
 
 function finishTest() {
   clearAllPluginPermissions();
   gTestBrowser.removeEventListener("load", pageLoad, true);
   gBrowser.removeCurrentTab();
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -93,17 +93,17 @@ function* runNextTest() {
     let shownState = false;
     onPopupEvent("popupshowing", function () {
       info("[" + nextTest.id + "] popup showing");
     });
     onPopupEvent("popupshown", function () {
       shownState = true;
       info("[" + nextTest.id + "] popup shown");
       Task.spawn(() => nextTest.onShown(this))
-          .then(undefined , ex => Assert.ok(false, "onShown failed: " + ex));
+          .then(undefined, ex => Assert.ok(false, "onShown failed: " + ex));
     });
     onPopupEvent("popuphidden", function () {
       info("[" + nextTest.id + "] popup hidden");
       nextTest.onHidden(this);
       goNext();
     }, () => shownState);
     info("[" + nextTest.id + "] added listeners; panel is open: " + PopupNotifications.isPanelOpen);
   }
--- a/browser/base/content/test/referrer/browser_referrer_simple_click.js
+++ b/browser/base/content/test/referrer/browser_referrer_simple_click.js
@@ -5,14 +5,14 @@ function startSimpleClickTestCase(aTestN
   info("browser_referrer_simple_click: " +
        getReferrerTestDescription(aTestNumber));
   BrowserTestUtils.browserLoaded(gTestWindow.gBrowser.selectedBrowser).then(function() {
     checkReferrerAndStartNextTest(aTestNumber, null, null,
                                   startSimpleClickTestCase);
   });
 
   clickTheLink(gTestWindow, "testlink", {});
-};
+}
 
 function test() {
   requestLongerTimeout(10);  // slowwww shutdown on e10s
   startReferrerTest(startSimpleClickTestCase);
 }
--- a/browser/base/content/test/social/browser_aboutHome_activation.js
+++ b/browser/base/content/test/social/browser_aboutHome_activation.js
@@ -73,17 +73,17 @@ function test()
   waitForExplicitFinish();
   requestLongerTimeout(2);
   ignoreAllUncaughtExceptions();
   PopupNotifications.panel.setAttribute("animate", "false");
   registerCleanupFunction(function () {
     PopupNotifications.panel.removeAttribute("animate");
   });
 
-  Task.spawn(function () {
+  Task.spawn(function* () {
     for (let test of gTests) {
       info(test.desc);
 
       // Create a tab to run the test.
       let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
 
       // Add an event handler to modify the snippets map once it's ready.
       let snippetsPromise = promiseSetupSnippetsMap(tab, test.snippet);
--- a/browser/base/content/test/social/browser_blocklist.js
+++ b/browser/base/content/test/social/browser_blocklist.js
@@ -87,22 +87,22 @@ var tests = {
     setAndUpdateBlocklist(blocklistURL).then(() => {
       try {
         SocialService.addProvider(manifest, function(provider) {
           try {
             SocialService.disableProvider(provider.origin, function() {
               ok(true, "added and removed provider");
               finishTest(true);
             });
-          } catch(e) {
+          } catch (e) {
             ok(false, "SocialService.disableProvider threw exception: " + e);
             finishTest(false);
           }
         });
-      } catch(e) {
+      } catch (e) {
         ok(false, "SocialService.addProvider threw exception: " + e);
         finishTest(false);
       }
     });
   },
   testAddingBlockedProvider: function(next) {
     function finishTest(good) {
       ok(good, "Unable to add blocklisted provider");
@@ -113,17 +113,17 @@ var tests = {
     setAndUpdateBlocklist(blocklistURL).then(() => {
       try {
         SocialService.addProvider(manifest_bad, function(provider) {
           SocialService.disableProvider(provider.origin, function() {
             ok(false, "SocialService.addProvider should throw blocklist exception");
             finishTest(false);
           });
         });
-      } catch(e) {
+      } catch (e) {
         ok(true, "SocialService.addProvider should throw blocklist exception: " + e);
         finishTest(true);
       }
     });
   },
   testInstallingBlockedProvider: function(next) {
     function finishTest(good) {
       ok(good, "Unable to install blocklisted provider");
@@ -138,17 +138,17 @@ var tests = {
           origin: manifest_bad.origin,
           url: activationURL,
           manifest: manifest_bad,
           window: window
         }
         Social.installProvider(data, function(addonManifest) {
           finishTest(false);
         });
-      } catch(e) {
+      } catch (e) {
         finishTest(true);
       }
     });
   },
   testBlockingExistingProvider: function(next) {
     let listener = {
       _window: null,
       onOpenWindow: function(aXULWindow) {
@@ -198,14 +198,14 @@ var tests = {
             Services.prefs.clearUserPref("social.manifest.blocked");
             resetBlocklist();
           });
         });
         // no callback - the act of updating should cause the listener above
         // to fire.
         setAndUpdateBlocklist(blocklistURL);
       });
-    } catch(e) {
+    } catch (e) {
       ok(false, "unable to add provider " + e);
       next();
     }
   }
 }
--- a/browser/base/content/test/social/browser_share.js
+++ b/browser/base/content/test/social/browser_share.js
@@ -193,17 +193,17 @@ var tests = {
     // ensure correct state
     SocialUI.onCustomizeEnd(window);
 
     let mm = getGroupMessageManager("social");
     mm.addMessageListener("sharedata", function handler(msg) {
       BrowserTestUtils.removeTab(testTab).then(() => {
         hasoptions(testData.options, JSON.parse(msg.data));
         testData = corpus[testIndex++];
-        BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; },"share panel closed").then(() => {
+        BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; }, "share panel closed").then(() => {
           if (testData) {
             runOneTest();
           } else {
             mm.removeMessageListener("sharedata", handler);
             SocialService.disableProvider(manifest.origin, next);
           }
         });
         SocialShare.iframe.messageManager.sendAsyncMessage("closeself", {});
@@ -367,17 +367,17 @@ var tests = {
       BrowserTestUtils.openNewForegroundTab(gBrowser, activationPage).then(tab => {
         ensureFrameLoaded(SocialShare.iframe).then(() => {
           // send keys to the input field.  An unexpected failure will happen
           // if the onbeforeunload handler is fired.
           EventUtils.sendKey("f");
           EventUtils.sendKey("a");
           EventUtils.sendKey("i");
           EventUtils.sendKey("l");
-  
+
           SocialShare.panel.addEventListener("popuphidden", function hidden(evt) {
             SocialShare.panel.removeEventListener("popuphidden", hidden);
             let topwin = Services.wm.getMostRecentWindow(null);
             is(topwin, window, "no dialog is open");
 
             BrowserTestUtils.removeTab(testTab).then(() => {
               SocialService.disableProvider(manifest.origin, next);
             });
--- a/browser/base/content/test/social/browser_social_activation.js
+++ b/browser/base/content/test/social/browser_social_activation.js
@@ -22,17 +22,17 @@ function removeProvider(provider) {
       SocialService.uninstallProvider(provider.origin, resolve);
     } else {
       SocialService.disableProvider(provider.origin, resolve);
     }
   });
 }
 
 function postTestCleanup(callback) {
-  Task.spawn(function () {
+  Task.spawn(function* () {
     // any tabs opened by the test.
     for (let tab of tabsToRemove) {
       yield BrowserTestUtils.removeTab(tab);
     }
     tabsToRemove = [];
     // all the providers may have been added.
     while (Social.providers.length > 0) {
       yield removeProvider(Social.providers[0]);
@@ -88,17 +88,17 @@ function getAddonItemInList(aId, aList) 
   }
   return null;
 }
 
 function clickAddonRemoveButton(tab, aCallback) {
   AddonManager.getAddonsByTypes(["service"], function(aAddons) {
     let addon = aAddons[0];
 
-    let doc = tab.linkedBrowser.contentDocument;;
+    let doc = tab.linkedBrowser.contentDocument;
     let list = doc.getElementById("addon-list");
 
     let item = getAddonItemInList(addon.id, list);
     let button = item._removeBtn;
     isnot(button, null, "Should have a remove button");
     ok(!button.disabled, "Button should not be disabled");
 
     // uninstall happens after about:addons tab is closed, so we wait on
@@ -182,38 +182,38 @@ var tests = {
       is(SocialUI.enabled, false, "SocialUI is not enabled");
       let panel = document.getElementById("servicesInstall-notification");
       ok(panel.hidden, "activation panel still hidden");
       checkSocialUI();
       Services.prefs.clearUserPref("social.remote-install.enabled");
       next();
     });
   },
-  
+
   testIFrameActivation: function(next) {
     activateIFrameProvider(gTestDomains[0], function() {
       is(SocialUI.enabled, false, "SocialUI is not enabled");
       ok(!SocialSidebar.provider, "provider is not installed");
       let panel = document.getElementById("servicesInstall-notification");
       ok(panel.hidden, "activation panel still hidden");
       checkSocialUI();
       next();
     });
   },
-  
+
   testActivationFirstProvider: function(next) {
     // first up we add a manifest entry for a single provider.
     activateOneProvider(gProviders[0], false, function() {
       // we deactivated leaving no providers left, so Social is disabled.
       ok(!SocialSidebar.provider, "should be no provider left after disabling");
       checkSocialUI();
       next();
     });
   },
-  
+
   testActivationMultipleProvider: function(next) {
     // The trick with this test is to make sure that Social.providers[1] is
     // the current provider when doing the undo - this makes sure that the
     // Social code doesn't fallback to Social.providers[0], which it will
     // do in some cases (but those cases do not include what this test does)
     // first enable the 2 providers
     SocialService.addProvider(gProviders[0], function() {
       SocialService.addProvider(gProviders[1], function() {
--- a/browser/base/content/test/social/browser_social_errorPage.js
+++ b/browser/base/content/test/social/browser_social_errorPage.js
@@ -15,17 +15,17 @@ function openPanel(url, panelCallback, l
   // open a flyout
   SocialFlyout.open(url, 0, panelCallback);
   // wait for both open and loaded before callback. Since the test doesn't close
   // the panel between opens, we cannot rely on events here. We need to ensure
   // popupshown happens before we finish out the tests.
   BrowserTestUtils.waitForCondition(function() {
                     return SocialFlyout.panel.state == "open" &&
                            SocialFlyout.iframe.contentDocument.readyState == "complete";
-                   },"flyout is open and loaded").then(() => { executeSoon(loadCallback) });
+                   }, "flyout is open and loaded").then(() => { executeSoon(loadCallback) });
 }
 
 function openChat(url, panelCallback, loadCallback) {
   // open a chat window
   let chatbar = getChatBar();
   openChatWindow(null, SocialSidebar.provider, url, panelCallback);
   chatbar.firstChild.addEventListener("DOMContentLoaded", function panelLoad() {
     chatbar.firstChild.removeEventListener("DOMContentLoaded", panelLoad, true);
--- a/browser/base/content/test/social/browser_social_marks_context.js
+++ b/browser/base/content/test/social/browser_social_marks_context.js
@@ -98,9 +98,9 @@ var tests = {
         is(SocialMarks.getProviders().length, 0, "mark providers removed");
         is(markLinkMenu.childNodes.length, 0, "marklink menu ok");
         is(markPageMenu.childNodes.length, 0, "markpage menu ok");
         checkSocialUI(window);
         next();
       });
     });
   }
-}
\ No newline at end of file
+}
--- a/browser/base/content/test/social/browser_social_multiprovider.js
+++ b/browser/base/content/test/social/browser_social_multiprovider.js
@@ -37,33 +37,33 @@ var tests = {
       is(menuProviders.length, gProviders.length, "correct number of providers listed in the menu");
       // Find the selectedProvider's menu item
       let el = menu.getElementsByAttribute("origin", selectedProvider.origin);
       is(el.length, 1, "selected provider menu item exists");
       is(el[0].getAttribute("checked"), "true", "selected provider menu item is checked");
     }
 
     // the menu is not populated until onpopupshowing, so wait for popupshown
-    BrowserTestUtils.waitForEvent(menu, "popupshown", true).then(()=>{
+    BrowserTestUtils.waitForEvent(menu, "popupshown", true).then(() => {
       menu.hidePopup(); // doesn't need visibility
       // first provider should already be visible in the sidebar
       is(Social.providers[0].origin, SocialSidebar.provider.origin, "selected provider in sidebar");
       checkProviderMenu(Social.providers[0]);
 
       // Now activate "provider 2"
-      BrowserTestUtils.waitForEvent(sbrowser, "load", true).then(()=>{
+      BrowserTestUtils.waitForEvent(sbrowser, "load", true).then(() => {
         checkUIStateMatchesProvider(Social.providers[1]);
 
-        BrowserTestUtils.waitForEvent(sbrowser, "load", true).then(()=>{
+        BrowserTestUtils.waitForEvent(sbrowser, "load", true).then(() => {
           checkUIStateMatchesProvider(Social.providers[0]);
           next();
         });
 
         // show the menu again so the menu is updated with the correct commands
-        BrowserTestUtils.waitForEvent(menu, "popupshown", true).then(()=>{
+        BrowserTestUtils.waitForEvent(menu, "popupshown", true).then(() => {
           // click on the provider menuitem to switch providers
           let el = menu.getElementsByAttribute("origin", Social.providers[0].origin);
           is(el.length, 1, "selected provider menu item exists");
           EventUtils.synthesizeMouseAtCenter(el[0], {});
         });
         EventUtils.synthesizeMouseAtCenter(button, {});
       });
       SocialSidebar.provider = Social.providers[1];
--- a/browser/base/content/test/social/browser_social_window.js
+++ b/browser/base/content/test/social/browser_social_window.js
@@ -162,17 +162,17 @@ var tests = {
                   SocialService.disableProvider(manifest.origin, function() {
                     Services.prefs.clearUserPref("social.manifest.test");
                     cbnext();
                   });
                 });
               });
             });
           });
-        });        
+        });
       });
     });
   },
 
   // Check per window sidebar functionality, including migration from using
   // prefs to using session state, and state inheritance of windows (new windows
   // inherit state from the opener).
   testPerWindowSidebar: function(cbnext) {
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -56,26 +56,26 @@ function defaultFinishChecks() {
 
 function runSocialTestWithProvider(manifest, callback, finishcallback) {
 
   let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
 
   let manifests = Array.isArray(manifest) ? manifest : [manifest];
 
   // Check that none of the provider's content ends up in history.
-  function finishCleanUp() {
+  function* finishCleanUp() {
     ok(!SocialSidebar.provider, "no provider in sidebar");
     SessionStore.setWindowValue(window, "socialSidebar", "");
     for (let i = 0; i < manifests.length; i++) {
       let m = manifests[i];
       for (let what of ['sidebarURL', 'iconURL', 'shareURL', 'markURL']) {
         if (m[what]) {
           yield promiseSocialUrlNotRemembered(m[what]);
         }
-      };
+      }
     }
     for (let i = 0; i < gURLsNotRemembered.length; i++) {
       yield promiseSocialUrlNotRemembered(gURLsNotRemembered[i]);
     }
     gURLsNotRemembered = [];
   }
 
   info("runSocialTestWithProvider: " + manifests.toSource());
@@ -150,20 +150,20 @@ function runSocialTests(tests, cbPreTest
     }
   })();
   let providersAtStart = Social.providers.length;
   info("runSocialTests: start test run with " + providersAtStart + " providers");
   window.focus();
 
 
   if (cbPreTest === undefined) {
-    cbPreTest = function(cb) {cb()};
+    cbPreTest = function(cb) { cb() };
   }
   if (cbPostTest === undefined) {
-    cbPostTest = function(cb) {cb()};
+    cbPostTest = function(cb) { cb() };
   }
 
   function runNextTest() {
     let result = testIter.next();
     if (result.done) {
       // out of items:
       (cbFinish || defaultFinishChecks)();
       is(providersAtStart, Social.providers.length,
@@ -289,17 +289,17 @@ function setManifestPref(name, manifest)
                createInstance(Ci.nsISupportsString);
   string.data = JSON.stringify(manifest);
   Services.prefs.setComplexValue(name, Ci.nsISupportsString, string);
 }
 
 function getManifestPrefname(aManifest) {
   // is same as the generated name in SocialServiceInternal.getManifestPrefname
   let originUri = Services.io.newURI(aManifest.origin, null, null);
-  return "social.manifest." + originUri.hostPort.replace('.','-');
+  return "social.manifest." + originUri.hostPort.replace('.', '-');
 }
 
 function setBuiltinManifestPref(name, manifest) {
   // we set this as a default pref, it must not be a user pref
   manifest.builtin = true;
   let string = Cc["@mozilla.org/supports-string;1"].
                createInstance(Ci.nsISupportsString);
   string.data = JSON.stringify(manifest);
@@ -397,17 +397,17 @@ function makeChat(mode, uniqueid, cb) {
   // want to use a specific url (different than above) for testing
   if (provider.chatURL) {
     chatUrl = provider.chatURL;
   }
   // Note that we use promiseChatLoaded instead of the callback to ensure the
   // content has started loading.
   let chatbox = getChatBar().openChat({
     origin: provider.origin,
-    title: provider.name,url: chatUrl + "?id=" + uniqueid,
+    title: provider.name, url: chatUrl + "?id=" + uniqueid,
     mode: mode
   });
   chatbox.promiseChatLoaded.then(
     () => {
     info("chat window has opened");
     chatbox.content.messageManager.sendAsyncMessage("Social:SetDocumentTitle", {
       title: uniqueid
     });
@@ -554,17 +554,17 @@ function promiseNodeRemoved(aNode) {
 }
 
 function promiseCloseChat(chat) {
   let promise = promiseNodeRemoved(chat);
   chat.close();
   return promise;
 }
 
-function closeAllChats() {
+function* closeAllChats() {
   let chatbar = getChatBar();
   while (chatbar.selectedChat) {
     yield promiseCloseChat(chatbar.selectedChat);
   }
 }
 
 function openChatViaUser() {
   let sidebarDoc = document.getElementById("social-sidebar-browser").contentDocument;
--- a/browser/base/content/test/social/social_crash_content_helper.js
+++ b/browser/base/content/test/social/social_crash_content_helper.js
@@ -1,31 +1,31 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var Cu = Components.utils;
-
-// Ideally we would use CrashTestUtils.jsm, but that's only available for
-// xpcshell tests - so we just copy a ctypes crasher from it.
-Cu.import("resource://gre/modules/ctypes.jsm");
-var crash = function() { // this will crash when called.
-  let zero = new ctypes.intptr_t(8);
-  let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
-  badptr.contents
-};
-
-
-var TestHelper = {
-  init: function() {
-    addMessageListener("social-test:crash", this);
-  },
-
-  receiveMessage: function(msg) {
-    switch (msg.name) {
-      case "social-test:crash":
-        privateNoteIntentionalCrash();
-        crash();
-      break;
-    }
-  },
-}
-
-TestHelper.init();
+/* Any copyright is dedicated to the Public Domain.
+* http://creativecommons.org/publicdomain/zero/1.0/ */
+
+var Cu = Components.utils;
+
+// Ideally we would use CrashTestUtils.jsm, but that's only available for
+// xpcshell tests - so we just copy a ctypes crasher from it.
+Cu.import("resource://gre/modules/ctypes.jsm");
+var crash = function() { // this will crash when called.
+  let zero = new ctypes.intptr_t(8);
+  let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
+  badptr.contents
+};
+
+
+var TestHelper = {
+  init: function() {
+    addMessageListener("social-test:crash", this);
+  },
+
+  receiveMessage: function(msg) {
+    switch (msg.name) {
+      case "social-test:crash":
+        privateNoteIntentionalCrash();
+        crash();
+      break;
+    }
+  },
+}
+
+TestHelper.init();
--- a/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js
+++ b/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js
@@ -21,17 +21,17 @@ add_task(function*() {
   is(generalPanel.state, "closed", "generalPanel starts as closed");
 
   let specificPanelPromise = BrowserTestUtils.waitForEvent(specificPanel, "popupshown");
   specificPanel.openPopupAtScreen(210, 210);
   yield specificPanelPromise;
   is(specificPanel.state, "open", "specificPanel has been opened");
 
   let generalPanelPromise = BrowserTestUtils.waitForEvent(generalPanel, "popupshown");
-  generalPanel.openPopupAtScreen(510,510);
+  generalPanel.openPopupAtScreen(510, 510);
   yield generalPanelPromise;
   is(generalPanel.state, "open", "generalPanel has been opened");
 
   gBrowser.tabContainer.advanceSelectedTab(-1, true);
   is(specificPanel.state, "closed", "specificPanel panel is closed after its tab loses focus");
   is(generalPanel.state, "open", "generalPanel is still open after tab switch");
 
   specificPanel.remove();
--- a/browser/base/content/test/urlbar/browser_action_keyword_override.js
+++ b/browser/base/content/test/urlbar/browser_action_keyword_override.js
@@ -22,19 +22,19 @@ add_task(function*() {
   is_element_hidden(urlHbox, "URL element should be hidden");
 
   let actionHbox = result._actionText.parentNode.parentNode;
   ok(actionHbox.classList.contains("ac-action"), "Action hbox element sanity check");
   is_element_visible(actionHbox, "Action element should be visible");
   is(result._actionText.textContent, "", "Action text should be empty");
 
   info("During override");
-  EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
+  EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
   is_element_visible(titleHbox, "Title element should be visible");
   is_element_hidden(urlHbox, "URL element should be hidden");
   is_element_visible(actionHbox, "Action element should be visible");
   is(result._actionText.textContent, "", "Action text should be empty");
 
-  EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
+  EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
 
   gURLBar.popup.hidePopup();
   yield promisePopupHidden(gURLBar.popup);
 });
--- a/browser/base/content/test/urlbar/browser_action_searchengine.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine.js
@@ -10,17 +10,17 @@ add_task(function* () {
 
   registerCleanupFunction(() => {
     Services.search.currentEngine = originalEngine;
     let engine = Services.search.getEngineByName("MozSearch");
     Services.search.removeEngine(engine);
 
     try {
       gBrowser.removeTab(tab);
-    } catch(ex) { /* tab may have already been closed in case of failure */ }
+    } catch (ex) { /* tab may have already been closed in case of failure */ }
 
     return PlacesTestUtils.clearHistory();
   });
 
   yield promiseAutocompleteResultPopup("open a search");
   let result = gURLBar.popup.richlistbox.firstChild;
 
   isnot(result, null, "Should have a result");
--- a/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
@@ -11,25 +11,25 @@ add_task(function* () {
 
   registerCleanupFunction(() => {
     Services.search.currentEngine = originalEngine;
     let engine = Services.search.getEngineByName("MozSearch");
     Services.search.removeEngine(engine);
 
     try {
       gBrowser.removeTab(tab);
-    } catch(ex) { /* tab may have already been closed in case of failure */ }
+    } catch (ex) { /* tab may have already been closed in case of failure */ }
 
     return PlacesTestUtils.clearHistory();
   });
 
   yield promiseAutocompleteResultPopup("moz open a search");
 
   let result = gURLBar.popup.richlistbox.children[0];
   ok(result.hasAttribute("image"), "Result should have an image attribute");
   ok(result.getAttribute("image") === engine.iconURI.spec,
      "Image attribute should have the search engine's icon");
 
-  EventUtils.synthesizeKey("VK_RETURN" , { });
+  EventUtils.synthesizeKey("VK_RETURN", { });
   yield promiseTabLoaded(gBrowser.selectedTab);
 
   is(gBrowser.selectedBrowser.currentURI.spec, "http://example.com/?q=open+a+search");
 });
--- a/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
+++ b/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
@@ -12,53 +12,53 @@ add_task(function* test_switchtab_overri
   yield deferred.promise;
 
   info("Opening and selecting second tab");
   let secondTab = gBrowser.selectedTab = gBrowser.addTab();
   registerCleanupFunction(() => {
     try {
       gBrowser.removeTab(tab);
       gBrowser.removeTab(secondTab);
-    } catch(ex) { /* tabs may have already been closed in case of failure */ }
+    } catch (ex) { /* tabs may have already been closed in case of failure */ }
   });
 
   info("Wait for autocomplete")
   deferred = Promise.defer();
   let onSearchComplete = gURLBar.onSearchComplete;
   registerCleanupFunction(() => {
     gURLBar.onSearchComplete = onSearchComplete;
   });
   gURLBar.onSearchComplete = function () {
     ok(gURLBar.popupOpen, "The autocomplete popup is correctly open");
     onSearchComplete.apply(gURLBar);
     deferred.resolve();
   }
 
   gURLBar.focus();
   gURLBar.value = "dummy_pag";
-  EventUtils.synthesizeKey("e" , {});
+  EventUtils.synthesizeKey("e", {});
   yield deferred.promise;
 
   info("Select second autocomplete popup entry");
-  EventUtils.synthesizeKey("VK_DOWN" , {});
+  EventUtils.synthesizeKey("VK_DOWN", {});
   ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
 
   info("Override switch-to-tab");
   deferred = Promise.defer();
   // In case of failure this would switch tab.
   let onTabSelect = event => {
     deferred.reject(new Error("Should have overridden switch to tab"));
   };
   gBrowser.tabContainer.addEventListener("TabSelect", onTabSelect, false);
   registerCleanupFunction(() => {
     gBrowser.tabContainer.removeEventListener("TabSelect", onTabSelect, false);
   });
   // Otherwise it would load the page.
   whenTabLoaded(secondTab, deferred.resolve);
 
-  EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
-  EventUtils.synthesizeKey("VK_RETURN" , { });
+  EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
+  EventUtils.synthesizeKey("VK_RETURN", { });
   info(`gURLBar.value = ${gURLBar.value}`);
-  EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
+  EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
   yield deferred.promise;
 
   yield PlacesTestUtils.clearHistory();
 });
--- a/browser/base/content/test/urlbar/browser_bug1024133-switchtab-override-keynav.js
+++ b/browser/base/content/test/urlbar/browser_bug1024133-switchtab-override-keynav.js
@@ -12,29 +12,29 @@ add_task(function* test_switchtab_overri
   yield tabLoadDeferred.promise;
 
   info("Opening and selecting second tab");
   let secondTab = gBrowser.selectedTab = gBrowser.addTab();
   registerCleanupFunction(() => {
     try {
       gBrowser.removeTab(tab);
       gBrowser.removeTab(secondTab);
-    } catch(ex) { /* tabs may have already been closed in case of failure */ }
+    } catch (ex) { /* tabs may have already been closed in case of failure */ }
     return PlacesTestUtils.clearHistory();
   });
 
   gURLBar.focus();
   gURLBar.value = "dummy_pag";
-  EventUtils.synthesizeKey("e" , {});
+  EventUtils.synthesizeKey("e", {});
   yield promiseSearchComplete();
 
   info("Select second autocomplete popup entry");
-  EventUtils.synthesizeKey("VK_DOWN" , {});
+  EventUtils.synthesizeKey("VK_DOWN", {});
   ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
 
   info("Shift+left on switch-to-tab entry");
 
-  EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
+  EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
   EventUtils.synthesizeKey("VK_LEFT", { shiftKey: true });
-  EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
+  EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
 
   ok(!/moz-action:switchtab/.test(gURLBar.inputField.value), "switch to tab should be hidden");
 });
--- a/browser/base/content/test/urlbar/browser_bug1104165-switchtab-decodeuri.js
+++ b/browser/base/content/test/urlbar/browser_bug1104165-switchtab-decodeuri.js
@@ -5,25 +5,25 @@ add_task(function* test_switchtab_decode
 
   info("Opening and selecting second tab");
   let newTab = gBrowser.selectedTab = gBrowser.addTab();
 
   info("Wait for autocomplete")
   yield promiseAutocompleteResultPopup("dummy_page");
 
   info("Select autocomplete popup entry");
-  EventUtils.synthesizeKey("VK_DOWN" , {});
+  EventUtils.synthesizeKey("VK_DOWN", {});
   ok(gURLBar.value.startsWith("moz-action:switchtab"), "switch to tab entry found");
 
   info("switch-to-tab");
   yield new Promise((resolve, reject) => {
     // In case of success it should switch tab.
     gBrowser.tabContainer.addEventListener("TabSelect", function select() {
       gBrowser.tabContainer.removeEventListener("TabSelect", select, false);
       is(gBrowser.selectedTab, tab, "Should have switched to the right tab");
       resolve();
     }, false);
-    EventUtils.synthesizeKey("VK_RETURN" , { });
+    EventUtils.synthesizeKey("VK_RETURN", { });
   });
 
   gBrowser.removeCurrentTab();
   yield PlacesTestUtils.clearHistory();
 });
--- a/browser/base/content/test/urlbar/browser_canonizeURL.js
+++ b/browser/base/content/test/urlbar/browser_canonizeURL.js
@@ -58,13 +58,13 @@ add_task(function*() {
     );
 
     gBrowser.selectedBrowser.focus();
     gURLBar.focus();
 
     yield Promise.all([focusEventPromise, messagePromise]);
 
     gURLBar.inputField.value = inputValue.slice(0, -1);
-    EventUtils.synthesizeKey(inputValue.slice(-1) , {});
+    EventUtils.synthesizeKey(inputValue.slice(-1), {});
     EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
     yield stoppedLoadPromise;
   }
 });
--- a/browser/base/content/test/urlbar/browser_locationBarCommand.js
+++ b/browser/base/content/test/urlbar/browser_locationBarCommand.js
@@ -198,17 +198,17 @@ function promiseNewTabSwitched() {
     });
   });
 }
 
 function promiseCheckChildNoFocusedElement(browser)
 {
   if (!gMultiProcessBrowser) {
     Assert.equal(Services.focus.focusedElement, null, "There should be no focused element");
-    return;
+    return null;
   }
 
   return ContentTask.spawn(browser, { }, function* () {
     const fm = Components.classes["@mozilla.org/focus-manager;1"].
                           getService(Components.interfaces.nsIFocusManager);
     Assert.equal(fm.focusedElement, null, "There should be no focused element");
   });
 }
--- a/browser/base/content/test/urlbar/browser_locationBarExternalLoad.js
+++ b/browser/base/content/test/urlbar/browser_locationBarExternalLoad.js
@@ -25,17 +25,17 @@ function promiseNewTabSwitched() {
   return new Promise(resolve => {
     gBrowser.addEventListener("TabSwitchDone", function onSwitch() {
       gBrowser.removeEventListener("TabSwitchDone", onSwitch);
       executeSoon(resolve);
     });
   });
 }
 
-function testURL(url, loadFunc, endFunc) {
+function* testURL(url, loadFunc, endFunc) {
   let tabSwitchedPromise = promiseNewTabSwitched();
   let tab = gBrowser.selectedTab = gBrowser.addTab();
   let browser = gBrowser.selectedBrowser;
 
   let pageshowPromise = promiseWaitForEvent(browser, "pageshow");
 
   yield tabSwitchedPromise;
   yield pageshowPromise;
--- a/browser/base/content/test/urlbar/browser_urlbarDecode.js
+++ b/browser/base/content/test/urlbar/browser_urlbarDecode.js
@@ -2,24 +2,24 @@
 
 // This test makes sure (1) you can't break the urlbar by typing particular JSON
 // or JS fragments into it, (2) urlbar.textValue shows URLs unescaped, and (3)
 // the urlbar also shows the URLs embedded in action URIs unescaped.  See bug
 // 1233672.
 
 add_task(function* injectJSON() {
   let inputStrs = [
-    'http://example.com/ ", "url": "bar' ,
-    'http://example.com/\\' ,
-    'http://example.com/"' ,
-    'http://example.com/","url":"evil.com' ,
-    'http://mozilla.org/\\u0020' ,
-    'http://www.mozilla.org/","url":1e6,"some-key":"foo' ,
-    'http://www.mozilla.org/","url":null,"some-key":"foo' ,
-    'http://www.mozilla.org/","url":["foo","bar"],"some-key":"foo' ,
+    'http://example.com/ ", "url": "bar',
+    'http://example.com/\\',
+    'http://example.com/"',
+    'http://example.com/","url":"evil.com',
+    'http://mozilla.org/\\u0020',
+    'http://www.mozilla.org/","url":1e6,"some-key":"foo',
+    'http://www.mozilla.org/","url":null,"some-key":"foo',
+    'http://www.mozilla.org/","url":["foo","bar"],"some-key":"foo',
   ];
   for (let inputStr of inputStrs) {
     yield checkInput(inputStr);
   }
   gURLBar.value = "";
   gURLBar.handleRevert();
   gURLBar.blur();
 });
@@ -79,17 +79,17 @@ function* checkInput(inputStr) {
     input: inputStr,
   };
   for (let key in params) {
     params[key] = encodeURIComponent(params[key]);
   }
   let expectedURL = "moz-action:" + type + "," + JSON.stringify(params);
   Assert.equal(item.getAttribute("url"), expectedURL, "url");
 
-  Assert.equal(item.getAttribute("title"), inputStr.replace("\\","/"), "title");
+  Assert.equal(item.getAttribute("title"), inputStr.replace("\\", "/"), "title");
   Assert.equal(item.getAttribute("text"), inputStr, "text");
 
   let itemType = item.getAttribute("type");
   Assert.equal(itemType, "visiturl");
 
-  Assert.equal(item._titleText.textContent, inputStr.replace("\\","/"), "Visible title");
+  Assert.equal(item._titleText.textContent, inputStr.replace("\\", "/"), "Visible title");
   Assert.equal(item._actionText.textContent, "Visit", "Visible action");
 }
--- a/browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
+++ b/browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
@@ -2,17 +2,17 @@
 
 /**
  * Check that navigating through both the URL bar and using in-page hash- or ref-
  * based links and back or forward navigation updates the URL bar and identity block correctly.
  */
 add_task(function* () {
   let baseURL = "https://example.org/browser/browser/base/content/test/urlbar/dummy_page.html";
   let url = baseURL + "#foo";
-  yield BrowserTestUtils.withNewTab({ gBrowser, url }, function(browser) {
+  yield BrowserTestUtils.withNewTab({ gBrowser, url }, function*(browser) {
     let identityBox = document.getElementById("identity-box");
     let expectedURL = url;
 
     let verifyURLBarState = testType => {
       is(gURLBar.textValue, expectedURL, "URL bar visible value should be correct " + testType);
       is(gURLBar.value, expectedURL, "URL bar value should be correct " + testType);
       ok(identityBox.classList.contains("verifiedDomain"), "Identity box should know we're doing SSL " + testType);
       is(gURLBar.getAttribute("pageproxystate"), "valid", "URL bar is in valid page proxy state");
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
@@ -2,17 +2,17 @@ const SUGGEST_URLBAR_PREF = "browser.url
 const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
 
 // Must run first.
 add_task(function* prepare() {
   Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
   let engine = yield promiseNewSearchEngine(TEST_ENGINE_BASENAME);
   let oldCurrentEngine = Services.search.currentEngine;
   Services.search.currentEngine = engine;
-  registerCleanupFunction(function () {
+  registerCleanupFunction(function* () {
     Services.prefs.clearUserPref(SUGGEST_URLBAR_PREF);
     Services.search.currentEngine = oldCurrentEngine;
 
     // Clicking suggestions causes visits to search results pages, so clear that
     // history now.
     yield PlacesTestUtils.clearHistory();
 
     // Make sure the popup is closed for the next test.
--- a/browser/base/content/test/urlbar/head.js
+++ b/browser/base/content/test/urlbar/head.js
@@ -251,17 +251,17 @@ function makeActionURI(action, params) {
 
 function is_hidden(element) {
   var style = element.ownerGlobal.getComputedStyle(element);
   if (style.display == "none")
     return true;
   if (style.visibility != "visible")
     return true;
   if (style.display == "-moz-popup")
-    return ["hiding","closed"].indexOf(element.state) != -1;
+    return ["hiding", "closed"].indexOf(element.state) != -1;
 
   // Hiding a parent element will hide all its children
   if (element.parentNode != element.ownerDocument)
     return is_hidden(element.parentNode);
 
   return false;
 }
 
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media.js
@@ -10,17 +10,17 @@ registerCleanupFunction(function() {
 
 const permissionError = "error: NotAllowedError: The request is not allowed " +
     "by the user agent or the platform in the current context.";
 
 var gTests = [
 
 {
   desc: "getUserMedia audio+video",
-  run: function checkAudioVideo() {
+  run: function* checkAudioVideo() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true);
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
 
     is(PopupNotifications.getNotification("webRTC-shareDevices").anchorID,
        "webRTC-shareDevices-notification-icon", "anchored to device icon");
     checkDeviceSelectors(true, true);
@@ -39,17 +39,17 @@ var gTests = [
     yield indicator;
     yield checkSharingUI({audio: true, video: true});
     yield closeStream();
   }
 },
 
 {
   desc: "getUserMedia audio only",
-  run: function checkAudioOnly() {
+  run: function* checkAudioOnly() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true);
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
 
     is(PopupNotifications.getNotification("webRTC-shareDevices").anchorID,
        "webRTC-shareMicrophone-notification-icon", "anchored to mic icon");
     checkDeviceSelectors(true);
@@ -68,17 +68,17 @@ var gTests = [
     yield indicator;
     yield checkSharingUI({audio: true});
     yield closeStream();
   }
 },
 
 {
   desc: "getUserMedia video only",
-  run: function checkVideoOnly() {
+  run: function* checkVideoOnly() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(false, true);
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
 
     is(PopupNotifications.getNotification("webRTC-shareDevices").anchorID,
        "webRTC-shareDevices-notification-icon", "anchored to device icon");
     checkDeviceSelectors(false, true);
@@ -96,17 +96,17 @@ var gTests = [
     yield indicator;
     yield checkSharingUI({video: true});
     yield closeStream();
   }
 },
 
 {
   desc: "getUserMedia audio+video, user clicks \"Don't Share\"",
-  run: function checkDontShare() {
+  run: function* checkDontShare() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true);
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(true, true);
 
     yield promiseMessage(permissionError, () => {
       activateSecondaryAction(kActionDeny);
@@ -115,17 +115,17 @@ var gTests = [
     yield expectObserverCalled("getUserMedia:response:deny");
     yield expectObserverCalled("recording-window-ended");
     yield checkNotSharing();
   }
 },
 
 {
   desc: "getUserMedia audio+video: stop sharing",
-  run: function checkStopSharing() {
+  run: function* checkStopSharing() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true);
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(true, true);
 
     let indicator = promiseIndicatorWindow();
     yield promiseMessage("ok", () => {
@@ -143,17 +143,17 @@ var gTests = [
 
     // the stream is already closed, but this will do some cleanup anyway
     yield closeStream(true);
   }
 },
 
 {
   desc: "getUserMedia audio+video: reloading the page removes all gUM UI",
-  run: function checkReloading() {
+  run: function* checkReloading() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true);
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(true, true);
 
     let indicator = promiseIndicatorWindow();
     yield promiseMessage("ok", () => {
@@ -179,20 +179,20 @@ var gTests = [
     yield expectObserverCalled("recording-window-ended");
     yield expectNoObserverCalled();
     yield checkNotSharing();
   }
 },
 
 {
   desc: "getUserMedia prompt: Always/Never Share",
-  run: function checkRememberCheckbox() {
+  run: function* checkRememberCheckbox() {
     let elt = id => document.getElementById(id);
 
-    function checkPerm(aRequestAudio, aRequestVideo,
+    function* checkPerm(aRequestAudio, aRequestVideo,
                        aExpectedAudioPerm, aExpectedVideoPerm, aNever) {
       let promise = promisePopupNotificationShown("webRTC-shareDevices");
       yield promiseRequestDevice(aRequestAudio, aRequestVideo);
       yield promise;
       yield expectObserverCalled("getUserMedia:request");
 
       is(elt("webRTC-selectMicrophone").hidden, !aRequestAudio,
          "microphone selector expected to be " + (aRequestAudio ? "visible" : "hidden"));
@@ -256,18 +256,18 @@ var gTests = [
     yield checkPerm(false, true, undefined, false, true);
     info("audio+video, user denies, expect both perms set to deny");
     yield checkPerm(true, true, false, false, true);
   }
 },
 
 {
   desc: "getUserMedia without prompt: use persistent permissions",
-  run: function checkUsePersistentPermissions() {
-    function usePerm(aAllowAudio, aAllowVideo, aRequestAudio, aRequestVideo,
+  run: function* checkUsePersistentPermissions() {
+    function* usePerm(aAllowAudio, aAllowVideo, aRequestAudio, aRequestVideo,
                      aExpectStream) {
       let Perms = Services.perms;
       let uri = gBrowser.selectedBrowser.documentURI;
 
       if (aAllowAudio !== undefined) {
         Perms.add(uri, "microphone", aAllowAudio ? Perms.ALLOW_ACTION
                                                  : Perms.DENY_ACTION);
       }
@@ -376,18 +376,18 @@ var gTests = [
     yield usePerm(undefined, false, true, false, undefined);
     info("deny video, request video, expect denied");
     yield usePerm(undefined, false, false, true, false);
   }
 },
 
 {
   desc: "Stop Sharing removes persistent permissions",
-  run: function checkStopSharingRemovesPersistentPermissions() {
-    function stopAndCheckPerm(aRequestAudio, aRequestVideo) {
+  run: function* checkStopSharingRemovesPersistentPermissions() {
+    function* stopAndCheckPerm(aRequestAudio, aRequestVideo) {
       let Perms = Services.perms;
       let uri = gBrowser.selectedBrowser.documentURI;
 
       // Initially set both permissions to 'allow'.
       Perms.add(uri, "microphone", Perms.ALLOW_ACTION);
       Perms.add(uri, "camera", Perms.ALLOW_ACTION);
 
       let indicator = promiseIndicatorWindow();
@@ -430,17 +430,17 @@ var gTests = [
     yield stopAndCheckPerm(true, false);
     info("request video, stop sharing resets video only");
     yield stopAndCheckPerm(false, true);
   }
 },
 
 {
   desc: "test showControlCenter",
-  run: function checkShowControlCenter() {
+  run: function* checkShowControlCenter() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(false, true);
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(false, true);
 
     let indicator = promiseIndicatorWindow();
     yield promiseMessage("ok", () => {
@@ -471,17 +471,17 @@ var gTests = [
     yield expectNoObserverCalled();
 
     yield closeStream();
   }
 },
 
 {
   desc: "'Always Allow' ignored and not shown on http pages",
-  run: function checkNoAlwaysOnHttp() {
+  run: function* checkNoAlwaysOnHttp() {
     // Load an http page instead of the https version.
     let browser = gBrowser.selectedBrowser;
     browser.loadURI(browser.documentURI.spec.replace("https://", "http://"));
     yield BrowserTestUtils.browserLoaded(browser);
 
     // Initially set both permissions to 'allow'.
     let Perms = Services.perms;
     let uri = browser.documentURI;
@@ -527,17 +527,17 @@ function test() {
   browser.addEventListener("load", function onload() {
     browser.removeEventListener("load", onload, true);
 
     is(PopupNotifications._currentNotifications.length, 0,
        "should start the test without any prior popup notification");
     ok(gIdentityHandler._identityPopup.hidden,
        "should start the test with the control center hidden");
 
-    Task.spawn(function () {
+    Task.spawn(function* () {
       yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
 
       for (let test of gTests) {
         info(test.desc);
         yield test.run();
 
         // Cleanup before the next test
         yield expectNoObserverCalled();
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js
@@ -4,17 +4,17 @@
 registerCleanupFunction(function() {
   gBrowser.removeCurrentTab();
 });
 
 var gTests = [
 
 {
   desc: "device sharing animation on background tabs",
-  run: function checkAudioVideo() {
+  run: function* checkAudioVideo() {
     function* getStreamAndCheckBackgroundAnim(aAudio, aVideo, aSharing) {
       // Get a stream
       let popupPromise = promisePopupNotificationShown("webRTC-shareDevices");
       yield promiseRequestDevice(aAudio, aVideo);
       yield popupPromise;
       yield expectObserverCalled("getUserMedia:request");
 
       yield promiseMessage("ok", () => {
@@ -80,17 +80,17 @@ function test() {
   browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
 
   browser.addEventListener("load", function onload() {
     browser.removeEventListener("load", onload, true);
 
     is(PopupNotifications._currentNotifications.length, 0,
        "should start the test without any prior popup notification");
 
-    Task.spawn(function () {
+    Task.spawn(function* () {
       yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
 
       for (let test of gTests) {
         info(test.desc);
         yield test.run();
       }
     }).then(finish, ex => {
      ok(false, "Unexpected Exception: " + ex);
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
@@ -11,17 +11,17 @@ function promiseReloadFrame(aFrameId) {
     content.wrappedJSObject.document.getElementById(aFrameId).contentWindow.location.reload();
   });
 }
 
 var gTests = [
 
 {
   desc: "getUserMedia audio+video",
-  run: function checkAudioVideo() {
+  run: function* checkAudioVideo() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true, "frame1");
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
 
     is(PopupNotifications.getNotification("webRTC-shareDevices").anchorID,
        "webRTC-shareDevices-notification-icon", "anchored to device icon");
     checkDeviceSelectors(true, true);
@@ -40,17 +40,17 @@ var gTests = [
     yield indicator;
     yield checkSharingUI({audio: true, video: true});
     yield closeStream(false, "frame1");
   }
 },
 
 {
   desc: "getUserMedia audio+video: stop sharing",
-  run: function checkStopSharing() {
+  run: function* checkStopSharing() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true, "frame1");
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(true, true);
 
     let indicator = promiseIndicatorWindow();
     yield promiseMessage("ok", () => {
@@ -81,17 +81,17 @@ var gTests = [
 
     // the stream is already closed, but this will do some cleanup anyway
     yield closeStream(true, "frame1");
   }
 },
 
 {
   desc: "getUserMedia audio+video: reloading the frame removes all sharing UI",
-  run: function checkReloading() {
+  run: function* checkReloading() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true, "frame1");
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(true, true);
 
     let indicator = promiseIndicatorWindow();
     yield promiseMessage("ok", () => {
@@ -116,17 +116,17 @@ var gTests = [
     yield expectObserverCalled("recording-window-ended");
     yield expectNoObserverCalled();
     yield checkNotSharing();
   }
 },
 
 {
   desc: "getUserMedia audio+video: reloading the frame removes prompts",
-  run: function checkReloadingRemovesPrompts() {
+  run: function* checkReloadingRemovesPrompts() {
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, true, "frame1");
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(true, true);
 
     info("reloading the frame");
     promise = promiseObserverCalled("recording-window-ended");
@@ -136,17 +136,17 @@ var gTests = [
 
     yield expectNoObserverCalled();
     yield checkNotSharing();
   }
 },
 
 {
   desc: "getUserMedia audio+video: reloading a frame updates the sharing UI",
-  run: function checkUpdateWhenReloading() {
+  run: function* checkUpdateWhenReloading() {
     // We'll share only the mic in the first frame, then share both in the
     // second frame, then reload the second frame. After each step, we'll check
     // the UI is in the correct state.
 
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
     yield promiseRequestDevice(true, false, "frame1");
     yield promise;
     yield expectObserverCalled("getUserMedia:request");
@@ -211,17 +211,17 @@ function test() {
   browser.messageManager.loadFrameScript(CONTENT_SCRIPT_HELPER, true);
 
   browser.addEventListener("load", function onload() {
     browser.removeEventListener("load", onload, true);
 
     is(PopupNotifications._currentNotifications.length, 0,
        "should start the test without any prior popup notification");
 
-    Task.spawn(function () {
+    Task.spawn(function* () {
       yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
 
       for (let test of gTests) {
         info(test.desc);
         yield test.run();
 
         // Cleanup before the next test
         yield expectNoObserverCalled();
--- a/browser/base/content/test/webrtc/head.js
+++ b/browser/base/content/test/webrtc/head.js
@@ -66,17 +66,17 @@ function promiseWindow(url) {
 function promiseIndicatorWindow() {
   // We don't show the indicator window on Mac.
   if ("nsISystemStatusBar" in Ci)
     return Promise.resolve();
 
   return promiseWindow("chrome://browser/content/webrtcIndicator.xul");
 }
 
-function assertWebRTCIndicatorStatus(expected) {
+function* assertWebRTCIndicatorStatus(expected) {
   let ui = Cu.import("resource:///modules/webrtcUI.jsm", {}).webrtcUI;
   let expectedState = expected ? "visible" : "hidden";
   let msg = "WebRTC indicator " + expectedState;
   if (!expected && ui.showGlobalIndicator) {
     // It seems the global indicator is not always removed synchronously
     // in some cases.
     info("waiting for the global indicator to be hidden");
     yield promiseWaitForCondition(() => !ui.showGlobalIndicator);
@@ -431,25 +431,23 @@ function* checkSharingUI(aExpected) {
     let expected = aExpected[convertId(id)];
     is(!!gIdentityHandler._sharingState[id], !!expected,
        "sharing state for " + id + " as expected");
     let icon = permissions.querySelectorAll(
       ".identity-popup-permission-icon." + id + "-icon");
     if (expected) {
       is(icon.length, 1, "should show " + id + " icon in control center panel");
       ok(icon[0].classList.contains("in-use"), "icon should have the in-use class");
+    } else if (!icon.length) {
+      ok(true, "should not show " + id + " icon in the control center panel");
     } else {
-      if (!icon.length) {
-        ok(true, "should not show " + id + " icon in the control center panel");
-      } else {
-        // This will happen if there are persistent permissions set.
-        ok(!icon[0].classList.contains("in-use"),
-           "if shown, the " + id + " icon should not have the in-use class");
-        is(icon.length, 1, "should not show more than 1 " + id + " icon");
-      }
+      // This will happen if there are persistent permissions set.
+      ok(!icon[0].classList.contains("in-use"),
+         "if shown, the " + id + " icon should not have the in-use class");
+      is(icon.length, 1, "should not show more than 1 " + id + " icon");
     }
   }
   gIdentityHandler._identityPopup.hidden = true;
 
   // Check the global indicators.
   yield* assertWebRTCIndicatorStatus(aExpected);
 }