mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
39a4e30ae8
- pointer style (db52d9c32) - Bug 1158407 - Stop using this one weird allocation fallback for MCreateThisWithTemplate. (r=terrence) (5b489cd5d) - Bug 1170124 - Remove unnecessary type monitoring in jit::InvokeFunction. r=bhackett (1603ee063) - Bug 1141865 - Part 2: Plumb new.target on the stack and make it accessible to JSNatives. (r=jorendorff, r=jandem, r=shu) (25cfa92ec) - Bug 1129795 - Convert rest of docshell/ to Gecko style. r=mccr8 (20acc2d82) - Bug 1162309 - Part 1: Remove instances of #ifdef PR_LOGGING in uriloader. r=froydnj (8768f60c0) - Bug 1162309 - Part 2: Remove instances of #ifdef PR_LOGGING in docshell. r=froydnj (e9de046f3) - Bug 1096908 - forward network security messages to the content process; r=hurley (69b38e624) - Bug 1156493 - e10s: move .cacheKey to nsICacheInfoChannel so child channels can get/set it, r=jduell (507efbe2b) - Bug 1017758 - Use infallible getters for appId/isInBrowserElement/unknownAppId; r=bz (8021f0ae8)
242 lines
8.2 KiB
C++
242 lines
8.2 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "jswrapper.h" // UncheckedUnwrap
|
|
|
|
#include "js/Proxy.h"
|
|
#include "vm/ProxyObject.h"
|
|
|
|
#include "jsobjinlines.h"
|
|
|
|
using namespace js;
|
|
|
|
bool
|
|
DirectProxyHandler::getPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
|
|
MutableHandle<PropertyDescriptor> desc) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, GET | SET | GET_PROPERTY_DESCRIPTOR);
|
|
MOZ_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetPropertyDescriptor(cx, target, id, desc);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
|
|
MutableHandle<PropertyDescriptor> desc) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, GET | SET | GET_PROPERTY_DESCRIPTOR);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetOwnPropertyDescriptor(cx, target, id, desc);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
|
|
Handle<PropertyDescriptor> desc,
|
|
ObjectOpResult &result) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, SET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return StandardDefineProperty(cx, target, id, desc, result);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::ownPropertyKeys(JSContext* cx, HandleObject proxy,
|
|
AutoIdVector& props) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetPropertyKeys(cx, target, JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, &props);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id,
|
|
ObjectOpResult &result) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, SET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return DeleteProperty(cx, target, id, result);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::enumerate(JSContext* cx, HandleObject proxy, MutableHandleObject objp) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
|
|
MOZ_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetIterator(cx, target, 0, objp);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::call(JSContext* cx, HandleObject proxy, const CallArgs& args) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, CALL);
|
|
RootedValue target(cx, proxy->as<ProxyObject>().private_());
|
|
return Invoke(cx, args.thisv(), target, args.length(), args.array(), args.rval());
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::construct(JSContext* cx, HandleObject proxy, const CallArgs& args) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, CALL);
|
|
RootedValue target(cx, proxy->as<ProxyObject>().private_());
|
|
return InvokeConstructor(cx, target, args.length(), args.array(), true, args.rval());
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
|
|
const CallArgs& args) const
|
|
{
|
|
args.setThis(ObjectValue(*args.thisv().toObject().as<ProxyObject>().target()));
|
|
if (!test(args.thisv())) {
|
|
ReportIncompatible(cx, args);
|
|
return false;
|
|
}
|
|
|
|
return CallNativeImpl(cx, impl, args);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::hasInstance(JSContext* cx, HandleObject proxy, MutableHandleValue v,
|
|
bool* bp) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return HasInstance(cx, target, v, bp);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::getPrototype(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetPrototype(cx, target, protop);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::setPrototype(JSContext *cx, HandleObject proxy, HandleObject proto,
|
|
ObjectOpResult &result) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return SetPrototype(cx, target, proto, result);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::setImmutablePrototype(JSContext *cx, HandleObject proxy, bool *succeeded) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return SetImmutablePrototype(cx, target, succeeded);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy, ObjectOpResult &result) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return PreventExtensions(cx, target, result);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return IsExtensible(cx, target, extensible);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue,
|
|
JSContext* cx) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return ObjectClassIs(target, classValue, cx);
|
|
}
|
|
|
|
const char*
|
|
DirectProxyHandler::className(JSContext* cx, HandleObject proxy) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetObjectClassName(cx, target);
|
|
}
|
|
|
|
JSString*
|
|
DirectProxyHandler::fun_toString(JSContext* cx, HandleObject proxy,
|
|
unsigned indent) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return fun_toStringHelper(cx, target, indent);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::regexp_toShared(JSContext* cx, HandleObject proxy,
|
|
RegExpGuard* g) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return RegExpToShared(cx, target, g);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const
|
|
{
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return Unbox(cx, target, vp);
|
|
}
|
|
|
|
JSObject*
|
|
DirectProxyHandler::weakmapKeyDelegate(JSObject* proxy) const
|
|
{
|
|
return UncheckedUnwrap(proxy);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::has(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, GET);
|
|
MOZ_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return HasProperty(cx, target, id, bp);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, GET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return HasOwnProperty(cx, target, id, bp);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::get(JSContext* cx, HandleObject proxy, HandleObject receiver,
|
|
HandleId id, MutableHandleValue vp) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, GET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetProperty(cx, target, receiver, id, vp);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleId id, HandleValue v,
|
|
HandleValue receiver, ObjectOpResult &result) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, id, SET);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return SetProperty(cx, target, id, v, receiver, result);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy,
|
|
AutoIdVector& props) const
|
|
{
|
|
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
|
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
|
return GetPropertyKeys(cx, target, JSITER_OWNONLY, &props);
|
|
}
|
|
|
|
bool
|
|
DirectProxyHandler::isCallable(JSObject* obj) const
|
|
{
|
|
JSObject * target = obj->as<ProxyObject>().target();
|
|
return target->isCallable();
|
|
}
|