Bug 803791 - Guard against allocating a zero-capacity direct buffer. r=cpeterson
Back out 30b9fbf49c01:c7fc23428c3b (bug 823010) for being rotted by 8 hours

--HG--
extra : rebase_source : 0dde2f719d4963113b578d07a17a8001fb4e0f63
Bug 823348 - Uninline UniversalXPConnect management. r=mrbkap

Every time the layout of CompartmentPrivate changes, I forget to rebuild in
caps/ and spend half an hour wondering what the heck is going on. :-(
Bug 823348 - Don't set universalXPConnectEnabled for chrome compartments. r=mrbkap

There's a browser-chrome test that does this, which means that _all_ subsequent
browser-chrome tests inherit it. So depending on the ordering of cases in
WrapperFactory, we might end up using a CrossCompartmentWrapper rather than an
XrayWrapper, meaning that stuff like nodePrincipal doesn't work anymore.

The semantics of UniversalXPConnect are now entirely dicatated by what makes
our test suite go green. So let's not force ourselves to bend over backwards
during wrapping to handle this case. And let's fix that stupid test while
we're at it.
Bug 823348 - Remove broken and unused __scriptOnly__ check. r=mrbkap

__scriptOnly__ is unused on mxr and addons-mxr. Morevoer, the current
implementation is totally broken, because we check for NNXOW, which only
happens when a random content JS object ends up in some other cross-origin
scope (via addons, presumably), whereas chrome objects use ChomeObjectWrapper.

I'm soon going to replace SCRIPT_ACCESS_ONLY with checked unwrapping, and mark
all COWs as unsafe to unwrap (see bug 821573 and bug 658909). So let's just kill
this thing here.
Bug 823348 - Do a better job of lying about the holder and make assertions fatal. r=mrbkap

I noticed this nonfatal assertion firing, unrelated to my patches. Leaking
the holder is not so great. Let's fix this for real.
Bug 823348 - Make NNXOWs use an explicitly opaque Policy. r=mrbkap

There's no reason to be doing a dynamic check here, given that the JSClasses
will never match. Lets be explicit and safe.
Bug 823348 - Flip off the wantXrays for chrome sandboxes. r=mrbkap

wantXrays means that the sandbox wants Xray wrappers even when accessing same-
origin content. The default is true, which Blake says has something to do with
GreaseMonkey and days of old.

This flag never had an effect for chrome, because the chrome->chrome case always
short-circuited to &CrossCompartmentWrapper::singleton. But once we start
respecting the flag as a general-purpose indicator that Xrays should be applied
same-origin, we need to either add a special case in Rewrap or make the flag reflect
reality. The latter seems cleaner and more sane.

However, things are complicated by the fact that there's also a completely different,
orthogonal usage, whereby setting wantXrays to false implicitly waives Xray on the
returned sandbox _and_ on any results returned from evalInSandbox. This is just nuts.
The former can be accomplished by callers manually using .wrappedJSObject, and the
latter by having EvalInSandbox transitively apply waivers from their sandbox arguments.

I've updated the documentation on the MDN page so that it only describes the
reasonable usage. The next step is to get rid of the crazy behavior. I think the
best path of migration is to have wantXrays: false keep implicitly waiving, but
waive return values from EvalInSandbox based on whether the argument was waived. This
patch does that.
Bug 823348 - Use EnsureCompartmentPrivate In Rewrap and stop checking for null. r=mrbkap
Bug 823348 - Use GetXrayType for content->chrome Xray wrappers. r=mrbkap

There's no reason to do this any different than we do for XOWs and such. The
only thing this might conceivably support would be certain chrome XPWNs-as-COWs.
But that would require that they forced a parent in precreate without being
flagged as DOM objects in classinfo. And it's not clear why we'd want to support
that. And we're generally moving away from COWs anyway.
Bug 823348 - Precompute various parameters in Rewrap. r=mrbkap

This is generally cleaner, and avoids potentially calling these functions
multiple times when we start moving this stuff around.
Bug 823348 - Move COW prototype remapping out of wrapper selection. r=mrbkap

It's pretty orthogonal, and makes the critical block more complicated than it
needs to be.
Bug 823348 - Hoist special cases to the top of WrapperFactory::Rewrap. r=mrbkap

This paves the way for more rule-based selection of wrappers in the common case.
Bug 823348 - Replace security wrapper enumeration with a more rule-based approach. r=mrbkap
Bug 823348 - Stop checking for Xray waivers in the Xray machinery. r=mrbkap

All the casese where we want to waive should now be going through WaiveXrayWrapper.
Bug 823348 - Tests. r=mrbkap

We tack these onto the tests from bug 812415, adding coverage for
nsExpandedPrincipal and making sure that the waivers are deep.

We also take the opportunity to check the asymmetric security
relationship between a principal and its corresponding nsEP.
Backout of Bug 757511 (cset 36e938e51481). r=bsmith
Backout part of Bug 726593 (cset 48918f0df283) that uses bug 757511. r=bsmith
No Bug - Bumping uuid of nsIStreamTransportService just in case. r=dougt
Bug 833178 - Increase Stream Transport thread pool max threads. r=bsmith