-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Clarify text about host added properties #301
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -357,10 +357,25 @@ <h1>Runtime Semantics: HostInitializeSyntheticRealm ( _realm_ )</h1> | |
operation used to inform the host of any newly created realms from | ||
the Realm constructor. Its return value is not used, though it may | ||
throw an exception. The idea of this hook is to initialize host | ||
data structures related to the Realm, e.g., for module loading. It | ||
is not expected that this hook would add properties to the Realm's | ||
global object. | ||
data structures related to the Realm, e.g., for module loading. | ||
</p> | ||
<p> | ||
The host may use this hook to add properties to the Realm's global | ||
object. Those properties must each be configurable to provide | ||
platform capabilities with no authority to cause side effects such | ||
as I/O or mutation of values that are shared across different | ||
realms within the same host environment. | ||
</p> | ||
<emu-note> | ||
<p> | ||
This specification does not recommend any specific addition. | ||
In the Web embedding, HTML and WebIDL will specify which | ||
interfaces are included. The Web Platform and Web-like | ||
environments may decide to include `setTimeout`, `EventTarget`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK setTimeout is IO. And as I explained in #284 I strongly against the host being able to add things into the realm without being able to have a clean version. This also hurts the API to be cross-platform safe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just an editorial note and we can remove the example. Anyway, please keep the discussion to the respective issue. |
||
`atob`, `TextEncoder`, `URL`, etc. while at the same time not | ||
including `HTMLElement`, `console`, `localStorage`, `fetch`, etc.. | ||
</p> | ||
</emu-note> | ||
</emu-clause> | ||
|
||
<emu-clause id="sec-hostimportmodulebindingdynamically" aoid="HostImportModuleBindingDynamically"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not enough for the SES requirement.
Imagine the host provide a
counter { [[Get]]: () => #counter, [[Set]]: (val) => #counter = val }
property on the Realm's global object, this provides a shared global state within the Realm (not shared across different realms). It provides a communication channel in the different compartments within the same realm.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I read the text to cover that case--I see the code sample as a value shared across realms, at a high level. I guess we just need to iterate on the wording so that it's maximally clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
#counter
is a host-defined pre-realm internal state, it will be a mutable state within the Realm and passes the current spec text but violate the SES requirement.