Thanks Kevin for your response.

I replace the line:

return caja.tame(div);

with:

return frame.domicile.tameNodeAsForeign(div);

I'm still getting the same error: This operation requires a TameBackedNode
when I try to append the node in the guest code.
1. Is it because we are getting a TameForeignNode and not a
TameBackedNode, right?
2. And what you mentioned before: "the guest is not allowed to look at or
modify that node or its children": can't I append an opaque node to a
current guest node?
3. And about to pass the DOM node from the guest to the host doesn't work
anymore?

Thanks again,

Melisa





On Mon, Apr 18, 2016 at 1:14 PM, 'Kevin Reid' via Google Caja Discuss <
[email protected]> wrote:

> On Sat, Apr 16, 2016 at 7:14 AM, Melisa Bok <[email protected]> wrote:
>
>> I'm wanting to generate some tools to create DOM objects in the host
>> place and return the object created to the guest. I tried with several
>> options and I couldn't. Here is my code:
>>
> ...
>
>>         var div = document.createElement("div");
>>         var t = document.createTextNode("This is a paragraph");
>>         div.appendChild(t);
>>         return caja.tame(div);
>>
>
> Special measures are required for DOM nodes that were not *created or
> first seen by *the guest. Specifically, call
>
> frame.domicile.tameNodeAsForeign(div)
>
> before passing it back. The Google APIs taming
> (src/com/google/caja/apitaming) is an existing example of doing this.
>
> Caveats:
>
>    - This also sets a policy that the guest is not allowed to look at or
>    modify that node or its children (they are “opaque nodes”). If that is not
>    what you need, the only *current* way around this is to not pass a DOM
>    node back, but create the nodes in a container passed out and let the guest
>    walk the tree to find them. (I would not recommend doing that.)
>    - frame.domicile is not really a public API. We should provide a
>    better one, but don't currently.
>
> --
>
> ---
> 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.
>

-- 

--- 
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