Allow ScriptMessageHandlers to be registered with WebContext

Bug #1495284 reported by Chris Coulson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Oxide
Triaged
Medium
Unassigned

Bug Description

Currently UserScripts are registered with WebContext, but ScriptMessageHandlers (the bit that allows user scripts to communicate with message handlers in the browser) are registered with individual WebViews (or even WebFrames). I'm not sure this makes complete sense - imagine the following scenario:

- An embedder wants to provide a simple extension mechanism.
- The extension mechanism allows for UserScripts to be installed.
- The extension mechanism provides a simple browser-side script environment for running extension code in.
- The browser-side script environment allows the extension code to add message handlers to receive messages from its user script.

Today, the embedder would have to create a ScriptMessageHandler on every WebView in response to the extension code adding a message handler. It would also add extra complexity when initializing new WebViews.

We could avoid this by allowing ScriptMessageHandlers to be registered with the WebContext. In some ways this makes sense, given that UserScripts are already registered there, and ScriptMessageHandler is the mechanism by which UserScripts interface with browser code.

Changed in oxide:
importance: Undecided → Medium
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.