Skip to content

Support pair and value iterable WebIDL bindings - #12819

Merged
bors-servo merged 5 commits into
servo:masterfrom
jdm:iterable2
Aug 24, 2016
Merged

bors-servo merged 5 commits into
servo:masterfrom
jdm:iterable2

Conversation

@jdm

@jdm jdm commented Aug 11, 2016 •

Copy link
Copy Markdown
Member

The actual iterator implementation and JSAPI calls related to setting up the interface are ported directly from Gecko's Codegen.py, IterableIterator.h, and IterableIterator.webidl. The changes to support multiple interfaces in one file are required because the internal iterator interface the parser generates gets associated with the original interface's WebIDL file. It seemed like a good time to address #571 in that case.



This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/bindings/codegen/CodegenRust.py, components/script/dom/bindings/mod.rs, components/script/dom/testbindingiterable.rs, components/script/dom/bindings/codegen/parser/update.sh, components/script/dom/webidls/IterableIterator.webidl, components/script/dom/webidls/TestBindingIterable.webidl, components/script/dom/mod.rs, components/script/dom/webidls/TestBindingPairIterable.webidl, components/script/dom/bindings/codegen/parser/WebIDL.py, components/script/dom/bindings/iterable.rs, components/script/dom/bindings/codegen/parser/callback-location.patch, components/script/dom/testbindingpairiterable.rs, components/script/dom/bindings/codegen/Configuration.py

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 11, 2016
@jdm

jdm commented Aug 11, 2016

Copy link
Copy Markdown
Member Author

r? @Manishearth

@highfive highfive assigned Manishearth and unassigned cbrewster Aug 11, 2016
@jdm

jdm commented Aug 15, 2016

Copy link
Copy Markdown
Member Author

I don't understand why appveyor is failing, since that error was intended to be addressed by the modification to WebIDL.py (which worked locally and on travis).

@Manishearth

Copy link
Copy Markdown
Member

I'm not familiar enough with codegen to give this a proper review -- I understand the changes, but not enough to find any mistakes/issues/etc.

r? @Ms2ger

@highfive highfive assigned Ms2ger and unassigned Manishearth Aug 15, 2016
@KiChjang

Copy link
Copy Markdown
Contributor

@nox is also a good person to review codegen.

@nox

nox commented Aug 16, 2016

Copy link
Copy Markdown
Contributor

Reviewed 5 of 5 files at r1, 7 of 7 files at r2.
Review status: 7 of 18 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed.


a discussion (no related file):
Can you paste a diff of the generated code showing the changes of supporting multiple WebIDL interfaces in a single file?


components/script/dom/bindings/codegen/CodegenRust.py, line 1749 [r1] (raw file):

            return t.identifier

        def removeWrapperAndNullableTypes(types):

I don't understand what that function is for, it looks like a misnomer. My intuition is that it peels wrappers and nullable types, but then it returns an array so I don't know what it does.


components/script/dom/bindings/codegen/CodegenRust.py, line 2110 [r1] (raw file):

    unionStructs = (i[1] for i in sorted(unionStructs.items(), key=operator.itemgetter(0)))

    return CGImports(CGList(unionStructs, "\n\n"), [], [], [], [], imports, config, ignored_warnings=[])

Nit: could you use named arguments?


components/script/dom/bindings/codegen/CodegenRust.py, line 2708 [r1] (raw file):

    def __init__(self, descriptor):
        CGGetPerInterfaceObject.__init__(self, descriptor, "GetProtoObject",
                                         "PrototypeList::ID", pub=True)

Why do we need to always expose GetProtoObject and GetConstructorObject now?


components/script/dom/bindings/codegen/CodegenRust.py, line 1521 [r2] (raw file):

                "condition": PropertyDefiner.getControllingCondition(m,
                                                                     descriptor)
            })

So where are the magic definitions of all these methods?


components/script/dom/bindings/codegen/parser/callback-location.patch, line 13 [r1] (raw file):

                 else:
                     type = IDLWrapperType(self.getLocation(p, 1), p[1])
                 p[0] = self.handleModifiers(type, p[2])

Did you upstream this?


Comments from Reviewable

@nox

nox commented Aug 16, 2016

Copy link
Copy Markdown
Contributor

I've reviewed the first two commits and will wait for an answer before reviewing the rest. On a side-note, @jdm could you shorten your commit titles? They are hard to read in git-log and on GH.

jeenalee added a commit to jeenalee/servo that referenced this pull request Aug 22, 2016
This commit implements iterable in DOM Headers based on iterable
implementation from [PR 12819](servo#12819).
@jdm

jdm commented Aug 23, 2016

Copy link
Copy Markdown
Member Author

Review status: 7 of 18 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed.


components/script/dom/bindings/codegen/CodegenRust.py, line 1749 [r1] (raw file):

Previously, nox (Anthony Ramine) wrote…

I don't understand what that function is for, it looks like a misnomer. My intuition is that it peels wrappers and nullable types, but then it returns an array so I don't know what it does.

It accepts an array of types, and returns an array of types that have had their wrapper and nullable-ness removed.

components/script/dom/bindings/codegen/CodegenRust.py, line 2708 [r1] (raw file):

Previously, nox (Anthony Ramine) wrote…

Why do we need to always expose GetProtoObject and GetConstructorObject now?

The functions need to be public to be reexported, and the code that adds the names to the reexport list shouldn't need to replicate the logic to decide if the functions need to be public or not. This was the easiest solution.

components/script/dom/bindings/codegen/CodegenRust.py, line 1521 [r2] (raw file):

Previously, nox (Anthony Ramine) wrote…

So where are the magic definitions of all these methods?

They are self-hosted and already exist.

components/script/dom/bindings/codegen/parser/callback-location.patch, line 13 [r1] (raw file):

Previously, nox (Anthony Ramine) wrote…

Did you upstream this?

Not yet. I'd like to do that as a followup.

Comments from Reviewable

@nox

nox commented Aug 23, 2016

Copy link
Copy Markdown
Contributor

-S-awaiting-review +S-awaiting-answer

Feel free to r=me if my last question is nonsense.


Reviewed 11 of 11 files at r3, 1 of 1 files at r4.
Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


a discussion (no related file):

Previously, nox (Anthony Ramine) wrote…

Can you paste a diff of the generated code showing the changes of supporting multiple WebIDL interfaces in a single file?

You forgot to do that.

components/script/dom/bindings/codegen/CodegenRust.py, line 2675 [r4] (raw file):

""" % properties))

        aliasedMembers = [m for m in self.descriptor.interface.members if m.isMethod() and m.aliases]

What are aliases here? I thought we didn't support Alias yet. Is that something different?


Comments from Reviewable

@nox nox added S-awaiting-answer Someone asked a question that requires an answer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 23, 2016
@jdm

jdm commented Aug 23, 2016

Copy link
Copy Markdown
Member Author

Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


a discussion (no related file):

Previously, nox (Anthony Ramine) wrote…

You forgot to do that.

Didn't forget; just not complete yet.

components/script/dom/bindings/codegen/CodegenRust.py, line 2675 [r4] (raw file):

Previously, nox (Anthony Ramine) wrote…

What are aliases here? I thought we didn't support Alias yet. Is that something different?

forEach is an automatic alias of @@iterator that is created by the webidl parser.

Comments from Reviewable

@jdm

jdm commented Aug 23, 2016

Copy link
Copy Markdown
Member Author

Before/after diff for TestBindingPairIterableBinding.rs when adding the iterable declaration that causes an extra interface to be generated in the binding file: https://gist.github.com/jdm/0c2fa6068c6f630a5377550f635cc2bb

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 23, 2016
@jdm jdm assigned nox and unassigned Ms2ger Aug 23, 2016
jeenalee added a commit to jeenalee/servo that referenced this pull request Aug 23, 2016
This commit implements iterable in DOM Headers based on iterable
implementation from [PR 12819](servo#12819).
@jeenalee jeenalee mentioned this pull request Aug 23, 2016
4 of 5 tasks
@jdm

jdm commented Aug 23, 2016

Copy link
Copy Markdown
Member Author

Whee, now appveyor passes and travis fails with the same error getting Function's original location wrong. I wonder if this is caused by running multiple parsers in parallel...

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #13009) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm

jdm commented Aug 24, 2016

Copy link
Copy Markdown
Member Author

@bors-servo: r=nox
One appveyor build had a weird problem with angle; not the fault of this PR.

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 928c4df has been approved by nox

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 24, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 928c4df with merge 25841eb...

bors-servo pushed a commit that referenced this pull request Aug 24, 2016
Support pair and value iterable WebIDL bindings

The actual iterator implementation and JSAPI calls related to setting up the interface are ported directly from Gecko's Codegen.py, IterableIterator.h, and IterableIterator.webidl. The changes to support multiple interfaces in one file are required because the internal iterator interface the parser generates gets associated with the original interface's WebIDL file. It seemed like a good time to address #571 in that case.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12628 and fix #571.
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12819)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - arm64

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 24, 2016
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Aug 24, 2016
@jdm

jdm commented Aug 24, 2016

Copy link
Copy Markdown
Member Author

@bors-servo: r=nox

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 86a0c45 has been approved by nox

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 24, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 86a0c45 with merge 1370fa5...

bors-servo pushed a commit that referenced this pull request Aug 24, 2016
Support pair and value iterable WebIDL bindings

The actual iterator implementation and JSAPI calls related to setting up the interface are ported directly from Gecko's Codegen.py, IterableIterator.h, and IterableIterator.webidl. The changes to support multiple interfaces in one file are required because the internal iterator interface the parser generates gets associated with the original interface's WebIDL file. It seemed like a good time to address #571 in that case.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12628 and fix #571.
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12819)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows-dev

@bors-servo
bors-servo merged commit 86a0c45 into servo:master Aug 24, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 24, 2016
jeenalee added a commit to jeenalee/servo that referenced this pull request Aug 24, 2016
This commit implements iterable in DOM Headers based on iterable
implementation from servo#12819. Expected wpt results are updated as well.
bors-servo pushed a commit that referenced this pull request Aug 24, 2016
Implement iterable for headers

<!-- Please describe your changes on the following line: -->
These patches make Headers iterable based on #12819.

The expected wpt results are updated as well.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because web platform tests for Headers already exist. Expected test results are updated with this PR.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12998)
<!-- Reviewable:end -->
samuknet pushed a commit to samuknet/servo that referenced this pull request Sep 6, 2016
This commit implements iterable in DOM Headers based on iterable
implementation from servo#12819. Expected wpt results are updated as well.
@Ms2ger
Ms2ger deleted the iterable2 branch September 29, 2016 10:39
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.

Support iterable declarations in WebIDL Multiple interface definitions in the same WebIDL file yield duplicate autogenerated definitions

8 participants