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 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
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

paulrouget commented Sep 4, 2019

Alright. Gonna use the compositor event approach instead.

@paulrouget paulrouget force-pushed the paulrouget:userAction branch from a303222 to fd25e9e Sep 4, 2019
@paulrouget
Copy link
Contributor Author

paulrouget commented Sep 4, 2019

Done.

@jdm
Copy link
Member

jdm commented Sep 4, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Sep 4, 2019

📌 Commit fd25e9e has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Sep 5, 2019

Testing commit fd25e9e with merge d05ebf3...

bors-servo added 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

bors-servo commented Sep 5, 2019

💔 Test failed - linux-rel-wpt

@CYBAI
Copy link
Collaborator

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"
}
@paulrouget paulrouget force-pushed the paulrouget:userAction branch from fd25e9e to f0bd0e7 Sep 12, 2019
@paulrouget
Copy link
Contributor Author

paulrouget commented Sep 12, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Sep 12, 2019

Trying commit f0bd0e7 with merge 30ad319...

bors-servo added 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

servo-wpt-sync commented Sep 12, 2019

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

bors-servo commented Sep 12, 2019

💔 Test failed - linux-rel-wpt

@paulrouget paulrouget force-pushed the paulrouget:userAction branch from f0bd0e7 to 316a815 Sep 12, 2019
@paulrouget
Copy link
Contributor Author

paulrouget commented Sep 12, 2019

@bors-servo try=wpt

@atouchet
Copy link
Contributor

atouchet commented Sep 19, 2019

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

bors-servo commented Sep 19, 2019

Testing commit 30eca13 with merge d65c0dc...

bors-servo added 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

bors-servo commented Sep 19, 2019

💔 Test failed - status-taskcluster

@paulrouget paulrouget force-pushed the paulrouget:userAction branch from 30eca13 to e6d2d77 Sep 20, 2019
@paulrouget paulrouget force-pushed the paulrouget:userAction branch from e6d2d77 to 014e5d4 Sep 20, 2019
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Sep 20, 2019

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

servo-wpt-sync commented Sep 20, 2019

Transplanted upstreamable changes to existing PR.

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

@paulrouget paulrouget force-pushed the paulrouget:userAction branch from 014e5d4 to ea7b581 Sep 20, 2019
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Sep 20, 2019

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

paulrouget commented Sep 20, 2019

@bors-servo r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Sep 20, 2019

📌 Commit ea7b581 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Sep 20, 2019

Testing commit ea7b581 with merge 293ccd0...

bors-servo added 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

bors-servo commented Sep 20, 2019

☀️ 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
3 checks passed
3 checks passed
Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Sep 20, 2019
0 of 5 tasks complete
.then((session) => {
let sessionPromise;
navigator.xr.test.simulateUserActivation(function() {
sessionPromise = navigator.xr.requestSession('inline');

This comment has been minimized.

@Manishearth

Manishearth Sep 24, 2019

Member

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

This comment has been minimized.

@jdm

jdm Sep 24, 2019

Member

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

This comment has been minimized.

@Manishearth

Manishearth Sep 24, 2019

Member

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

This comment has been minimized.

@Manishearth

Manishearth Sep 24, 2019

Member

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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants
You can’t perform that action at this time.