(url: string | null | undefined)
| 3 | import {isPDF} from '../../utils/url'; |
| 4 | |
| 5 | export function canInjectScript(url: string | null | undefined): boolean { |
| 6 | if (url === 'about:blank') { |
| 7 | return false; |
| 8 | } |
| 9 | if (isFirefox) { |
| 10 | return Boolean(url |
| 11 | && !url.startsWith('about:') |
| 12 | && !url.startsWith('moz') |
| 13 | && !url.startsWith('view-source:') |
| 14 | && !url.startsWith('resource:') |
| 15 | && !url.startsWith('chrome:') |
| 16 | && !url.startsWith('jar:') |
| 17 | && !url.startsWith('https://addons.mozilla.org/') |
| 18 | && !isPDF(url) |
| 19 | ); |
| 20 | } |
| 21 | if (isEdge) { |
| 22 | return Boolean(url |
| 23 | && !url.startsWith('chrome') |
| 24 | && !url.startsWith('data') |
| 25 | && !url.startsWith('devtools') |
| 26 | && !url.startsWith('edge') |
| 27 | && !url.startsWith('https://chrome.google.com/webstore') |
| 28 | && !url.startsWith('https://chromewebstore.google.com/') |
| 29 | && !url.startsWith('https://microsoftedge.microsoft.com/addons') |
| 30 | && !url.startsWith('view-source') |
| 31 | ); |
| 32 | } |
| 33 | return Boolean(url |
| 34 | && !url.startsWith('chrome') |
| 35 | && !url.startsWith('https://chrome.google.com/webstore') |
| 36 | && !url.startsWith('https://chromewebstore.google.com/') |
| 37 | && !url.startsWith('data') |
| 38 | && !url.startsWith('devtools') |
| 39 | && !url.startsWith('view-source') |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | export async function readSyncStorage<T extends {[key: string]: any}>(defaults: T): Promise<T | null> { |
| 44 | return new Promise<T | null>((resolve) => { |
no test coverage detected
searching dependent graphs…