author | Henry Chang <hchang@mozilla.com> |
Tue, 19 Jul 2016 23:31:00 -0400 | |
changeset 305838 | ad5230005e910448a8d1dc01083bdb86e5e2e6bf |
parent 305837 | 1afe2708eef591cbef2b709fe6bff6371d7dc3ab |
child 305839 | 2bb2126f4034aff15d68dd0d16eff0d861d47601 |
push id | 79679 |
push user | ryanvm@gmail.com |
push date | Wed, 20 Jul 2016 14:30:49 +0000 |
treeherder | mozilla-inbound@2bb2126f4034 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | francois |
bugs | 1264885 |
milestone | 50.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
modules/libpref/init/all.js | file | annotate | diff | comparison | revisions | |
toolkit/components/url-classifier/content/listmanager.js | file | annotate | diff | comparison | revisions |
--- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -5108,16 +5108,23 @@ pref("browser.safebrowsing.debug", false // The protocol version we communicate with google server. pref("browser.safebrowsing.provider.google.pver", "2.2"); pref("browser.safebrowsing.provider.google.lists", "goog-badbinurl-shavar,goog-downloadwhite-digest256,goog-phish-shavar,goog-malware-shavar,goog-unwanted-shavar"); pref("browser.safebrowsing.provider.google.updateURL", "https://safebrowsing.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2&key=%GOOGLE_API_KEY%"); pref("browser.safebrowsing.provider.google.gethashURL", "https://safebrowsing.google.com/safebrowsing/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"); pref("browser.safebrowsing.provider.google.reportURL", "https://safebrowsing.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); +// Prefs for v4. +pref("browser.safebrowsing.provider.google4.pver", "4"); +pref("browser.safebrowsing.provider.google4.lists", "goog-phish-proto,goog-malware-proto,goog-unwanted-proto"); +pref("browser.safebrowsing.provider.google4.updateURL", "https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$req=%REQUEST_BASE64%&$ct=application/x-protobuf&key=%GOOGLE_API_KEY%"); +pref("browser.safebrowsing.provider.google4.gethashURL", "https://safebrowsing.googleapis.com/v4/fullHashes:find?$req=%REQUEST_BASE64%&$ct=application/x-protobuf&key=%GOOGLE_API_KEY%"); +pref("browser.safebrowsing.provider.google4.reportURL", "https://safebrowsing.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); + pref("browser.safebrowsing.reportPhishMistakeURL", "https://%LOCALE%.phish-error.mozilla.com/?hl=%LOCALE%&url="); pref("browser.safebrowsing.reportPhishURL", "https://%LOCALE%.phish-report.mozilla.com/?hl=%LOCALE%&url="); pref("browser.safebrowsing.reportMalwareMistakeURL", "https://%LOCALE%.malware-error.mozilla.com/?hl=%LOCALE%&url="); // The table and global pref for blocking plugin content pref("browser.safebrowsing.blockedURIs.enabled", false); pref("urlclassifier.blockedTable", "test-block-simple,mozplugin-block-digest256");
--- a/toolkit/components/url-classifier/content/listmanager.js +++ b/toolkit/components/url-classifier/content/listmanager.js @@ -348,45 +348,63 @@ PROT_ListManager.prototype.makeUpdateReq return; } // An object of the form // { tableList: comma-separated list of tables to request, // tableNames: map of tables that need updating, // request: list of tables and existing chunk ranges from tableData // } var streamerMap = { tableList: null, tableNames: {}, request: "" }; + let useProtobuf = false; for (var tableName in this.tablesData) { // Skip tables not matching this update url if (this.tablesData[tableName].updateUrl != updateUrl) { continue; } + + // Check if |updateURL| is for 'proto'. (only v4 uses protobuf for now.) + // We use the table name 'goog-*-proto' and an additional provider "google4" + // to describe the v4 settings. + let isCurTableProto = tableName.endsWith('-proto'); + if (useProtobuf && !isCurTableProto) { + log('ERROR: Tables for the same updateURL should all be "proto" or none. ' + + 'Check "browser.safebrowsing.provider.google4.lists"'); + } + useProtobuf = isCurTableProto; + if (this.needsUpdate_[this.tablesData[tableName].updateUrl][tableName]) { streamerMap.tableNames[tableName] = true; } if (!streamerMap.tableList) { streamerMap.tableList = tableName; } else { streamerMap.tableList += "," + tableName; } } - // Build the request. For each table already in the database, include the - // chunk data from the database - var lines = tableData.split("\n"); - for (var i = 0; i < lines.length; i++) { - var fields = lines[i].split(";"); - var name = fields[0]; - if (streamerMap.tableNames[name]) { - streamerMap.request += lines[i] + "\n"; - delete streamerMap.tableNames[name]; + + if (useProtobuf) { + // TODO: Bug 1275507 - XPCOM API to build v4 update request. + streamerMap.request = ""; + } else { + // Build the request. For each table already in the database, include the + // chunk data from the database + var lines = tableData.split("\n"); + for (var i = 0; i < lines.length; i++) { + var fields = lines[i].split(";"); + var name = fields[0]; + if (streamerMap.tableNames[name]) { + streamerMap.request += lines[i] + "\n"; + delete streamerMap.tableNames[name]; + } } - } - // For each requested table that didn't have chunk data in the database, - // request it fresh - for (let tableName in streamerMap.tableNames) { - streamerMap.request += tableName + ";\n"; + // For each requested table that didn't have chunk data in the database, + // request it fresh + for (let tableName in streamerMap.tableNames) { + streamerMap.request += tableName + ";\n"; + } } log("update request: " + JSON.stringify(streamerMap, undefined, 2) + "\n"); // Don't send an empty request. if (streamerMap.request.length > 0) { this.makeUpdateRequestForEntry_(updateUrl, streamerMap.tableList, streamerMap.request);