Skip to content

Commit bf24651

Browse files
logic improvement
1 parent 6e80c31 commit bf24651

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

src/PyBytesProxyHandler.cc

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -148,33 +148,32 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
148148
));
149149
return true;
150150
}
151-
}
152151

153-
// "constructor" property
154-
bool isConstructorProperty;
155-
if (id.isString() && JS_StringEqualsLiteral(cx, id.toString(), "constructor", &isConstructorProperty) && isConstructorProperty) {
156-
JS::RootedObject global(cx, JS::GetNonCCWObjectGlobal(proxy));
152+
// "constructor" property
153+
if (JS_StringEqualsLiteral(cx, id.toString(), "constructor", &isProperty) && isProperty) {
154+
JS::RootedObject global(cx, JS::GetNonCCWObjectGlobal(proxy));
157155

158-
JS::RootedObject uint8ArrayPrototype(cx);
159-
if (!JS_GetClassPrototype(cx, JSProto_Uint8Array, &uint8ArrayPrototype)) {
160-
return false;
161-
}
156+
JS::RootedObject uint8ArrayPrototype(cx);
157+
if (!JS_GetClassPrototype(cx, JSProto_Uint8Array, &uint8ArrayPrototype)) {
158+
return false;
159+
}
162160

163-
JS::RootedValue Uint8Array_Prototype_Constructor(cx);
164-
if (!JS_GetProperty(cx, uint8ArrayPrototype, "constructor", &Uint8Array_Prototype_Constructor)) {
165-
return false;
166-
}
161+
JS::RootedValue Uint8Array_Prototype_Constructor(cx);
162+
if (!JS_GetProperty(cx, uint8ArrayPrototype, "constructor", &Uint8Array_Prototype_Constructor)) {
163+
return false;
164+
}
167165

168-
JS::RootedObject rootedUint8ArrayPrototypeConstructor(cx, Uint8Array_Prototype_Constructor.toObjectOrNull());
166+
JS::RootedObject rootedUint8ArrayPrototypeConstructor(cx, Uint8Array_Prototype_Constructor.toObjectOrNull());
169167

170-
desc.set(mozilla::Some(
171-
JS::PropertyDescriptor::Data(
172-
JS::ObjectValue(*rootedUint8ArrayPrototypeConstructor),
173-
{JS::PropertyAttribute::Enumerable}
174-
)
175-
));
168+
desc.set(mozilla::Some(
169+
JS::PropertyDescriptor::Data(
170+
JS::ObjectValue(*rootedUint8ArrayPrototypeConstructor),
171+
{JS::PropertyAttribute::Enumerable}
172+
)
173+
));
176174

177-
return true;
175+
return true;
176+
}
178177
}
179178

180179
if (id.isSymbol()) {

0 commit comments

Comments
 (0)