diff --git a/extension-manifest-v2/package.json b/extension-manifest-v2/package.json index 33a1e7504..002a529cc 100644 --- a/extension-manifest-v2/package.json +++ b/extension-manifest-v2/package.json @@ -45,7 +45,7 @@ "@ghostery/trackers-preview": "^1.0.0", "@ghostery/ui": "^1.0.0", "@sentry/browser": "7.1.1", - "@whotracksme/webextension-packages": "^4.0.6", + "@whotracksme/webextension-packages": "^5.0.0", "classnames": "^2.3.2", "d3": "^7.8.5", "foundation-sites": "^6.6.2", diff --git a/extension-manifest-v3/package.json b/extension-manifest-v3/package.json index c9a75c0cb..e5485ffa6 100644 --- a/extension-manifest-v3/package.json +++ b/extension-manifest-v3/package.json @@ -38,7 +38,7 @@ "@ghostery/trackers-preview": "^1.0.0", "@ghostery/ui": "^1.0.0", "@github/relative-time-element": "^4.3.0", - "@whotracksme/webextension-packages": "^4.0.6", + "@whotracksme/webextension-packages": "^5.0.0", "hybrids": "^8.2.5", "idb": "^7.1.1", "jwt-decode": "^4.0.0", diff --git a/extension-manifest-v3/src/background/reporting/index.js b/extension-manifest-v3/src/background/reporting/index.js index f10784330..1ac2cc9ba 100644 --- a/extension-manifest-v3/src/background/reporting/index.js +++ b/extension-manifest-v3/src/background/reporting/index.js @@ -89,6 +89,8 @@ const config = { COLLECTOR_DIRECT_URL, COLLECTOR_PROXY_URL, CONFIG_URL: 'https://api.ghostery.net/api/v1/config', + SAFE_QUORUM_CONFIG_ENDPOINT: + 'https://safe-browsing-quorum.privacy.ghostery.net/config', ...platformSpecificSettings(), }, request: { @@ -107,6 +109,7 @@ const communication = new AnonymousCommunication({ const urlReporter = new UrlReporter({ config: config.url, storage: new Storage('reporting'), + connectDatabase: prefixedIndexedDBKeyValueStore('reporting'), communication, }); let requestReporter = null; @@ -176,10 +179,6 @@ const setup = asyncSetup([ }), ]); -function delay(timeInMs) { - return new Promise((resolve) => setTimeout(resolve, timeInMs)); -} - async function onLocationChange(details) { try { setup.pending && (await setup.pending); @@ -220,15 +219,7 @@ async function onLocationChange(details) { } try { - const jobRegistered = await urlReporter.analyzeUrl(url); - if (jobRegistered) { - // TODO: This part here is not robust: - // we should avoid timers in MV3 or at least assume that we the service - // worker will die (persisting the jobs and shift the scheduling - // responsibility into the reporting module itself could help) - await delay(2000 + 3000 * Math.random()); - await urlReporter.processPendingJobs(); - } + await urlReporter.analyzeUrl(url); } catch (e) { console.warn('Unexpected error in reporting module:', e); } @@ -253,7 +244,7 @@ chrome.runtime.onMessage.addListener((msg, sender) => { } }); -// for debugging service-workers (TODO: provide a way to control logging) +// for debugging service-workers globalThis.ghostery = globalThis.ghostery || {}; globalThis.ghostery.WTM = { communication, @@ -261,4 +252,5 @@ globalThis.ghostery.WTM = { requestReporter, config, webRequestPipeline, + extensionStartedAt: new Date(), }; diff --git a/package-lock.json b/package-lock.json index 5dd48b53f..8444d1c0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "@ghostery/trackers-preview": "^1.0.0", "@ghostery/ui": "^1.0.0", "@sentry/browser": "7.1.1", - "@whotracksme/webextension-packages": "^4.0.6", + "@whotracksme/webextension-packages": "^5.0.0", "classnames": "^2.3.2", "d3": "^7.8.5", "foundation-sites": "^6.6.2", @@ -117,7 +117,7 @@ "@ghostery/trackers-preview": "^1.0.0", "@ghostery/ui": "^1.0.0", "@github/relative-time-element": "^4.3.0", - "@whotracksme/webextension-packages": "^4.0.6", + "@whotracksme/webextension-packages": "^5.0.0", "hybrids": "^8.2.5", "idb": "^7.1.1", "jwt-decode": "^4.0.0", @@ -3820,9 +3820,9 @@ } }, "node_modules/@whotracksme/webextension-packages": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@whotracksme/webextension-packages/-/webextension-packages-4.0.6.tgz", - "integrity": "sha512-6eaEgYdupYC002qYQ4QBPcWstRX0p05hX2dmsz+ccCQOeXHHoL3O/WPfDwn1IOOeyp7wcgKgbfOc+MPOhpXTbQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@whotracksme/webextension-packages/-/webextension-packages-5.0.0.tgz", + "integrity": "sha512-HQtdQFFfhlEyrtqKRIuWqJ/KNDvPTtCiSHo39EWEhxpHyBMFEibPwg9dbVv3KlxRFL1SLsfC/wluyNE75HX5RA==", "dependencies": { "@cliqz/url-parser": "^1.1.5", "date-fns": "^2.29.3",