NEW 105330
REGRESSION(r137607): resource load client callbacks are not called for the main resource when loading HTML string
https://bugs.webkit.org/show_bug.cgi?id=105330
Summary REGRESSION(r137607): resource load client callbacks are not called for the ma...
Carlos Garcia Campos
Reported 2012-12-18 11:16:01 PST
Since r137607, the resource load client callbacks are not called when loading with substitute data. I think the problem is that MainResourceLoader is not a ResourceLoader anymore, and only main frame callback are called. This affects most of the WebKit2 GTK+ unit tests, that are timing out, because WebKit2GTK+ always expects main resource load callbacks to be emitted.
Attachments
Patch (4.87 KB, patch)
2012-12-19 04:53 PST, Carlos Garcia Campos
no flags
japhet's attempt (3.46 KB, patch)
2012-12-19 10:02 PST, Nate Chapin
beidson: review-
Add an identifier ASSERT, rename m_identifier (3.93 KB, patch)
2012-12-19 12:22 PST, Nate Chapin
no flags
Fix a capitalization issue (3.93 KB, patch)
2012-12-19 13:18 PST, Nate Chapin
no flags
Alexey Proskuryakov
Comment 1 2012-12-18 11:26:09 PST
WebArchives and application cache both use substitute data, so this may well affect them, too.
Carlos Garcia Campos
Comment 2 2012-12-19 04:53:42 PST
Created attachment 180134 [details] Patch Notify the frame loader client about main resources loaded from substitute data.
Build Bot
Comment 3 2012-12-19 05:27:05 PST
Comment on attachment 180134 [details] Patch Attachment 180134 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/15411596 New failing tests: fast/frames/frame-unload-crash2.html http/tests/appcache/crash-when-navigating-away-then-back.html fast/forms/number/number-spinbutton-crash.html
WebKit Review Bot
Comment 4 2012-12-19 07:45:53 PST
Comment on attachment 180134 [details] Patch Attachment 180134 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/15411644 New failing tests: platform/chromium/fast/forms/suggestion-picker/month-suggestion-picker-reset-value-after-reload.html fast/forms/week-multiple-fields/week-multiple-fields-spinbutton-change-and-input-events.html platform/chromium/fast/forms/suggestion-picker/week-suggestion-picker-reset-value-after-reload.html platform/chromium/fast/forms/suggestion-picker/datetime-suggestion-picker-reset-value-after-reload.html fast/forms/month-multiple-fields/month-multiple-fields-spinbutton-change-and-input-events.html fast/forms/time-multiple-fields/time-multiple-fields-state-change-on-focus-or-blur.html fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-change-and-input-events.html platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-reset-value-after-reload.html fast/forms/number/number-spinbutton-crash.html fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-spinbutton-change-and-input-events.html fast/frames/frame-unload-crash2.html fast/forms/date-multiple-fields/date-multiple-fields-spinbutton-change-and-input-events.html platform/chromium/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-reset-value-after-reload.html
Nate Chapin
Comment 5 2012-12-19 10:02:46 PST
Created attachment 180188 [details] japhet's attempt
Brady Eidson
Comment 6 2012-12-19 11:29:41 PST
Comment on attachment 180188 [details] japhet's attempt View in context: https://bugs.webkit.org/attachment.cgi?id=180188&action=review > Source/WebCore/loader/MainResourceLoader.cpp:697 > unsigned long MainResourceLoader::identifier() const > { > + if (m_identifier) > + return m_identifier; > if (ResourceLoader* resourceLoader = loader()) > return resourceLoader->identifier(); This breaks the "setIdentifier" API on ResourceLoader that WebKit2 relies on.
Brady Eidson
Comment 7 2012-12-19 11:32:58 PST
(In reply to comment #6) > (From update of attachment 180188 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=180188&action=review > > > Source/WebCore/loader/MainResourceLoader.cpp:697 > > unsigned long MainResourceLoader::identifier() const > > { > > + if (m_identifier) > > + return m_identifier; > > if (ResourceLoader* resourceLoader = loader()) > > return resourceLoader->identifier(); > > This breaks the "setIdentifier" API on ResourceLoader that WebKit2 relies on. Now that we've made MainResourceLoader no longer be a ResourceLoader, we're going to start getting in to trouble as we diverge the two. Having two copies of the identifier seems like a great first step towards breaking things.
Nate Chapin
Comment 8 2012-12-19 11:34:54 PST
(In reply to comment #7) > (In reply to comment #6) > > (From update of attachment 180188 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=180188&action=review > > > > > Source/WebCore/loader/MainResourceLoader.cpp:697 > > > unsigned long MainResourceLoader::identifier() const > > > { > > > + if (m_identifier) > > > + return m_identifier; > > > if (ResourceLoader* resourceLoader = loader()) > > > return resourceLoader->identifier(); > > > > This breaks the "setIdentifier" API on ResourceLoader that WebKit2 relies on. > > Now that we've made MainResourceLoader no longer be a ResourceLoader, we're going to start getting in to trouble as we diverge the two. Having two copies of the identifier seems like a great first step towards breaking things. MainResourceLoader::m_identifier should only be used when it is a SubstituteData load. In that case, there should not be a ResourceLoader. So there should still only be one identifier per load. Should I consider an assert to that effect here?
Brady Eidson
Comment 9 2012-12-19 12:04:37 PST
(In reply to comment #8) > (In reply to comment #7) > > (In reply to comment #6) > > > (From update of attachment 180188 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=180188&action=review > > > > > > > Source/WebCore/loader/MainResourceLoader.cpp:697 > > > > unsigned long MainResourceLoader::identifier() const > > > > { > > > > + if (m_identifier) > > > > + return m_identifier; > > > > if (ResourceLoader* resourceLoader = loader()) > > > > return resourceLoader->identifier(); > > > > > > This breaks the "setIdentifier" API on ResourceLoader that WebKit2 relies on. > > > > Now that we've made MainResourceLoader no longer be a ResourceLoader, we're going to start getting in to trouble as we diverge the two. Having two copies of the identifier seems like a great first step towards breaking things. > > MainResourceLoader::m_identifier should only be used when it is a SubstituteData load. In that case, there should not be a ResourceLoader. So there should still only be one identifier per load. > > Should I consider an assert to that effect here? Yes please. On that note, I might also feel better about it having a different name, like in cgarcia's patch.
Nate Chapin
Comment 10 2012-12-19 12:09:34 PST
(In reply to comment #9) > (In reply to comment #8) > > (In reply to comment #7) > > > (In reply to comment #6) > > > > (From update of attachment 180188 [details] [details] [details] [details]) > > > > View in context: https://bugs.webkit.org/attachment.cgi?id=180188&action=review > > > > > > > > > Source/WebCore/loader/MainResourceLoader.cpp:697 > > > > > unsigned long MainResourceLoader::identifier() const > > > > > { > > > > > + if (m_identifier) > > > > > + return m_identifier; > > > > > if (ResourceLoader* resourceLoader = loader()) > > > > > return resourceLoader->identifier(); > > > > > > > > This breaks the "setIdentifier" API on ResourceLoader that WebKit2 relies on. > > > > > > Now that we've made MainResourceLoader no longer be a ResourceLoader, we're going to start getting in to trouble as we diverge the two. Having two copies of the identifier seems like a great first step towards breaking things. > > > > MainResourceLoader::m_identifier should only be used when it is a SubstituteData load. In that case, there should not be a ResourceLoader. So there should still only be one identifier per load. > > > > Should I consider an assert to that effect here? > > Yes please. > > On that note, I might also feel better about it having a different name, like in cgarcia's patch. Yeah, that's a good point. Will do both.
Nate Chapin
Comment 11 2012-12-19 12:22:38 PST
Created attachment 180206 [details] Add an identifier ASSERT, rename m_identifier
Nate Chapin
Comment 12 2012-12-19 13:18:07 PST
Created attachment 180215 [details] Fix a capitalization issue
Brady Eidson
Comment 13 2012-12-19 14:05:39 PST
Comment on attachment 180215 [details] Fix a capitalization issue I kind of cringe at "!loader()" being the check for "is this a data load", but I guess it already has precedent.
Nate Chapin
Comment 14 2012-12-19 14:09:43 PST
(In reply to comment #13) > (From update of attachment 180215 [details]) > I kind of cringe at "!loader()" being the check for "is this a data load", but I guess it already has precedent. Yeah :( I had done it that way because I foresaw using the same if() statement to fake resource load callbacks for main resource cache hits (once cache hits are permitted). I can make it based on a non-zero m_substituteDataLoadIdentifier in the interim if you prefer.
Brady Eidson
Comment 15 2012-12-19 14:15:51 PST
(In reply to comment #14) > (In reply to comment #13) > > (From update of attachment 180215 [details] [details]) > > I kind of cringe at "!loader()" being the check for "is this a data load", but I guess it already has precedent. > > Yeah :( > > I had done it that way because I foresaw using the same if() statement to fake resource load callbacks for main resource cache hits (once cache hits are permitted). I can make it based on a non-zero m_substituteDataLoadIdentifier in the interim if you prefer. We'd still need a different check to *get* the substitute identifier, so then we'd have two types of checks... this is fine for now.
WebKit Review Bot
Comment 16 2012-12-19 21:46:03 PST
Comment on attachment 180215 [details] Fix a capitalization issue Clearing flags on attachment: 180215 Committed r138222: <http://trac.webkit.org/changeset/138222>
Carlos Garcia Campos
Comment 17 2012-12-19 23:47:29 PST
Comment on attachment 180134 [details] Patch Clearing flags, landed patch works much better than mine, thanks Nate!
Csaba Osztrogonác
Comment 18 2012-12-20 04:14:38 PST
(In reply to comment #16) > (From update of attachment 180215 [details]) > Clearing flags on attachment: 180215 > > Committed r138222: <http://trac.webkit.org/changeset/138222> It caused a regression on Qt - see https://bugs.webkit.org/show_bug.cgi?id=105529 for details.
Chris Dumez
Comment 19 2012-12-27 01:59:45 PST
After this patch, http/tests/appcache/main-resource-redirect.html is crashing on EFL port. The reason for this is that ResourceLoadClient::didReceiveResponseForResource() is now called with 0 identifier (which is not a valid key in our HashTable). Could you tell me if this is expected? If 0 is now a valid resource identifier, then I should probably use WTF::UnsignedWithZeroKeyHashTraits for our Resource HashTable.
Carlos Garcia Campos
Comment 20 2012-12-27 02:17:45 PST
(In reply to comment #19) > After this patch, http/tests/appcache/main-resource-redirect.html is crashing on EFL port. The reason for this is that ResourceLoadClient::didReceiveResponseForResource() is now called with 0 identifier (which is not a valid key in our HashTable). > > Could you tell me if this is expected? If 0 is now a valid resource identifier, then I should probably use WTF::UnsignedWithZeroKeyHashTraits for our Resource HashTable. Sounds like a bug, I don't think 0 is a valid resource identifier.
Chris Dumez
Comment 21 2012-12-27 03:09:16 PST
(In reply to comment #20) > (In reply to comment #19) > > After this patch, http/tests/appcache/main-resource-redirect.html is crashing on EFL port. The reason for this is that ResourceLoadClient::didReceiveResponseForResource() is now called with 0 identifier (which is not a valid key in our HashTable). > > > > Could you tell me if this is expected? If 0 is now a valid resource identifier, then I should probably use WTF::UnsignedWithZeroKeyHashTraits for our Resource HashTable. > > Sounds like a bug, I don't think 0 is a valid resource identifier. Thanks for your reply. I filed Bug 105788 to track the regression.
Ryosuke Niwa
Comment 22 2013-01-08 01:38:23 PST
This patch caused a serious memory leak. See the bug 106137.
Note You need to log in before you can comment on or make changes to this bug.