Bug 1754405 part 8 - Rename JSID_VOID to PropertyKey::Void(). r=evilpie

Differential Revision: https://phabricator.services.mozilla.com/D138279
This commit is contained in:
Jan de Mooij 2022-02-13 12:01:46 +00:00
Родитель dec8bffeb2
Коммит 4249b631d8
20 изменённых файлов: 79 добавлений и 66 удалений

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

@ -21,7 +21,7 @@ using namespace JS;
namespace mozilla::dom {
jsid s_length_id = JSID_VOID;
jsid s_length_id = JS::PropertyKey::Void();
bool DefineStaticJSVals(JSContext* cx) {
return AtomizeAndPinJSString(cx, s_length_id, "length");

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

@ -25,7 +25,7 @@ class PinnedStringId {
jsid id;
public:
constexpr PinnedStringId() : id(JSID_VOID) {}
constexpr PinnedStringId() : id(JS::PropertyKey::Void()) {}
bool init(JSContext* cx, const char* string) {
JSString* str = JS_AtomizeAndPinString(cx, string);

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

@ -7,20 +7,24 @@
#ifndef js_Id_h
#define js_Id_h
// [SMDOC] Property Key / JSID
// [SMDOC] PropertyKey / jsid
//
// A jsid is an identifier for a property or method of an object which is
// either a 31-bit unsigned integer, interned string or symbol.
// A PropertyKey is an identifier for a property of an object which is either a
// 31-bit unsigned integer, interned string or symbol.
//
// Also, there is an additional jsid value, JSID_VOID, which does not occur in
// JS scripts but may be used to indicate the absence of a valid jsid. A void
// jsid is not a valid id and only arises as an exceptional API return value,
// such as in JS_NextProperty. Embeddings must not pass JSID_VOID into JSAPI
// entry points expecting a jsid and do not need to handle JSID_VOID in hooks
// receiving a jsid except when explicitly noted in the API contract.
// Also, there is an additional PropertyKey value, PropertyKey::Void(), which
// does not occur in JS scripts but may be used to indicate the absence of a
// valid key. A void PropertyKey is not a valid key and only arises as an
// exceptional API return value. Embeddings must not pass a void PropertyKey
// into JSAPI entry points expecting a PropertyKey and do not need to handle
// void keys in hooks receiving a PropertyKey except when explicitly noted in
// the API contract.
//
// A jsid is not implicitly convertible to or from a Value; JS_ValueToId or
// JS_IdToValue must be used instead.
// A PropertyKey is not implicitly convertible to or from a Value; JS_ValueToId
// or JS_IdToValue must be used instead.
//
// jsid is an alias for JS::PropertyKey. New code should use PropertyKey instead
// of jsid.
#include "mozilla/Maybe.h"
@ -118,6 +122,10 @@ struct PropertyKey {
bool isWellKnownSymbol(JS::SymbolCode code) const;
// A void PropertyKey. This is equivalent to a PropertyKey created by the
// default constructor.
static constexpr PropertyKey Void() { return PropertyKey(); }
static constexpr bool fitsInInt(int32_t i) { return i >= 0; }
static constexpr PropertyKey Int(int32_t i) {
@ -204,12 +212,11 @@ using jsid = JS::PropertyKey;
#define JSID_INT_MIN 0
#define JSID_INT_MAX INT32_MAX
constexpr const jsid JSID_VOID;
extern JS_PUBLIC_DATA const JS::HandleId JSID_VOIDHANDLE;
namespace JS {
// Handle<PropertyKey> version of PropertyKey::Void().
extern JS_PUBLIC_DATA const JS::HandleId VoidHandlePropertyKey;
template <>
struct GCPolicy<jsid> {
static void trace(JSTracer* trc, jsid* idp, const char* name) {

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

@ -18,7 +18,7 @@ struct IdValuePair {
JS::Value value;
jsid id;
IdValuePair() : value(JS::UndefinedValue()), id(JSID_VOID) {}
IdValuePair() : value(JS::UndefinedValue()), id(JS::PropertyKey::Void()) {}
explicit IdValuePair(jsid idArg) : value(JS::UndefinedValue()), id(idArg) {}
IdValuePair(jsid idArg, const Value& valueArg) : value(valueArg), id(idArg) {}

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

@ -60,7 +60,7 @@ struct TaggedPtr<jsid> {
return JS::PropertyKey::fromNonIntAtom(str);
}
static jsid wrap(JS::Symbol* sym) { return PropertyKey::Symbol(sym); }
static jsid empty() { return JSID_VOID; }
static jsid empty() { return JS::PropertyKey::Void(); }
};
template <>

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

@ -15,7 +15,7 @@ FRAGMENT(jsid, simple) {
cx, JS::PropertyKey::Symbol(JS::GetSymbolFor(cx, interned)));
JS::Rooted<jsid> well_known_symbol_id(
cx, JS::GetWellKnownSymbolKey(cx, JS::SymbolCode::iterator));
jsid void_id = JSID_VOID;
jsid void_id = JS::PropertyKey::Void();
breakpoint();

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

@ -347,12 +347,12 @@ static bool ValueToNameOrSymbolId(JSContext* cx, HandleValue idVal,
}
if (!id.isAtom() && !id.isSymbol()) {
id.set(JSID_VOID);
id.set(JS::PropertyKey::Void());
return true;
}
if (id.isAtom() && id.toAtom()->isIndex()) {
id.set(JSID_VOID);
id.set(JS::PropertyKey::Void());
return true;
}

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

@ -2976,7 +2976,7 @@ void MacroAssembler::PushEmptyRooted(VMFunctionData::RootType rootType) {
Push(UndefinedValue());
break;
case VMFunctionData::RootId:
Push(ImmWord(JSID_BITS(JSID_VOID)));
Push(ImmWord(JSID_BITS(JS::PropertyKey::Void())));
break;
}
}

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

@ -244,7 +244,7 @@ bool js::SetPropertyIgnoringNamedGetter(
bool BaseProxyHandler::getOwnEnumerablePropertyKeys(
JSContext* cx, HandleObject proxy, MutableHandleIdVector props) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), ENUMERATE);
MOZ_ASSERT(props.length() == 0);
if (!ownPropertyKeys(cx, proxy, props)) {
@ -285,7 +285,7 @@ bool BaseProxyHandler::getOwnEnumerablePropertyKeys(
bool BaseProxyHandler::enumerate(JSContext* cx, HandleObject proxy,
MutableHandleIdVector props) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), ENUMERATE);
// GetPropertyKeys will invoke getOwnEnumerablePropertyKeys along the proto
// chain for us.
@ -339,7 +339,7 @@ bool BaseProxyHandler::nativeCall(JSContext* cx, IsAcceptableThis test,
bool BaseProxyHandler::hasInstance(JSContext* cx, HandleObject proxy,
MutableHandleValue v, bool* bp) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), GET);
cx->check(proxy, v);
return JS::InstanceofOperator(cx, proxy, v, bp);
}
@ -389,7 +389,7 @@ bool BaseProxyHandler::setImmutablePrototype(JSContext* cx, HandleObject proxy,
bool BaseProxyHandler::getElements(JSContext* cx, HandleObject proxy,
uint32_t begin, uint32_t end,
ElementAdder* adder) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), GET);
return js::GetElementsWithAdder(cx, proxy, proxy, begin, end, adder);
}

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

@ -226,7 +226,7 @@ bool Proxy::ownPropertyKeys(JSContext* cx, HandleObject proxy,
return false;
}
const BaseProxyHandler* handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::ENUMERATE, true);
if (!policy.allowed()) {
return policy.returnValue();
@ -583,7 +583,7 @@ bool Proxy::getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy,
return false;
}
const BaseProxyHandler* handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::ENUMERATE, true);
if (!policy.allowed()) {
return policy.returnValue();
@ -621,7 +621,7 @@ bool Proxy::enumerate(JSContext* cx, HandleObject proxy,
return AppendUnique(cx, props, protoProps);
}
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::ENUMERATE, true);
// If the policy denies access but wants us to return true, we need
@ -644,7 +644,7 @@ bool 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, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::CALL, true);
if (!policy.allowed()) {
args.rval().setUndefined();
@ -664,7 +664,7 @@ bool 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, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::CALL, true);
if (!policy.allowed()) {
args.rval().setUndefined();
@ -695,7 +695,7 @@ bool Proxy::hasInstance(JSContext* cx, HandleObject proxy, MutableHandleValue v,
}
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,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::GET, true);
if (!policy.allowed()) {
return policy.returnValue();
@ -729,7 +729,7 @@ const char* Proxy::className(JSContext* cx, HandleObject proxy) {
}
const BaseProxyHandler* handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::GET, /* mayThrow = */ false);
// Do the safe thing if the policy rejects.
if (!policy.allowed()) {
@ -745,7 +745,7 @@ JSString* Proxy::fun_toString(JSContext* cx, HandleObject proxy,
return nullptr;
}
const BaseProxyHandler* handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::GET, /* mayThrow = */ false);
// Do the safe thing if the policy rejects.
if (!policy.allowed()) {
@ -781,7 +781,7 @@ bool Proxy::getElements(JSContext* cx, HandleObject proxy, uint32_t begin,
return false;
}
const BaseProxyHandler* handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
AutoEnterPolicy policy(cx, handler, proxy, JS::VoidHandlePropertyKey,
BaseProxyHandler::GET,
/* mayThrow = */ true);
if (!policy.allowed()) {

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

@ -65,7 +65,7 @@ bool ForwardingProxyHandler::defineProperty(JSContext* cx, HandleObject proxy,
bool ForwardingProxyHandler::ownPropertyKeys(
JSContext* cx, HandleObject proxy, MutableHandleIdVector props) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), ENUMERATE);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return GetPropertyKeys(
cx, target, JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props);
@ -81,7 +81,7 @@ bool ForwardingProxyHandler::delete_(JSContext* cx, HandleObject proxy,
bool ForwardingProxyHandler::enumerate(JSContext* cx, HandleObject proxy,
MutableHandleIdVector props) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), ENUMERATE);
MOZ_ASSERT(
!hasPrototype()); // Should never be called if there's a prototype.
RootedObject target(cx, proxy->as<ProxyObject>().target());
@ -155,7 +155,7 @@ bool ForwardingProxyHandler::set(JSContext* cx, HandleObject proxy, HandleId id,
bool ForwardingProxyHandler::call(JSContext* cx, HandleObject proxy,
const CallArgs& args) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, CALL);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), CALL);
RootedValue target(cx, proxy->as<ProxyObject>().private_());
InvokeArgs iargs(cx);
@ -168,7 +168,7 @@ bool ForwardingProxyHandler::call(JSContext* cx, HandleObject proxy,
bool ForwardingProxyHandler::construct(JSContext* cx, HandleObject proxy,
const CallArgs& args) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, CALL);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), CALL);
RootedValue target(cx, proxy->as<ProxyObject>().private_());
if (!IsConstructor(target)) {
@ -200,7 +200,7 @@ bool ForwardingProxyHandler::hasOwn(JSContext* cx, HandleObject proxy,
bool ForwardingProxyHandler::getOwnEnumerablePropertyKeys(
JSContext* cx, HandleObject proxy, MutableHandleIdVector props) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), ENUMERATE);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return GetPropertyKeys(cx, target, JSITER_OWNONLY, props);
}
@ -220,7 +220,7 @@ bool ForwardingProxyHandler::nativeCall(JSContext* cx, IsAcceptableThis test,
bool ForwardingProxyHandler::hasInstance(JSContext* cx, HandleObject proxy,
MutableHandleValue v, bool* bp) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), GET);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return HasInstance(cx, target, v, bp);
}
@ -239,7 +239,7 @@ bool ForwardingProxyHandler::isArray(JSContext* cx, HandleObject proxy,
const char* ForwardingProxyHandler::className(JSContext* cx,
HandleObject proxy) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), GET);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return GetObjectClassName(cx, target);
}
@ -247,7 +247,7 @@ const char* ForwardingProxyHandler::className(JSContext* cx,
JSString* ForwardingProxyHandler::fun_toString(JSContext* cx,
HandleObject proxy,
bool isToSource) const {
assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
assertEnteredPolicy(cx, proxy, JS::PropertyKey::Void(), GET);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return fun_toStringHelper(cx, target, isToSource);
}

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

@ -14,9 +14,10 @@
using namespace js;
static const jsid voidIdValue = JSID_VOID;
const JS::HandleId JSID_VOIDHANDLE =
JS::HandleId::fromMarkedLocation(&voidIdValue);
static const JS::PropertyKey voidKeyValue = JS::PropertyKey::Void();
const JS::HandleId JS::VoidHandlePropertyKey =
JS::HandleId::fromMarkedLocation(&voidKeyValue);
bool JS::PropertyKey::isPrivateName() const {
return isSymbol() && toSymbol()->isPrivateName();

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

@ -919,7 +919,7 @@ class DictionaryPropMap final : public PropMap {
clearHeaderFlagBits(HasPrevFlag);
}
void clearProperty(uint32_t index) { keys_[index] = JSID_VOID; }
void clearProperty(uint32_t index) { keys_[index] = PropertyKey::Void(); }
static void skipTrailingHoles(MutableHandle<DictionaryPropMap*> map,
uint32_t* mapLength);

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

@ -87,7 +87,7 @@ class MOZ_STACK_CLASS StackScopedCloneData : public StructuredCloneHolderBase {
}
FunctionForwarderOptions forwarderOptions;
if (!xpc::NewFunctionForwarder(aCx, JSID_VOIDHANDLE, obj,
if (!xpc::NewFunctionForwarder(aCx, JS::VoidHandlePropertyKey, obj,
forwarderOptions, &functionValue)) {
return nullptr;
}
@ -398,7 +398,7 @@ bool NewFunctionForwarder(JSContext* cx, HandleId idArg, HandleObject callable,
FunctionForwarderOptions& options,
MutableHandleValue vp) {
RootedId id(cx, idArg);
if (id == JSID_VOIDHANDLE) {
if (id.isVoid()) {
id = GetJSIDByIndex(cx, XPCJSContext::IDX_EMPTYSTRING);
}

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

@ -1101,7 +1101,7 @@ XPCJSContext::~XPCJSContext() {
XPCJSContext::XPCJSContext()
: mCallContext(nullptr),
mAutoRoots(nullptr),
mResolveName(JSID_VOID),
mResolveName(JS::PropertyKey::Void()),
mResolvingWrapper(nullptr),
mWatchdogManager(GetWatchdogManager()),
mSlowScriptSecondHalf(false),

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

@ -2977,7 +2977,7 @@ void XPCJSRuntime::Initialize(JSContext* cx) {
mLoaderGlobal.init(cx, nullptr);
// these jsids filled in later when we have a JSContext to work with.
mStrIDs[0] = JSID_VOID;
mStrIDs[0] = JS::PropertyKey::Void();
nsScriptSecurityManager::GetScriptSecurityManager()->InitJSCallbacks(cx);
@ -3081,7 +3081,7 @@ bool XPCJSRuntime::InitializeStrings(JSContext* cx) {
for (unsigned i = 0; i < XPCJSContext::IDX_TOTAL_COUNT; i++) {
str = JS_AtomizeAndPinString(cx, mStrings[i]);
if (!str) {
mStrIDs[0] = JSID_VOID;
mStrIDs[0] = JS::PropertyKey::Void();
return false;
}
mStrIDs[i] = PropertyKey::fromPinnedString(str);

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

@ -723,7 +723,7 @@ bool XPC_WN_Helper_Call(JSContext* cx, unsigned argc, Value* vp) {
// N.B. we want obj to be the callee, not JS_THIS(cx, vp)
RootedObject obj(cx, &args.callee());
XPCCallContext ccx(cx, obj, nullptr, JSID_VOIDHANDLE, args.length(),
XPCCallContext ccx(cx, obj, nullptr, JS::VoidHandlePropertyKey, args.length(),
args.array(), args.rval().address());
if (!ccx.IsValid()) {
return false;
@ -741,7 +741,7 @@ bool XPC_WN_Helper_Construct(JSContext* cx, unsigned argc, Value* vp) {
return false;
}
XPCCallContext ccx(cx, obj, nullptr, JSID_VOIDHANDLE, args.length(),
XPCCallContext ccx(cx, obj, nullptr, JS::VoidHandlePropertyKey, args.length(),
args.array(), args.rval().address());
if (!ccx.IsValid()) {
return false;
@ -908,7 +908,7 @@ bool XPC_WN_CallMethod(JSContext* cx, unsigned argc, Value* vp) {
}
obj = FixUpThisIfBroken(obj, funobj);
XPCCallContext ccx(cx, obj, funobj, JSID_VOIDHANDLE, args.length(),
XPCCallContext ccx(cx, obj, funobj, JS::VoidHandlePropertyKey, args.length(),
args.array(), vp);
XPCWrappedNative* wrapper = ccx.GetWrapper();
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
@ -937,7 +937,7 @@ bool XPC_WN_GetterSetter(JSContext* cx, unsigned argc, Value* vp) {
RootedObject obj(cx, &args.thisv().toObject());
obj = FixUpThisIfBroken(obj, funobj);
XPCCallContext ccx(cx, obj, funobj, JSID_VOIDHANDLE, args.length(),
XPCCallContext ccx(cx, obj, funobj, JS::VoidHandlePropertyKey, args.length(),
args.array(), vp);
XPCWrappedNative* wrapper = ccx.GetWrapper();
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);

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

@ -678,7 +678,7 @@ class MOZ_STACK_CLASS XPCCallContext final {
explicit XPCCallContext(JSContext* cx, JS::HandleObject obj = nullptr,
JS::HandleObject funobj = nullptr,
JS::HandleId id = JSID_VOIDHANDLE,
JS::HandleId id = JS::VoidHandlePropertyKey,
unsigned argc = NO_ARGS, JS::Value* argv = nullptr,
JS::Value* rval = nullptr);
@ -2361,7 +2361,7 @@ class MOZ_STACK_CLASS CreateObjectInOptions : public OptionsBase {
public:
explicit CreateObjectInOptions(JSContext* cx = xpc_GetSafeJSContext(),
JSObject* options = nullptr)
: OptionsBase(cx, options), defineAs(cx, JSID_VOID) {}
: OptionsBase(cx, options), defineAs(cx, JS::PropertyKey::Void()) {}
virtual bool Parse() override { return ParseId("defineAs", &defineAs); }
@ -2373,7 +2373,7 @@ class MOZ_STACK_CLASS ExportFunctionOptions : public OptionsBase {
explicit ExportFunctionOptions(JSContext* cx = xpc_GetSafeJSContext(),
JSObject* options = nullptr)
: OptionsBase(cx, options),
defineAs(cx, JSID_VOID),
defineAs(cx, JS::PropertyKey::Void()),
allowCrossOriginArguments(false) {}
virtual bool Parse() override {

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

@ -2004,7 +2004,8 @@ bool XrayWrapper<Base, Traits>::defineProperty(JSContext* cx,
template <typename Base, typename Traits>
bool XrayWrapper<Base, Traits>::ownPropertyKeys(
JSContext* cx, HandleObject wrapper, MutableHandleIdVector props) const {
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE);
assertEnteredPolicy(cx, wrapper, JS::PropertyKey::Void(),
BaseProxyHandler::ENUMERATE);
return getPropertyKeys(
cx, wrapper, JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props);
}
@ -2112,7 +2113,8 @@ bool XrayWrapper<Base, Traits>::enumerate(
template <typename Base, typename Traits>
bool XrayWrapper<Base, Traits>::call(JSContext* cx, HandleObject wrapper,
const JS::CallArgs& args) const {
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL);
assertEnteredPolicy(cx, wrapper, JS::PropertyKey::Void(),
BaseProxyHandler::CALL);
// Hard cast the singleton since SecurityWrapper doesn't have one.
return Traits::call(cx, wrapper, args, Base::singleton);
}
@ -2120,7 +2122,8 @@ bool XrayWrapper<Base, Traits>::call(JSContext* cx, HandleObject wrapper,
template <typename Base, typename Traits>
bool XrayWrapper<Base, Traits>::construct(JSContext* cx, HandleObject wrapper,
const JS::CallArgs& args) const {
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL);
assertEnteredPolicy(cx, wrapper, JS::PropertyKey::Void(),
BaseProxyHandler::CALL);
// Hard cast the singleton since SecurityWrapper doesn't have one.
return Traits::construct(cx, wrapper, args, Base::singleton);
}
@ -2137,7 +2140,8 @@ bool XrayWrapper<Base, Traits>::hasInstance(JSContext* cx,
JS::HandleObject wrapper,
JS::MutableHandleValue v,
bool* bp) const {
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::GET);
assertEnteredPolicy(cx, wrapper, JS::PropertyKey::Void(),
BaseProxyHandler::GET);
// CrossCompartmentWrapper::hasInstance unwraps |wrapper|'s Xrays and enters
// its compartment. Any present XrayWrappers should be preserved, so the
@ -2265,7 +2269,8 @@ template <typename Base, typename Traits>
bool XrayWrapper<Base, Traits>::getPropertyKeys(
JSContext* cx, HandleObject wrapper, unsigned flags,
MutableHandleIdVector props) const {
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE);
assertEnteredPolicy(cx, wrapper, JS::PropertyKey::Void(),
BaseProxyHandler::ENUMERATE);
// Enumerate expando properties first. Note that the expando object lives
// in the target compartment.

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

@ -1480,7 +1480,7 @@ struct ClearJSHolder : public TraceCallbacks {
}
virtual void Trace(JS::Heap<jsid>* aPtr, const char*, void*) const override {
*aPtr = JSID_VOID;
*aPtr = JS::PropertyKey::Void();
}
virtual void Trace(JS::Heap<JSObject*>* aPtr, const char*,