Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Issue 19962002: Protect documents from deletion when their onload removes them (Closed)

Created:
7 years, 5 months ago by Stephen Chennney
Modified:
7 years, 5 months ago
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, adamk+blink_chromium.org
Visibility:
Public.

Description

Protect documents from deletion when their onload removes them When an XML document is the src of an iframe, and the onload method changes the src to something else, the XML document may be garbage collected before the original load is completed. Bad things result. In this patch we protect the document in Document::finishedParsing. R=abarth@chromium.org,eseidel@chromium.org,inferno@chromium.org BUG=260428 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=154680

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+55 lines, --1 lines) Patch
A LayoutTests/loader/iframe-src-change-onload-crash.html View 1 chunk +48 lines, -0 lines 0 comments Download
A LayoutTests/loader/iframe-src-change-onload-crash-expected.txt View 1 chunk +3 lines, -0 lines 0 comments Download
A + LayoutTests/loader/resources/empty.xml View 0 chunks +-1 lines, --1 lines 0 comments Download
M Source/core/dom/Document.cpp View 1 chunk +5 lines, -0 lines 1 comment Download

Messages

Total messages: 16 (0 generated)
Stephen Chennney
7 years, 5 months ago (2013-07-22 15:29:17 UTC) #1
abarth-chromium
https://codereview.chromium.org/19962002/diff/1/Source/core/dom/Document.cpp File Source/core/dom/Document.cpp (right): https://codereview.chromium.org/19962002/diff/1/Source/core/dom/Document.cpp#newcode4068 Source/core/dom/Document.cpp:4068: RefPtr<Document> protect(this); Why doesn't this issue occur with HTML ...
7 years, 5 months ago (2013-07-22 18:06:24 UTC) #2
Stephen Chennney
On 2013/07/22 18:06:24, abarth wrote: > https://codereview.chromium.org/19962002/diff/1/Source/core/dom/Document.cpp > File Source/core/dom/Document.cpp (right): > > https://codereview.chromium.org/19962002/diff/1/Source/core/dom/Document.cpp#newcode4068 > ...
7 years, 5 months ago (2013-07-22 18:38:35 UTC) #3
eseidel
I'd be very interested to see stacks of both finishedParsing calls. I'm not sure this ...
7 years, 5 months ago (2013-07-22 19:13:36 UTC) #4
Stephen Chennney
On 2013/07/22 19:13:36, eseidel wrote: > I'd be very interested to see stacks of both ...
7 years, 5 months ago (2013-07-22 19:27:37 UTC) #5
eseidel
So yes, if finishedParsing is being called by the TreeBuidler, then a ParseSession is on ...
7 years, 5 months ago (2013-07-22 19:35:21 UTC) #6
eseidel
Actually, maybe it's: // Informs the the rest of WebCore that parsing is really finished ...
7 years, 5 months ago (2013-07-22 19:36:23 UTC) #7
eseidel
lgtm Looking at this further, I think this is OK.
7 years, 5 months ago (2013-07-22 19:41:38 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/schenney@chromium.org/19962002/1
7 years, 5 months ago (2013-07-22 19:41:59 UTC) #9
commit-bot: I haz the power
Change committed as 154680
7 years, 5 months ago (2013-07-22 20:33:18 UTC) #10
Stephen Chennney
I traced the code with an HTML document in the iframe. There the last ref ...
7 years, 5 months ago (2013-07-22 22:08:43 UTC) #11
eseidel
So HTML has this same bug it just manages not to crash?
7 years, 5 months ago (2013-07-22 22:13:22 UTC) #12
Stephen Chennney
On 2013/07/22 22:13:22, eseidel wrote: > So HTML has this same bug it just manages ...
7 years, 5 months ago (2013-07-22 22:16:26 UTC) #13
eseidel
HTMLTreeBuilder doesn't have a RefPtr<Document> I believe it's kept alive by the ParserSession, or?
7 years, 5 months ago (2013-07-22 22:18:27 UTC) #14
Stephen Chennney
On 2013/07/22 22:18:27, eseidel wrote: > HTMLTreeBuilder doesn't have a RefPtr<Document> I believe it's kept ...
7 years, 5 months ago (2013-07-22 22:35:20 UTC) #15
Stephen Chennney
7 years, 5 months ago (2013-07-22 22:36:14 UTC) #16
Message was sent while issue was closed.
On 2013/07/22 22:35:20, Stephen Chenney wrote:
> On 2013/07/22 22:18:27, eseidel wrote:
> > HTMLTreeBuilder doesn't have a RefPtr<Document> I believe it's kept alive by
> the
> > ParserSession, or?
> 
> HTMLDocumentParser owns an HTMLTreeBuilder which owns/manages an
> HTMLConstructionSite which owns some HTMLStackItems which combined own a bunch
> of elements of which one is the Document which gets deleted in the process of
> clearing the stack. So ultimately it is true to say that the
HTMLDocumentParser
> protects the document it is parsing/has-just-parsed.

All that is inferred from the destructor call stack for the document that
corresponds to the xml doc that causes problems.

Powered by Google App Engine
This is Rietveld 408576698