XPConnect Chrome Object Wrappers: Difference between revisions

Jump to navigation Jump to search
(revised to reflect the current COW spec)
(→‎COWing Objects: rewording)
Line 41: Line 41:
By default, non-function Chrome objects passed into content space are completely opaque: no information can be accessed from them, and no properties can be defined on them.
By default, non-function Chrome objects passed into content space are completely opaque: no information can be accessed from them, and no properties can be defined on them.


When a non-readable property is accessed, its value is <tt>undefined</tt>.  A security exception is not thrown in this case, as we don't want to break code that relies on [http://en.wikipedia.org/wiki/Duck_typing duck typing].
When a non-writable property is written to, a security exception will be raised. However, when a non-readable property is accessed, its value is <tt>undefined</tt>: a security exception isn't thrown because we don't want to break code that relies on [http://en.wikipedia.org/wiki/Duck_typing duck typing].
 
However, when a non-writable property is written to, a security exception will be raised.


To bypass this default behavior, individual properties can be exposed by defining a <tt>__exposedProps__</tt> property on the object, like so:
To bypass this default behavior, individual properties can be exposed by defining a <tt>__exposedProps__</tt> property on the object, like so:
874

edits

Navigation menu