Skip to content

Conversation

@tommckee1
Copy link
Member

@tommckee1 tommckee1 commented Jul 10, 2019

According to the Web IDL spec, section 2.5.3 (some formatting is mine):

If

  • the type of an argument is a dictionary type or a union type that has
    a dictionary type as one of its flattened member types,
  • and that dictionary type and its ancestors have no required members,
  • and the argument is either the final argument or is followed only by
    optional arguments,

then the argument must be specified as optional and have a default value
provided.

IIUC, the 'startOrOptions' parameter for Performance.Measure falls into
the category where it needs to be marked optional and given a default
value. Right now it is marked optional but does not have a default
value.

This change adds a default value of an empty dictionary for the
startOrOptions parameter. This should not change any user-visible
behaviour because an omitted paremeter would have been treated as an
empty dictionary in the bindings layer anyways.


Preview | Diff

According to the Web IDL spec, section 2.5.3 (some formatting is mine):

If
- the type of an argument is a dictionary type or a union type that has
a dictionary type as one of its flattened member types,
- and that dictionary type and its ancestors have no required members,
- and the argument is either the final argument or is followed only by
optional arguments,

then the argument must be specified as optional and have a default value
provided.

IIUC, the 'startOrOptions' parameter for Performance.Measure falls into
the category where it needs to be marked optional and given a default
value. Right now it is marked optional but does not have a default
value.

This change adds a default value of an empty dictionary for the
startOrOptions parameter. This should not change any user-visible
behaviour because an omitted paremeter would have been treated as an
empty dictionary in the bindings layer anyways.
@npm1
Copy link
Contributor

npm1 commented Jul 10, 2019

This was a recent addition in whatwg/webidl#750. Chrome currently is not even able to parse such language, see https://bugs.chromium.org/p/chromium/issues/detail?id=948139#c6. Therefore, I'm unsure if we should immediately attempt to follow this rule. We (and possibly other browser vendors) cannot implement it until bindings has been fixed. @yoavweiss thoughts?

@npm1
Copy link
Contributor

npm1 commented Jul 10, 2019

Also the ipr failure needs to be fixed https://labs.w3.org/repo-manager/pr/id/w3c/user-timing/65
I think this is fixed by linking your GitHub account to a W3C account or something of the sort.

@tommckee1
Copy link
Member Author

tommckee1 commented Jul 12, 2019

Oops, I didn't realize that change to IDL was so new. +1 for waiting to merge until IDL support is updated.

For the ipr failure, I think I linked my accounts up correctly...
https://www.w3.org/users/116347 shows me as affiliated with Google and
https://www.w3.org/users/116347/connectedaccounts lists @tommckee1 as associated to the w3c identity
But, when I go to https://labs.w3.org/repo-manager/pr/id/w3c/user-timing/65 and click the "Revalidate" button, I get a fetch failure...

Are there any other steps that need to be done?

@marcoscaceres
Copy link
Member

Marked as non substantive for IPR from ash-nazg.

@marcoscaceres marcoscaceres requested review from npm1 and yoavweiss July 14, 2019 09:13
@marcoscaceres
Copy link
Member

Catching up on comments... we implement the new syntax in Gecko.

Co-Authored-By: Marcos Cáceres <marcos@marcosc.com>
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 noting Chromium can’t parse this syntax yet, but otherwise all good. It has no noticeable change in userland code.

@marcoscaceres
Copy link
Member

Oops, thought this was a new pull request. Serves me right for reviewing stuff on my phone 😊

Copy link
Contributor

@npm1 npm1 left a comment

Choose a reason for hiding this comment

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

Looks like ReSpec is marking in red the whole WebIDL section just because it fails to contain the newly added "{}" syntax. That seems a bit excessive. LGTM to make the spec pretty again.

@npm1 npm1 merged commit 6198dcf into w3c:gh-pages Jul 17, 2019
@npm1
Copy link
Contributor

npm1 commented Jul 17, 2019

Missed one in the constructor of PerformanceMark if you want to do another PR for that @tommckee1 :)

tommckee1 added a commit to tommckee1/user-timing that referenced this pull request Jul 17, 2019
Similar to w3c#65 but the
'markOptions' argument to the PerformanceMark constructor needs a
default value too.
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.

3 participants