WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
165852
WebContent crash under WebCore::CachedResource::load in WebCore::FrameLoader::outgoingReferrer const
https://bugs.webkit.org/show_bug.cgi?id=165852
Summary
WebContent crash under WebCore::CachedResource::load in WebCore::FrameLoader:...
Antti Koivisto
Reported
2016-12-14 09:11:02 PST
Null ptr
Attachments
patch
(1.72 KB, patch)
2016-12-14 09:17 PST
,
Antti Koivisto
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2016-12-14 09:11:16 PST
<
rdar://problem/27297153
>
Antti Koivisto
Comment 2
2016-12-14 09:17:57 PST
Created
attachment 297093
[details]
patch
Chris Dumez
Comment 3
2016-12-14 09:24:11 PST
Comment on
attachment 297093
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=297093&action=review
> Source/WebCore/loader/FrameLoader.cpp:929 > // because they need to be contained in iframes with the srcdoc.
Getting a null frame would mean that we have a top-level frame with an srcdoc document. This is weird unless the iframe that has the srcdoc is not yet (or no longer in the tree), i.e. detached.
Chris Dumez
Comment 4
2016-12-14 09:27:38 PST
Comment on
attachment 297093
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=297093&action=review
>> Source/WebCore/loader/FrameLoader.cpp:929 >> // because they need to be contained in iframes with the srcdoc. > > Getting a null frame would mean that we have a top-level frame with an srcdoc document. This is weird unless the iframe that has the srcdoc is not yet (or no longer in the tree), i.e. detached.
Based on the trace, I suspect this would be reproducible if we: 1. Created an iframe with an srcdoc but not add it to the document 2. Add an HTMLImageElement to that srcdoc 3. Set the src attribute on that HTMLImageElement If so, then this comment and assertion are wrong and your fix is indeed right.
Antti Koivisto
Comment 5
2016-12-14 09:53:06 PST
> If so, then this comment and assertion are wrong and your fix is indeed > right.
The theory has been that we shouldn't even try to do any loads in disconnected frames so we shouldn't get here in the first place. That's why I didn't remove the assert.
Chris Dumez
Comment 6
2016-12-14 09:56:22 PST
(In reply to
comment #5
)
> > If so, then this comment and assertion are wrong and your fix is indeed > > right. > > The theory has been that we shouldn't even try to do any loads in > disconnected frames so we shouldn't get here in the first place. That's why > I didn't remove the assert.
I believe that if you set the src of an HTMLImageElement, the load will go through. It goes through even if the HTMLImageElement is itself detached.
Antti Koivisto
Comment 7
2016-12-14 10:14:31 PST
I tried this but it doesn't hit the case: <iframe srcdoc="text" onload="test()"></iframe> <script> function test() { const iframe = document.querySelector("iframe"); const contentDocument = iframe.contentDocument; document.body.removeChild(iframe); const img = contentDocument.createElement("img"); img.setAttribute("src", "foo.png"); } </script> Note that this doesn't necessarily have anything to do with srcdoc, local m_frame could be null.
Chris Dumez
Comment 8
2016-12-14 10:16:23 PST
(In reply to
comment #7
)
> I tried this but it doesn't hit the case: > > <iframe srcdoc="text" onload="test()"></iframe> > <script> > function test() { > const iframe = document.querySelector("iframe"); > const contentDocument = iframe.contentDocument; > document.body.removeChild(iframe); > const img = contentDocument.createElement("img"); > img.setAttribute("src", "foo.png"); > } > </script> > > Note that this doesn't necessarily have anything to do with srcdoc, local > m_frame could be null.
FrameLoader::m_frame is a reference so if it is null, we have bigger issues.
Antti Koivisto
Comment 9
2016-12-14 10:27:08 PST
> FrameLoader::m_frame is a reference so if it is null, we have bigger issues.
True, like dead frame loader. Anyway, I don't know how to repro.
Chris Dumez
Comment 10
2016-12-14 10:28:07 PST
Comment on
attachment 297093
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=297093&action=review
Ok, well we tried. I could not write a test case either.
> Source/WebCore/loader/FrameLoader.cpp:932 > + if (!frame)
nit: I would have used a ternary.
Antti Koivisto
Comment 11
2016-12-14 10:31:26 PST
> nit: I would have used a ternary.
I like early bailouts for exceptional cases. I feel ternary sort-of signals that both cases are on the same level.
WebKit Commit Bot
Comment 12
2016-12-14 10:55:03 PST
Comment on
attachment 297093
[details]
patch Clearing flags on attachment: 297093 Committed
r209817
: <
http://trac.webkit.org/changeset/209817
>
WebKit Commit Bot
Comment 13
2016-12-14 10:55:08 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