Closed Bug 829248 Opened 11 years ago Closed 11 years ago

Implement support for [TreatUndefinedAs=Missing] in WebIDL

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I want this for add/removeEventListener.
Blocks: 829250
Actually, I don't.  But this is still useful!
Assignee: bzbarsky → nobody
No longer blocks: 829250
Whiteboard: [mentor=bz][lang=c++][lang=python]
Hello there,

My friend and I are interested in helping out.  Is this bug still active?  If so, where/how do we begin?

Thanks.
This is still active, yes.

Assuming you've pulled a Firefox tree, you want to look at dom/bindings/Codegen.py and read http://dev.w3.org/2006/webapi/WebIDL/#dfn-overload-resolution-algorithm I guess.  Then start thinking about how to best implement it (probably by walking backwards through the arguments and changing argc as neeed up front in the generated code for method calls).
Cool!

I assume this is part of a large(r) project overall, are there any other mentored bugs from this project that I could work on while we're at it?

Thanks!
You can search bugzilla for mentored bugs, right?
I'm not familiar with the Implementation of WebIDL but can I take this bug and try to work on it?
Sure.  Please feel free to ask questions as needed!
Assignee: nobody → joejoevictor
I've read the w3c website about WebIDL and I kinda understand it's the interface between JavaScript and browser backend but I'm not sure how the implementation reflects to firefox code base.

Could you briefly explain it to me or point me to a page where I can read about it myself?

Thanks!
The way it works right now is that there is a Python script (well, several) that parses WebIDL and produces C++ code that acts like glue between JavaScript and the C++.

The relevant code is in dom/bindings/parser/WebIDL.py (the parser) and dom/bindings/Codegen.py (the script that builds the C++ code from the data model).  The generated code ends up in the dom/bindings subdirectory of the objdir (e.g. dom/bindings/URLBinding.cpp).  There's some user-facing (as in, for people writing C++ code that's supposed to implement web stuff) documentation at https://developer.mozilla.org/en/Mozilla/WebIDL_bindings
Can you confirm that you're still working on this bug?
Flags: needinfo?(joejoevictor)
Blocks: 875289
methods, since it's not clear what that should really look like.

This also does not require that [TreatUndefinedAs=Missing] on an
argument force it on all later arguments, since it's not clear that we
want that long-term.
Attachment #755016 - Flags: review?(khuey)
Assignee: joejoevictor → bzbarsky
Stealing, because this is blocking people.
Flags: needinfo?(joejoevictor)
Whiteboard: [mentor=bz][lang=c++][lang=python] → [need review]
Blocks: 861938
Comment on attachment 755016 [details] [diff] [review]
Implement basic support for [TreatUndefinedAs=Missing] in WebIDL.   does not add support for [TreatUndefinedAs=Missing] in overloaded

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

::: dom/bindings/parser/WebIDL.py
@@ +406,5 @@
>                          raise WebIDLError("[TreatUndefinedAs=Missing] is only "
>                                            "allowed on optional arguments",
>                                            [self.location])
> +                else:
> +                    if value == 'Null':

Is there a reason not to just do elif and not have a separate level of control flow.  I don't see one but it's possible I'm still too jetlagged to read code properly ...
Attachment #755016 - Flags: review?(khuey) → review+
You're totally right.  I had the code looking a bit differently partway though writing the patch and then never reread it carefully enough...  Fixed to do elif.

https://hg.mozilla.org/integration/mozilla-inbound/rev/5f66c33dbf00
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla24
https://hg.mozilla.org/mozilla-central/rev/5f66c33dbf00
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: