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

Issue 865192 link

Starred by 6 users

Issue metadata

Status: Available
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Page Visibility API not updating in cross-domain iframe

Reported by samkjo...@gmail.com, Jul 18

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Steps to reproduce the problem:
1. Open dev tools on any page containing a cross-domain iframe and select the document of the cross-domain iframe.
2. With dev tools in a separate window, minimize the page. The values of `document.hidden` and `document.visibilityState` will (incorrectly) be `false` and `"visible"`, respectively.
3. Now select the document of the top window in dev tools and repeat step 2. The values of `document.hidden` and `document.visibilityState` will be `true` and `"hidden"`

What is the expected behavior?
When the page is minimized, `document.hidden` should be `true` and `document.visibilityState` should be `"hidden"` (in any document).

What went wrong?
In the cross-domain iframe, `document.hidden` is `false` and `document.visibilityState` is `"visible"`

Did this work before? Yes I don't know the exact version.

Does this work in other browsers? Yes

Chrome version: 67.0.3396.99  Channel: stable
OS Version: OS X 10.13.6
Flash Version: Shockwave Flash 30.0 r0

This bug only affects Chrome 67 (as far as I know), and only affects the minimized window and lockscreen cases.

It is not present in Chrome Canary, Opera, Firefox, or Safari. Even though Canary works OK, I'm still filing in case this was something that was missed.
 
Components: Blink>PageLifecycle Internals>Sandbox>SiteIsolation
Cc: fsam...@chromium.org a...@chromium.org dcheng@chromium.org lfg@chromium.org
Labels: -Pri-2 Pri-1
Owner: kenrb@chromium.org
Status: Assigned (was: Unconfirmed)
Interesting.  This repros for me on Mac Chrome 67.0.3396.99, but not on Windows or Linux Chrome 67.0.3396.99 (using http://csreis.github.io/tests/cross-site-iframe.html after clicking "Go cross-site (simple page)").

It still repros for me on Mac Canary 69.0.3495.0, so it doesn't appear fixed.

Ken, do you happen to know who works on the page visibility API and who might be able to look into this?  CC'ing Avi as well, since it's Mac specific.
Labels: FoundIn-67
Cc: kenrb@chromium.org
Owner: panicker@chromium.org
panicker@, do you think you (or someone on your team) could investigate this?
Cc: panicker@chromium.org ojan@chromium.org
Owner: ----
Status: Available (was: Assigned)
Page visibility doesn't have an owner at the moment.
I'm happy to do code reviews, but won't have time to look into this P1 issue (also out for the rest of the week btw)
This affects also the case in which a window is totally covered by another one.
We also stumbled over this issue today.

We could reproduce the issue in MacOS 10.13.6 with Chrome 69.0.3497.92 (Official Build). We also tried on MacOS 10.13.6 with Chrome 68.0.3440.106 and could not reproduce the issue there. If the OP found it in Chrome 67 it seems to have been fixed in Chrome 68 but reintroduced in Chrome 69.

Seems like a clear bug to us since the rfc specifies that the state should always be based on the top context and we get different document.hidden values in top context (true) and cross-site-iframe context (false) when minimizing the browser.

So the info about minimizing reaches the browser since document.hidden gives true in the top context but somehow this information does not reach the cross-site-iframe. This also breaks related features like the throttling of timeouts in background.
On issue 886613 I found out that adding --disable-features=WebContentsOcclusion to the command line fixed an issue related to cross-site-iframes... I wonder if the same fix causes this to work. And that would explain why it is mac only because occulusion support is mac & chromeos only.
Thanks for the note. We tried adding --disable-features=WebContentsOcclusion but it does not fix the issue. It rather disables detecting minimized browser completely.

With --disable-features=WebContentsOcclusion in minimized browser:
- in top context: document.hidden == false
- in cross-site-iframe context: document.hidden == false

Without --disable-features=WebContentsOcclusion in minimized browser:
- in top context: document.hidden == true
- in cross-site-iframe context: document.hidden == false


Owner: fdoray@chromium.org
Any updates on this? Anything we can do to narrow down the issue?
I actually think this might be related to WebContentsImpl::WasOccluded; right now we do not replicate a page message for visibility API the same way as WebContentsImpl::WasHidden. I will test this and update.
Confirming that adding:
  SendPageMessage(new PageMsg_WasHidden(MSG_ROUTING_NONE));
to WebContentsImpl::WasOccluded fixes the issue. This is similar to  issue 903455  but not exactly the same. I can work on this if no one else is.
Cc: danakj@chromium.org
+danakj who's looking at page visibility recently.
Can WebContentsImpl::WasOccluded and WebContentsImpl::WasHidden share code and do the same things?
Also same for Shown. Note that WebContentsImpl::WasShown was recently reordered to fix race conditions, with sending the Page shown before the widgets.
danakj@: There is similarities between them - but I suspect there is Occluded-specific logic which we might need to preserve (looking at RenderWidgetHostViewMac/Aura::WasOccluded and Hide).

Sign in to add a comment