On Fri, Jul 26, 2013 at 12:33 AM, Liu Lei <[email protected]> wrote:
> when str is a string, it is ok,but when str is a Date Object,
>
> if (ttype === 'object') {
> var ctor = directConstructor(t);
> if (ctor === BASE_OBJECT_CONSTRUCTOR) {
> f = untameCajaRecord(t);
> } else {
> throw new TypeError(
> 'Untaming of guest constructed objects unsupported: ' + t);
> }
> } else if (ttype === 'function') {
> f = untameCajaFunction(t);
> }
>
It looks like you have a very, very old version of Caja. This code is from
January 2012, and indeed does not support passing Date objects out of the
taming membrane.
You should always use the latest version of Caja in order to ensure
security, and in this case upgrading will fix this problem.
You should also update your call to use the latest API:
frame.content('', bareJS, 'text/javascript')
.api({
alert: frame.tame(frame.**markFunction(function(str){
alert(str);
}))
})
.run();
Note that the addition of frame.tame(); this is now required. Note that the
additional environment is provided separately from run().
Note also that I have removed .contentCajoled(). While this is still
supported, it is inferior in performance to the new ES5 mode which does not
need any cajoling step, and takes unprocessed JS/HTML directly.
--
---
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/groups/opt_out.