Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd trait DomObjectWrap to provide WRAP function #25624
Conversation
highfive
commented
Jan 27, 2020
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @paulrouget (or someone else) soon. |
highfive
commented
Jan 27, 2020
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jan 27, 2020
140775b
to
205e619
|
Ok, there's an interesting mixture here:
I think a reasonable choice here is:
|
|
Hi @jdm
This seems to break the code in htmlconstructor, as it makes all HTML element bindings reexport the I am modifying the |
|
That sounds reasonable for now. |
|
|
|
This looks like a nice improvement so far! Is this PR still WIP, or is the next step to review the code? |
|
Hi @jdm I am still working on some build errors caused by my change. I will switch it ready-for-review once I fix them. Thanks! |
|
|
| @@ -119,6 +117,11 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> { | |||
| } | |||
| } | |||
|
|
|||
| impl<T: DomObject + DomObjectWrap + JSTraceable + Iterable> DomObjectWrap for IterableIterator<T> { | |||
| const WRAP: unsafe fn(JSContext, &GlobalScope, Box<Self>) -> Root<Dom<Self>> = | |||
This comment has been minimized.
This comment has been minimized.
jdm
Mar 19, 2020
Member
What is the code that requires a DomObjectWrap implementation for IterableIterator? It's hard for me to figure out if this WRAP will be called anywhere - it looks like it will be used by IterableIterator::new, which doesn't seem like it will work.
This comment has been minimized.
This comment has been minimized.
lyuyuan
Mar 19, 2020
Author
Contributor
You are right. WPT crashed when executing IterableIterator::new
This comment has been minimized.
This comment has been minimized.
lyuyuan
Mar 21, 2020
•
Author
Contributor
IterableIterator::new calls reflect_dom_object<T, U> which requires T implements DomObjectWrap. This requires IterableIterator implements the trait.
| @@ -6286,6 +6309,8 @@ def reexportedName(name): | |||
| cgThings.append(CGWrapGlobalMethod(descriptor, properties)) | |||
| else: | |||
| cgThings.append(CGWrapMethod(descriptor)) | |||
| if not descriptor.interface.isIteratorInterface(): | |||
This comment has been minimized.
This comment has been minimized.
jdm
Mar 19, 2020
Member
Why can we not generate a DomObjectWrap implementation for iterator interfaces?
This comment has been minimized.
This comment has been minimized.
lyuyuan
Mar 21, 2020
Author
Contributor
Sorry for making this mistake. For interfaces that provides Wrap function for both itself and IterableIterator (FormData, Header...), I introduced another trait DomObjectIteratorWrap which provides a const ITER_WRAP that points to the iterator Wrap function. Then, IterableIterator<T>::WRAP could point to T::ITER_WRAP, therefore, implements the DomObjectWrap trait.
|
Overall I'm really excited about these changes! |
Add trait DomObjectWrap to provide WRAP function <!-- Please describe your changes on the following line: --> --- <!-- 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 #8576 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
|
|
Indeed:
|
|
Great solution! |
|
|
Add trait DomObjectWrap to provide WRAP function <!-- Please describe your changes on the following line: --> --- <!-- 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 #8576 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
|
|
@bors-servo retry |
|
|
lyuyuan commentedJan 27, 2020
•
edited
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors