Skip to content

Commit

Permalink
override importScripts with error-function so that web extension ca…
Browse files Browse the repository at this point in the history
…nnot use them, microsoft#128080
  • Loading branch information
jrieken committed Jul 14, 2021
1 parent 9f4c43f commit 28f4bd6
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ declare namespace self {
let dispatchEvent: any;
let indexedDB: { open: any, [k: string]: any };
let caches: { open: any, [k: string]: any };
let importScripts: any;
}

const nativeClose = self.close.bind(self);
Expand All @@ -39,6 +40,8 @@ self.close = () => console.trace(`'close' has been blocked`);
const nativePostMessage = postMessage.bind(self);
self.postMessage = () => console.trace(`'postMessage' has been blocked`);

self.importScripts = () => { throw new Error(`'importScripts' has been blocked`); };

// const nativeAddEventListener = addEventListener.bind(self);
self.addEventListener = () => console.trace(`'addEventListener' has been blocked`);

Expand Down

0 comments on commit 28f4bd6

Please sign in to comment.