mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Use common sub-expression more (r=self).
This commit is contained in:
parent
b223802f5f
commit
40fbf4f25a
@ -2519,19 +2519,18 @@ obj_create(JSContext *cx, uintN argc, Value *vp)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (JSObject *proto = v.toObjectOrNull()) {
|
||||
if (proto->isXML()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_XML_PROTO_FORBIDDEN);
|
||||
return false;
|
||||
}
|
||||
JSObject *proto = v.toObjectOrNull();
|
||||
if (proto && proto->isXML()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_XML_PROTO_FORBIDDEN);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the callee's global as the parent of the new object to avoid dynamic
|
||||
* scoping (i.e., using the caller's global).
|
||||
*/
|
||||
JSObject *obj = NewNonFunction<WithProto::Given>(cx, &js_ObjectClass, v.toObjectOrNull(),
|
||||
vp->toObject().getGlobal());
|
||||
JSObject *obj = NewNonFunction<WithProto::Given>(cx, &js_ObjectClass, proto,
|
||||
vp->toObject().getGlobal());
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
vp->setObject(*obj); /* Root and prepare for eventual return. */
|
||||
|
Loading…
Reference in New Issue
Block a user