A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Component Model IDL Brainstorming

From WHATWG Wiki
Jump to navigation Jump to search

RolandSteiner This may be obsoleted by the Proxy approach for isolation.

Overview

Components, along with other web constructs such as workers and <iframe> elements, may benefit from having their interfaces declared explicitly. This would be especially useful in the case of confined components, who cannot be trusted to run scripts to effect subclassing and forwarding function calls between the hosting element and the shadow DOM. The following is therefore a proposal for a declarative way to define the interface, that the browser then can safely inspect and use as a basis to set up such forwarding automatically.

Perceived Advantages

All of the following may look very verbose, and could probably be implemented much quicker in pure JavaScript. However, this approach still conceivably has the following advantages:

  • Can be used where JavaScript cannot be run, e.g. due to confinement
    • Browser can automatically use the definitions to set up and abstract away postMessage() calls, etc., that are necessary to bridge the separation
    • Browser can even use magic to handle the forwarding and does not have to rely on postMessage() or other functions available in JavaScript
  • Not component-specific, could be used for workers, <iframes>, intents
  • Same definitions can be used cross-language (not limited to JavaScript)