XPConnect Chrome Object Wrappers: Difference between revisions

simplified explanation
(added Cu.exposeToContent() call on functions that need wrapping)
(simplified explanation)
Line 17: Line 17:
</pre>
</pre>


In the above example, <tt>foo()</tt> is wrapped by a COW when accessed by sandboxed code executed via <tt>Components.utils.evalInSandbox()</tt>.  The object <tt>{bar: 5}</tt> is wrapped in an <tt>XPCSafeJSObjectWrapper</tt> before being passed into <tt>foo()</tt>, and whatever is returned from <tt>foo()</tt> and placed in <tt>result</tt> is usually wrapped in a COW as well.
In the above example, <tt>foo()</tt> is wrapped by a COW when accessed by sandboxed code executed via <tt>Components.utils.evalInSandbox()</tt>.  The object <tt>{bar: 5}</tt> is wrapped in an <tt>XPCSafeJSObjectWrapper</tt> before being passed into <tt>foo()</tt>.
874

edits