Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebXR should not work from an iFrame unless it is allowed to use the xr-spatial-tracking permissions policy #26376

Conversation

achan00
Copy link
Contributor

@achan00 achan00 commented Mar 23, 2024

7b007a8

WebXR should not work from an iFrame unless it is allowed to use the xr-spatial-tracking permissions policy
https://bugs.webkit.org/show_bug.cgi?id=271363
rdar://122963817

Reviewed by Mike Wyrzykowski.

Follow the latest WebXR spec and check whether 'xr-spatial-tracking' is enabled for
the requesting document's origin in WebGLRenderingContextBase::makeXRCompatible and
WebXRSystem::resolveRequestedFeatures.

Added layout tests to verify 'xr-spatial-tracking' permissions policy is checked
properly for xr.isSessionSupported, xr.requestSession, and WebGLRenderingContextBase::makeXRCompatible.
Set up symbolic links to the webxr related scripts from http/wpt/webxr folder so the
pages embedded in the iframes can reference them.

* LayoutTests/http/tests/webxr/resources/resources/test-only-api.js: Added.
* LayoutTests/http/tests/webxr/resources/resources/webxr_test_constants_single_view.js: Added.
* LayoutTests/http/tests/webxr/resources/resources/webxr_util.js: Added.
* LayoutTests/http/tests/webxr/resources/webxr-issessionsupported-test.html: Added.
* LayoutTests/http/tests/webxr/resources/webxr-makexrcompatible-test.html: Added.
* LayoutTests/http/tests/webxr/resources/webxr-requestsession-test.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-allowed-by-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-allowed-by-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-denied-by-insufficient-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-denied-by-insufficient-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-allowed-by-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-allowed-by-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-denied-by-insufficient-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-denied-by-insufficient-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-allowed-by-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-allowed-by-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-denied-by-insufficient-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-denied-by-insufficient-feature-policy.html: Added.
* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-gpup/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
Skip http/tests/webxr tests in the same places where we've skipped other webxr layout tests.
* LayoutTests/platform/wpe/TestExpectations:
Filed a new bug on a crash found when calling WebXRSession destructor.
* LayoutTests/platform/wincairo/TestExpectations:
Skip http/tests/webxr tests in the same places where we've skipped other webxr layout tests.
* Source/WebCore/Modules/webxr/WebXRSystem.cpp:
(WebCore::WebXRSystem::isFeaturePermitted const):
(WebCore::WebXRSystem::resolveRequestedFeatures const):
* Source/WebCore/Modules/webxr/WebXRSystem.h:
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::makeXRCompatible):

Canonical link: https://commits.webkit.org/277301@main

2559ec2

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-skia
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@achan00 achan00 self-assigned this Mar 23, 2024
@achan00 achan00 added the WebXR For bugs in WebXR label Mar 23, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 23, 2024
Copy link
Contributor

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-reviewer πŸ‘ from me. Nice one solving for the script duplication!

@achan00 achan00 removed the merging-blocked Applied to prevent a change from being merged label Apr 9, 2024
@achan00 achan00 force-pushed the eng/WebXR-should-not-work-from-an-iFrame-unless-it-is-allowed-to-use-the-xr-spatial-tracking-permissions-policy branch from f23fd7d to 224554e Compare April 9, 2024 22:21
@achan00 achan00 force-pushed the eng/WebXR-should-not-work-from-an-iFrame-unless-it-is-allowed-to-use-the-xr-spatial-tracking-permissions-policy branch from 224554e to 2559ec2 Compare April 10, 2024 00:18
@achan00 achan00 added the merge-queue Applied to send a pull request to merge-queue label Apr 10, 2024
…xr-spatial-tracking permissions policy

https://bugs.webkit.org/show_bug.cgi?id=271363
rdar://122963817

Reviewed by Mike Wyrzykowski.

Follow the latest WebXR spec and check whether 'xr-spatial-tracking' is enabled for
the requesting document's origin in WebGLRenderingContextBase::makeXRCompatible and
WebXRSystem::resolveRequestedFeatures.

Added layout tests to verify 'xr-spatial-tracking' permissions policy is checked
properly for xr.isSessionSupported, xr.requestSession, and WebGLRenderingContextBase::makeXRCompatible.
Set up symbolic links to the webxr related scripts from http/wpt/webxr folder so the
pages embedded in the iframes can reference them.

* LayoutTests/http/tests/webxr/resources/resources/test-only-api.js: Added.
* LayoutTests/http/tests/webxr/resources/resources/webxr_test_constants_single_view.js: Added.
* LayoutTests/http/tests/webxr/resources/resources/webxr_util.js: Added.
* LayoutTests/http/tests/webxr/resources/webxr-issessionsupported-test.html: Added.
* LayoutTests/http/tests/webxr/resources/webxr-makexrcompatible-test.html: Added.
* LayoutTests/http/tests/webxr/resources/webxr-requestsession-test.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-allowed-by-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-allowed-by-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-denied-by-insufficient-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-issessionsupported-denied-by-insufficient-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-allowed-by-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-allowed-by-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-denied-by-insufficient-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-makexrcompatible-denied-by-insufficient-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-allowed-by-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-allowed-by-feature-policy.html: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-denied-by-insufficient-feature-policy-expected.txt: Added.
* LayoutTests/http/tests/webxr/webxr-third-party-iframe-requestsession-denied-by-insufficient-feature-policy.html: Added.
* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-gpup/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
Skip http/tests/webxr tests in the same places where we've skipped other webxr layout tests.
* LayoutTests/platform/wpe/TestExpectations:
Filed a new bug on a crash found when calling WebXRSession destructor.
* LayoutTests/platform/wincairo/TestExpectations:
Skip http/tests/webxr tests in the same places where we've skipped other webxr layout tests.
* Source/WebCore/Modules/webxr/WebXRSystem.cpp:
(WebCore::WebXRSystem::isFeaturePermitted const):
(WebCore::WebXRSystem::resolveRequestedFeatures const):
* Source/WebCore/Modules/webxr/WebXRSystem.h:
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::makeXRCompatible):

Canonical link: https://commits.webkit.org/277301@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/WebXR-should-not-work-from-an-iFrame-unless-it-is-allowed-to-use-the-xr-spatial-tracking-permissions-policy branch from 2559ec2 to 7b007a8 Compare April 10, 2024 15:59
@webkit-commit-queue
Copy link
Collaborator

Committed 277301@main (7b007a8): https://commits.webkit.org/277301@main

Reviewed commits have been landed. Closing PR #26376 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 10, 2024
@webkit-commit-queue webkit-commit-queue merged commit 7b007a8 into WebKit:main Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebXR For bugs in WebXR
Projects
None yet
6 participants