Closed
Bug 918011
Opened 11 years ago
Closed 11 years ago
Support dictionaries inside unions
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(5 files, 1 obsolete file)
73.02 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
20.24 KB,
patch
|
khuey
:
review+
|
Details | Diff | Splinter Review |
11.12 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
7.91 KB,
patch
|
Details | Diff | Splinter Review | |
23.38 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
This will work as long as the dictionaries inside the union are in separate webidl files.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #806834 -
Flags: review?(bugs)
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #806836 -
Flags: review?(bugs)
Comment 3•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #0)
> This will work as long as the dictionaries inside the union are in separate
> webidl files.
Somewhat odd limitation. What happens if dictionaries are in the same file?
Comment 4•11 years ago
|
||
Comment on attachment 806834 [details] [diff] [review]
part 1. Move RootedDictionary into its own header.
Uh, painful diff. I guess it is right.
Stuff copied to RootedDictionary.h, remove from the original file and
stuff in the original file removed from RootedDictionary.h
Attachment #806834 -
Flags: review?(bugs) → review+
Comment 5•11 years ago
|
||
Comment on attachment 806836 [details] [diff] [review]
part 2. Support dictionaries in unions.
This needs some tests.
Attachment #806836 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 6•11 years ago
|
||
> What happens if dictionaries are in the same file?
In the case when dictionary X has a union containing dictionary Y in it and X and Y are in the same Foo.webidl, FooBinding.h will include UnionTypes.h which will try to include FooBinding.h, fail due to include guards, and then sizeof(Y) will be unknown in UnionTypes.h and declaring the union will fail and the compile will fail. With a possibly-hard-to-understand-if-you-haven't-read-this-comment error message. :(
> Uh, painful diff.
Sorry. Wanted to preserve the blame. :(
> This needs some tests.
I did a bunch of manual testing. Adding codegen tests would link the resulting code into release builds, which is undesirable. Our union-testing situation sucks.
Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(bugs)
Comment 7•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #6)
> > What happens if dictionaries are in the same file?
>
> In the case when dictionary X has a union containing dictionary Y in it and
> X and Y are in the same Foo.webidl, FooBinding.h will include UnionTypes.h
> which will try to include FooBinding.h, fail due to include guards, and then
> sizeof(Y) will be unknown in UnionTypes.h and declaring the union will fail
> and the compile will fail. With a
> possibly-hard-to-understand-if-you-haven't-read-this-comment error message.
> :(
I there anything we could do here. At least give some sane error message. It would be rather
natural to put dictionaries to the same file and use them there in an union.
> Sorry. Wanted to preserve the blame. :(
Yes, blame is more important than easy review.
> I did a bunch of manual testing. Adding codegen tests would link the
> resulting code into release builds, which is undesirable. Our
> union-testing situation sucks.
Hmm, would debug-build only tests be ok?
Flags: needinfo?(bugs)
Assignee | ||
Comment 8•11 years ago
|
||
> At least give some sane error message.
I can probably hack in something like that. Let me try.
> would debug-build only tests be ok?
Hmm. Yes. I guess I can add some debug-only test IDL...
Assignee | ||
Comment 9•11 years ago
|
||
Good news: writing the tests found some bugs.
Bad news: that means another patch to review.
Good news: The resulting code is way cleaner.
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #807990 -
Flags: review?(khuey)
Assignee | ||
Comment 11•11 years ago
|
||
Attachment #807992 -
Flags: review?(bugs)
Assignee | ||
Comment 12•11 years ago
|
||
Assignee | ||
Comment 13•11 years ago
|
||
Attachment #807995 -
Flags: review?(bugs)
Assignee | ||
Updated•11 years ago
|
Attachment #806836 -
Attachment is obsolete: true
Comment 14•11 years ago
|
||
Comment on attachment 807995 [details] [diff] [review]
part 4. Support dictionaries in unions.
what happens for example if one does (EventInit or MutationObserverInit) ?
I assume some error.
Attachment #807995 -
Flags: review?(bugs) → review+
Updated•11 years ago
|
Attachment #807992 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 15•11 years ago
|
||
> what happens for example if one does (EventInit or MutationObserverInit) ?
WebIDL validation error: dictionary types are not distinguishable, so you can't use two of them in a union.
Comment on attachment 807990 [details] [diff] [review]
part 2. Preprocess some of our test WebIDL files so we can have debug-only tests.
Review of attachment 807990 [details] [diff] [review]:
-----------------------------------------------------------------
r=me if nfroyd didn't bit rot this.
::: dom/webidl/moz.build
@@ +532,5 @@
> + 'TestCodeGen.webidl',
> + 'TestExampleGen.webidl',
> + 'TestJSImplGen.webidl',
> + ]
> +
nit: whitespace on empty line
Attachment #807990 -
Flags: review?(khuey) → review+
Comment 17•11 years ago
|
||
Comment on attachment 807990 [details] [diff] [review]
part 2. Preprocess some of our test WebIDL files so we can have debug-only tests.
Review of attachment 807990 [details] [diff] [review]:
-----------------------------------------------------------------
::: python/mozbuild/mozbuild/frontend/emitter.py
@@ +23,5 @@
> PreprocessedWebIDLFile,
> Program,
> ReaderSummary,
> TestWebIDLFile,
> + PreprocessedTestWebIDLFile,
Nit: alphabetize.
Assignee | ||
Comment 18•11 years ago
|
||
Fixed the nits, and:
https://hg.mozilla.org/integration/mozilla-inbound/rev/45e3854df7fe
https://hg.mozilla.org/integration/mozilla-inbound/rev/2da382c02bcf
https://hg.mozilla.org/integration/mozilla-inbound/rev/a7192af15890
https://hg.mozilla.org/integration/mozilla-inbound/rev/ea71558fef5b
Flags: needinfo?(bzbarsky)
Keywords: dev-doc-needed
Whiteboard: [need review]
Target Milestone: --- → mozilla27
Comment 19•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/45e3854df7fe
https://hg.mozilla.org/mozilla-central/rev/2da382c02bcf
https://hg.mozilla.org/mozilla-central/rev/a7192af15890
https://hg.mozilla.org/mozilla-central/rev/ea71558fef5b
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 20•11 years ago
|
||
Flags: needinfo?(bzbarsky)
Keywords: dev-doc-needed → dev-doc-complete
Updated•11 years ago
|
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•