In prerendering, document.visibilityState should returns "prerender".

RESOLVED FIXED in Firefox 49

Status

()

RESOLVED FIXED
5 years ago
5 days ago

People

(Reporter: teoli, Assigned: freesamael)

Tracking

(Blocks: 1 bug, {dev-doc-complete})

unspecified
mozilla49
x86
macOS
dev-doc-complete
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox49 fixed)

Details

(Whiteboard: btpp-active, URL)

Attachments

(2 attachments, 7 obsolete attachments)

(Reporter)

Description

5 years ago
document.visibilityState should returns "prerender" when in prerender mode.

According to this, I understand that Chrome supports it: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/TwCghLHBYwA
Assignee: nobody → sawang
Whiteboard: btpp-active
Depends on: 1271240
Posted patch Part 2: Add test case (obsolete) — Splinter Review
Attachment #8751595 - Attachment is obsolete: true
Attachment #8751597 - Attachment is obsolete: true
Posted patch Part 2: Add test case (obsolete) — Splinter Review
Posted patch Part 2: Add test case (obsolete) — Splinter Review
Attachment #8751716 - Attachment is obsolete: true
Attachment #8751717 - Attachment is obsolete: true
Comment on attachment 8752064 [details] [diff] [review]
Part 1: Update document to support prerender visibility state. r=smaug

Hi Olli,

It seems as long as prerender flag is set correctly, it needs only minimal change to nsDocument to support "prerender" visibilityState.

Could you help to review this patch?
Attachment #8752064 - Flags: review?(bugs)
Comment on attachment 8752065 [details] [diff] [review]
Part 2: Add test case

Hi Olli,

The test case tries to verify behaviors based on the description of the latest draft [1]:
> If doc was prerendered and has not previously transitioned to "visible", return "prerender".

It indicates visibilityState should never change back to "prerender" again after active, so the flow tests transition from prerender => visible => hidden => visible on both remote and non-remote browsers.

It also checks hidden attribute should be true when "hidden" or "prerender" [2].

Could you help to review this patch?

[1] https://w3c.github.io/page-visibility/#visibilitystate-attribute
[2] https://w3c.github.io/page-visibility/#hidden-attribute
Attachment #8752065 - Flags: review?(bugs)
Comment on attachment 8752064 [details] [diff] [review]
Part 1: Update document to support prerender visibility state. r=smaug

Not about this bug; just wondering if anyone supports "unloaded" state, and if so, should we too. Perhaps worth to file a bug.
Attachment #8752064 - Flags: review?(bugs) → review+
Attachment #8752065 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] from comment #10)
> Comment on attachment 8752064 [details] [diff] [review]
> Part 1: Update document to support prerender visibility state
> 
> Not about this bug; just wondering if anyone supports "unloaded" state, and
> if so, should we too. Perhaps worth to file a bug.

I just noticed the latest draft has removed "unloaded" state, instead it simply uses hidden:
> Return "hidden" if: ... 
> 3. The user agent is to unload doc
ah, that is better. I was looking at some other version then.
Attachment #8752065 - Attachment is obsolete: true
Comment on attachment 8753710 [details] [diff] [review]
Part 2: Add test case. r=smaug

split the test case into 2 so it runs on non-e10s mode
Attachment #8753710 - Attachment description: Part 2: Add test case → Part 2: Add test case. r=smaug
Attachment #8753710 - Flags: review+
Attachment #8752064 - Attachment description: Part 1: Update document to support prerender visibility state → Part 1: Update document to support prerender visibility state. r=smaug
Keywords: checkin-needed
rebase before checkin
Attachment #8752064 - Attachment is obsolete: true
Attachment #8753710 - Attachment is obsolete: true
Attachment #8756233 - Attachment description: Part 2: Add test case → Part 2: Add test case. r=smaug
Attachment #8756233 - Flags: review+
Attachment #8756234 - Attachment description: Part 1: Update document to support prerender visibility state → Part 1: Update document to support prerender visibility state. r=smaug
Attachment #8756234 - Flags: review+

Comment 20

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/d9b584a14402
https://hg.mozilla.org/mozilla-central/rev/7909d0735869
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox49: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
(Reporter)

Updated

3 years ago
Keywords: dev-doc-needed
Component: DOM → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.