WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
110388
Preloads should be cleared when JavaScript cancels loading prematurely.
https://bugs.webkit.org/show_bug.cgi?id=110388
Summary
Preloads should be cleared when JavaScript cancels loading prematurely.
James Simonsen
Reported
2013-02-20 14:54:10 PST
Preloads should be cleared on document.write()
Attachments
Patch
(4.94 KB, patch)
2013-02-20 14:55 PST
,
James Simonsen
no flags
Details
Formatted Diff
Diff
Patch
(5.09 KB, patch)
2013-02-20 17:16 PST
,
James Simonsen
no flags
Details
Formatted Diff
Diff
Patch
(5.10 KB, patch)
2013-02-21 11:51 PST
,
James Simonsen
no flags
Details
Formatted Diff
Diff
Patch
(5.18 KB, patch)
2013-02-21 11:59 PST
,
James Simonsen
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
James Simonsen
Comment 1
2013-02-20 14:55:34 PST
Created
attachment 189386
[details]
Patch
James Simonsen
Comment 2
2013-02-20 14:57:04 PST
This was discovered and reported internally at Google. Preloaded resources were being reused after a document.write() even though they were explicitly marked no-cache.
Adam Barth
Comment 3
2013-02-20 14:58:18 PST
Comment on
attachment 189386
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=189386&action=review
> Source/WebCore/dom/Document.cpp:4407 > + // Parser should have picked up all preloads by now > + m_cachedResourceLoader->clearPreloads();
This isn't true for the threaded parser. The threaded parser doesn't finish synchronously.
James Simonsen
Comment 4
2013-02-20 14:59:40 PST
(In reply to
comment #3
)
> (From update of
attachment 189386
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=189386&action=review
> > > Source/WebCore/dom/Document.cpp:4407 > > + // Parser should have picked up all preloads by now > > + m_cachedResourceLoader->clearPreloads(); > > This isn't true for the threaded parser. The threaded parser doesn't finish synchronously.
It calls finishedParsing() before it's actually finished?
WebKit Review Bot
Comment 5
2013-02-20 15:37:24 PST
Comment on
attachment 189386
[details]
Patch
Attachment 189386
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/16660547
New failing tests: fast/js/regress/inlined-put-by-id-transition.html
James Simonsen
Comment 6
2013-02-20 15:41:38 PST
(In reply to
comment #5
)
> (From update of
attachment 189386
[details]
) >
Attachment 189386
[details]
did not pass chromium-ews (chromium-xvfb): > Output:
http://queues.webkit.org/results/16660547
> > New failing tests: > fast/js/regress/inlined-put-by-id-transition.html
This appears to be a flake. It doesn't reproduce locally and seems totally unrelated.
Antti Koivisto
Comment 7
2013-02-20 17:10:35 PST
Comment on
attachment 189386
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=189386&action=review
> Source/WebCore/ChangeLog:9 > + > + We should clear preloads as soon as the parser finishes, instead of waiting for > + implicitClose(), which doesn't happen with a document.write().
Why? Please describe the problem you are fixing in the ChangeLog.
Antti Koivisto
Comment 8
2013-02-20 17:11:02 PST
(In reply to
comment #2
)
> This was discovered and reported internally at Google. Preloaded resources were being reused after a document.write() even though they were explicitly marked no-cache.
What makes you think this is a bug?
James Simonsen
Comment 9
2013-02-20 17:16:33 PST
Created
attachment 189421
[details]
Patch
James Simonsen
Comment 10
2013-02-20 17:16:56 PST
(In reply to
comment #7
)
> (From update of
attachment 189386
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=189386&action=review
> > > Source/WebCore/ChangeLog:9 > > + > > + We should clear preloads as soon as the parser finishes, instead of waiting for > > + implicitClose(), which doesn't happen with a document.write(). > > Why? Please describe the problem you are fixing in the ChangeLog.
Done.
Adam Barth
Comment 11
2013-02-20 19:48:23 PST
> It calls finishedParsing() before it's actually finished?
Nope. You're right! I was confused with finishParsing. :)
Antti Koivisto
Comment 12
2013-02-21 09:32:33 PST
Comment on
attachment 189421
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=189421&action=review
> Source/WebCore/ChangeLog:11 > + Preloads should be cleared on document.write() > +
https://bugs.webkit.org/show_bug.cgi?id=110388
> + > + Reviewed by NOBODY (OOPS!). > + > + If a page preloads a resource, then uses document.write(), that resource is forever marked > + as a preload and will always be fetched from cache even after an explicit reload. Instead, > + we should clear the preloads as soon as the parser finishes, rather than waiting for > + implicitClose.
I still don't quite understand. What does document.write have to do with this? Your test case does not use document.write.
James Simonsen
Comment 13
2013-02-21 11:51:03 PST
Created
attachment 189568
[details]
Patch
James Simonsen
Comment 14
2013-02-21 11:55:47 PST
(In reply to
comment #12
)
> (From update of
attachment 189421
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=189421&action=review
> > > Source/WebCore/ChangeLog:11 > > + Preloads should be cleared on document.write() > > +
https://bugs.webkit.org/show_bug.cgi?id=110388
> > + > > + Reviewed by NOBODY (OOPS!). > > + > > + If a page preloads a resource, then uses document.write(), that resource is forever marked > > + as a preload and will always be fetched from cache even after an explicit reload. Instead, > > + we should clear the preloads as soon as the parser finishes, rather than waiting for > > + implicitClose. > > I still don't quite understand. What does document.write have to do with this? Your test case does not use document.write.
Oh. Good point. I must've inadvertently removed that while I was working on it. It seems both cases cause problems though, so I've updated the description to match. Basically (if it's not clear already), the problem is that some resources get permanently marked as preloads. When you reload the page, we reuse the resource from memory cache because it's still marked as as preload even though the resource is explicitly no-cache. So, we need to more aggressively clear out the preloads when JavaScript stops the parser.
James Simonsen
Comment 15
2013-02-21 11:59:23 PST
Created
attachment 189569
[details]
Patch
Adam Barth
Comment 16
2013-02-21 17:16:13 PST
Antti, did you have further comments on this patch?
Antti Koivisto
Comment 17
2013-02-22 07:15:08 PST
Comment on
attachment 189569
[details]
Patch Ok, r=me
WebKit Review Bot
Comment 18
2013-02-22 14:01:56 PST
Comment on
attachment 189569
[details]
Patch Clearing flags on attachment: 189569 Committed
r143789
: <
http://trac.webkit.org/changeset/143789
>
WebKit Review Bot
Comment 19
2013-02-22 14:02:02 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug