[Webkit-unassigned] [Bug 24747] New: preloading logic caused the same resource was loaded and reloaded.(sent two requests for same resource)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 22 06:43:13 PDT 2009


           Summary: preloading logic caused the same resource was loaded and
                    reloaded.(sent two requests for same resource)
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows Vista
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Page Loading
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: johnnyding.webkit at gmail.com

Please refer to the following html content

<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<SCRIPT type="text/javascript" src="test.js"></SCRIPT>
</HEAD><BODY><IMG src="test.jpg">

The following is bug analysis:

1)When requiring "test.js", WebKit started a PreloadScanner to see whether
there were some resources written in m_pendingSrc which could be preloaded in
function "HTMLTokenizer::scriptHandler". 

2)In "DocLoader::preload", it put resources in pending list when they were
preload images or body resources before WebKit had something to draw, which
caused "test.jpg" was put in DocLoader's m_pendingPreloads.

3)When finishing "test.js", WebKit continued parsing m_pendingSrc in
"HTMLTokenizer::notifyFinished", which caused WebKit called "requestResource"
to get a CachedResource for "test.jpg" (parameter isPreload is false).

4)After calling "HTMLTokenizer::notifyFinished", the DocLoader's
checkForPendingPreloads was called(see Loader::Host::didFinishLoading). In this
function, it called "requestResource" again to get a CachedResource for
"test.jpg" (parameter isPreload is true). Inside "DocLoader::requestResource",
the function "checkForReload" removed the existing CachedResource for
"test.jpg" created in step3 and started to re-create a CachedResource to reload
"test.jpg", which is totally unnecessary.

The reason of this problem is that WebKit created CachedResource for one
resource and reloaded it because of preloading logic. I think we should check
isPreload parameter in function "checkForReload", ignore the reload request if
the isPreload is true when there is one CachedResource existed for same

The patch for the fix and corresponding testcase will be sent soon.


Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list