File tree Expand file tree Collapse file tree 7 files changed +20
-10
lines changed
Expand file tree Collapse file tree 7 files changed +20
-10
lines changed Original file line number Diff line number Diff line change 55 * LICENSE file in the root directory of this source tree.
66 */
77
8+ import './globals' ;
9+
810import { DYNAMIC_STRING_MARKER , Origin , STATES } from './config' ;
911import { MESSAGE_TYPE , ORIGIN_HOST } from './config' ;
1012
Original file line number Diff line number Diff line change @@ -22,9 +22,7 @@ export async function getRecords(): Promise<
2222 [ string , { creationTime : number ; violations : Array < Violation > ; url : string } ]
2323 >
2424> {
25- const tabIDs = await chrome . storage . local . getKeys ( ) ;
26- const entries = await chrome . storage . local . get ( tabIDs ) ;
27- return Object . entries ( entries ) ;
25+ return Object . entries ( await chrome . storage . local . get ( null ) ) ;
2826}
2927
3028export async function downloadHashSource (
@@ -105,10 +103,8 @@ export async function trackViolationForTab(
105103
106104export async function setUpHistoryCleaner ( ) : Promise < void > {
107105 const now = Date . now ( ) ;
108- const keys = await chrome . storage . local . getKeys ( ) ;
109- const entries = await chrome . storage . local . get ( keys ) ;
110106
111- const entriesToDelete = Object . entries ( entries )
107+ const entriesToDelete = ( await getRecords ( ) )
112108 . filter ( ( [ _keys , entry ] ) => now - entry . creationTime >= HISTORY_TTL_MSEC )
113109 . map ( entry => entry [ 0 ] ) ;
114110
Original file line number Diff line number Diff line change 55 * LICENSE file in the root directory of this source tree.
66 */
77
8+ import './globals' ;
9+
810import {
911 MESSAGE_TYPE ,
1012 DOWNLOAD_SRC_ENABLED ,
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ // See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities
9+ // To enable Promise APIs we need to use `browser` outside of Chrome
10+ self . chrome = self . browser ?? self . chrome ;
Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ declare global {
2222 showSaveFilePicker : ( _ : {
2323 suggestedName : string ;
2424 } ) => Promise < FileSystemFileHandle > ;
25- }
26- interface FileSystemFileHandle {
27- createWritable : ( ) => Promise < WritableStream > ;
25+ browser : typeof chrome ;
2826 }
2927}
Original file line number Diff line number Diff line change 55 * LICENSE file in the root directory of this source tree.
66 */
77
8+ import '../globals' ;
9+
810import type { Origin , State } from '../config' ;
911import {
1012 DOWNLOAD_SRC_ENABLED ,
Original file line number Diff line number Diff line change 55 "moduleResolution" : " node" ,
66 "noFallthroughCasesInSwitch" : true ,
77 "strict" : true ,
8- "target" : " ES6 "
8+ "target" : " ES2017 "
99 }
1010}
You can’t perform that action at this time.
0 commit comments