Dispatch a "firstpaint" event for mozbrowsers

RESOLVED FIXED in mozilla18

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: cjones, Assigned: Justin Lebar (not reading bugmail))

Tracking

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

unspecified
mozilla18
dev-doc-needed
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

This lets the embedder know when the iframe has valid pixels available.  This is useful for things like https://github.com/mozilla-b2g/gaia/issues/4213 .

To implement this, I think we'd want to
 - register a MozAfterPaint listener from BrowserElementChild when it's initialized
 - when the first MozAfterPaint event is dispatched, fire the "firstpaint" notification to the embedder
 - unhook the MozAfterPaint listener (they can cause some perf issues)
(Assignee)

Updated

5 years ago
Assignee: nobody → justin.lebar+bug
Hm ... need to be careful about about:blank here.
(Assignee)

Comment 2

5 years ago
(In reply to Chris Jones [:cjones] [:warhammer] from comment #1)
> Hm ... need to be careful about about:blank here.

Yeah, I was just about to comment on that.  :)  But I think we can just check the location of the docshell/document.
(Assignee)

Comment 3

5 years ago
> But I think we can just check the location of the docshell/document.

...unless http://foo.com can be painted before the docshell's location changes away from about:blank.  I hope not, but I'm not sure.
If that were true, I think that many things other than this would be broken.
(Assignee)

Comment 5

5 years ago
One way to find out, I guess.

https://tbpl.mozilla.org/?tree=Try&rev=0f81ae103909

Anyone want to take bets on which platform will go randomorange?  My money is on OSX.
(Assignee)

Comment 6

5 years ago
No random oranges; just permaorange on opt builds on all platforms.  :)
(Assignee)

Comment 7

5 years ago
Second time's a charm? https://tbpl.mozilla.org/?tree=Try&rev=3ec505fdd543
(Assignee)

Comment 8

5 years ago
Created attachment 657434 [details] [diff] [review]
Part 1: Fire a "firstpaint" event in iframe mozbrowser.
Attachment #657434 - Flags: review?
(Assignee)

Comment 9

5 years ago
Created attachment 657435 [details] [diff] [review]
Bug 787378 - Part 2: Tests for mozbrowserfirstpaint event.
Attachment #657435 - Flags: review?
(Assignee)

Updated

5 years ago
Attachment #657434 - Flags: review? → review?(dale)
(Assignee)

Updated

5 years ago
Attachment #657435 - Flags: review? → review?(dale)
Comment on attachment 657434 [details] [diff] [review]
Part 1: Fire a "firstpaint" event in iframe mozbrowser.

Stealing.

>diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js

> function debug(msg) {
>-  //dump("BrowserElementChild - " + msg + "\n");
>+  // dump("BrowserElementChild - " + msg + "\n");

This is distracting, please remove.

Looks good!  r=me with nitfix
Attachment #657434 - Flags: review?(dale) → review+
Attachment #657435 - Flags: review?(dale) → review+
(Assignee)

Comment 11

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/0d060c3e7d65
https://hg.mozilla.org/integration/mozilla-inbound/rev/50e752beca26

I, um, forgot to put "r=cjones" in the commit messages.  Oops.
10 demerits.  10 more and we bust you down to L2 ;).
https://hg.mozilla.org/mozilla-central/rev/0d060c3e7d65
https://hg.mozilla.org/mozilla-central/rev/50e752beca26
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Blocks: 796254

Updated

5 years ago
No longer blocks: 796254

Updated

4 years ago
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.