зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1488858 - Rename NonNullObject to RequireObject. r=jorendorff
This commit is contained in:
Родитель
bb8206e952
Коммит
93b3ec9605
|
@ -27,7 +27,7 @@ static bool Reflect_deleteProperty(JSContext* cx, unsigned argc, Value* vp) {
|
|||
// Step 1.
|
||||
RootedObject target(
|
||||
cx,
|
||||
NonNullObjectArg(cx, "`target`", "Reflect.deleteProperty", args.get(0)));
|
||||
RequireObjectArg(cx, "`target`", "Reflect.deleteProperty", args.get(0)));
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ bool js::Reflect_getPrototypeOf(JSContext* cx, unsigned argc, Value* vp) {
|
|||
// Step 1.
|
||||
RootedObject target(
|
||||
cx,
|
||||
NonNullObjectArg(cx, "`target`", "Reflect.getPrototypeOf", args.get(0)));
|
||||
RequireObjectArg(cx, "`target`", "Reflect.getPrototypeOf", args.get(0)));
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ bool js::Reflect_isExtensible(JSContext* cx, unsigned argc, Value* vp) {
|
|||
// Step 1.
|
||||
RootedObject target(
|
||||
cx,
|
||||
NonNullObjectArg(cx, "`target`", "Reflect.isExtensible", args.get(0)));
|
||||
RequireObjectArg(cx, "`target`", "Reflect.isExtensible", args.get(0)));
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ bool js::Reflect_ownKeys(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
// Step 1.
|
||||
RootedObject target(
|
||||
cx, NonNullObjectArg(cx, "`target`", "Reflect.ownKeys", args.get(0)));
|
||||
cx, RequireObjectArg(cx, "`target`", "Reflect.ownKeys", args.get(0)));
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ static bool Reflect_preventExtensions(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
// Step 1.
|
||||
RootedObject target(
|
||||
cx, NonNullObjectArg(cx, "`target`", "Reflect.preventExtensions",
|
||||
cx, RequireObjectArg(cx, "`target`", "Reflect.preventExtensions",
|
||||
args.get(0)));
|
||||
if (!target) {
|
||||
return false;
|
||||
|
@ -134,7 +134,7 @@ static bool Reflect_set(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
// Step 1.
|
||||
RootedObject target(
|
||||
cx, NonNullObjectArg(cx, "`target`", "Reflect.set", args.get(0)));
|
||||
cx, RequireObjectArg(cx, "`target`", "Reflect.set", args.get(0)));
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ static bool Reflect_setPrototypeOf(JSContext* cx, unsigned argc, Value* vp) {
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
// Step 1.
|
||||
RootedObject obj(cx, NonNullObjectArg(cx, "`target`",
|
||||
RootedObject obj(cx, RequireObjectArg(cx, "`target`",
|
||||
"Reflect.setPrototypeOf", args.get(0)));
|
||||
if (!obj) {
|
||||
return false;
|
||||
|
|
|
@ -761,7 +761,7 @@ bool ScriptedProxyHandler::defineProperty(JSContext* cx, HandleObject proxy,
|
|||
static bool CreateFilteredListFromArrayLike(JSContext* cx, HandleValue v,
|
||||
MutableHandleIdVector props) {
|
||||
// Step 2.
|
||||
RootedObject obj(cx, NonNullObject(cx, JSMSG_NOT_NONNULL_OBJECT_RET_OWNKEYS,
|
||||
RootedObject obj(cx, RequireObject(cx, JSMSG_NOT_NONNULL_OBJECT_RET_OWNKEYS,
|
||||
JSDVG_IGNORE_STACK, v));
|
||||
if (!obj) {
|
||||
return false;
|
||||
|
@ -1478,7 +1478,7 @@ static bool ProxyCreate(JSContext* cx, CallArgs& args, const char* callerName) {
|
|||
|
||||
// Step 1.
|
||||
RootedObject target(cx,
|
||||
NonNullObjectArg(cx, "`target`", callerName, args[0]));
|
||||
RequireObjectArg(cx, "`target`", callerName, args[0]));
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1492,7 +1492,7 @@ static bool ProxyCreate(JSContext* cx, CallArgs& args, const char* callerName) {
|
|||
|
||||
// Step 3.
|
||||
RootedObject handler(cx,
|
||||
NonNullObjectArg(cx, "`handler`", callerName, args[1]));
|
||||
RequireObjectArg(cx, "`handler`", callerName, args[1]));
|
||||
if (!handler) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3663,7 +3663,7 @@ const Class Debugger::class_ = {
|
|||
|
||||
static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args,
|
||||
const char* fnname) {
|
||||
JSObject* thisobj = NonNullObject(cx, args.thisv());
|
||||
JSObject* thisobj = RequireObject(cx, args.thisv());
|
||||
if (!thisobj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -4240,7 +4240,7 @@ bool Debugger::construct(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
// Check that the arguments, if any, are cross-compartment wrappers.
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
JSObject* argobj = NonNullObject(cx, args[i]);
|
||||
JSObject* argobj = RequireObject(cx, args[i]);
|
||||
if (!argobj) {
|
||||
return false;
|
||||
}
|
||||
|
@ -5152,7 +5152,7 @@ bool Debugger::findScripts(JSContext* cx, unsigned argc, Value* vp) {
|
|||
ScriptQuery query(cx, dbg);
|
||||
|
||||
if (args.length() >= 1) {
|
||||
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
|
||||
RootedObject queryObject(cx, RequireObject(cx, args[0]));
|
||||
if (!queryObject || !query.parseQuery(queryObject)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -5554,7 +5554,7 @@ bool Debugger::findObjects(JSContext* cx, unsigned argc, Value* vp) {
|
|||
ObjectQuery query(cx, dbg);
|
||||
|
||||
if (args.length() >= 1) {
|
||||
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
|
||||
RootedObject queryObject(cx, RequireObject(cx, args[0]));
|
||||
if (!queryObject || !query.parseQuery(queryObject)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -5817,7 +5817,7 @@ bool Debugger::adoptSource(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return false;
|
||||
}
|
||||
|
||||
RootedObject obj(cx, NonNullObject(cx, args[0]));
|
||||
RootedObject obj(cx, RequireObject(cx, args[0]));
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
@ -6120,7 +6120,7 @@ JSObject* Debugger::wrapWasmScript(JSContext* cx,
|
|||
|
||||
static JSObject* DebuggerScript_check(JSContext* cx, HandleValue v,
|
||||
const char* fnname) {
|
||||
JSObject* thisobj = NonNullObject(cx, v);
|
||||
JSObject* thisobj = RequireObject(cx, v);
|
||||
if (!thisobj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -6827,7 +6827,7 @@ static bool DebuggerScript_getPossibleBreakpoints(JSContext* cx, unsigned argc,
|
|||
RootedObject result(cx);
|
||||
DebuggerScriptGetPossibleBreakpointsMatcher<false> matcher(cx, &result);
|
||||
if (args.length() >= 1 && !args[0].isUndefined()) {
|
||||
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
|
||||
RootedObject queryObject(cx, RequireObject(cx, args[0]));
|
||||
if (!queryObject || !matcher.parseQuery(queryObject)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -6849,7 +6849,7 @@ static bool DebuggerScript_getPossibleBreakpointOffsets(JSContext* cx,
|
|||
RootedObject result(cx);
|
||||
DebuggerScriptGetPossibleBreakpointsMatcher<true> matcher(cx, &result);
|
||||
if (args.length() >= 1 && !args[0].isUndefined()) {
|
||||
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
|
||||
RootedObject queryObject(cx, RequireObject(cx, args[0]));
|
||||
if (!queryObject || !matcher.parseQuery(queryObject)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -7997,7 +7997,7 @@ static bool DebuggerScript_setBreakpoint(JSContext* cx, unsigned argc,
|
|||
return false;
|
||||
}
|
||||
|
||||
RootedObject handler(cx, NonNullObject(cx, args[1]));
|
||||
RootedObject handler(cx, RequireObject(cx, args[1]));
|
||||
if (!handler) {
|
||||
return false;
|
||||
}
|
||||
|
@ -8095,7 +8095,7 @@ static bool DebuggerScript_clearBreakpoint(JSContext* cx, unsigned argc,
|
|||
}
|
||||
Debugger* dbg = Debugger::fromChildJSObject(obj);
|
||||
|
||||
JSObject* handler = NonNullObject(cx, args[0]);
|
||||
JSObject* handler = RequireObject(cx, args[0]);
|
||||
if (!handler) {
|
||||
return false;
|
||||
}
|
||||
|
@ -8419,7 +8419,7 @@ static bool DebuggerSource_construct(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
static NativeObject* DebuggerSource_check(JSContext* cx, HandleValue thisv,
|
||||
const char* fnname) {
|
||||
JSObject* thisobj = NonNullObject(cx, thisv);
|
||||
JSObject* thisobj = RequireObject(cx, thisv);
|
||||
if (!thisobj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -9732,7 +9732,7 @@ void DebuggerFrame::trace(JSTracer* trc, JSObject* obj) {
|
|||
/* static */
|
||||
DebuggerFrame* DebuggerFrame::checkThis(JSContext* cx, const CallArgs& args,
|
||||
const char* fnname, bool checkLive) {
|
||||
JSObject* thisobj = NonNullObject(cx, args.thisv());
|
||||
JSObject* thisobj = RequireObject(cx, args.thisv());
|
||||
if (!thisobj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -9924,7 +9924,7 @@ static bool DebuggerArguments_getArg(JSContext* cx, unsigned argc, Value* vp) {
|
|||
int32_t i = args.callee().as<JSFunction>().getExtendedSlot(0).toInt32();
|
||||
|
||||
// Check that the this value is an Arguments object.
|
||||
RootedObject argsobj(cx, NonNullObject(cx, args.thisv()));
|
||||
RootedObject argsobj(cx, RequireObject(cx, args.thisv()));
|
||||
if (!argsobj) {
|
||||
return false;
|
||||
}
|
||||
|
@ -10219,7 +10219,7 @@ bool DebuggerFrame::evalWithBindingsMethod(JSContext* cx, unsigned argc,
|
|||
}
|
||||
mozilla::Range<const char16_t> chars = stableChars.twoByteRange();
|
||||
|
||||
RootedObject bindings(cx, NonNullObject(cx, args[1]));
|
||||
RootedObject bindings(cx, RequireObject(cx, args[1]));
|
||||
if (!bindings) {
|
||||
return false;
|
||||
}
|
||||
|
@ -10286,7 +10286,7 @@ void DebuggerObject_trace(JSTracer* trc, JSObject* obj) {
|
|||
static DebuggerObject* DebuggerObject_checkThis(JSContext* cx,
|
||||
const CallArgs& args,
|
||||
const char* fnname) {
|
||||
JSObject* thisobj = NonNullObject(cx, args.thisv());
|
||||
JSObject* thisobj = RequireObject(cx, args.thisv());
|
||||
if (!thisobj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -11404,7 +11404,7 @@ bool DebuggerObject::executeInGlobalWithBindingsMethod(JSContext* cx,
|
|||
}
|
||||
mozilla::Range<const char16_t> chars = stableChars.twoByteRange();
|
||||
|
||||
RootedObject bindings(cx, NonNullObject(cx, args[1]));
|
||||
RootedObject bindings(cx, RequireObject(cx, args[1]));
|
||||
if (!bindings) {
|
||||
return false;
|
||||
}
|
||||
|
@ -12576,7 +12576,7 @@ void DebuggerEnv_trace(JSTracer* trc, JSObject* obj) {
|
|||
static DebuggerEnvironment* DebuggerEnvironment_checkThis(
|
||||
JSContext* cx, const CallArgs& args, const char* fnname,
|
||||
bool requireDebuggee) {
|
||||
JSObject* thisobj = NonNullObject(cx, args.thisv());
|
||||
JSObject* thisobj = RequireObject(cx, args.thisv());
|
||||
if (!thisobj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ bool js::ToPropertyDescriptor(JSContext* cx, HandleValue descval,
|
|||
MutableHandle<PropertyDescriptor> desc) {
|
||||
// step 2
|
||||
RootedObject obj(
|
||||
cx, NonNullObject(cx, JSMSG_NOT_NONNULL_OBJECT_PROP_DESC, descval));
|
||||
cx, RequireObject(cx, JSMSG_NOT_NONNULL_OBJECT_PROP_DESC, descval));
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1008,7 +1008,7 @@ XDRResult XDRObjectLiteral(XDRState<mode>* xdr, MutableHandleObject obj);
|
|||
*/
|
||||
extern void ReportNotObject(JSContext* cx, const Value& v);
|
||||
|
||||
inline JSObject* NonNullObject(JSContext* cx, HandleValue v) {
|
||||
inline JSObject* RequireObject(JSContext* cx, HandleValue v) {
|
||||
if (v.isObject()) {
|
||||
return &v.toObject();
|
||||
}
|
||||
|
@ -1027,7 +1027,7 @@ inline JSObject* NonNullObject(JSContext* cx, HandleValue v) {
|
|||
extern void ReportNotObject(JSContext* cx, JSErrNum err, int spindex,
|
||||
HandleValue v);
|
||||
|
||||
inline JSObject* NonNullObject(JSContext* cx, JSErrNum err, int spindex,
|
||||
inline JSObject* RequireObject(JSContext* cx, JSErrNum err, int spindex,
|
||||
HandleValue v) {
|
||||
if (v.isObject()) {
|
||||
return &v.toObject();
|
||||
|
@ -1038,7 +1038,7 @@ inline JSObject* NonNullObject(JSContext* cx, JSErrNum err, int spindex,
|
|||
|
||||
extern void ReportNotObject(JSContext* cx, JSErrNum err, HandleValue v);
|
||||
|
||||
inline JSObject* NonNullObject(JSContext* cx, JSErrNum err, HandleValue v) {
|
||||
inline JSObject* RequireObject(JSContext* cx, JSErrNum err, HandleValue v) {
|
||||
if (v.isObject()) {
|
||||
return &v.toObject();
|
||||
}
|
||||
|
@ -1053,7 +1053,7 @@ inline JSObject* NonNullObject(JSContext* cx, JSErrNum err, HandleValue v) {
|
|||
extern void ReportNotObjectArg(JSContext* cx, const char* nth, const char* fun,
|
||||
HandleValue v);
|
||||
|
||||
inline JSObject* NonNullObjectArg(JSContext* cx, const char* nth,
|
||||
inline JSObject* RequireObjectArg(JSContext* cx, const char* nth,
|
||||
const char* fun, HandleValue v) {
|
||||
if (v.isObject()) {
|
||||
return &v.toObject();
|
||||
|
|
|
@ -34,7 +34,7 @@ static bool FillCharBufferCallback(const char16_t* buf, uint32_t len,
|
|||
return true;
|
||||
}
|
||||
|
||||
static JSObject* NonNullObject(JSContext* aCx, HandleValue aValue) {
|
||||
static JSObject* RequireObject(JSContext* aCx, HandleValue aValue) {
|
||||
if (!aValue.isObject()) {
|
||||
JS_ReportErrorASCII(aCx, "Expected object");
|
||||
return nullptr;
|
||||
|
@ -142,7 +142,7 @@ static bool Middleman_RegisterReplayDebugger(JSContext* aCx, unsigned aArgc,
|
|||
return JS_WrapValue(aCx, args.rval());
|
||||
}
|
||||
|
||||
RootedObject obj(aCx, NonNullObject(aCx, args.get(0)));
|
||||
RootedObject obj(aCx, RequireObject(aCx, args.get(0)));
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static bool Middleman_SpawnReplayingChild(JSContext* aCx, unsigned aArgc,
|
|||
static bool Middleman_SendManifest(JSContext* aCx, unsigned aArgc, Value* aVp) {
|
||||
CallArgs args = CallArgsFromVp(aArgc, aVp);
|
||||
|
||||
RootedObject manifestObject(aCx, NonNullObject(aCx, args.get(1)));
|
||||
RootedObject manifestObject(aCx, RequireObject(aCx, args.get(1)));
|
||||
if (!manifestObject) {
|
||||
return false;
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ static bool RecordReplay_ManifestFinished(JSContext* aCx, unsigned aArgc,
|
|||
|
||||
CharBuffer responseBuffer;
|
||||
if (args.hasDefined(0)) {
|
||||
RootedObject responseObject(aCx, NonNullObject(aCx, args.get(0)));
|
||||
RootedObject responseObject(aCx, RequireObject(aCx, args.get(0)));
|
||||
if (!responseObject) {
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче