@@ -89,6 +89,8 @@ const config = {
89
89
COLLECTOR_DIRECT_URL ,
90
90
COLLECTOR_PROXY_URL ,
91
91
CONFIG_URL : 'https://api.ghostery.net/api/v1/config' ,
92
+ SAFE_QUORUM_CONFIG_ENDPOINT :
93
+ 'https://safe-browsing-quorum.privacy.ghostery.net/config' ,
92
94
...platformSpecificSettings ( ) ,
93
95
} ,
94
96
request : {
@@ -107,6 +109,7 @@ const communication = new AnonymousCommunication({
107
109
const urlReporter = new UrlReporter ( {
108
110
config : config . url ,
109
111
storage : new Storage ( 'reporting' ) ,
112
+ connectDatabase : prefixedIndexedDBKeyValueStore ( 'reporting' ) ,
110
113
communication,
111
114
} ) ;
112
115
let requestReporter = null ;
@@ -176,10 +179,6 @@ const setup = asyncSetup([
176
179
} ) ,
177
180
] ) ;
178
181
179
- function delay ( timeInMs ) {
180
- return new Promise ( ( resolve ) => setTimeout ( resolve , timeInMs ) ) ;
181
- }
182
-
183
182
async function onLocationChange ( details ) {
184
183
try {
185
184
setup . pending && ( await setup . pending ) ;
@@ -220,15 +219,7 @@ async function onLocationChange(details) {
220
219
}
221
220
222
221
try {
223
- const jobRegistered = await urlReporter . analyzeUrl ( url ) ;
224
- if ( jobRegistered ) {
225
- // TODO: This part here is not robust:
226
- // we should avoid timers in MV3 or at least assume that we the service
227
- // worker will die (persisting the jobs and shift the scheduling
228
- // responsibility into the reporting module itself could help)
229
- await delay ( 2000 + 3000 * Math . random ( ) ) ;
230
- await urlReporter . processPendingJobs ( ) ;
231
- }
222
+ await urlReporter . analyzeUrl ( url ) ;
232
223
} catch ( e ) {
233
224
console . warn ( 'Unexpected error in reporting module:' , e ) ;
234
225
}
@@ -253,12 +244,13 @@ chrome.runtime.onMessage.addListener((msg, sender) => {
253
244
}
254
245
} ) ;
255
246
256
- // for debugging service-workers (TODO: provide a way to control logging)
247
+ // for debugging service-workers
257
248
globalThis . ghostery = globalThis . ghostery || { } ;
258
249
globalThis . ghostery . WTM = {
259
250
communication,
260
251
urlReporter,
261
252
requestReporter,
262
253
config,
263
254
webRequestPipeline,
255
+ extensionStartedAt : new Date ( ) ,
264
256
} ;
0 commit comments