Bug 105330 - REGRESSION(r137607): resource load client callbacks are not called for the main resource when loading HTML string
Summary: REGRESSION(r137607): resource load client callbacks are not called for the ma...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk, Regression
Depends on: 105529 105788
Blocks: 106137
  Show dependency treegraph
 
Reported: 2012-12-18 11:16 PST by Carlos Garcia Campos
Modified: 2013-01-08 01:38 PST (History)
9 users (show)

See Also:


Attachments
Patch (4.87 KB, patch)
2012-12-19 04:53 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
japhet's attempt (3.46 KB, patch)
2012-12-19 10:02 PST, Nate Chapin
beidson: review-
Details | Formatted Diff | Diff
Add an identifier ASSERT, rename m_identifier (3.93 KB, patch)
2012-12-19 12:22 PST, Nate Chapin
no flags Details | Formatted Diff | Diff
Fix a capitalization issue (3.93 KB, patch)
2012-12-19 13:18 PST, Nate Chapin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 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.
Comment 1 Alexey Proskuryakov 2012-12-18 11:26:09 PST
WebArchives and application cache both use substitute data, so this may well affect them, too.
Comment 2 Carlos Garcia Campos 2012-12-19 04:53:42 PST
Created attachment 180134 [details]
Patch

Notify the frame loader client about main resources loaded from substitute data.
Comment 3 Build Bot 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
Comment 4 WebKit Review Bot 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
Comment 5 Nate Chapin 2012-12-19 10:02:46 PST
Created attachment 180188 [details]
japhet's attempt
Comment 6 Brady Eidson 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.
Comment 7 Brady Eidson 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.
Comment 8 Nate Chapin 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?
Comment 9 Brady Eidson 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.
Comment 10 Nate Chapin 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.
Comment 11 Nate Chapin 2012-12-19 12:22:38 PST
Created attachment 180206 [details]
Add an identifier ASSERT, rename m_identifier
Comment 12 Nate Chapin 2012-12-19 13:18:07 PST
Created attachment 180215 [details]
Fix a capitalization issue
Comment 13 Brady Eidson 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.
Comment 14 Nate Chapin 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.
Comment 15 Brady Eidson 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.
Comment 16 WebKit Review Bot 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>
Comment 17 Carlos Garcia Campos 2012-12-19 23:47:29 PST
Comment on attachment 180134 [details]
Patch

Clearing flags, landed patch works much better than mine, thanks Nate!
Comment 18 Csaba Osztrogonác 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.
Comment 19 Chris Dumez 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.
Comment 20 Carlos Garcia Campos 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.
Comment 21 Chris Dumez 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.
Comment 22 Ryosuke Niwa 2013-01-08 01:38:23 PST
This patch caused a serious memory leak. See the bug 106137.