Bug 1531176 - Split the Google key management between gls and safe browsing r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D21459
This commit is contained in:
Sylvestre Ledru
2019-03-07 11:31:18 +00:00
parent 087f793bfd
commit cb15c544b5
20 changed files with 57 additions and 33 deletions

View File

@@ -352,10 +352,10 @@ var SafeBrowsing = {
gethashURL = gethashURL.replace("SAFEBROWSING_ID", clientID);
// Disable updates and gethash if the Google API key is missing.
let googleKey = Services.urlFormatter.formatURL("%GOOGLE_API_KEY%").trim();
let googleSBKey = Services.urlFormatter.formatURL("%GOOGLE_SAFEBROWSING_API_KEY%").trim();
if ((provider == "google" || provider == "google4") &&
(!googleKey || googleKey == "no-google-api-key")) {
log("Missing Google API key, clearing updateURL and gethashURL.");
(!googleSBKey || googleSBKey == "no-google-safebrowsing-api-key")) {
log("Missing Google SafeBrowsing API key, clearing updateURL and gethashURL.");
updateURL = "";
gethashURL = "";
}

View File

@@ -60,7 +60,7 @@ for (let pref of prefs) {
var listmanager = Cc["@mozilla.org/url-classifier/listmanager;1"].
getService(Ci.nsIUrlListManager);
let googleKey = SpecialPowers.Services.urlFormatter.formatURL("%GOOGLE_API_KEY%").trim();
let googleKey = SpecialPowers.Services.urlFormatter.formatURL("%GOOGLE_SAFEBROWSING_API_KEY%").trim();
for (let list of lists) {
if (!list)
@@ -75,7 +75,7 @@ for (let list of lists) {
let provider = listsToProvider[index];
let pref = "browser.safebrowsing.provider." + provider + ".gethashURL";
if ((provider == "google" || provider == "google4") &&
(!googleKey || googleKey == "no-google-api-key")) {
(!googleKey || googleKey == "no-google-safebrowsing-api-key")) {
is(url, "", "getHash url of " + list + " should be empty");
} else {
is(url, SpecialPowers.getCharPref(pref), list + " matches its gethash url");