Bug 17948 - Exception in -[WebDataSource webArchive]
Summary: Exception in -[WebDataSource webArchive]
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-19 07:06 PDT by Michael Tsai
Modified: 2008-11-25 13:47 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Tsai 2008-03-19 07:06:16 PDT
I've seen several cases where WebKit raises an exception:

-[NSCFArray insertObject:atIndex:]: attempt to insert nil

when my code calls [[[webView mainFrame] dataSource] webArchive]. I've been able to reproduce this only rarely on my Mac, but I have a customer for whom it happens 100% of the time, no matter the page.

As far as I can tell, the exception is being raised in -[WebDataSource subresources]. It looks like the WebResource that's being created in the loop is returning nil from its -init method. While there may be an interesting and significant reason for that, I suggest that -subresources refrain from adding nil objects to the array so that at least a partial Web archive can be returned.
Comment 1 David Kilzer (:ddkilzer) 2008-11-24 13:28:18 PST
Does your customer have any third-party "extensions" (haxies, input managers, etc.) installed for Safari?
Comment 2 Michael Tsai 2008-11-24 13:41:11 PST
No.
Comment 3 David Kilzer (:ddkilzer) 2008-11-24 20:15:58 PST
Could you have the customer recreate the crash and post a crash log to this bug?  If you would prefer not to post a crash log of your application here, please create a bug using <https://bugreport.apple.com/> and report the 7-digit bug number here.

Comment 4 Michael Tsai 2008-11-25 06:19:35 PST
It's not crashing for the customer, just raising an exception that's caught in my code.
Comment 5 David Kilzer (:ddkilzer) 2008-11-25 10:16:58 PST
(In reply to comment #4)
> It's not crashing for the customer, just raising an exception that's caught in
> my code.

Is there any way you could provide a stack trace when the exception is caught?  Can you provide a reproducible test case using a local copy of the customer's web page?

BTW, what revision(s) of WebKit are you using?  Does this work on a nightly WebKit build?

After re-reading the description, this sounds related to Bug 22466.  I think the code in WebKit -[WebDataSource subresources] has moved to DocumentLoader::subresources() in tip-of-tree (ToT) WebKit, though.

Comment 6 Michael Tsai 2008-11-25 11:16:14 PST
One of the problem Web pages was:

http://www.faqts.com/knowledge_base/index.phtml/fid/199/

I am no longer able to reproduce the problem using the WebKit from Safari 3.2.1.
Comment 7 David Kilzer (:ddkilzer) 2008-11-25 11:26:46 PST
(In reply to comment #6)
> One of the problem Web pages was:
> 
> http://www.faqts.com/knowledge_base/index.phtml/fid/199/
> 
> I am no longer able to reproduce the problem using the WebKit from Safari
> 3.2.1.

Can this bug be closed then?

Comment 8 Michael Tsai 2008-11-25 12:29:34 PST
Yes.
Comment 9 David Kilzer (:ddkilzer) 2008-11-25 13:47:30 PST
See also Bug 17151.

Closing per Comment #8.