Bug 18361 - Creating thread in web plugin breaks JavaScript timer functionality
Summary: Creating thread in web plugin breaks JavaScript timer functionality
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: Macintosh Intel OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-08 05:27 PDT by Tim Mityok
Modified: 2008-05-12 07:22 PDT (History)
1 user (show)

See Also:


Attachments
WebKit Plugin w/threading enabled and source code. (131.17 KB, application/octet-stream)
2008-04-08 05:29 PDT, Tim Mityok
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Mityok 2008-04-08 05:27:19 PDT
After creating a new thread in a WebKit plugin using [NSThread detachNewThreadSelector: toTarget: withObject:] any existing or new JavaScript timers created using setTimeout() fail to fire in the browser.

In a web plugin a thread is created in a Cocoa method that is exposed as a JavaScript function using the JavaScript bridge feature. This Cocoa method is called by a separate JavaScript function injected into the active DOM by the web plugin.

Disabling the thread creation method in the plugin or disabling the plugin with thread support and relaunching the browser enables JavaScript timers once more.

Example Plugin w/Threading that breaks JavaScript timers available upon request.

JavaScript timer tests: http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
Comment 1 Tim Mityok 2008-04-08 05:29:43 PDT
Created attachment 20404 [details]
WebKit Plugin w/threading enabled and source code.

Attached plugin will disable JavaScript timers when loaded. Source code shows how the thread is made and what it does within the plugin.
Comment 2 Alexey Proskuryakov 2008-05-12 07:17:13 PDT
I do not get Xippee.plugin in the list of installed plug-ins after putting it into /Library/Internet Plug-Ins and restarting Safari. Of course, timer tests do not fail in this situation.

Would it be possible for you to make a complete buildable test plug-in for debugging?
Comment 3 Alexey Proskuryakov 2008-05-12 07:22:20 PDT
Hmm, I got a crash with Xippee code in backtrace soon after removing the plug-in from /Library/Internet Plug-Ins, so I guess that It was loaded, after all. Anyway, I don't see timer failures. Is there anything else that needs to be done to reproduce the problem?