-
Notifications
You must be signed in to change notification settings - Fork 49
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
Use SetIntegrityLevel instead of Object.freeze() #125
base: main
Are you sure you want to change the base?
Conversation
Verbose, but clear and correct. Fixes #74.
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.
LGTM from a functional point of view. (John no longer works on Chrome.)
<li><p>Append <var>action</var> to <var>frozenActions</var>. | ||
<li><p>Perform <a abstract-op>SetIntegrityLevel</a>(<var>jsAction</var>, "frozen"). | ||
|
||
<li><p>Let <var>idlAction</var> be <var>jsAction</var>, <a>converted to an IDL value</a>. |
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 isn't correct, at least as written. The conversion, presumably to an IDL NotificationAction
type (although that isn't stated), will re-perform the Get()s of all the properties, which can be observable if Object.prototype is modified. Then we'll convert back to JS in the binding layer.
I don't think there's any way to do this rigorously as long as your return type is FrozenArray<NotificationAction>
(instead of FrozenArray<object>
). The conversion between JS objects and dictionaries is observable and side effecting.
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 cannot use FrozenArray
then either since it's constructor takes an IDL value. I'm not sure I want to inline all of that. That would be rather bad and I'd likely make mistakes or it would result in mismatches down the line.
There is some mismatch here though with implementations I think where JS values are backed by IDL values and you can manipulate either. That's not conversion, but just grabbing the corresponding value, but IDL doesn't formalize that.
Verbose, but clear and correct.
Fixes #74.
Preview | Diff