Closed Bug 1141916 Opened 9 years ago Closed 8 years ago

support [ChromeOnly] on dictionary members

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: heycam, Assigned: heycam)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

In bug 1123523 I want to add a [ChromeOnly] dictionary member to MutationObserverInit, for an observation option that should only be available to chrome code.

The behaviour I'll go for is:

* when converting from a JS object in non-chrome code, [ChromeOnly]
  dictionary members are treated as if they weren't specified
* when converting to a JS object in non-chrome code, [ChromeOnly] dictionary
  members never get a property set on the JS object
* [ChromeOnly] can't be used on required dictionary members
* [ChromeOnly] can't be used on a dictionary member if there is a
  [Cached] or [StoreInSlot] attribute somewhere whose type ultimately
  includes that dictionary member -- otherwise this would mean whether the
  property exists on the JS object depends on whether chrome or non-chrome
  code happens to get the attribute first
Blocks: 1123523
The plan in comment 0 sounds good; we should be able to drop the fourth bullet point once we fix bug 946906.  Maybe file a followup on that?
Let me know if (and how) I should add a test for this.
Blocks: 1141918
Blocks: 1143271
No longer blocks: 1123523
Comment on attachment 8575770 [details] [diff] [review]
Part 2: Support [ChromeOnly] on dictionary members.

Review of attachment 8575770 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bindings/parser/WebIDL.py
@@ +3317,5 @@
> +                    return (True, location)
> +                if dictionary.parent:
> +                    (contains, location) = dictionaryContainsChromeOnlyMember(dictionary.parent)
> +                    if contains:
> +                        return (True, location)

Shouldn't this be a while loop?

dictionary = type.inner
while dictionary:
  ...
  dictionary = dictionary.parent
Attachment #8575770 - Flags: review?(peterv) → review+
Attachment #8575769 - Flags: review?(peterv) → review+
This never landed?
Flags: needinfo?(cam)
> Shouldn't this be a while loop?

Yes, it should.
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f34508f1a4a0
Part 1: Store extended attributes on IDLArguments.  r=peterv
https://hg.mozilla.org/integration/mozilla-inbound/rev/b4555556428e
Part 2: Support [ChromeOnly] on dictionary members. r=peterv
Added a webidl parser test that would catch the bug comment 5 pointed out, fixed the code, and checked this in.
Flags: needinfo?(cam)
https://hg.mozilla.org/mozilla-central/rev/f34508f1a4a0
https://hg.mozilla.org/mozilla-central/rev/b4555556428e
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.