Injects a script into a target context. The script is run at document_idle by default.
Note: This method is available in Manifest V3 or higher in Chrome and Firefox 101. In Safari and Firefox 102+, this method is also available in Manifest V2.
To use this API you must have the "scripting" permission and permission for the target's URL, either explicitly as a host permission or using the activeTab permission. Note that some special pages do not allow this permission, including reader view, view-source, and PDF viewer pages.
In Firefox and Safari, partial lack of host permissions can result in a successful execution (with the partial results in the resolved promise). In Chrome, any missing permission prevents any execution from happening (see Issue 1325114).
The scripts you inject are called content scripts.
This is an asynchronous function that returns a Promise.