Summary: | preloading logic caused the same resource was loaded and reloaded.(sent two requests for same resource) | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | johnnyding <johnnyding.webkit> | ||||||||||||||||||
Component: | Page Loading | Assignee: | Adam Barth <abarth> | ||||||||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||||||||
Severity: | Normal | CC: | abarth, ap, darin, emacemac7, jasneet, johnnyding.webkit, koivisto, yael | ||||||||||||||||||
Priority: | P2 | ||||||||||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||||||||||
Hardware: | PC | ||||||||||||||||||||
OS: | Windows Vista | ||||||||||||||||||||
Attachments: |
|
Description
johnnyding
2009-03-22 06:43:12 PDT
Created attachment 28831 [details]
HTML file for reproducing this problem
Created attachment 28832 [details]
image file for the test HTML
Created attachment 28833 [details]
empty js file for the test HTML
Created attachment 28851 [details]
patch V1 for fixing this bug, so far no test
I did not add test for this patch. It's because to reproduce this problem, I have to rewrite my own HTTP server to catch up the image reload and return a 401 error to let page trigger the error condition. I am not sure whether you guys have concerns on it or not. If not, I will add it on patch V2. It's highly appreciated if someone can point me out the similar existing testcase, then I can leverage it.
Thanks!
> 401 error
You could use technique from http/tests/resources/network-simulator.php to make a stateful resource that would generate an error every other time. Some caution should be taken to reset the state before and/or after the test, so that each run of the test would be guaranteed to be the same, even if code were temporarily broken.
Created attachment 29186 [details]
patch V2 to fix this bug
V2 is ready. sorry for being late.
Created attachment 29187 [details]
latest V2 patch
*** Bug 25015 has been marked as a duplicate of this bug. *** Would anyone take a look this bug and patch? Thanks! This patch is simple. I will highly appreciate if someone who has review authority can take a look this patch. Thanks! (In reply to comment #10) > This patch is simple. I will highly appreciate if someone who has review > authority can take a look this patch. > > Thanks! There is no patch on this bug which is marked for review. Please mark your patches r=? if you'd like someone to review them. :) http://webkit.org/coding/contributing.html Comment on attachment 29187 [details]
latest V2 patch
You ChangeLog entry shoudl also have a description of what you're changing (why your'e making the change, how you're fixing the bug, etc.) and the URL of the bugzilla bug.
Created attachment 29419 [details]
update patch v2
Thank Eric. I have added the bug URL and simple description for the patch.
> ignore the reload request if the isPreload is true when there is one > CachedResource existed for same resource. I don't think that this is correct. When reloading a page with Cmd+R, you need to reload (revalidate) all resources, preloaded or not. This bug might have been fixed in <http://trac.webkit.org/changeset/43831>, but I'm somewhat confused since in that case, it was essential that the document was a result of posting a form. It does look to me like Darin's patch should have fixed it. Johnny, can you check if that's the case? (In reply to comment #15) > It does look to me like Darin's patch should have fixed it. Johnny, can you > check if that's the case? Maciej means Alexey's patch <http://trac.webkit.org/changeset/43831>. I was just the reviewer. Yes, Alexey's patch has fixed it. I will close this bug. (In reply to comment #14) > > ignore the reload request if the isPreload is true when there is one > > CachedResource existed for same resource. > > I don't think that this is correct. When reloading a page with Cmd+R, you need > to reload (revalidate) all resources, preloaded or not. > > This bug might have been fixed in <http://trac.webkit.org/changeset/43831>, but > I'm somewhat confused since in that case, it was essential that the document > was a result of posting a form. > I don't see the original bug related with Alexey's patch. But this case were because WebKit called requestPreload for a preloaded resource in DocLoader::checkForPendingPreloads without checking whether the resource was loaded or not. So yes, Alexey's patch did fix it. We should land a test from this bug - we have very few tests for preloading, so it would be very useful. Would you be willing to prepare a patch with just the test, and submit it for review? Sure, I think the test in my previous patch should be OK. I will extract it and send it as a new patch for test. Created attachment 30712 [details]
patch for test of this issue
Comment on attachment 30712 [details] patch for test of this issue > + Reviewed by NOBODY (OOPS!). > + https://bugs.webkit.org/show_bug.cgi?id=24747 > + > + Add a test case for multiple requests for same sub-resource due to preload. We usually put an empty line after "Reviewed by" line, not between bug reference and title. > + > + * http\tests\loading\preload-img-test-expected.txt: Added. > + * http\tests\loading\preload-img-test.html: Added. > + * http\tests\loading\resources\preload-test.jpg: Added. > + * http\tests\resources\network-simulator.php: One day we should fix prepare-ChangeLog to not emit Windows paths. > +main frame - didStartProvisionalLoadForFrame > +main frame - didCommitLoadForFrame > +main frame - didFinishDocumentLoadForFrame > +main frame - didHandleOnloadEventsForFrame > +main frame - didFinishLoadForFrame These lines are useless - but I know that they are generated because the test in in a loading/ directory. Maybe we just need a new directory for preloading tests. > + document.getElementById("outputPanel").innerHTML = "FALIED"; Typo: "FAILED". + <span id="outputPanel">PASSED</span> It's not good to have "PASSED" output from the beginning - if the test doesn't run to completion, that could mask the failure. These are all extremely minor nitpicks, just wanted to mention them for the future. No need to fix them to land this patch. It is really great to have a framework for preloading tests, and thanks for refactoring network-simulator! r=me Thanks, Alexey! I keep your comments in mind for future work. Will land. I'll try to fix some of the nits too. Sending LayoutTests/ChangeLog Adding LayoutTests/http/tests/loading/preload-img-test-expected.txt Adding LayoutTests/http/tests/loading/preload-img-test.html Adding LayoutTests/http/tests/loading/resources/preload-test.jpg Sending LayoutTests/http/tests/resources/network-simulator.php Transmitting file data ..... Committed revision 44350. Follow-up fix in <http://trac.webkit.org/changeset/44380>. |