mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
Prevent chrome API access (#583)
`chrome.runtime.connect` & `chrome.runtime.sendMessage` are still accessible to userscripts.
This commit is contained in:
@@ -18,6 +18,7 @@ globalThis.initCustomAPIForUserScripts = grants => {
|
||||
// Clear access to privileged API to prevent userscripts from communicating
|
||||
// to the privileged backend.
|
||||
globalThis.browser = undefined;
|
||||
globalThis.chrome = undefined;
|
||||
|
||||
if (grants.includes("GM_info")) {
|
||||
// Example of an API that retrieves information:
|
||||
|
||||
Reference in New Issue
Block a user