Bug 87448

Summary: Presence of video tag causes DumpRenderTree to exit before calling onload handler
Product: WebKit Reporter: Kenneth Russell <kbr>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, eric.carlson, jer.noble
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case; unzip in LayoutTests/fast/canvas/webgl
none
Revised test case showing onload handler is not called none

Description Kenneth Russell 2012-05-24 18:41:15 PDT
Created attachment 143946 [details]
Test case; unzip in LayoutTests/fast/canvas/webgl

It appears that if a <video> tag is present, DumpRenderTree will exit before calling the body's onload handler, unless layoutTestController.waitUntilDone() has been called. If waitUntilDone() is called within the body's onload handler, the test will exit early.

Reproduced with Chromium port's DumpRenderTree implementation. Not sure whether it happens with other ports.

Commenting out the video tag causes the onload handler to run 100% reliably.

Calling waitUntilDone() in script executed during page load causes the test to run 100% reliably.

See the attached test case; unzip in LayoutTests/fast/canvas/webgl.
Comment 1 Kenneth Russell 2012-05-24 18:43:50 PDT
Discovered while working on Bug 87042 and Bug 86877.
Comment 2 Ami Fischman 2012-05-24 23:29:09 PDT
kbr: do you know if DRT's behavior is document somewhere vis-a-vis what it guarantees to execute before exiting when waitUntilDone() hasn't been called?
Comment 3 Eric Carlson 2012-05-25 08:49:36 PDT
The media element will block the document's 'load' event during setup and initial buffering, are you sure your onload handler is being called at all?
Comment 4 Kenneth Russell 2012-05-25 10:18:26 PDT
(In reply to comment #2)
> kbr: do you know if DRT's behavior is document somewhere vis-a-vis what it guarantees to execute before exiting when waitUntilDone() hasn't been called?

I don't know whether it's written down but it seems to be common knowledge among WebKit developers; jamesr told me that that is definitely the rule.
Comment 5 Ami Fischman 2012-05-25 10:20:15 PDT
(In reply to comment #4)
> (In reply to comment #2)
> > kbr: do you know if DRT's behavior is document somewhere vis-a-vis what it guarantees to execute before exiting when waitUntilDone() hasn't been called?
> 
> I don't know whether it's written down but it seems to be common knowledge among WebKit developers; jamesr told me that that is definitely the rule.

Sorry, what is the common knowledge?
(I really don't know what the contract is)
Comment 6 Kenneth Russell 2012-05-25 10:22:40 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #2)
> > > kbr: do you know if DRT's behavior is document somewhere vis-a-vis what it guarantees to execute before exiting when waitUntilDone() hasn't been called?
> > 
> > I don't know whether it's written down but it seems to be common knowledge among WebKit developers; jamesr told me that that is definitely the rule.
> 
> Sorry, what is the common knowledge?
> (I really don't know what the contract is)

Sorry; I meant that the onload handler is called before DRT exits.
Comment 7 Kenneth Russell 2012-05-25 10:23:26 PDT
(In reply to comment #3)
> The media element will block the document's 'load' event during setup and initial buffering, are you sure your onload handler is being called at all?

When the problem occurs, the onload handler is definitely not getting called. I'll upload a revised test case showing this.
Comment 8 Kenneth Russell 2012-05-25 10:24:02 PDT
Created attachment 144096 [details]
Revised test case showing onload handler is not called
Comment 9 Eric Carlson 2012-05-25 10:41:40 PDT
(In reply to comment #7)
> 
> When the problem occurs, the onload handler is definitely not getting called. I'll upload a revised test case showing this.

So I'll bet that this is caused by the <video> element delaying the 'load' event while loading and parsing the initial portion of the file. As far as I know DRT does not wait for the 'load' event to be fired, that is what waitUntilDone() is for.
Comment 10 Ami Fischman 2012-05-25 10:45:55 PDT
(In reply to comment #9)
> As far as I know DRT does not wait for the 'load' event to be fired, that is what waitUntilDone() is for.

Eric: what would you say DRTs contract is/should be?
FWIW, http://trac.webkit.org/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree says:
   By default, DumpRenderTree dumps each test file immediately after the document has loaded and the load event handlers have executed.
Comment 11 Eric Carlson 2012-05-25 11:02:41 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > As far as I know DRT does not wait for the 'load' event to be fired, that is what waitUntilDone() is for.
> 
> Eric: what would you say DRTs contract is/should be?
> FWIW, http://trac.webkit.org/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree says:
>    By default, DumpRenderTree dumps each test file immediately after the document has loaded and the load event handlers have executed.

Silly me!