(
allowlist:
| {
defaults: string[];
current: string[];
}
| undefined
)
| 20 | // In case the defaults change over time, reconcile the saved setting with the |
| 21 | // new default allowlist. |
| 22 | export function computeAllowlist( |
| 23 | allowlist: |
| 24 | | { |
| 25 | defaults: string[]; |
| 26 | current: string[]; |
| 27 | } |
| 28 | | undefined |
| 29 | ): string[] { |
| 30 | if (allowlist === undefined) { |
| 31 | allowlist = { |
| 32 | defaults: [], |
| 33 | current: [], |
| 34 | }; |
| 35 | } |
| 36 | for (const newDefault of defaultAllowlist) { |
| 37 | if (!allowlist.defaults.includes(newDefault) && !allowlist.current.includes(newDefault)) { |
| 38 | allowlist.current.push(newDefault); |
| 39 | } |
| 40 | } |
| 41 | for (const oldDefault of allowlist.defaults) { |
| 42 | if (!defaultAllowlist.includes(oldDefault) && allowlist.current.includes(oldDefault)) { |
| 43 | allowlist.current.splice(allowlist.current.indexOf(oldDefault), 1); |
| 44 | } |
| 45 | } |
| 46 | return allowlist.current; |
| 47 | } |
| 48 | |
| 49 | export function getStorageData(): Promise<Storage> { |
| 50 | return new Promise((resolve, reject) => { |
no outgoing calls
no test coverage detected