On Sun, Jul 27, 2014 at 5:18 AM, Tim Shnaider <[email protected]> wrote:

> What am I missing - there seems to be no mechanism to catch or handle
> exceptions when executing pure JS
> Trying to support user definable scripts so I've no control over content.
> Do I need to wrap it in try/catch blocks?
>

The main "run()" path is primarily intended for the "virtual web page" use
case — Caja matches browser behavior which defaults to logging and ignoring
errors. There is supposed to be a mechanism for handling this, as also
available in browsers: window.onerror (within the guest). However, I just
took a look at the code and this is one of the things that is known to be
missing in ES5 mode:

https://code.google.com/p/google-caja/issues/detail?id=1433

However, it should be easy to implement. I'll see if I can take a look at
it (probably not this week).

Tracing through ses-single-frame.js for #5687 I can see at line 27106 that
> an exception when compiledFunc() is called is not bubbled up.
>
>     Q.when(promise, function (compiledFunc) {
>       var result = compiledFunc(imports);
>       if (opt_runDone) {
>         opt_runDone(result);
>       }
>     }, function (failure) {
>       config.console.log('Failed to load guest content: ' + failure);
>     });
>

Yes, this is what needs to be changed to fix issue 1433.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to