In chrome there is [chrome.debugger API](https://developer.chrome.com/docs/extensions/reference/api/debugger) that allows debugging pages using Chrome DevTools Protocol (CDP). This gives access to a lot of functions including the ability to inject in non-global functions.
In chrome there is chrome.debugger API that allows debugging pages using Chrome DevTools Protocol (CDP).
This gives access to a lot of functions including the ability to inject in non-global functions.