Support [AllowResizable], [AllowShared], SharedArrayBuffer, and AllowSharedBufferSource#276
Conversation
|
@domenic Could you assign some reviewer(s) to this PR? I can't seem to do it myself. |
|
I'll still work on jsdom stuff, don't worry. I plan to review this tomorrow :) |
|
I appreciate the separate commits; it made reviewing this easier. If you're up for some rebase-fu, here are some minor notes:
Or, if you prefer, we can just do a big squash-and-merge with a sufficiently-detailed commit message. |
3fa69ce to
2a4057d
Compare
Previously, ArrayBufferView objects were always returned as-is. However, we now need to emit dedicated conversions to support extended attributes such as [AllowResizable] and [AllowShared]. See https://webidl.spec.whatwg.org/#js-buffer-source-types
2a4057d to
71c3e58
Compare
This also fixes the crash reported in jsdom#231.
71c3e58 to
47447ef
Compare
domenic
left a comment
There was a problem hiding this comment.
Awesome stuff, thank you!
The repeated conversions for unions with primitives are a bit strange, but I see the follow the spec exactly. (I.e. https://webidl.spec.whatwg.org/#js-union steps 13.1 + 17.)
Probably some optimizations are possible for simple unions. But I think the right tactic there would be to work on the more general project of slimming down the generated code, driven by analyzing all of jsdom to see what are the worst offenders weighted by web platform prevalence.
SharedArrayBufferis now a separate IDL type, and[AllowShared] BufferSourcehas been replaced with a newAllowSharedBufferSourcetypedef.[AllowResizable]and[AllowShared], which need to be checked bywebidl-conversions. Thus, we now generate the appropriate conversion calls.allowResizableto (Shared)ArrayBuffer conversions webidl-conversions#51.objecttype in unions.objecttype is in a union #231.