Skip to content
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

feat: parse SharedArrayBuffer and validate AllowShared #747

Merged
merged 4 commits into from
Jun 26, 2023
Merged

Conversation

saschanaz
Copy link
Member

This patch closes #746 and includes:

  • A relevant test
  • A relevant documentation update

if (this.idlType === "BufferSource") {
// XXX: For now this is a hack. Consider moving parents' extAttrs into types as the spec says:
// https://webidl.spec.whatwg.org/#idl-annotated-types
for (const extAttrs of [this.extAttrs, this.parent?.extAttrs]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be [this.extAttrs, this.parent?.extAttrs].flat() to avoid the second for loop?

Copy link
Member

@marcoscaceres marcoscaceres Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, maybe also... to flatten to code a little more:

for (const extAttr of [this.extAttrs, this.parent?.extAttrs].flat()) {
   if (extAttr.name !== "AllowShared") continue;
   // the rest... 
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That way the autofix won't know which array includes the attr and it'll need to rescan 😬

Copy link
Member

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a style nit.

@saschanaz saschanaz merged commit 164675c into main Jun 26, 2023
@saschanaz saschanaz deleted the allowshared branch June 26, 2023 11:55
pyoor added a commit to pyoor/gecko-webidl that referenced this pull request Jul 5, 2023
Since w3c/webidl2.js#747, webidl2 treats
SharedArrayBuffer as an inline type which breaks parsing of gecko IDLs.
saschanaz pushed a commit to mozilla/gecko-webidl that referenced this pull request Jul 11, 2023
Since w3c/webidl2.js#747, webidl2 treats
SharedArrayBuffer as an inline type which breaks parsing of gecko IDLs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Give SharedArrayBuffer a dedicated type
2 participants