Bug 1027402 - Part 4: Mark Proxy Handler uses const. (r=jorendorff, r=bz)
This commit is contained in:
@@ -2112,7 +2112,7 @@ Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
desc.object().set(nullptr); // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
@@ -2143,7 +2143,7 @@ Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
desc.object().set(nullptr); // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
@@ -2168,7 +2168,7 @@ Proxy::defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
@@ -2179,7 +2179,7 @@ bool
|
||||
Proxy::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
@@ -2190,7 +2190,7 @@ bool
|
||||
Proxy::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
*bp = true; // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true);
|
||||
if (!policy.allowed())
|
||||
@@ -2222,7 +2222,7 @@ bool
|
||||
Proxy::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
@@ -2240,7 +2240,7 @@ bool
|
||||
Proxy::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
*bp = false; // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
@@ -2261,7 +2261,7 @@ bool
|
||||
Proxy::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
*bp = false; // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
@@ -2274,7 +2274,7 @@ Proxy::get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
vp.setUndefined(); // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
@@ -2315,7 +2315,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
@@ -2352,7 +2352,7 @@ bool
|
||||
Proxy::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
@@ -2363,7 +2363,7 @@ bool
|
||||
Proxy::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
vp.setUndefined(); // default result if we refuse to perform this action
|
||||
if (!handler->hasPrototype()) {
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
@@ -2398,7 +2398,7 @@ bool
|
||||
Proxy::preventExtensions(JSContext *cx, HandleObject proxy)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
return handler->preventExtensions(cx, proxy);
|
||||
}
|
||||
|
||||
@@ -2406,7 +2406,7 @@ bool
|
||||
Proxy::call(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
|
||||
// Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we
|
||||
// can only set our default value once we're sure that we're not calling the
|
||||
@@ -2425,7 +2425,7 @@ bool
|
||||
Proxy::construct(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
|
||||
// Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we
|
||||
// can only set our default value once we're sure that we're not calling the
|
||||
@@ -2455,7 +2455,7 @@ bool
|
||||
Proxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
*bp = false; // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
@@ -2479,7 +2479,7 @@ Proxy::className(JSContext *cx, HandleObject proxy)
|
||||
if (!JS_CHECK_STACK_SIZE(GetNativeStackLimit(cx), &stackDummy))
|
||||
return "too much recursion";
|
||||
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
BaseProxyHandler::GET, /* mayThrow = */ false);
|
||||
// Do the safe thing if the policy rejects.
|
||||
@@ -2493,7 +2493,7 @@ JSString *
|
||||
Proxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return nullptr);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
BaseProxyHandler::GET, /* mayThrow = */ false);
|
||||
// Do the safe thing if the policy rejects.
|
||||
@@ -2553,7 +2553,7 @@ Proxy::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end,
|
||||
HandleObject result)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET,
|
||||
/* mayThrow = */ true);
|
||||
if (!policy.allowed()) {
|
||||
|
||||
Reference in New Issue
Block a user