Bug 1393790 part 1 - Remove JS_STUBGETTER and JS_STUBSETTER. r=jorendorff
This commit is contained in:
@@ -695,8 +695,7 @@ nsDOMClassInfo::Resolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||||||
// window.classname, just fall through and let the JS engine
|
// window.classname, just fall through and let the JS engine
|
||||||
// return the Object constructor.
|
// return the Object constructor.
|
||||||
if (!::JS_DefinePropertyById(cx, obj, id, desc.value(),
|
if (!::JS_DefinePropertyById(cx, obj, id, desc.value(),
|
||||||
JSPROP_ENUMERATE,
|
JSPROP_ENUMERATE)) {
|
||||||
JS_STUBGETTER, JS_STUBSETTER)) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,8 +943,7 @@ DefineInterfaceConstants(JSContext *cx, JS::Handle<JSObject*> obj, const nsIID *
|
|||||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv), rv);
|
NS_ENSURE_TRUE(NS_SUCCEEDED(rv), rv);
|
||||||
|
|
||||||
if (!::JS_DefineProperty(cx, obj, name.get(), v,
|
if (!::JS_DefineProperty(cx, obj, name.get(), v,
|
||||||
JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT,
|
JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) {
|
||||||
JS_STUBGETTER, JS_STUBSETTER)) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1475,8 +1473,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||||||
// Per ECMA, the prototype property is {DontEnum, DontDelete, ReadOnly}
|
// Per ECMA, the prototype property is {DontEnum, DontDelete, ReadOnly}
|
||||||
if (!JS_WrapValue(cx, &v) ||
|
if (!JS_WrapValue(cx, &v) ||
|
||||||
!JS_DefineProperty(cx, class_obj, "prototype", v,
|
!JS_DefineProperty(cx, class_obj, "prototype", v,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
JSPROP_PERMANENT | JSPROP_READONLY)) {
|
||||||
JS_STUBGETTER, JS_STUBSETTER)) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1757,8 +1754,7 @@ LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
|
|||||||
NS_ENSURE_TRUE(interfaces, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(interfaces, NS_ERROR_OUT_OF_MEMORY);
|
||||||
bool ok =
|
bool ok =
|
||||||
JS_DefineProperty(cx, components, "interfaces", interfaces,
|
JS_DefineProperty(cx, components, "interfaces", interfaces,
|
||||||
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY,
|
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
|
||||||
JS_STUBGETTER, JS_STUBSETTER);
|
|
||||||
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
// Define a bunch of shims from the Ci.nsIDOMFoo to window.Foo for DOM
|
// Define a bunch of shims from the Ci.nsIDOMFoo to window.Foo for DOM
|
||||||
@@ -1780,8 +1776,7 @@ LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
|
|||||||
|
|
||||||
// Define the shim on the interfaces object.
|
// Define the shim on the interfaces object.
|
||||||
ok = JS_DefineProperty(cx, interfaces, geckoName, v,
|
ok = JS_DefineProperty(cx, interfaces, geckoName, v,
|
||||||
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY,
|
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
|
||||||
JS_STUBGETTER, JS_STUBSETTER);
|
|
||||||
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14686,8 +14686,7 @@ nsGlobalWindow::RedefineProperty(JSContext* aCx, const char* aPropName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_WrapObject(aCx, &thisObj) ||
|
if (!JS_WrapObject(aCx, &thisObj) ||
|
||||||
!JS_DefineProperty(aCx, thisObj, aPropName, aValue, JSPROP_ENUMERATE,
|
!JS_DefineProperty(aCx, thisObj, aPropName, aValue, JSPROP_ENUMERATE)) {
|
||||||
JS_STUBGETTER, JS_STUBSETTER)) {
|
|
||||||
aError.Throw(NS_ERROR_FAILURE);
|
aError.Throw(NS_ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -837,8 +837,7 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
|
|||||||
if (!namedConstructor ||
|
if (!namedConstructor ||
|
||||||
!JS_DefineProperty(cx, namedConstructor, "prototype",
|
!JS_DefineProperty(cx, namedConstructor, "prototype",
|
||||||
proto,
|
proto,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
JSPROP_PERMANENT | JSPROP_READONLY) ||
|
||||||
JS_STUBGETTER, JS_STUBSETTER) ||
|
|
||||||
(defineOnGlobal &&
|
(defineOnGlobal &&
|
||||||
!DefineConstructor(cx, global, namedConstructors->mName,
|
!DefineConstructor(cx, global, namedConstructors->mName,
|
||||||
namedConstructor))) {
|
namedConstructor))) {
|
||||||
|
|||||||
@@ -905,8 +905,7 @@ GetOrCreateClassObjectMap(JSContext *cx, JS::Handle<JSObject*> scope, const char
|
|||||||
// It's not there. Create and define it.
|
// It's not there. Create and define it.
|
||||||
JS::Rooted<JSObject*> map(cx, JS::NewWeakMapObject(cx));
|
JS::Rooted<JSObject*> map(cx, JS::NewWeakMapObject(cx));
|
||||||
if (!map || !JS_DefineProperty(cx, scope, mapName, map,
|
if (!map || !JS_DefineProperty(cx, scope, mapName, map,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
JSPROP_PERMANENT | JSPROP_READONLY))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -1067,8 +1066,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
|
|||||||
JSAutoCompartment ac3(cx, holder);
|
JSAutoCompartment ac3(cx, holder);
|
||||||
if (!JS_WrapObject(cx, &proto) ||
|
if (!JS_WrapObject(cx, &proto) ||
|
||||||
!JS_DefineUCProperty(cx, holder, aClassName.get(), -1, proto,
|
!JS_DefineUCProperty(cx, holder, aClassName.get(), -1, proto,
|
||||||
JSPROP_READONLY | JSPROP_PERMANENT,
|
JSPROP_READONLY | JSPROP_PERMANENT))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
{
|
{
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,8 +120,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
|
|||||||
// Define it as a property on the scopeObject, using the same name used on
|
// Define it as a property on the scopeObject, using the same name used on
|
||||||
// the content side.
|
// the content side.
|
||||||
bool ok = JS_DefineUCProperty(cx, scopeObject, className, -1, propertyHolder,
|
bool ok = JS_DefineUCProperty(cx, scopeObject, className, -1, propertyHolder,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
JSPROP_PERMANENT | JSPROP_READONLY);
|
||||||
JS_STUBGETTER, JS_STUBSETTER);
|
|
||||||
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
|
||||||
} else {
|
} else {
|
||||||
propertyHolder = targetClassObject;
|
propertyHolder = targetClassObject;
|
||||||
|
|||||||
@@ -478,8 +478,7 @@ XPCShellEnvironment::Init()
|
|||||||
JS::Rooted<Value> privateVal(cx, PrivateValue(this));
|
JS::Rooted<Value> privateVal(cx, PrivateValue(this));
|
||||||
if (!JS_DefineProperty(cx, globalObj, "__XPCShellEnvironment",
|
if (!JS_DefineProperty(cx, globalObj, "__XPCShellEnvironment",
|
||||||
privateVal,
|
privateVal,
|
||||||
JSPROP_READONLY | JSPROP_PERMANENT,
|
JSPROP_READONLY | JSPROP_PERMANENT) ||
|
||||||
JS_STUBGETTER, JS_STUBSETTER) ||
|
|
||||||
!JS_DefineFunctions(cx, globalObj, gGlobalFunctions) ||
|
!JS_DefineFunctions(cx, globalObj, gGlobalFunctions) ||
|
||||||
!JS_DefineProfilingFunctions(cx, globalObj))
|
!JS_DefineProfilingFunctions(cx, globalObj))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2081,17 +2081,11 @@ ShellAllocationMetadataBuilder::build(JSContext* cx, HandleObject,
|
|||||||
static int createdIndex = 0;
|
static int createdIndex = 0;
|
||||||
createdIndex++;
|
createdIndex++;
|
||||||
|
|
||||||
if (!JS_DefineProperty(cx, obj, "index", createdIndex, 0,
|
if (!JS_DefineProperty(cx, obj, "index", createdIndex, 0))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
{
|
|
||||||
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
|
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
|
||||||
}
|
|
||||||
|
|
||||||
if (!JS_DefineProperty(cx, obj, "stack", stack, 0,
|
if (!JS_DefineProperty(cx, obj, "stack", stack, 0))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
{
|
|
||||||
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
|
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
|
||||||
}
|
|
||||||
|
|
||||||
int stackIndex = 0;
|
int stackIndex = 0;
|
||||||
RootedId id(cx);
|
RootedId id(cx);
|
||||||
@@ -2100,11 +2094,8 @@ ShellAllocationMetadataBuilder::build(JSContext* cx, HandleObject,
|
|||||||
if (iter.isFunctionFrame() && iter.compartment() == cx->compartment()) {
|
if (iter.isFunctionFrame() && iter.compartment() == cx->compartment()) {
|
||||||
id = INT_TO_JSID(stackIndex);
|
id = INT_TO_JSID(stackIndex);
|
||||||
RootedObject callee(cx, iter.callee(cx));
|
RootedObject callee(cx, iter.callee(cx));
|
||||||
if (!JS_DefinePropertyById(cx, stack, id, callee, 0,
|
if (!JS_DefinePropertyById(cx, stack, id, callee, 0))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
{
|
|
||||||
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
|
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
|
||||||
}
|
|
||||||
stackIndex++;
|
stackIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2475,8 +2475,7 @@ JS_InitCTypesClass(JSContext* cx, HandleObject global)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!JS_DefineProperty(cx, global, "ctypes", ctypes,
|
if (!JS_DefineProperty(cx, global, "ctypes", ctypes,
|
||||||
JSPROP_READONLY | JSPROP_PERMANENT,
|
JSPROP_READONLY | JSPROP_PERMANENT)) {
|
||||||
JS_STUBGETTER, JS_STUBSETTER)){
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,16 +45,14 @@ BEGIN_TEST(testAddPropertyHook)
|
|||||||
JS::RootedValue arr(cx, JS::ObjectValue(*obj));
|
JS::RootedValue arr(cx, JS::ObjectValue(*obj));
|
||||||
|
|
||||||
CHECK(JS_DefineProperty(cx, global, "arr", arr,
|
CHECK(JS_DefineProperty(cx, global, "arr", arr,
|
||||||
JSPROP_ENUMERATE,
|
JSPROP_ENUMERATE));
|
||||||
JS_STUBGETTER, JS_STUBSETTER));
|
|
||||||
|
|
||||||
JS::RootedObject arrObj(cx, &arr.toObject());
|
JS::RootedObject arrObj(cx, &arr.toObject());
|
||||||
for (int i = 0; i < ExpectedCount; ++i) {
|
for (int i = 0; i < ExpectedCount; ++i) {
|
||||||
obj = JS_NewObject(cx, &AddPropertyClass);
|
obj = JS_NewObject(cx, &AddPropertyClass);
|
||||||
CHECK(obj);
|
CHECK(obj);
|
||||||
CHECK(JS_DefineElement(cx, arrObj, i, obj,
|
CHECK(JS_DefineElement(cx, arrObj, i, obj,
|
||||||
JSPROP_ENUMERATE,
|
JSPROP_ENUMERATE));
|
||||||
JS_STUBGETTER, JS_STUBSETTER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now add a prop to each of the objects, but make sure to do
|
// Now add a prop to each of the objects, but make sure to do
|
||||||
|
|||||||
@@ -12,12 +12,11 @@ BEGIN_TEST(testSetProperty_NativeGetterStubSetter)
|
|||||||
JS::RootedObject obj(cx, JS_NewPlainObject(cx));
|
JS::RootedObject obj(cx, JS_NewPlainObject(cx));
|
||||||
CHECK(obj);
|
CHECK(obj);
|
||||||
|
|
||||||
CHECK(JS_DefineProperty(cx, global, "globalProp", obj, JSPROP_ENUMERATE,
|
CHECK(JS_DefineProperty(cx, global, "globalProp", obj, JSPROP_ENUMERATE));
|
||||||
JS_STUBGETTER, JS_STUBSETTER));
|
|
||||||
|
|
||||||
CHECK(JS_DefineProperty(cx, obj, "prop", JS::UndefinedHandleValue,
|
CHECK(JS_DefineProperty(cx, obj, "prop", JS::UndefinedHandleValue,
|
||||||
JSPROP_SHARED | JSPROP_PROPOP_ACCESSORS,
|
JSPROP_SHARED | JSPROP_PROPOP_ACCESSORS,
|
||||||
JS_PROPERTYOP_GETTER(NativeGet), JS_STUBSETTER));
|
JS_PROPERTYOP_GETTER(NativeGet), nullptr));
|
||||||
|
|
||||||
EXEC("'use strict'; \n"
|
EXEC("'use strict'; \n"
|
||||||
"var error, passed = false; \n"
|
"var error, passed = false; \n"
|
||||||
|
|||||||
@@ -2261,10 +2261,6 @@ inline int CheckIsSetterOp(JSSetterOp op);
|
|||||||
(static_cast<void>(sizeof(JS::detail::CheckIsSetterOp(v))), \
|
(static_cast<void>(sizeof(JS::detail::CheckIsSetterOp(v))), \
|
||||||
reinterpret_cast<JSNative>(v))
|
reinterpret_cast<JSNative>(v))
|
||||||
|
|
||||||
#define JS_STUBGETTER JS_PROPERTYOP_GETTER(JS_PropertyStub)
|
|
||||||
|
|
||||||
#define JS_STUBSETTER JS_PROPERTYOP_SETTER(JS_StrictPropertyStub)
|
|
||||||
|
|
||||||
#define JS_PS_ACCESSOR_SPEC(name, getter, setter, flags, extraFlags) \
|
#define JS_PS_ACCESSOR_SPEC(name, getter, setter, flags, extraFlags) \
|
||||||
{ name, uint8_t(JS_CHECK_ACCESSOR_FLAGS(flags) | extraFlags), \
|
{ name, uint8_t(JS_CHECK_ACCESSOR_FLAGS(flags) | extraFlags), \
|
||||||
{ { getter, setter } } }
|
{ { getter, setter } } }
|
||||||
|
|||||||
@@ -232,9 +232,7 @@ DefineHelpProperty(JSContext* cx, HandleObject obj, const char* prop, const char
|
|||||||
RootedAtom atom(cx, Atomize(cx, value, strlen(value)));
|
RootedAtom atom(cx, Atomize(cx, value, strlen(value)));
|
||||||
if (!atom)
|
if (!atom)
|
||||||
return false;
|
return false;
|
||||||
return JS_DefineProperty(cx, obj, prop, atom,
|
return JS_DefineProperty(cx, obj, prop, atom, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||||
JSPROP_READONLY | JSPROP_PERMANENT,
|
|
||||||
JS_STUBGETTER, JS_STUBSETTER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
|
|||||||
@@ -1440,11 +1440,8 @@ js::InitMathClass(JSContext* cx, HandleObject obj)
|
|||||||
if (!Math)
|
if (!Math)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!JS_DefineProperty(cx, obj, js_Math_str, Math, JSPROP_RESOLVING,
|
if (!JS_DefineProperty(cx, obj, js_Math_str, Math, JSPROP_RESOLVING))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
{
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
if (!JS_DefineFunctions(cx, Math, math_static_methods))
|
if (!JS_DefineFunctions(cx, Math, math_static_methods))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (!JS_DefineConstDoubles(cx, Math, math_constants))
|
if (!JS_DefineConstDoubles(cx, Math, math_constants))
|
||||||
|
|||||||
@@ -992,11 +992,8 @@ js::InitJSONClass(JSContext* cx, HandleObject obj)
|
|||||||
if (!JSON)
|
if (!JSON)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!JS_DefineProperty(cx, global, js_JSON_str, JSON, JSPROP_RESOLVING,
|
if (!JS_DefineProperty(cx, global, js_JSON_str, JSON, JSPROP_RESOLVING))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
{
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
if (!JS_DefineFunctions(cx, JSON, json_static_methods))
|
if (!JS_DefineFunctions(cx, JSON, json_static_methods))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -261,8 +261,7 @@ RegisterPerfMeasurement(JSContext* cx, HandleObject globalArg)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (const pm_const* c = pm_consts; c->name; c++) {
|
for (const pm_const* c = pm_consts; c->name; c++) {
|
||||||
if (!JS_DefineProperty(cx, ctor, c->name, c->value, PM_CATTRS,
|
if (!JS_DefineProperty(cx, ctor, c->name, c->value, PM_CATTRS))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ js::InitProxyClass(JSContext* cx, HandleObject obj)
|
|||||||
|
|
||||||
if (!JS_DefineFunctions(cx, ctor, static_methods))
|
if (!JS_DefineFunctions(cx, ctor, static_methods))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (!JS_DefineProperty(cx, obj, "Proxy", ctor, JSPROP_RESOLVING, JS_STUBGETTER, JS_STUBSETTER))
|
if (!JS_DefineProperty(cx, obj, "Proxy", ctor, JSPROP_RESOLVING))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
global->setConstructor(JSProto_Proxy, ObjectValue(*ctor));
|
global->setConstructor(JSProto_Proxy, ObjectValue(*ctor));
|
||||||
|
|||||||
@@ -433,8 +433,7 @@ ExportFunction(JSContext* cx, HandleValue vfunction, HandleValue vscope, HandleV
|
|||||||
// the target.
|
// the target.
|
||||||
if (!JSID_IS_VOID(options.defineAs)) {
|
if (!JSID_IS_VOID(options.defineAs)) {
|
||||||
if (!JS_DefinePropertyById(cx, targetScope, id, rval,
|
if (!JS_DefinePropertyById(cx, targetScope, id, rval,
|
||||||
JSPROP_ENUMERATE,
|
JSPROP_ENUMERATE)) {
|
||||||
JS_STUBGETTER, JS_STUBSETTER)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,8 +479,7 @@ CreateObjectIn(JSContext* cx, HandleValue vobj, CreateObjectInOptions& options,
|
|||||||
|
|
||||||
if (define) {
|
if (define) {
|
||||||
if (!JS_DefinePropertyById(cx, scope, options.defineAs, obj,
|
if (!JS_DefinePropertyById(cx, scope, options.defineAs, obj,
|
||||||
JSPROP_ENUMERATE,
|
JSPROP_ENUMERATE))
|
||||||
JS_STUBGETTER, JS_STUBSETTER))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user