On Fri, Nov 14, 2008 at 7:51 PM, Michael Nordman <[EMAIL PROTECTED]> wrote:
> ========================================================================
> 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?
>
Yes, it works in workers as well. Added 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;
Works, changed to this solution. New snapshot uploaded.
Thanks,
Andrei