Bug 18234

Summary: JS exception thrown from NPN_InvokeDefault not shown in error console.
Product: WebKit Reporter: Jeremy Moskovich <playmobil>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ap, ddkilzer, dglazkov, emacemac7, ggaren, mjs, oliver
Priority: P2 Keywords: GoogleBug, InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   

Description Jeremy Moskovich 2008-03-31 01:57:53 PDT
Invoking the following JS code from an NPAPI plug-in via the NPN_InvokeDefault() function doesn't show the exception in the error console:

function() { throw "An Exception"; }

Stepping into _NPN_InvokeDefault() in NP_jsobject.cpp shows that the exception appears to have been set correctly in the ExecState but this apparently isn't bubbled up when the plugin code returns control to the browser.
Comment 1 Alexey Proskuryakov 2008-03-31 22:58:26 PDT
See also: bug 17470.
Comment 2 Eric Seidel (no email) 2008-04-01 12:16:55 PDT
This bug blocks Google Gears support in Safari.
Comment 3 Eric Seidel (no email) 2008-04-08 02:05:25 PDT
Working on a real fix as we speak.
Comment 4 Eric Seidel (no email) 2008-04-16 07:47:56 PDT
Updating the bug, finally.  This is very much tied to the NPN_SetException bug.  The fix is to save off the current ExecState in a static (or per-thread) static, and then throw the exception in that ExecState.  I tried saving the ExecState on the Instance, however that doesn't work for Obj-C (since it's a static method), and doesn't work well for JS/C++ either since you have to be thrown an JavaScriptObject in order to be able to get back to an Instance.

I may find time to finish up my patch, but right now real work is distracting...
Comment 5 David Kilzer (:ddkilzer) 2008-07-20 10:41:54 PDT
<rdar://problem/6089187>
Comment 6 David Kilzer (:ddkilzer) 2008-07-20 15:26:10 PDT
Related to Bug 19936?

Comment 7 Eric Seidel (no email) 2011-05-17 10:48:38 PDT
This is stll likely a bug, but Gears no longer cares since Gears is dead.
Comment 8 Alexey Proskuryakov 2022-06-20 17:03:45 PDT
NPAPI is gone.