Bug 31322

Summary: REGRESSION (r50587): Repro crash saving pcmag.com article as a webarchive
Product: WebKit Reporter: Brady Eidson <beidson>
Component: Page LoadingAssignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Critical Keywords: InRadar
Priority: P1    
Version: 528+ (Nightly build)   
Hardware: Macintosh   
OS: OS X 10.5   
URL: http://www.pcmag.com/article2/0,2817,2354369,00.asp
Attachments:
Description Flags
Fix + layout test sam: review+, beidson: commit-queue-

Description Brady Eidson 2009-11-10 15:15:45 PST
Go to http://www.pcmag.com/article2/0,2817,2354369,00.asp then save the page as a webarchive.  Crash!

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   com.apple.WebCore             	0x0000000101ba29fc WTF::RefPtr<WebCore::StyleList>::operator WebCore::StyleList* WTF::RefPtr<WebCore::StyleList>::*() const + 12 (RefPtr.h:72)
1   com.apple.WebCore             	0x0000000101ba23e3 WebCore::CSSRuleList::length() const + 25 (CSSRuleList.cpp:54)
2   com.apple.WebCore             	0x0000000101bee366 WebCore::CSSStyleSheet::addSubresourceStyleURLs(WTF::ListHashSet<WebCore::KURL, WebCore::KURLHash>&) + 254 (CSSStyleSheet.cpp:235)
3   com.apple.WebCore             	0x0000000101e72e69 WebCore::HTMLLinkElement::addSubresourceAttributeURLs(WTF::ListHashSet<WebCore::KURL, WebCore::KURLHash>&) const + 143 (HTMLLinkElement.cpp:424)
4   com.apple.WebCore             	0x00000001021b9152 WebCore::Node::getSubresourceURLs(WTF::ListHashSet<WebCore::KURL, WebCore::KURLHash>&) const + 42 (Node.cpp:2282)
5   com.apple.WebCore             	0x0000000102172490 WebCore::LegacyWebArchive::create(WebCore::String const&, WebCore::Frame*, WTF::Vector<WebCore::Node*, 0ul> const&) + 882 (LegacyWebArchive.cpp:516)
6   com.apple.WebCore             	0x00000001021730d1 WebCore::LegacyWebArchive::create(WebCore::Node*) + 315 (LegacyWebArchive.cpp:430)
7   com.apple.WebKit              	0x00000001015828c9 -[DOMNode(WebDOMNodeOperations) webArchive] + 70 (WebDOMOperations.mm:53)
...

We're walking a CSSStyleSheet looking for subresource URLs.  The CSSRuleList we get is null do to a failed security origin check.  We should just walk the stylesheet directly.
Comment 1 Brady Eidson 2009-11-10 15:19:48 PST
<rdar://problem/7381219>
Comment 2 Brady Eidson 2009-11-10 15:28:37 PST
Created attachment 42904 [details]
Fix + layout test
Comment 3 Brady Eidson 2009-11-10 15:32:10 PST
http://trac.webkit.org/changeset/50587
Comment 4 Brady Eidson 2009-11-10 15:37:59 PST
http://trac.webkit.org/changeset/50778