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

Do not allow XR session on non user-activated events #24133

Merged
merged 1 commit into from Sep 20, 2019

Conversation

paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Sep 4, 2019

This sets the thread in "user interaction mode" when the dispatched event is trusted. I also tried an approach where we would not rely on the dispatched event but just set "user interaction mode" when we get a compositor event (which, we can assume, are only user generated). That worked as well.

Fixes #23787.


This change is Reviewable

@highfive
Copy link

highfive commented Sep 4, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/script_thread.rs, components/script/dom/xrtest.rs, components/script/dom/event.rs, components/script/dom/xr.rs
  • @KiChjang: components/script/script_thread.rs, components/script/dom/xrtest.rs, components/script/dom/event.rs, components/script/dom/xr.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 4, 2019
@highfive
Copy link

highfive commented Sep 4, 2019

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!

@paulrouget
Copy link
Contributor Author

Alright. Gonna use the compositor event approach instead.

@paulrouget
Copy link
Contributor Author

Done.

@jdm
Copy link
Member

jdm commented Sep 4, 2019

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit fd25e9e has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Sep 4, 2019
@bors-servo
Copy link
Contributor

⌛ Testing commit fd25e9e with merge d05ebf3...

bors-servo pushed a commit that referenced this pull request Sep 5, 2019
Do not allow XR session on non user-activated events

@jdm can you look at this? This sets the thread in "user interaction mode" when the dispatched event is trusted. I also tried an approach where we would not rely on the dispatched event but just set "user interaction mode" when we get a compositor event (which, we can assume, are only user generated). That worked as well.

r? @jdm

<!-- 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/24133)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 5, 2019
@CYBAI
Copy link
Member

CYBAI commented Sep 5, 2019

{
    "status": "PASS", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": "Requesting immersive session outside of a user gesture rejects", 
    "test": "/webxr/xrDevice_requestSession_immersive_no_gesture.https.html", 
    "line": 374587, 
    "action": "test_result", 
    "expected": "FAIL"
}
{
    "status": "TIMEOUT", 
    "group": "default", 
    "message": "Test timed out", 
    "stack": null, 
    "subtest": "create_session", 
    "test": "/_mozilla/webxr/create_session.html", 
    "line": 393534, 
    "action": "test_result", 
    "expected": "PASS"
}
{
    "status": "ERROR", 
    "group": "default", 
    "message": "The operation is insecure.", 
    "stack": "undefined:undefined:undefined", 
    "subtest": null, 
    "test": "/_mozilla/webxr/create_session.html", 
    "line": 393535, 
    "action": "test_result", 
    "expected": "OK"
}
{
    "status": "FAIL", 
    "group": "default", 
    "message": "promise_test: Unhandled rejection with value: object \"SecurityError: The operation is insecure.\"", 
    "stack": null, 
    "subtest": "obtain_frame", 
    "test": "/_mozilla/webxr/obtain_frame.html", 
    "line": 394168, 
    "action": "test_result", 
    "expected": "PASS"
}
{
    "status": "FAIL", 
    "group": "default", 
    "message": "promise_test: Unhandled rejection with value: object \"SecurityError: The operation is insecure.\"", 
    "stack": null, 
    "subtest": "Ensure that XRWebGLLayer's constructor throws appropriate errors", 
    "test": "/webxr/xrWebGLLayer_constructor.https.html", 
    "line": 401177, 
    "action": "test_result", 
    "expected": "TIMEOUT"
}
{
    "status": "OK", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/webxr/xrWebGLLayer_constructor.https.html", 
    "line": 401178, 
    "action": "test_result", 
    "expected": "ERROR"
}

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 12, 2019
@paulrouget
Copy link
Contributor Author

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

⌛ Trying commit f0bd0e7 with merge 30ad319...

bors-servo pushed a commit that referenced this pull request Sep 12, 2019
Do not allow XR session on non user-activated events

@jdm can you look at this? This sets the thread in "user interaction mode" when the dispatched event is trusted. I also tried an approach where we would not rely on the dispatched event but just set "user interaction mode" when we get a compositor event (which, we can assume, are only user generated). That worked as well.

r? @jdm

<!-- 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/24133)
<!-- Reviewable:end -->
@servo-wpt-sync
Copy link
Collaborator

Opened new PR for upstreamable changes.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#19018.

@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Sep 12, 2019
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Sep 12, 2019
@paulrouget
Copy link
Contributor Author

@bors-servo try=wpt

@jdm jdm added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 13, 2019
@atouchet
Copy link
Contributor

This looks like it needs to be restarted.

@jdm
Copy link
Member

jdm commented Sep 19, 2019

@bors-servo retry

@bors-servo
Copy link
Contributor

⌛ Testing commit 30eca13 with merge d65c0dc...

bors-servo pushed a commit that referenced this pull request Sep 19, 2019
Do not allow XR session on non user-activated events

@jdm can you look at this? This sets the thread in "user interaction mode" when the dispatched event is trusted. I also tried an approach where we would not rely on the dispatched event but just set "user interaction mode" when we get a compositor event (which, we can assume, are only user generated). That worked as well.

r? @jdm

<!-- 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/24133)
<!-- Reviewable:end -->
@jdm
Copy link
Member

jdm commented Sep 19, 2019

This needs a ./mach fmt, sadly.

@bors-servo
Copy link
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 19, 2019
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 20, 2019
@servo-wpt-sync
Copy link
Collaborator

Transplanted upstreamable changes to existing PR.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#19051.

1 similar comment
@servo-wpt-sync
Copy link
Collaborator

Transplanted upstreamable changes to existing PR.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#19051.

@servo-wpt-sync
Copy link
Collaborator

Transplanted upstreamable changes to existing PR.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#19051.

@paulrouget
Copy link
Contributor Author

@bors-servo r=jdm

@bors-servo
Copy link
Contributor

📌 Commit ea7b581 has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Sep 20, 2019
@bors-servo
Copy link
Contributor

⌛ Testing commit ea7b581 with merge 293ccd0...

bors-servo pushed a commit that referenced this pull request Sep 20, 2019
Do not allow XR session on non user-activated events

This sets the thread in "user interaction mode" when the dispatched event is trusted. I also tried an approach where we would not rely on the dispatched event but just set "user interaction mode" when we get a compositor event (which, we can assume, are only user generated). That worked as well.

Fixes #23787.

<!-- 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/24133)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: jdm
Pushing 293ccd0 to master...

@bors-servo bors-servo merged commit ea7b581 into servo:master Sep 20, 2019
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 20, 2019
.then((session) => {
let sessionPromise;
navigator.xr.test.simulateUserActivation(function() {
sessionPromise = navigator.xr.requestSession('inline');
Copy link
Member

Choose a reason for hiding this comment

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

Note: this was a mistake, inline sessions with no tracking data (which must be explicitly requested via features) don't need activation

Copy link
Member

Choose a reason for hiding this comment

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

File an issue? That sounds like a mistake in our implementation.

Copy link
Member

Choose a reason for hiding this comment

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

We don't support inline (#24186) or features (#24270), so this test will fail anyway.

Copy link
Member

Choose a reason for hiding this comment

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

In other words, we don't have enough of an implementation of the prerequisites to write the code for this. Paul's implementation is correct for the features we have right now, it's just the test change that isn't. Alex Cooper is already fixing the test so we're fine, I just wanted to note this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check for user activation in WebXR
8 participants