========================================================================
http://mondrian.corp.google.com/file/9007880///depot/googleclient/gears/opensource/gears/base/common/js_runner_ff_marshaling.cc?a=1
File 
//depot/googleclient/gears/opensource/gears/base/common/js_runner_ff_marshaling.cc
 (snapshot 1)
------------------------------------
Line 545: // situation so, in practice, it will make little difference.
A bit spooky, creating a separate empty script and using that context to throw
an error into the current script, but if it works i buy your comment... 

1) Have you tested this in workers as well as in documents? More than one
'runner' in a thread many confuse things. A unit test?

2) We may be able to reuse more of the JS runner code available to us. Here's a
comment from JsCallContext::SetException that this block is missing...

  // First set the exception to any value, in case we fail to create the full
  // exception object below.  Setting any jsval will satisfy the JS engine,
  // we just won't get e.message.  We use INT_TO_JSVAL(1) here for simplicity.
  JS_BeginRequest(js_context_);
  JS_SetPendingException(js_context_, INT_TO_JSVAL(1));
  JS_EndRequest(js_context_);

Would the following work?

scoped_ptr<JsRunnerInterface> js_runner(NewJsRunner(runtime));
JsCallContext call_context(cx, js_runner, argc, argv, js_retval);
call_context.SetException("blah");
return JS_FALSE;
========================================================================

-- 
To respond, reply to this email or visit http://mondrian.corp.google.com/9007880

Reply via email to