Bug 36208 - dispatchDidFinishLoad() gets called before all resources finished loaded if another frame is loading the same resources
Summary: dispatchDidFinishLoad() gets called before all resources finished loaded if a...
Status: RESOLVED DUPLICATE of bug 18762
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-03-16 22:11 PDT by mitz
Modified: 2011-03-02 06:15 PST (History)
4 users (show)

See Also:


Attachments
Sample project (14.39 KB, application/octet-stream)
2010-03-16 22:11 PDT, mitz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2010-03-16 22:11:44 PDT
Created attachment 50874 [details]
Sample project

Under certain conditions, dispatchDidFinishLoad() may get called on a FrameLoaderClient before all the frame’s resources have actually finished loading. Specifically, the scenario is as follows:
1. Frame A’s main resource begins loading
2. Frame A kicks off loading of subresource R
3. Frame B’s main resource begins loading
4. Frame B requests the same subresource R
5. Frame B’s main resource finishes loading

At that point, frame B’s FrameLoadClient will get dispatchDidFinishLoad(), even though resource R has not finished loading.

The reason for this is that Frame B’s DocumentLoader doesn’t track the loading of R, since the Cache::requestResource() returns an already-loading resource (whose ResourceLoader is tracked by Frame A’s DocumentLoader). Thus when Frame B’s main resource finishes loading, its DocumentLoader sees no subresource loaders in progress, and that allows the didFinishLoad to be dispatched.

The attached project demonstrates this on Mac OS X. Open the project and build DidNotQuiteFinishLoading. Then copy file1.html, file2.html and common.css into your working directory and run DidNotQuiteFinishLoading. A printed value of rgb(0, 0, 0) indicates that Frame B’s didFinishLoading occurred before the style sheet had actually finished loading. A result of rgb(255, 0, 0) would be correct.
Comment 1 mitz 2010-03-16 22:12:21 PDT
<rdar://problem/7762277>
Comment 2 Andreas Kling 2011-03-02 06:15:40 PST

*** This bug has been marked as a duplicate of bug 18762 ***