Closed Bug 690056 Opened 13 years ago Closed 13 years ago

Implement visibility api

Categories

(Core :: DOM: Core & HTML, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

()

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 1 obsolete file)

To do it per spec, we need a fix for bug 443316.

Do we want to do a moz-prefixed impl with moz-prefixed numeric constants instead for now?
Or we could not have those constants for now; just the two properties.  That seems ok to me.
Blocks: webapi
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → Trunk
Paul, is there anything else you'd want from bug 674701 after we finish this?  I.e. what do you want that Page Visibility doesn't provide, or do you have specific browser bugs in mind with existing Page Visibility implementations that we should avoid here.
Hi Chris,

glad  you're asking. Here are the common usecases I want to see covered:

- notification when the browser is hidden because of a phone call
- notification when the engine is halted (most mobile OS'ses halt the browser threat in some cases)

A page can technically be visible but still 'frozen' - easiest example is an alert(). I think window focus events might be enough if implemented correctly to cover this.

Does this help?
Keywords: dev-doc-needed
Attachment #563842 - Attachment is obsolete: true
Attachment #563842 - Flags: review?(jonas)
++bz, this totally rocks
One drawback: when we drop the vendor prefix any content written against this code will break unless it's also checking the non-prefixed bits...
That's a good question, yes.

I think Henri's real issue is with the timeframe it takes to get to CR.  I fully expect this spec to be in CR within a few months, so that the vendor prefixes will go away then.  The benefits of small specs.

In the meantime, I made a bunch of implementation calls that the spec does not define yet and I'm not sure about, so I want to prefix just to make sure we don't get locked into those.  I _think_ I made the right tradeoffs, but it's not obvious.
Comment on attachment 563844 [details] [diff] [review]
Implement a vendor-prefixed version of the visibility API.   idea is to fire the visibilitychange event synchronously during pageshow and pagehide, since we're

Review of attachment 563844 [details] [diff] [review]:
-----------------------------------------------------------------

I'm surprised that only calling PostVisibilityUpdateEvent in one location covers all cases. Does it cover display:none iframes getting hidden? I couldn't see a test for that.

Or do we not want to do that yet given the discussion on the mailing list?

::: content/base/src/nsDocument.cpp
@@ +8727,5 @@
> +nsDocument::GetVisibilityState() const
> +{
> +  // We have to check a few pieces of information here:
> +  // 1)  Are we in bfcache (!IsVisible())?  If so, nothing else matters;
> +  //     we

There seems to be an end to the sentence missing.
> Does it cover display:none iframes getting hidden?

No.  For now, I'm not doing anything special for display:none iframes, just like other browsers do not.  The version of this patch in my tree in fact has a test for that non-specialness.

It would be pretty simple to change that if we want, of course.

> There seems to be an end to the sentence missing.

There should just be a period after "matters" and no trailing "we".  Fixed.
Comment on attachment 563844 [details] [diff] [review]
Implement a vendor-prefixed version of the visibility API.   idea is to fire the visibilitychange event synchronously during pageshow and pagehide, since we're

Cool, sounds good with that.
Attachment #563844 - Flags: review?(jonas) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/c7b4452ef1d2
Flags: in-testsuite+
Priority: -- → P1
Target Milestone: --- → mozilla10
https://hg.mozilla.org/mozilla-central/rev/c7b4452ef1d2
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Depends on: 1121701
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: