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?
Then I need to consider an invisible mechanism to call from the catch()
handler, i.e. an exposed onerror function in the passed API object.
Seems a bit ugly, but I want to know if an error occured after frame.run()
called
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);
});
My code:
caja.initialize({
cajaServer: '/client/caja/',
maxAcceptableSeverity: 'NO_KNOWN_EXPLOIT_SPEC_VIOLATION',
debug: true,
es5Mode: true
});
var consoleService = {
log: function()
{
console.log.apply(console,arguments);
}
};
caja.markReadOnlyRecord(consoleService); // (2)
caja.markFunction(consoleService.log);
var tamedConsoleService = caja.tame(consoleService);
caja.load(undefined, undefined, function (frame)
{
var _api = { console: tamedConsoleService};
frame.code('/dummy.js','application/javascript',
'consolea.log("smoo")' ) <- throws exception as consolea undefined, unable
to detect
.api(_api)
.run(function ()
{
});
});
--
---
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.