override `importScripts` with error-function so that web extension cannot use...

override `importScripts` with error-function so that web extension cannot use them, https://github.com/microsoft/vscode/issues/128080
上级 9f4c43ff
......@@ -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);
......@@ -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`);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册