On 03/20/2012 07:14 PM, Ben Bucksch wrote:
> Sorry, but I got confused with your extensive use of the words "waived"
> and "waivers". Maybe it's because English is not my native language, but
> I understand "waived" as "forgotten or "dropped", but "waivers" =
> "forgetters" or "droppers" makes no sense to me. Could you explain more,
> ideally without using the word "waive"? Thanks.
The idea here is not too complicated, but the terminology has always
been a little messy...
By default, chrome code touching content receives Xray wrappers
(formerly called XPCNativeWrappers). That is normally enough for chrome
code (it provides access to DOM behaviors and methods). If, however,
chrome code needs closer access to the underlying object, then it waives
the Xray wrapping behavior and gets a new wrapper around the object
(whose existence is mostly invisible except for preventing security
bugs). We can refer to the new wrapper however we want; they were called
SJOWs for a while, but nobody liked that. They have a new name in the
source code that I won't even mention here because it's so wrong, but we
can also call them waivers.
The second point to make is that once you waive the Xray behavior (by
using XPCNativeWrapper.unwrap(object) or by using
object.wrappedJSObject) you waive Xray behavior for all objects you
access though the return value. Therefore, if I have
XPCNativeWrapper.uwnrap(xrayWrappedWindow).document.body.firstChild, the
firstChild would *not* show Xray behavior. So we can think of the second
type of wrappers as "waivers of Xray behavior".
For what it's worth, XPCNativeWrapper.unwrap is a good way of avoiding
the "oops, my object wasn't an Xray wrapper and my
object.wrappedJSObject is returning odd things" problem.
-Blake