Backed out changeset 28f8a3519d73 (bug 1267480) for mochitest bc6 perma-failing
authorIris Hsiao <ihsiao@mozilla.com>
Wed, 05 Apr 2017 14:23:13 +0800
changeset 556225 a0d2eafc208f320437c0403cd3cdac90bd700436
parent 556224 95e21766cd72bdda8da9bf8e8bd43909da3be861
child 556226 5694d3ce08bf3141beb0f3f49b1a37711c8c649c
push id52480
push userbmo:standard8@mozilla.com
push dateWed, 05 Apr 2017 14:31:04 +0000
bugs1267480
milestone55.0a1
backs out28f8a3519d733370c1f6a848a243f05ade19663d
Backed out changeset 28f8a3519d73 (bug 1267480) for mochitest bc6 perma-failing
browser/components/preferences/in-content-old/tests/browser.ini
browser/components/preferences/in-content-old/tests/browser_security.js
browser/components/preferences/in-content-old/tests/browser_security_download_protection.js
browser/components/preferences/in-content-old/tests/browser_security_unwanted_downloads.js
browser/components/preferences/in-content/tests/browser.ini
browser/components/preferences/in-content/tests/browser_security.js
browser/components/preferences/in-content/tests/browser_security_download_protection.js
browser/components/preferences/in-content/tests/browser_security_unwanted_downloads.js
--- a/browser/components/preferences/in-content-old/tests/browser.ini
+++ b/browser/components/preferences/in-content-old/tests/browser.ini
@@ -33,17 +33,15 @@ skip-if = true || !healthreport # Bug 11
 [browser_privacypane_1.js]
 [browser_privacypane_3.js]
 [browser_privacypane_4.js]
 [browser_privacypane_5.js]
 [browser_privacypane_8.js]
 [browser_sanitizeOnShutdown_prefLocked.js]
 [browser_searchsuggestions.js]
 [browser_security.js]
-[browser_security_download_protection.js]
-[browser_security_unwanted_downloads.js]
 [browser_subdialogs.js]
 support-files =
   subdialog.xul
   subdialog2.xul
 [browser_telemetry.js]
 # Skip this test on Android as FHR and Telemetry are separate systems there.
 skip-if = !healthreport || !telemetry || (os == 'linux' && debug) || (os == 'android')
--- a/browser/components/preferences/in-content-old/tests/browser_security.js
+++ b/browser/components/preferences/in-content-old/tests/browser_security.js
@@ -6,17 +6,17 @@ const PREFS = [
 
   "browser.safebrowsing.downloads.remote.block_potentially_unwanted",
   "browser.safebrowsing.downloads.remote.block_uncommon"
 ];
 
 let originals = PREFS.map(pref => [pref, Services.prefs.getBoolPref(pref)])
 let originalMalwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable");
 registerCleanupFunction(function() {
-  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val));
+  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val))
   Services.prefs.setCharPref("urlclassifier.malwareTable", originalMalwareTable);
 });
 
 // test the safebrowsing preference
 add_task(function*() {
   function* checkPrefSwitch(val1, val2) {
     Services.prefs.setBoolPref("browser.safebrowsing.phishing.enabled", val1);
     Services.prefs.setBoolPref("browser.safebrowsing.malware.enabled", val2);
@@ -50,8 +50,81 @@ add_task(function*() {
     yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
   }
 
   yield* checkPrefSwitch(true, true);
   yield* checkPrefSwitch(false, true);
   yield* checkPrefSwitch(true, false);
   yield* checkPrefSwitch(false, false);
 });
+
+// test the download protection preference
+add_task(function*() {
+  function* checkPrefSwitch(val) {
+    Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", val);
+
+    yield openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true });
+
+    let doc = gBrowser.selectedBrowser.contentDocument;
+    let checkbox = doc.getElementById("blockDownloads");
+    let blockUncommon = doc.getElementById("blockUncommonUnwanted");
+    let checked = checkbox.checked;
+    is(checked, val, "downloads preference is initialized correctly");
+    // should be disabled when val is false (= pref is turned off)
+    is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly");
+
+    // click the checkbox
+    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
+
+    // check that setting is now turned on or off
+    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.enabled"), !checked,
+       "safebrowsing.downloads preference is set correctly");
+
+    // check if the uncommon warning checkbox has updated
+    is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly");
+
+    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
+  }
+
+  yield* checkPrefSwitch(true);
+  yield* checkPrefSwitch(false);
+});
+
+// test the unwanted/uncommon software warning preference
+add_task(function*() {
+  function* checkPrefSwitch(val1, val2) {
+    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted", val1);
+    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_uncommon", val2);
+
+    yield openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true });
+
+    let doc = gBrowser.selectedBrowser.contentDocument;
+    let checkbox = doc.getElementById("blockUncommonUnwanted");
+    let checked = checkbox.checked;
+    is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
+
+    // click the checkbox
+    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
+
+    // check that both settings are now turned on or off
+    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted"), !checked,
+       "block_potentially_unwanted is set correctly");
+    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_uncommon"), !checked,
+       "block_uncommon is set correctly");
+
+    // when the preference is on, the malware table should include these ids
+    let malwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable").split(",");
+    is(malwareTable.includes("goog-unwanted-shavar"), !checked,
+       "malware table doesn't include goog-unwanted-shavar");
+    is(malwareTable.includes("test-unwanted-simple"), !checked,
+       "malware table doesn't include test-unwanted-simple");
+    let sortedMalware = malwareTable.slice(0);
+    sortedMalware.sort();
+    Assert.deepEqual(malwareTable, sortedMalware, "malware table has been sorted");
+
+    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
+  }
+
+  yield* checkPrefSwitch(true, true);
+  yield* checkPrefSwitch(false, true);
+  yield* checkPrefSwitch(true, false);
+  yield* checkPrefSwitch(false, false);
+});
deleted file mode 100644
--- a/browser/components/preferences/in-content-old/tests/browser_security_download_protection.js
+++ /dev/null
@@ -1,48 +0,0 @@
-const PREFS = [
-  "browser.safebrowsing.phishing.enabled",
-  "browser.safebrowsing.malware.enabled",
-
-  "browser.safebrowsing.downloads.enabled",
-
-  "browser.safebrowsing.downloads.remote.block_potentially_unwanted",
-  "browser.safebrowsing.downloads.remote.block_uncommon"
-];
-
-let originals = PREFS.map(pref => [pref, Services.prefs.getBoolPref(pref)])
-let originalMalwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable");
-registerCleanupFunction(function() {
-  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val));
-  Services.prefs.setCharPref("urlclassifier.malwareTable", originalMalwareTable);
-});
-
-// test the download protection preference
-add_task(function*() {
-  function* checkPrefSwitch(val) {
-    Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", val);
-
-    yield openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true });
-
-    let doc = gBrowser.selectedBrowser.contentDocument;
-    let checkbox = doc.getElementById("blockDownloads");
-    let blockUncommon = doc.getElementById("blockUncommonUnwanted");
-    let checked = checkbox.checked;
-    is(checked, val, "downloads preference is initialized correctly");
-    // should be disabled when val is false (= pref is turned off)
-    is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly");
-
-    // click the checkbox
-    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
-
-    // check that setting is now turned on or off
-    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.enabled"), !checked,
-       "safebrowsing.downloads preference is set correctly");
-
-    // check if the uncommon warning checkbox has updated
-    is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly");
-
-    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  }
-
-  yield* checkPrefSwitch(true);
-  yield* checkPrefSwitch(false);
-});
deleted file mode 100644
--- a/browser/components/preferences/in-content-old/tests/browser_security_unwanted_downloads.js
+++ /dev/null
@@ -1,57 +0,0 @@
-const PREFS = [
-  "browser.safebrowsing.phishing.enabled",
-  "browser.safebrowsing.malware.enabled",
-
-  "browser.safebrowsing.downloads.enabled",
-
-  "browser.safebrowsing.downloads.remote.block_potentially_unwanted",
-  "browser.safebrowsing.downloads.remote.block_uncommon"
-];
-
-let originals = PREFS.map(pref => [pref, Services.prefs.getBoolPref(pref)])
-let originalMalwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable");
-registerCleanupFunction(function() {
-  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val));
-  Services.prefs.setCharPref("urlclassifier.malwareTable", originalMalwareTable);
-});
-
-// test the unwanted/uncommon software warning preference
-add_task(function*() {
-  function* checkPrefSwitch(val1, val2) {
-    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted", val1);
-    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_uncommon", val2);
-
-    yield openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true });
-
-    let doc = gBrowser.selectedBrowser.contentDocument;
-    let checkbox = doc.getElementById("blockUncommonUnwanted");
-    let checked = checkbox.checked;
-    is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
-
-    // click the checkbox
-    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
-
-    // check that both settings are now turned on or off
-    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted"), !checked,
-       "block_potentially_unwanted is set correctly");
-    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_uncommon"), !checked,
-       "block_uncommon is set correctly");
-
-    // when the preference is on, the malware table should include these ids
-    let malwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable").split(",");
-    is(malwareTable.includes("goog-unwanted-shavar"), !checked,
-       "malware table doesn't include goog-unwanted-shavar");
-    is(malwareTable.includes("test-unwanted-simple"), !checked,
-       "malware table doesn't include test-unwanted-simple");
-    let sortedMalware = malwareTable.slice(0);
-    sortedMalware.sort();
-    Assert.deepEqual(malwareTable, sortedMalware, "malware table has been sorted");
-
-    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  }
-
-  yield* checkPrefSwitch(true, true);
-  yield* checkPrefSwitch(false, true);
-  yield* checkPrefSwitch(true, false);
-  yield* checkPrefSwitch(false, false);
-});
--- a/browser/components/preferences/in-content/tests/browser.ini
+++ b/browser/components/preferences/in-content/tests/browser.ini
@@ -32,18 +32,16 @@ skip-if = true || !healthreport # Bug 11
 [browser_privacypane_1.js]
 [browser_privacypane_3.js]
 [browser_privacypane_4.js]
 [browser_privacypane_5.js]
 [browser_privacypane_8.js]
 [browser_sanitizeOnShutdown_prefLocked.js]
 [browser_searchsuggestions.js]
 [browser_security.js]
-[browser_security_download_protection.js]
-[browser_security_unwanted_downloads.js]
 [browser_siteData.js]
 [browser_siteData2.js]
 [browser_subdialogs.js]
 support-files =
   subdialog.xul
   subdialog2.xul
 [browser_telemetry.js]
 # Skip this test on Android as FHR and Telemetry are separate systems there.
--- a/browser/components/preferences/in-content/tests/browser_security.js
+++ b/browser/components/preferences/in-content/tests/browser_security.js
@@ -6,17 +6,17 @@ const PREFS = [
 
   "browser.safebrowsing.downloads.remote.block_potentially_unwanted",
   "browser.safebrowsing.downloads.remote.block_uncommon"
 ];
 
 let originals = PREFS.map(pref => [pref, Services.prefs.getBoolPref(pref)])
 let originalMalwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable");
 registerCleanupFunction(function() {
-  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val));
+  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val))
   Services.prefs.setCharPref("urlclassifier.malwareTable", originalMalwareTable);
 });
 
 // test the safebrowsing preference
 add_task(function*() {
   function* checkPrefSwitch(val1, val2) {
     Services.prefs.setBoolPref("browser.safebrowsing.phishing.enabled", val1);
     Services.prefs.setBoolPref("browser.safebrowsing.malware.enabled", val2);
@@ -51,8 +51,83 @@ add_task(function*() {
     yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
   }
 
   yield* checkPrefSwitch(true, true);
   yield* checkPrefSwitch(false, true);
   yield* checkPrefSwitch(true, false);
   yield* checkPrefSwitch(false, false);
 });
+
+// test the download protection preference
+add_task(function*() {
+  function* checkPrefSwitch(val) {
+    Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", val);
+
+    yield openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
+
+    let doc = gBrowser.selectedBrowser.contentDocument;
+    let checkbox = doc.getElementById("blockDownloads");
+    let blockUncommon = doc.getElementById("blockUncommonUnwanted");
+    let checked = checkbox.checked;
+    is(checked, val, "downloads preference is initialized correctly");
+    // should be disabled when val is false (= pref is turned off)
+    is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly");
+
+    // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
+    checkbox.scrollIntoView();
+    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
+
+    // check that setting is now turned on or off
+    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.enabled"), !checked,
+       "safebrowsing.downloads preference is set correctly");
+
+    // check if the uncommon warning checkbox has updated
+    is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly");
+
+    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
+  }
+
+  yield* checkPrefSwitch(true);
+  yield* checkPrefSwitch(false);
+});
+
+// test the unwanted/uncommon software warning preference
+add_task(function*() {
+  function* checkPrefSwitch(val1, val2) {
+    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted", val1);
+    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_uncommon", val2);
+
+    yield openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
+
+    let doc = gBrowser.selectedBrowser.contentDocument;
+    let checkbox = doc.getElementById("blockUncommonUnwanted");
+    let checked = checkbox.checked;
+    is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
+
+    // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
+    checkbox.scrollIntoView();
+    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
+
+    // check that both settings are now turned on or off
+    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted"), !checked,
+       "block_potentially_unwanted is set correctly");
+    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_uncommon"), !checked,
+       "block_uncommon is set correctly");
+
+    // when the preference is on, the malware table should include these ids
+    let malwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable").split(",");
+    is(malwareTable.includes("goog-unwanted-shavar"), !checked,
+       "malware table doesn't include goog-unwanted-shavar");
+    is(malwareTable.includes("test-unwanted-simple"), !checked,
+       "malware table doesn't include test-unwanted-simple");
+    let sortedMalware = malwareTable.slice(0);
+    sortedMalware.sort();
+    Assert.deepEqual(malwareTable, sortedMalware, "malware table has been sorted");
+
+    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
+  }
+
+  yield* checkPrefSwitch(true, true);
+  yield* checkPrefSwitch(false, true);
+  yield* checkPrefSwitch(true, false);
+  yield* checkPrefSwitch(false, false);
+});
deleted file mode 100644
--- a/browser/components/preferences/in-content/tests/browser_security_download_protection.js
+++ /dev/null
@@ -1,49 +0,0 @@
-const PREFS = [
-  "browser.safebrowsing.phishing.enabled",
-  "browser.safebrowsing.malware.enabled",
-
-  "browser.safebrowsing.downloads.enabled",
-
-  "browser.safebrowsing.downloads.remote.block_potentially_unwanted",
-  "browser.safebrowsing.downloads.remote.block_uncommon"
-];
-
-let originals = PREFS.map(pref => [pref, Services.prefs.getBoolPref(pref)])
-let originalMalwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable");
-registerCleanupFunction(function() {
-  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val));
-  Services.prefs.setCharPref("urlclassifier.malwareTable", originalMalwareTable);
-});
-
-// test the download protection preference
-add_task(function*() {
-  function* checkPrefSwitch(val) {
-    Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", val);
-
-    yield openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
-
-    let doc = gBrowser.selectedBrowser.contentDocument;
-    let checkbox = doc.getElementById("blockDownloads");
-    let blockUncommon = doc.getElementById("blockUncommonUnwanted");
-    let checked = checkbox.checked;
-    is(checked, val, "downloads preference is initialized correctly");
-    // should be disabled when val is false (= pref is turned off)
-    is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly");
-
-    // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
-    checkbox.scrollIntoView();
-    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
-
-    // check that setting is now turned on or off
-    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.enabled"), !checked,
-       "safebrowsing.downloads preference is set correctly");
-
-    // check if the uncommon warning checkbox has updated
-    is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly");
-
-    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  }
-
-  yield* checkPrefSwitch(true);
-  yield* checkPrefSwitch(false);
-});
deleted file mode 100644
--- a/browser/components/preferences/in-content/tests/browser_security_unwanted_downloads.js
+++ /dev/null
@@ -1,58 +0,0 @@
-const PREFS = [
-  "browser.safebrowsing.phishing.enabled",
-  "browser.safebrowsing.malware.enabled",
-
-  "browser.safebrowsing.downloads.enabled",
-
-  "browser.safebrowsing.downloads.remote.block_potentially_unwanted",
-  "browser.safebrowsing.downloads.remote.block_uncommon"
-];
-
-let originals = PREFS.map(pref => [pref, Services.prefs.getBoolPref(pref)])
-let originalMalwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable");
-registerCleanupFunction(function() {
-  originals.forEach(([pref, val]) => Services.prefs.setBoolPref(pref, val));
-  Services.prefs.setCharPref("urlclassifier.malwareTable", originalMalwareTable);
-});
-
-// test the unwanted/uncommon software warning preference
-add_task(function*() {
-  function* checkPrefSwitch(val1, val2) {
-    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted", val1);
-    Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_uncommon", val2);
-
-    yield openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
-
-    let doc = gBrowser.selectedBrowser.contentDocument;
-    let checkbox = doc.getElementById("blockUncommonUnwanted");
-    let checked = checkbox.checked;
-    is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
-
-    // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
-    checkbox.scrollIntoView();
-    EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
-
-    // check that both settings are now turned on or off
-    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted"), !checked,
-       "block_potentially_unwanted is set correctly");
-    is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_uncommon"), !checked,
-       "block_uncommon is set correctly");
-
-    // when the preference is on, the malware table should include these ids
-    let malwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable").split(",");
-    is(malwareTable.includes("goog-unwanted-shavar"), !checked,
-       "malware table doesn't include goog-unwanted-shavar");
-    is(malwareTable.includes("test-unwanted-simple"), !checked,
-       "malware table doesn't include test-unwanted-simple");
-    let sortedMalware = malwareTable.slice(0);
-    sortedMalware.sort();
-    Assert.deepEqual(malwareTable, sortedMalware, "malware table has been sorted");
-
-    yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  }
-
-  yield* checkPrefSwitch(true, true);
-  yield* checkPrefSwitch(false, true);
-  yield* checkPrefSwitch(true, false);
-  yield* checkPrefSwitch(false, false);
-});