mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-17 23:08:33 +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
|
// Clear access to privileged API to prevent userscripts from communicating
|
||||||
// to the privileged backend.
|
// to the privileged backend.
|
||||||
globalThis.browser = undefined;
|
globalThis.browser = undefined;
|
||||||
|
globalThis.chrome = undefined;
|
||||||
|
|
||||||
if (grants.includes("GM_info")) {
|
if (grants.includes("GM_info")) {
|
||||||
// Example of an API that retrieves information:
|
// Example of an API that retrieves information:
|
||||||
|
|||||||
Reference in New Issue
Block a user