Bug 25837 - Crash after calling -[WebView close] in webView:plugInFailedWithError:dataSource:
Summary: Crash after calling -[WebView close] in webView:plugInFailedWithError:dataSou...
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://world.kbs.co.kr/aod/aod_ch03_s...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-16 12:17 PDT by Jeff Johnson
Modified: 2010-03-20 23:17 PDT (History)
0 users

See Also:


Attachments
crash backtrace (8.52 KB, text/plain)
2009-05-16 12:18 PDT, Jeff Johnson
no flags Details
sample Xcode project (20.65 KB, application/octet-stream)
2009-05-16 12:19 PDT, Jeff Johnson
no flags Details
svn diff (1007 bytes, text/plain)
2009-05-16 12:19 PDT, Jeff Johnson
no flags Details
crash log (27.40 KB, text/plain)
2009-05-16 12:43 PDT, Jeff Johnson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Johnson 2009-05-16 12:17:19 PDT
Description:
If you call -[WebView close] in the WebResourceLoadDelegate method, webView:plugInFailedWithError:dataSource:, it can cause a crash.

Steps to Reproduce:
1) Boot Mac OS X 10.5.7.
2) Unzip, build, and run the attached sample Xcode project "MiniBrowser.zip".

Notes:
The MiniBrowser project is from /Developer/Examples/WebKit installed by Xcode 3.1.2. I made two modifications to that project:
(1) I load http://world.kbs.co.kr/aod/aod_ch03_skin_e.htm rather than http://www.apple.com
(2) I added the following method:

- (void)webView:(WebView *)sender plugInFailedWithError:(NSError *)error dataSource:(WebDataSource *)dataSource
{
	[sender close]; // This causes a crash.
}

By the way, you may see 3 build warnings "warning: 'WebView' may not respond to '-close'", but this is apparently just because the method -[WebView close] is available in 10.4.11 and later, but the deployment target of the project is set to 10.4. If you set the SDK and deployment target to 10.5., these warnings go away.

The crash occurs with stock 10.5.7 WebKit. It also occurs with WebKit revision 43755 from svn. However, r43755 needs to be modified slightly for the crash to occur. This is apparently because the plugin detection code has changed somehow, and WebKit now detects a plugin for the web page, so webView:plugInFailedWithError:dataSource: doesn't even get called anymore. My modification, which is attached as the file "diff.txt", simply guarantees that no plugin is found and the WebResourceLoadDelegate method will get called.

The backtrace for the crash with r43755 is attached as the file "backtrace.txt".

The crash does not occur if I call [sender performSelector:@selector(close) withObject:nil afterDelay:0.0] rather than [sender close].

There's nothing in the documentation for -[WebView close] that says it's not safe to call in a delegate method. It's desirable to call -[WebView close] on failures such as webView:plugInFailedWithError:dataSource:, because it stops all activity in the WebView. This is analogous to -[NSURLConnection cancel].
Comment 1 Jeff Johnson 2009-05-16 12:18:08 PDT
Created attachment 30414 [details]
crash backtrace
Comment 2 Jeff Johnson 2009-05-16 12:19:08 PDT
Created attachment 30415 [details]
sample Xcode project
Comment 3 Jeff Johnson 2009-05-16 12:19:37 PDT
Created attachment 30416 [details]
svn diff
Comment 4 Jeff Johnson 2009-05-16 12:43:18 PDT
Created attachment 30417 [details]
crash log
Comment 5 Jeff Johnson 2009-05-16 23:46:12 PDT
I've been told that this crash can be reproduced by some people with unmodified TOT WebKit.

I can reproduce it with unmodified WebKit prior to http://trac.webkit.org/changeset/39115/trunk

It would seem that I have a plugin or plugins detected by r39115 but not prior to that revision.

Comment 6 Jeff Johnson 2009-05-17 19:35:10 PDT
I can now reproduce this crash with svn r43816 without having to modify the source at all.

Comment 7 Jeff Johnson 2010-03-20 23:17:23 PDT
The page http://world.kbs.co.kr/aod/aod_ch03_skin_e.htm appears to use the Flip4Mac WMV plug-in, so to reproduce the bug, you may have to uninstall that.

With TOT svn r56311, I now get an unrecoverable hang rather than a crash. I can provide logs and/or more info, but I'd like someone to confirm this bug first.