Bug 37691

Summary: [v8] In Workers, script errors right after close() are not delivered to the Worker.onerror
Product: WebKit Reporter: Dmitry Titov <dimich>
Component: WebCore Misc.Assignee: Dmitry Titov <dimich>
Severity: Normal CC: atwilson, levin, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: All   
Description Flags
Patch. yurys: review+, dimich: commit-queue-

Description Dmitry Titov 2010-04-15 18:54:58 PDT
WorkerGlobalScope.close() sets a flag in WorkerScriptController which makes WorkerScriptController::proxy() to always return 0. That prevents re-entry in JS after the block of script that called close() exits. However, the static accessor WebCore::getScriptExecutionContext() that retrieves the current WorkerContext using the DOM wrapper of the current v8 context uses proxy() and therefore starts to return 0 as well. This is un-necessary (and harmful) since retrieving of the current WorkerContext is not used to evaluate JS but rather to call various methods on it (like reportException(...)) and creating objects, which is fine to do even after close() called. 

The worker-close.html layout test is currently failing on chromium for this reason.

The fix is to avoid using proxy() for pulling out the WorkerContext from WorkerScriptController and just pull it from WorkerScriptController directly, since it also has it. Patch coming.
Comment 1 Dmitry Titov 2010-04-15 19:25:51 PDT
Created attachment 53505 [details]
Comment 2 Dmitry Titov 2010-04-16 17:16:41 PDT
Updated the expected result for platform/chromium and landed: http://trac.webkit.org/changeset/57767