Bug 1053271 - Remove some unused XRayWrapper code. r=bz.

--HG--
extra : rebase_source : 62e659d4b70872997b62185b2f634d87e9242d9d
This commit is contained in:
Peter Van der Beken 2018-06-04 16:37:04 +02:00
Родитель f4270dc255
Коммит b986ba77dd
3 изменённых файлов: 0 добавлений и 72 удалений

Просмотреть файл

@ -141,23 +141,6 @@ IsXrayWrapper(JSObject* obj);
JSObject* JSObject*
XrayAwareCalleeGlobal(JSObject* fun); XrayAwareCalleeGlobal(JSObject* fun);
// A version of XrayAwareCalleeGlobal that can be used from a binding
// specialized getter. We need this function because in a specialized getter we
// don't have a callee JSFunction, so can't use xpc::XrayAwareCalleeGlobal.
// Instead we do something a bit hacky using our current compartment and "this"
// value. Note that for the Xray case thisObj will NOT be in the compartment of
// "cx".
//
// As expected, the outparam "global" need not be same-compartment with either
// thisObj or cx, though it _will_ be same-compartment with one of them.
//
// This function can fail; the return value indicates success or failure.
bool
XrayAwareCalleeGlobalForSpecializedGetters(JSContext* cx,
JS::Handle<JSObject*> thisObj,
JS::MutableHandle<JSObject*> global);
void void
TraceXPCGlobal(JSTracer* trc, JSObject* obj); TraceXPCGlobal(JSTracer* trc, JSObject* obj);

Просмотреть файл

@ -145,39 +145,6 @@ XrayAwareCalleeGlobal(JSObject* fun)
return js::GetGlobalForObjectCrossCompartment(xrayTarget); return js::GetGlobalForObjectCrossCompartment(xrayTarget);
} }
bool
XrayAwareCalleeGlobalForSpecializedGetters(JSContext* cx,
JS::Handle<JSObject*> thisObj,
JS::MutableHandle<JSObject*> global)
{
JS::Rooted<JSObject*> wrappedObj(cx, thisObj);
if (!JS_WrapObject(cx, &wrappedObj)) {
return false;
}
if (xpc::WrapperFactory::IsXrayWrapper(wrappedObj)) {
// Our current compartment would generaly get xrays to thisObj. That
// means we're presumably doing a call over Xrays, an the compartment of
// the callee is presumably that of thisObj. This isn't _necessarily_
// true (e.g. chrome code could be using a chrome-side getter and doing
// .call() with a content-side this value), but people shouldn't do
// that!
//
// If someoen does do something weird here, the only impact is that we
// will create the rejected promise that a promise-returning getter
// creates around any exceptions it throws in the "wrong" compartment.
// In particular, we might create it in the content compartment even
// though we should really have created it in the chrome compartment
// (for the case when a chrome getter is invoked with a content object
// instead of just invoking the xrayed getter).
global.set(js::GetGlobalForObjectCrossCompartment(thisObj));
return true;
}
global.set(JS::CurrentGlobalOrNull(cx));
return true;
}
JSObject* JSObject*
XrayTraits::getExpandoChain(HandleObject obj) XrayTraits::getExpandoChain(HandleObject obj)
{ {
@ -1363,12 +1330,6 @@ XrayTraits::getExpandoClass(JSContext* cx, HandleObject target) const
static const size_t JSSLOT_XRAY_HOLDER = 0; static const size_t JSSLOT_XRAY_HOLDER = 0;
static JSObject*
GetHolder(JSObject* obj)
{
return &js::GetProxyReservedSlot(obj, JSSLOT_XRAY_HOLDER).toObject();
}
/* static */ JSObject* /* static */ JSObject*
XrayTraits::getHolder(JSObject* wrapper) XrayTraits::getHolder(JSObject* wrapper)
{ {
@ -1707,17 +1668,6 @@ DOMXrayTraits::getExpandoClass(JSContext* cx, HandleObject target) const
namespace XrayUtils { namespace XrayUtils {
JSObject*
GetNativePropertiesObject(JSContext* cx, JSObject* wrapper)
{
MOZ_ASSERT(js::IsWrapper(wrapper) && WrapperFactory::IsXrayWrapper(wrapper),
"bad object passed in");
JSObject* holder = GetHolder(wrapper);
MOZ_ASSERT(holder, "uninitialized wrapper being used?");
return holder;
}
bool bool
HasNativeProperty(JSContext* cx, HandleObject wrapper, HandleId id, bool* hasProp) HasNativeProperty(JSContext* cx, HandleObject wrapper, HandleId id, bool* hasProp)
{ {

Просмотреть файл

@ -37,9 +37,6 @@ namespace XrayUtils {
bool bool
IsTransparent(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id); IsTransparent(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id);
JSObject*
GetNativePropertiesObject(JSContext* cx, JSObject* wrapper);
bool bool
HasNativeProperty(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id, HasNativeProperty(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id,
bool* hasProp); bool* hasProp);
@ -465,8 +462,6 @@ extern template class SecurityXrayDOM;
extern template class PermissiveXrayJS; extern template class PermissiveXrayJS;
extern template class PermissiveXrayOpaque; extern template class PermissiveXrayOpaque;
class AutoSetWrapperNotShadowing;
/* /*
* Slots for Xray expando objects. See comments in XrayWrapper.cpp for details * Slots for Xray expando objects. See comments in XrayWrapper.cpp for details
* of how these get used; we mostly want the value of JSSLOT_EXPANDO_COUNT here. * of how these get used; we mostly want the value of JSSLOT_EXPANDO_COUNT here.