Bug 1436213 - Make test_bug1274685_unowned_list.js work on pver2 and pver4. r=gcp

This test is supposed to verify that Safe Browsing providers can
be initialized correctly even when a table is not configured
properly.

By removing a table from both google and google4, we ensure that
the test will be meaningful regardless of the stack in use.

Also filter out the console noise triggered by looking for the
update and gethash URLs of the "test" dummy provider.

MozReview-Commit-ID: KjWqSqA4FxJ
This commit is contained in:
Francois Marier
2018-02-06 15:36:48 -08:00
parent f7d10a683c
commit f890efb3fa
2 changed files with 12 additions and 6 deletions

View File

@@ -339,6 +339,9 @@ this.SafeBrowsing = {
}
Object.keys(this.providers).forEach(function(provider) {
if (provider == "test") {
return; // skip
}
let updateURL = Services.urlFormatter.formatURLPref(
"browser.safebrowsing.provider." + provider + ".updateURL");
let gethashURL = Services.urlFormatter.formatURLPref(

View File

@@ -9,11 +9,14 @@ updateAppInfo();
function run_test() {
SafeBrowsing.init();
let origList = Services.prefs.getCharPref("browser.safebrowsing.provider.google.lists");
let origListV2 = Services.prefs.getCharPref("browser.safebrowsing.provider.google.lists");
let origListV4 = Services.prefs.getCharPref("browser.safebrowsing.provider.google4.lists");
// Remove 'goog-malware-shavar' from the original.
let trimmedList = origList.replace("goog-malware-shavar,", "");
Services.prefs.setCharPref("browser.safebrowsing.provider.google.lists", trimmedList);
// Ensure there's a list missing in both Safe Browsing V2 and V4.
let trimmedListV2 = origListV2.replace("goog-malware-shavar,", "");
Services.prefs.setCharPref("browser.safebrowsing.provider.google.lists", trimmedListV2);
let trimmedListV4 = origListV4.replace("goog-malware-proto,", "");
Services.prefs.setCharPref("browser.safebrowsing.provider.google4.lists", trimmedListV4);
try {
// Bug 1274685 - Unowned Safe Browsing tables break list updates
@@ -26,6 +29,6 @@ function run_test() {
} catch (e) {
ok(false, "Exception thrown due to " + e.toString());
}
Services.prefs.setCharPref("browser.safebrowsing.provider.google.lists", origList);
Services.prefs.clearUserPref("browser.safebrowsing.provider.google.lists");
Services.prefs.clearUserPref("browser.safebrowsing.provider.google4.lists");
}