GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

Search e01

One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.

6 results across 6 corpora for runtime.onUserScriptMessage.

Developer library 6

Work with documentId

- runtime.MessageSender includes `documentId`, available in runtime.onConnect, runtime.onMessage, runtime.onMessageExternal, runtime.onConnectExternal, runtime.onUserScriptMessage, and runtime.onUserScriptConnect listeners. - scripting.executeScript() returns `documentId` in each `InjectionResult`. - userScripts.execute() results include `documentId`. - webNavigation.getAllFrames() returns `documentId` and `parentDoc

userScripts

h other parts of an extension with messages using runtime.sendMessage() and runtime.connect(). However, extensions receive messages using the dedicated runtime.onUserScriptMessage and runtime.onUserScriptConnect. Dedicated handlers are used as they make it easier to identify messages from user scripts, which are a less-trusted context. To enable messaging APIs, call userScripts.configureWorld() with the `messaging`

userScripts.WorldProperties

oolean`. Whether the runtime.sendMessage and runtime.connect methods are exposed to the user script world. Defaults to hiding these messaging APIs. The runtime.onUserScriptMessage and runtime.onUserScriptConnect event handlers are triggered when these methods are called. h2 ## Browser compatibility

runtime

ocess or a content script. - runtime.onMessageExternal - : Fired when a message is sent from another extension. Cannot be used in a content script. - runtime.onUserScriptMessage - : Fired when a message is sent from a user script registered by the extension. - runtime.onPerformanceWarning - : Fired when a runtime performance issue is detected for the extension. - runtime.onRestartRequired - : Fired when the d

runtime.onUserScriptMessage

ails about the message sender. - a `sendResponse` function the listener can use to send a response back to the sender. ## Syntax ```js-nolint browser.runtime.onUserScriptMessage.addListener(listener) browser.runtime.onUserScriptMessage.removeListener(listener) browser.runtime.onUserScriptMessage.hasListener(listener) ``` Events have three functions: - `addListener(listener)` - : Adds a listener to this event. -

runtime.MessageSender

e.onConnectExternal() listeners, it's a property of the `port` argument (runtime.Port). - messages in runtime.onMessage, runtime.onMessageExternal, and runtime.onUserScriptMessage listeners. ## Type Values of this type are objects. They contain the following properties: - `documentId` - : `string`. A UUID of the document that opened the connection. See the [Work with documentId](/docs/Mozilla/Add-ons/WebExtensi

JSON results · Services directory