@@ -287,8 +287,10 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
287
287
if (id.isString ()) {
288
288
bool isProperty;
289
289
290
+ JSString *idString = id.toString ();
291
+
290
292
// "length" and "byteLength" properties have the same value
291
- if (((JS_StringEqualsLiteral (cx, id. toString () , " length" , &isProperty) && isProperty) || (JS_StringEqualsLiteral (cx, id.toString (), " byteLength" , &isProperty) && isProperty))) {
293
+ if (((JS_StringEqualsLiteral (cx, idString , " length" , &isProperty) && isProperty) || (JS_StringEqualsLiteral (cx, id.toString (), " byteLength" , &isProperty) && isProperty))) {
292
294
JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
293
295
294
296
JS::RootedObject rootedArrayBuffer (cx, arrayBuffer->get ());
@@ -304,7 +306,7 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
304
306
}
305
307
306
308
// "buffer" property
307
- if (JS_StringEqualsLiteral (cx, id. toString () , " buffer" , &isProperty) && isProperty) {
309
+ if (JS_StringEqualsLiteral (cx, idString , " buffer" , &isProperty) && isProperty) {
308
310
JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
309
311
310
312
desc.set (mozilla::Some (
@@ -316,7 +318,7 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
316
318
}
317
319
318
320
// "BYTES_PER_ELEMENT" property
319
- if (JS_StringEqualsLiteral (cx, id. toString () , " BYTES_PER_ELEMENT" , &isProperty) && isProperty) {
321
+ if (JS_StringEqualsLiteral (cx, idString , " BYTES_PER_ELEMENT" , &isProperty) && isProperty) {
320
322
desc.set (mozilla::Some (
321
323
JS::PropertyDescriptor::Data (
322
324
JS::Int32Value (1 )
@@ -326,7 +328,7 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
326
328
}
327
329
328
330
// "byteOffset" property
329
- if (JS_StringEqualsLiteral (cx, id. toString () , " byteOffset" , &isProperty) && isProperty) {
331
+ if (JS_StringEqualsLiteral (cx, idString , " byteOffset" , &isProperty) && isProperty) {
330
332
desc.set (mozilla::Some (
331
333
JS::PropertyDescriptor::Data (
332
334
JS::Int32Value (0 )
@@ -336,7 +338,7 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
336
338
}
337
339
338
340
// "constructor" property
339
- if (JS_StringEqualsLiteral (cx, id. toString () , " constructor" , &isProperty) && isProperty) {
341
+ if (JS_StringEqualsLiteral (cx, idString , " constructor" , &isProperty) && isProperty) {
340
342
JS::RootedObject uint8ArrayPrototype (cx);
341
343
if (!JS_GetClassPrototype (cx, JSProto_Uint8Array, &uint8ArrayPrototype)) {
342
344
return false ;
0 commit comments