New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 817454 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug
Proj-VR
Proj-XR


Participants' hotlists:
Hotlist-1


Sign in to add a comment

WebVR scenes not rendering in magic window through an iframe

Project Member Reported by winston...@samsung.com, Feb 28 2018

Issue description

Chrome Version: Chrome Canary, 66.0.3356.0, Chrome Beta 65.0.3325.85, Chrome 64.0.3282.137
OS: Android

What steps will reproduce the problem?
(1) Enable WebVR in chrome://flags
(2) Go to https://aframe.io/examples/


What is the expected result?
The A-frame example should render the scene through the magic window feature.


What happens instead?
The A-frame example does not render the scene. If you tap the scene, the scene will get rendered.

Additional Information
The A-frame example is loaded through an iframe. In order for the scene to render,
the frame needs to receive focus. Normally if the page has blur, then the scene does 
not get rendered:

void VRDisplay::RequestVSync() {
...
if (display_blurred_)
    return;
...
}

This function returns whether the frame is focused:

bool VRDisplay::FocusedOrPresenting() {
  // The browser can't track focus for frames, so we still need to check for
  // focus in the renderer, even if the browser is checking focus before
  // sending input.
  return navigator_vr_->IsFocused() || is_presenting_;
}

And this function reports if the frame has focus:

void NavigatorVR::FocusedFrameChanged() {
  bool focused = IsFrameFocused(GetSupplementable()->GetFrame());
  if (focused == focused_)
    return;
  focused_ = focused;
  if (controller_) {
    controller_->SetListeningForActivate(listening_for_activate_ && focused);
    controller_->FocusChanged();
  }
}

The problem is in void NavigatorVR::FocusedFrameChanged(), specifically this line:
bool focused = IsFrameFocused(GetSupplementable()->GetFrame());.
The focused flag should check if the page has focus, so all child frames receive focus
as well. Currently, the parent frame has focus, but the child frame (iframe in the above
website) does not receive focus and fails to call RequestVSync() to render in magic window.

Also, from my understanding, these methods 'onvrdisplayblur' and 'onvrdisplayfocus' refer to the display/page and not a frame on the page?

I attached a diff that fixes this problem, but it might not be the complete solution.

 
diff.txt
669 bytes View Download
Components: Blink>WebVR
This is currently working as intended. We intentionally don't want unfocused frames to receive the input and tracking data provided by the VR APIs.

There are many reasons for this, but one key one is that we don't want to allow cross-origin content to do things like side-channel attacks using the high-accuracy sensor data provided by the VR APIs to figure out what the user is doing on the host page, up to and including things like keylogging.

We could consider relaxing this to allow same-origin frames without focus, but then we'd probably also want to re-use poses across navigators for the same frame or something so we're not doing extra unnecessary IPC for each additional webVR frame on the page.

I think the best solution here is just for A-frame to focus the iframe that it wants webVR active in.
navigators for the same page*
Cc: bajones@chromium.org
For spec discussion, see https://github.com/immersive-web/webxr/issues/250. We should address that before making complex changes.
Thanks for clarifying. I'll notify the A-frame team.
Owner: winston...@samsung.com
Status: Assigned (was: Untriaged)
Winston, assigning back to you.  Could you mark this as WontFix once you've notified A-frame, etc?
Hi, I submitted an issue a while back (https://github.com/aframevr/aframe/issues/3411).
Status: WontFix (was: Assigned)
Components: Blink>WebXR

Sign in to add a comment