зеркало из https://github.com/mozilla/gecko-dev.git
Bug 912411 (part 2) - Move JSID_{VOID,EMPTY}HANDLE from jsapi.{h,cpp} to Id.{h,cpp}. r=luke.
--HG-- extra : rebase_source : 5fb68bf5079e3261fdca6cb99717d3a502c878f3
This commit is contained in:
Родитель
6ae716adf2
Коммит
8129026433
|
@ -157,4 +157,7 @@ extern JS_PUBLIC_DATA(const jsid) JSID_EMPTY;
|
|||
# define JSID_EMPTY ((jsid)JSID_TYPE_OBJECT)
|
||||
#endif
|
||||
|
||||
extern JS_PUBLIC_DATA(const JS::Handle<jsid>) JSID_VOIDHANDLE;
|
||||
extern JS_PUBLIC_DATA(const JS::Handle<jsid>) JSID_EMPTYHANDLE;
|
||||
|
||||
#endif /* js_Id_h */
|
||||
|
|
|
@ -4719,7 +4719,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub,
|
|||
ICUpdatedStub *denseStub = compiler.getStub(compiler.getStubSpace(script));
|
||||
if (!denseStub)
|
||||
return false;
|
||||
if (!denseStub->addUpdateStubForValue(cx, script, obj, JS::JSID_VOIDHANDLE, rhs))
|
||||
if (!denseStub->addUpdateStubForValue(cx, script, obj, JSID_VOIDHANDLE, rhs))
|
||||
return false;
|
||||
|
||||
stub->addNewStub(denseStub);
|
||||
|
@ -4733,7 +4733,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub,
|
|||
ICUpdatedStub *denseStub = compiler.getStub(compiler.getStubSpace(script));
|
||||
if (!denseStub)
|
||||
return false;
|
||||
if (!denseStub->addUpdateStubForValue(cx, script, obj, JS::JSID_VOIDHANDLE, rhs))
|
||||
if (!denseStub->addUpdateStubForValue(cx, script, obj, JSID_VOIDHANDLE, rhs))
|
||||
return false;
|
||||
|
||||
stub->addNewStub(denseStub);
|
||||
|
|
|
@ -107,11 +107,6 @@ using js::frontend::Parser;
|
|||
#define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
|
||||
#endif
|
||||
|
||||
const jsid voidIdValue = JSID_VOID;
|
||||
const jsid emptyIdValue = JSID_EMPTY;
|
||||
const HandleId JS::JSID_VOIDHANDLE = HandleId::fromMarkedLocation(&voidIdValue);
|
||||
const HandleId JS::JSID_EMPTYHANDLE = HandleId::fromMarkedLocation(&emptyIdValue);
|
||||
|
||||
/* Make sure that jschar is two bytes unsigned integer */
|
||||
JS_STATIC_ASSERT((jschar)-1 > 0);
|
||||
JS_STATIC_ASSERT(sizeof(jschar) == 2);
|
||||
|
|
|
@ -4580,11 +4580,4 @@ extern JS_PUBLIC_API(JSObject *)
|
|||
JS_DecodeInterpretedFunction(JSContext *cx, const void *data, uint32_t length,
|
||||
JSPrincipals *principals, JSPrincipals *originPrincipals);
|
||||
|
||||
namespace JS {
|
||||
|
||||
extern JS_PUBLIC_DATA(const Handle<jsid>) JSID_VOIDHANDLE;
|
||||
extern JS_PUBLIC_DATA(const Handle<jsid>) JSID_EMPTYHANDLE;
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
#endif /* jsapi_h */
|
||||
|
|
|
@ -2362,7 +2362,7 @@ Proxy::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &prop
|
|||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
return proxy->as<ProxyObject>().handler()->getOwnPropertyNames(cx, proxy, props);
|
||||
|
@ -2405,7 +2405,7 @@ Proxy::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
|||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
if (!handler->hasPrototype())
|
||||
|
@ -2543,7 +2543,7 @@ Proxy::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
|||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
return handler->keys(cx, proxy, props);
|
||||
|
@ -2556,7 +2556,7 @@ Proxy::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleV
|
|||
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, JS::JSID_VOIDHANDLE,
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
BaseProxyHandler::GET, true);
|
||||
// If the policy denies access but wants us to return true, we need
|
||||
// to hand a valid (empty) iterator object to the caller.
|
||||
|
@ -2601,7 +2601,7 @@ Proxy::call(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
|||
// 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
|
||||
// trap.
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE,
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
BaseProxyHandler::CALL, true);
|
||||
if (!policy.allowed()) {
|
||||
args.rval().setUndefined();
|
||||
|
@ -2620,7 +2620,7 @@ Proxy::construct(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
|||
// 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
|
||||
// trap.
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE,
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
BaseProxyHandler::CALL, true);
|
||||
if (!policy.allowed()) {
|
||||
args.rval().setUndefined();
|
||||
|
@ -2647,7 +2647,7 @@ Proxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool
|
|||
JS_CHECK_RECURSION(cx, return false);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
*bp = false; // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, true);
|
||||
if (!policy.allowed())
|
||||
return policy.returnValue();
|
||||
return proxy->as<ProxyObject>().handler()->hasInstance(cx, proxy, v, bp);
|
||||
|
@ -2670,7 +2670,7 @@ Proxy::className(JSContext *cx, HandleObject proxy)
|
|||
return "too much recursion";
|
||||
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE,
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
BaseProxyHandler::GET, /* mayThrow = */ false);
|
||||
// Do the safe thing if the policy rejects.
|
||||
if (!policy.allowed()) {
|
||||
|
@ -2684,7 +2684,7 @@ Proxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent)
|
|||
{
|
||||
JS_CHECK_RECURSION(cx, return NULL);
|
||||
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE,
|
||||
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
|
||||
BaseProxyHandler::GET, /* mayThrow = */ false);
|
||||
// Do the safe thing if the policy rejects.
|
||||
if (!policy.allowed()) {
|
||||
|
|
|
@ -5,9 +5,15 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "js/Id.h"
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
#ifdef JS_USE_JSID_STRUCT_TYPES
|
||||
const jsid JSID_VOID = { size_t(JSID_TYPE_VOID) };
|
||||
const jsid JSID_EMPTY = { size_t(JSID_TYPE_OBJECT) };
|
||||
#endif
|
||||
|
||||
static const jsid voidIdValue = JSID_VOID;
|
||||
static const jsid emptyIdValue = JSID_EMPTY;
|
||||
const JS::HandleId JSID_VOIDHANDLE = JS::HandleId::fromMarkedLocation(&voidIdValue);
|
||||
const JS::HandleId JSID_EMPTYHANDLE = JS::HandleId::fromMarkedLocation(&emptyIdValue);
|
||||
|
||||
|
|
|
@ -1024,7 +1024,7 @@ public:
|
|||
JSContext* cx = GetDefaultJSContext(),
|
||||
JS::HandleObject obj = JS::NullPtr(),
|
||||
JS::HandleObject funobj = JS::NullPtr(),
|
||||
JS::HandleId id = JS::JSID_VOIDHANDLE,
|
||||
JS::HandleId id = JSID_VOIDHANDLE,
|
||||
unsigned argc = NO_ARGS,
|
||||
jsval *argv = nullptr,
|
||||
jsval *rval = nullptr);
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#ifndef __AccessCheck_h__
|
||||
#define __AccessCheck_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jswrapper.h"
|
||||
#include "js/Id.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
|
||||
|
@ -76,7 +76,7 @@ struct CrossOriginAccessiblePropertiesOnly : public Policy {
|
|||
}
|
||||
static bool deny(js::Wrapper::Action act, JS::HandleId id) {
|
||||
// Silently fail for enumerate-like operations.
|
||||
if (act == js::Wrapper::GET && id == JS::JSID_VOIDHANDLE)
|
||||
if (act == js::Wrapper::GET && id == JSID_VOIDHANDLE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "ChromeObjectWrapper.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
using namespace JS;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче