Repository navigation
script: Implement the WindowProxy ProxyTraps according to specification - #47632
Conversation
5f7d81a to
e94aaf7
Compare
| descriptor.handle_mut(), | ||
| &mut is_none, | ||
| ) | ||
| JS_GetOwnPropertyDescriptorById(cx, proxy, id, descriptor.handle_mut(), &mut is_none) |
There was a problem hiding this comment.
InvokeGetOwnPropertyDescriptor assumes that the proxy is a ProxyObject, but this function is now being used for WindowProxy as well. JS_GetOwnPropertyDescriptorById doesn't make this assumption.
|
|
||
| // Step 3. If IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver). | ||
| if is_platform_object_same_origin(cx, proxy) { | ||
| let window = unsafe { GetSubframeWindowProxy(cx, proxy.into(), id.into()) }; |
There was a problem hiding this comment.
I will clean up and optimize GetSubframeWindowProxy in a followup.
| // TODO: We do not know the origin of this new window at this point in the execution | ||
| // and we *really* don't want to use the origin of `global_to_clone_from`. The whole | ||
| // point is that this is a window with a *different* origin. Just use an opaque origin | ||
| // here which is guaranteed to never be equal to `global_to_clone_from`'s origin. |
There was a problem hiding this comment.
This is fixing an issue revealed by the new proxy traps. A DissimilarOriginWindow shouldn't be initialized with the origin that it is dissimilar from.
| def emitsCrossOriginPropertyTable(self) -> bool: | ||
| return self.concrete and self.interface.hasCrossOriginMembers |
There was a problem hiding this comment.
WindowProxy is not technically a cross-origin object in the same way that other ones are, but we do need access to the list of cross-origin properties.
| [Replaceable, CrossOriginReadable] readonly attribute WindowProxy frames; | ||
| [Replaceable, CrossOriginReadable] readonly attribute unsigned long length; | ||
| [PutForwards=href, LegacyUnforgeable, CrossOriginReadable, CrossOriginWritable] | ||
| readonly attribute DissimilarOriginLocation location; |
There was a problem hiding this comment.
This is simply replicating the attributes from Window.webidl.
| @@ -1,3 +1,4 @@ | |||
| [response-start-after-coop-bcg-switch.https.html] | |||
| expected: ERROR | |||
There was a problem hiding this comment.
I still need to investigate this new failure, but I suspect it's revealing a false pass from before.
|
I verified that most new test failures are fixed by #47630 That said, the implementation of windowproxy is still voodoo for me, so unfortunately I am not the appropriate reviewer here. Hopefully somebody else can review and I can read along. Basically, I can see you implemented the spec steps pretty much, but don't know the specifics of cross-origin objects to know if this has any security impact or so. |
e94aaf7 to
1580afa
Compare
jdm
left a comment
There was a problem hiding this comment.
This is great! Thank you for digging in here; it's good news that we could just reuse the proxyhandler infrastructure in many cases.
…cation This change re-implements the `ProxyTraps` for `WindowProxy` according to the specification which says that they should always take into account same origin concerns. In addition to fixing security and correctness issues, this means that now there is only a single type of `WindowProxy` `ProxyTrap` instead of two, simplifying the code. Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Josh Bowman-Matthews <[email protected]>
1580afa to
3353163
Compare
…t:srcdoc` (servo#47630) The [specification] says that `about:blank` and `about:srcdoc` should inherit their source origin. This means that instead of always creating a new opaque origin in the parser for these kind of pages, we should try harder to preserve the source origin. [specification]: https://html.spec.whatwg.org/multipage/#determining-the-origin Testing: This will cause more tests to pass once servo#47632 lands. --------- Signed-off-by: Martin Robinson <[email protected]> Signed-off-by: Martin Robinson <[email protected]>
…cation (servo#47632) This change re-implements the `ProxyTraps` for `WindowProxy` according to the specification which says that they should always take into account same origin concerns. In addition to fixing security and correctness issues, this means that now there is only a single type of `WindowProxy` `ProxyTrap` instead of two, simplifying the code. This change exposes quite a few places that we should be inheriting the `Origin`, but are not properly doing so. servo#47630 is an example of a fix necessary to get more of these tests passing. Testing: This gets many tests passing and reveal quite a few new fails that are progressions. Fixes: servo#28556. Fixes: servo#44669. Fixes: servo#47548. Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Josh Bowman-Matthews <[email protected]>
…t:srcdoc` (servo#47630) The [specification] says that `about:blank` and `about:srcdoc` should inherit their source origin. This means that instead of always creating a new opaque origin in the parser for these kind of pages, we should try harder to preserve the source origin. [specification]: https://html.spec.whatwg.org/multipage/#determining-the-origin Testing: This will cause more tests to pass once servo#47632 lands. --------- Signed-off-by: Martin Robinson <[email protected]> Signed-off-by: Martin Robinson <[email protected]>
…cation (servo#47632) This change re-implements the `ProxyTraps` for `WindowProxy` according to the specification which says that they should always take into account same origin concerns. In addition to fixing security and correctness issues, this means that now there is only a single type of `WindowProxy` `ProxyTrap` instead of two, simplifying the code. This change exposes quite a few places that we should be inheriting the `Origin`, but are not properly doing so. servo#47630 is an example of a fix necessary to get more of these tests passing. Testing: This gets many tests passing and reveal quite a few new fails that are progressions. Fixes: servo#28556. Fixes: servo#44669. Fixes: servo#47548. Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Josh Bowman-Matthews <[email protected]>
…t:srcdoc` (servo#47630) The [specification] says that `about:blank` and `about:srcdoc` should inherit their source origin. This means that instead of always creating a new opaque origin in the parser for these kind of pages, we should try harder to preserve the source origin. [specification]: https://html.spec.whatwg.org/multipage/#determining-the-origin Testing: This will cause more tests to pass once servo#47632 lands. --------- Signed-off-by: Martin Robinson <[email protected]> Signed-off-by: Martin Robinson <[email protected]>
…to specification (#47632) This change re-implements the `ProxyTraps` for `WindowProxy` according to the specification which says that they should always take into account same origin concerns. In addition to fixing security and correctness issues, this means that now there is only a single type of `WindowProxy` `ProxyTrap` instead of two, simplifying the code. This change exposes quite a few places that we should be inheriting the `Origin`, but are not properly doing so. #47630 is an example of a fix necessary to get more of these tests passing. Testing: This gets many tests passing and reveal quite a few new fails that are progressions. Fixes: #28556. Fixes: #44669. Fixes: #47548. Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Josh Bowman-Matthews <[email protected]> (cherry picked from commit dfac8fa)
… and `about:srcdoc` (#47630) The [specification] says that `about:blank` and `about:srcdoc` should inherit their source origin. This means that instead of always creating a new opaque origin in the parser for these kind of pages, we should try harder to preserve the source origin. [specification]: https://html.spec.whatwg.org/multipage/#determining-the-origin Testing: This will cause more tests to pass once #47632 lands. --------- Signed-off-by: Martin Robinson <[email protected]> Signed-off-by: Martin Robinson <[email protected]> (cherry picked from commit fb160c4)
This change re-implements the
ProxyTrapsforWindowProxyaccordingto the specification which says that they should always take into
account same origin concerns. In addition to fixing security and
correctness issues, this means that now there is only a single type of
WindowProxyProxyTrapinstead of two, simplifying the code.This change exposes quite a few places that we should be inheriting
the
Origin, but are not properly doing so. #47630 is an exampleof a fix necessary to get more of these tests passing.
Testing: This gets many tests passing and reveal quite a few new
fails that are progressions.
Fixes: #28556.
Fixes: #44669.
Fixes: #47548.