Use SetIntegrityLevel instead of Object.freeze()#125
Conversation
Verbose, but clear and correct. Fixes #74.
beverloo
left a comment
There was a problem hiding this comment.
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.
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.
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