diff options
author | bors-servo <servo-ops@mozilla.com> | 2021-08-01 10:31:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-01 10:31:40 -0400 |
commit | bd92fad81a24d08208a5739cad4bde6eb58d6ce8 (patch) | |
tree | e0e84609080a1d237bfdcaa10e0bef18cdea26ea /components/script/dom/bindings/codegen/Configuration.py | |
parent | 052278d0580ec1cbd2c9887e65d259dbf5efa775 (diff) | |
parent | afbe2fa1f259411b6c49a3ec3b2baccfbf1664d9 (diff) | |
download | servo-bd92fad81a24d08208a5739cad4bde6eb58d6ce8.tar.gz servo-bd92fad81a24d08208a5739cad4bde6eb58d6ce8.zip |
Auto merge of #28546 - yvt:feat-cow-infra, r=jdm
Implement `Location`'s custom internal methods
This PR partly resurrects #16501 and introduces the use of principals object to associate objects and Realms with origins. Using this infrastructure, this PR implements [the custom internal methods][1] of the `Location` interface, which is "maybe-cross-origin".
Unimplemented/incomplete things:
- Other maybe-cross-origin interfaces, namely `WindowProxy` and `DissimilarWindowLocation`, aren't implemented correctly yet (causing most test cases of `tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html` to fail).
- `WindowProxy`: #28556
- [The "perform a security check" operation][2] and `Location`'s non-cross-origin properties' relevant `Document` origin checks aren't implemented either (not sure if they are covered by the existing tests).
- There are a slight deviation from the standard and inefficiency in `CrossOriginGetOwnPropertyHelper`'s current implementation.
- #28557
[1]: https://html.spec.whatwg.org/multipage/#the-location-interface
[2]: https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #16243 and make some progress in #2382
---
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___
Diffstat (limited to 'components/script/dom/bindings/codegen/Configuration.py')
-rw-r--r-- | components/script/dom/bindings/codegen/Configuration.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py index b92f68af3b9..cf6885be265 100644 --- a/components/script/dom/bindings/codegen/Configuration.py +++ b/components/script/dom/bindings/codegen/Configuration.py @@ -299,6 +299,9 @@ class Descriptor(DescriptorProvider): if iface: iface.setUserData('hasConcreteDescendant', True) + if self.isMaybeCrossOriginObject(): + self.proxy = True + if self.proxy: iface = self.interface while iface.parent: @@ -404,6 +407,11 @@ class Descriptor(DescriptorProvider): def supportsIndexedProperties(self): return self.operations['IndexedGetter'] is not None + def isMaybeCrossOriginObject(self): + # If we're isGlobal and have cross-origin members, we're a Window, and + # that's not a cross-origin object. The WindowProxy is. + return self.concrete and self.interface.hasCrossOriginMembers and not self.isGlobal() + def hasDescendants(self): return (self.interface.getUserData("hasConcreteDescendant", False) or self.interface.getUserData("hasProxyDescendant", False)) |