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 upMake bindings aware of exposed members/partial interfaces #23500
Conversation
highfive
commented
Jun 3, 2019
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @avadacatavra (or someone else) soon. |
highfive
commented
Jun 3, 2019
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jun 3, 2019
|
@bors-servo try=wpt |
Make bindings aware of exposed members/partial interfaces <!-- 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 #23332 <!-- 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. --> <!-- 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/23500) <!-- Reviewable:end -->
| return "Condition::Satisfied" | ||
|
|
||
|
|
||
| def ExposedCondition(cond): |
This comment has been minimized.
This comment has been minimized.
sreeise
Jun 3, 2019
Author
Contributor
This function is just temporary. I wans't sure if there was a better way to get the mappings for the global bit sets. Also, what do 'Worklet' and 'Worker' map to? There is no obvious global bit set for those versus something like 'ServiceWorker'
This comment has been minimized.
This comment has been minimized.
jdm
Jun 3, 2019
Member
Worklet and Worker map to any interface that has a [Global=(Worker)] or [Global=(Worklet)] annotation, respectively. For example, both ServiceWorkerGlobalScope and DedicatedWorkerGlobalScope should match Worker.
| @@ -2593,6 +2621,12 @@ def definition_body(self): | |||
| assert isinstance(func, list) and len(func) == 1 | |||
| conditions.append("%s(aCx, aObj)" % func[0]) | |||
|
|
|||
| exposed = iface.getExtendedAttribute("Exposed") | |||
This comment has been minimized.
This comment has been minimized.
sreeise
Jun 3, 2019
Author
Contributor
@jdm Looking at the generated bindings the constructors for some of the interfaces are duplicated. PerformanceBinding.rs shows:
unsafe fn ConstructorEnabled(aCx: *mut JSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::SERVICE_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW)
}
These include both the iface.exposureSet and the Exposed attribute which seems to be why they are duplicated.
I am not sure on this, should one of these be changed or left out?
This comment has been minimized.
This comment has been minimized.
jdm
Jun 3, 2019
Member
What if we merge the exposureSet and exposed attribute checks by creating a set made of the values and iterating over them? Something like set(camel_to_upper_snake(i) for i in iface.exposureSet) + set(camel_to_upper_snake(i) for i in exposed), then generate a single is_exposed_in from the resulting set?
This comment has been minimized.
This comment has been minimized.
jdm
Jun 3, 2019
Member
Possibly we should be taking the intersection of the sets, rather than the union of them.
This comment has been minimized.
This comment has been minimized.
sreeise
Jun 4, 2019
Author
Contributor
After looking at both the exposed list and iface.exposureSet, there is actually no difference between the two so there may not be a need to generate anything for the exposed list here. The naming is different where the exposed list only includes 'worker' and 'worklet' instead of the global names for worker and worklet but once you map them to the correct names they are the same as the exposureSet for every interface.
|
The changes don't expose all of the annotations. I was facing some issues when there are multiple annotations exposed versus just one. If I change Unfortunately, when I attempted to do so it caused either GL errors or crash errors from Pipeline.rs. I am not exactly sure at this point what is causing the errors or if there is another way to go about this. |
|
|
|
Good start! |
| return "Condition::Satisfied" | ||
|
|
||
|
|
||
| def ExposedCondition(cond): |
This comment has been minimized.
This comment has been minimized.
jdm
Jun 3, 2019
Member
Worklet and Worker map to any interface that has a [Global=(Worker)] or [Global=(Worklet)] annotation, respectively. For example, both ServiceWorkerGlobalScope and DedicatedWorkerGlobalScope should match Worker.
| "DedicatedWorker": "DedicatedWorkerGlobalScope", | ||
| "PaintWorklet": "PaintWorkletGlobalScope", | ||
| "TestWorklet": "TestWorkletGlobalScope" | ||
| }) |
This comment has been minimized.
This comment has been minimized.
jdm
Jun 3, 2019
Member
We should be able to generate this dictionary programmatically:
global_descriptors = config.getDescriptors(isGlobal=True)gives us all of the interfaces that have aGlobalannotationdescriptor.interface.getExtendedAttribute("Global")gives us the list of values for a particular interface
| @@ -1565,7 +1591,9 @@ def getControllingCondition(interfaceMember, descriptor): | |||
| PropertyDefiner.getStringAttr(interfaceMember, | |||
| "Pref"), | |||
| PropertyDefiner.getStringAttr(interfaceMember, | |||
| "Func")) | |||
| "Func"), | |||
| PropertyDefiner.getStringAttr(interfaceMember, | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jun 3, 2019
Member
I suspect that we will want a different method than getStringAttr because Exposed can contain multiple values?
| @@ -2593,6 +2621,12 @@ def definition_body(self): | |||
| assert isinstance(func, list) and len(func) == 1 | |||
| conditions.append("%s(aCx, aObj)" % func[0]) | |||
|
|
|||
| exposed = iface.getExtendedAttribute("Exposed") | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jun 3, 2019
Member
What if we merge the exposureSet and exposed attribute checks by creating a set made of the values and iterating over them? Something like set(camel_to_upper_snake(i) for i in iface.exposureSet) + set(camel_to_upper_snake(i) for i in exposed), then generate a single is_exposed_in from the resulting set?
|
I would be really interested in learning more about the errors you saw when you changed generateGuardedArray. |
|
The current test failures don't look good:
|
|
Ok, the failures are coming from passing the prototype objects to I think we can solve this by changing the |
I am honestly not sure if this is fixed or not (I guess we will see). Running the tests in a debugger, at least for me, is crashing my screen with out of memory errors so I am assuming this still needs some work. |
They were 502 GL errors and 0 for the pipeline namespace id, but these are no longer there after I made the changes you suggested for |
|
@bors-servo try=wpt |
Make bindings aware of exposed members/partial interfaces <!-- 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 #23332 <!-- 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. --> <!-- 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/23500) <!-- Reviewable:end -->
|
@bors-servo try=wpt |
Make bindings aware of exposed members/partial interfaces <!-- 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 #23332 <!-- 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. --> <!-- 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/23500) <!-- Reviewable:end -->
|
|
| @@ -9,7 +9,9 @@ | |||
| client.addEventListener("readystatechange", test.step_func(function() { | |||
| if(client.readyState == 4) { | |||
| control_flag = true | |||
| assert_equals(client.responseXML, null) | |||
| if (test.GLOBAL.isWindow()) { | |||
This comment has been minimized.
This comment has been minimized.
CYBAI
Jul 14, 2019
Collaborator
I think you can fix the failure by using self.GLOBAL.isWindow()
Ref: https://web-platform-tests.org/writing-tests/testharness.html#multi-global-tests
This comment has been minimized.
This comment has been minimized.
sreeise
Jul 14, 2019
Author
Contributor
Oh ok, I was thinking it was referring to the actual name used for the test object.
|
|
html/dom has an .ini file for WorkerNavigator I didnt see but I am not sure why abort-after-send.any.js is saying that test.GLOBAL is undefined. |
…s/partial interfaces
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#17812. |
|
Hopefully that is all of them. Sorry about causing the tests to have to be rerun. I am getting a segfault crash if I try to run abort-after-send.any.js locally which also happens on a few other tests so I can't be sure if it actually passes. |
|
Could you file a separate issue with the backtrace from the segfault when running that test? That sounds interesting. |
|
@bors-servo try=wpt |
Make bindings aware of exposed members/partial interfaces <!-- 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 #23332 <!-- 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. --> <!-- 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/23500) <!-- Reviewable:end -->
|
|
|
@bors-servo r+ |
|
|
Done! #23772 |
Make bindings aware of exposed members/partial interfaces <!-- 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 #23332 <!-- 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. --> <!-- 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/23500) <!-- Reviewable:end -->
|
|
sreeise commentedJun 3, 2019
•
edited by SimonSapin
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is