UNCONFIRMED 109351
Cache XHRs is not working well
https://bugs.webkit.org/show_bug.cgi?id=109351
Summary Cache XHRs is not working well
Hyungwook Lee
Reported 2013-02-09 03:12:50 PST
Cache XHRs is not working well as we expected caused by wrong httpBody() comparison. bool CachedRawResource::canReuse(const ResourceRequest& newRequest) const { ... if (m_resourceRequest.httpBody() != newRequest.httpBody()) return false; ... } FormData* ResourceRequestBase::httpBody() returns pointer. Hence we need to compare its value instead of pointer.
Attachments
patches for 109351 (1.81 KB, patch)
2013-02-09 05:18 PST, Hyungwook Lee
no flags
patches for 109351 (1.81 KB, patch)
2013-02-09 05:25 PST, Hyungwook Lee
no flags
Hyungwook Lee
Comment 1 2013-02-09 05:18:09 PST
Created attachment 187425 [details] patches for 109351
WebKit Review Bot
Comment 2 2013-02-09 05:21:08 PST
Attachment 187425 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/loader/cache/CachedRawResource.cpp']" exit_code: 1 Source/WebCore/loader/cache/CachedRawResource.cpp:183: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/loader/cache/CachedRawResource.cpp:184: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/loader/cache/CachedRawResource.cpp:186: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/loader/cache/CachedRawResource.cpp:187: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/loader/cache/CachedRawResource.cpp:189: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/loader/cache/CachedRawResource.cpp:190: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/loader/cache/CachedRawResource.cpp:191: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/loader/cache/CachedRawResource.cpp:192: Tab found; better to use spaces [whitespace/tab] [1] Total errors found: 8 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Hyungwook Lee
Comment 3 2013-02-09 05:25:46 PST
Created attachment 187426 [details] patches for 109351
Alexey Proskuryakov
Comment 4 2013-02-11 17:44:42 PST
What is the expected behavior when just sending two identical POST requests with XHR? I expect them to be delivered to the server. Caching POST responses makes sense for back/forward navigation, but probably not for XHR. So it seems like this mistake was actually resulting in correct behavior.
Hyungwook Lee
Comment 5 2013-02-11 18:44:43 PST
Oh I see, I got your point and I can understand why it uses pointer instead of value.
Nate Chapin
Comment 6 2013-02-12 08:54:10 PST
(In reply to comment #4) > What is the expected behavior when just sending two identical POST requests with XHR? I expect them to be delivered to the server. > > Caching POST responses makes sense for back/forward navigation, but probably not for XHR. > > So it seems like this mistake was actually resulting in correct behavior. For reasons I don't remember, canReuse() permits reuse of POST requests if the new request is POST as well. Should we change it to support GET only?
Alexey Proskuryakov
Comment 7 2013-02-12 10:39:41 PST
> For reasons I don't remember, canReuse() permits reuse of POST requests if the new request is POST as well Perhaps that's for b/f navigation?
Hyungwook Lee
Comment 8 2013-02-15 05:41:43 PST
I think my patches is not fully considered real world's situation. Using cached XHRs (GET/POST both) easily break many web services which uses XHRs to update their web services.
Note You need to log in before you can comment on or make changes to this bug.