|Summary:||preloading logic caused the same resource was loaded and reloaded.(sent two requests for same resource)|
|Component:||Page Loading||Assignee:||Adam Barth <abarth>|
|Severity:||Normal||CC:||abarth, ap, darin, emacemac7, jasneet, johnnyding.webkit, koivisto, yael|
|Version:||528+ (Nightly build)|
Description johnnyding 2009-03-22 06:43:12 PDT
Comment 1 johnnyding 2009-03-22 06:44:28 PDT
Created attachment 28831 [details] HTML file for reproducing this problem
Comment 2 johnnyding 2009-03-22 06:45:07 PDT
Created attachment 28832 [details] image file for the test HTML
Comment 3 johnnyding 2009-03-22 06:46:00 PDT
Created attachment 28833 [details] empty js file for the test HTML
Comment 4 johnnyding 2009-03-23 05:40:54 PDT
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!
Comment 5 Alexey Proskuryakov 2009-03-23 09:02:47 PDT
> 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.
Comment 6 johnnyding 2009-04-02 02:25:11 PDT
Created attachment 29186 [details] patch V2 to fix this bug V2 is ready. sorry for being late.
Comment 8 Mark Rowe (bdash) 2009-04-02 18:22:34 PDT
*** Bug 25015 has been marked as a duplicate of this bug. ***
Comment 9 johnnyding 2009-04-04 01:50:10 PDT
Would anyone take a look this bug and patch? Thanks!
Comment 10 johnnyding 2009-04-07 18:35:50 PDT
This patch is simple. I will highly appreciate if someone who has review authority can take a look this patch. Thanks!
Comment 11 Eric Seidel (no email) 2009-04-08 03:54:42 PDT
(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 12 Eric Seidel (no email) 2009-04-08 03:56:15 PDT
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.
Comment 13 johnnyding 2009-04-12 04:48:15 PDT
Created attachment 29419 [details] update patch v2 Thank Eric. I have added the bug URL and simple description for the patch.
Comment 14 Alexey Proskuryakov 2009-05-21 02:47:51 PDT
> 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.
Comment 15 Maciej Stachowiak 2009-05-22 02:20:53 PDT
It does look to me like Darin's patch should have fixed it. Johnny, can you check if that's the case?
Comment 16 Darin Adler 2009-05-22 09:15:51 PDT
(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.
Comment 17 johnnyding 2009-05-22 10:17:48 PDT
Yes, Alexey's patch has fixed it. I will close this bug.
Comment 18 johnnyding 2009-05-22 10:29:05 PDT
(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.
Comment 19 Alexey Proskuryakov 2009-05-22 11:01:03 PDT
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?
Comment 20 johnnyding 2009-05-23 09:57:50 PDT
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.
Comment 21 johnnyding 2009-05-27 11:37:56 PDT
Created attachment 30712 [details] patch for test of this issue
Comment 22 Alexey Proskuryakov 2009-05-27 12:24:36 PDT
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
Comment 23 johnnyding 2009-05-28 17:41:59 PDT
Thanks, Alexey! I keep your comments in mind for future work.
Comment 24 Adam Barth 2009-06-02 00:12:58 PDT
Will land. I'll try to fix some of the nits too.
Comment 25 Adam Barth 2009-06-02 00:28:13 PDT
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.