[njs] Fixed attribute initialization for external properties.
noreply at nginx.com
noreply at nginx.com
Tue Jul 2 02:32:02 UTC 2024
details: https://github.com/nginx/njs/commit/286d00b93ffa54958aab9a930a844ba4ba83f095
branches: master
commit: 286d00b93ffa54958aab9a930a844ba4ba83f095
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Fri, 21 Jun 2024 19:14:35 -0700
description:
Fixed attribute initialization for external properties.
---
src/njs_extern.c | 8 +++-----
src/test/njs_unit_test.c | 5 +++++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/njs_extern.c b/src/njs_extern.c
index df51f9b7..9ec1c1c9 100644
--- a/src/njs_extern.c
+++ b/src/njs_extern.c
@@ -236,11 +236,9 @@ njs_external_prop_handler(njs_vm_t *vm, njs_object_prop_t *self,
return NJS_ERROR;
}
- if (slots != NULL) {
- prop->writable = slots->writable;
- prop->configurable = slots->configurable;
- prop->enumerable = slots->enumerable;
- }
+ prop->writable = self->writable;
+ prop->configurable = self->configurable;
+ prop->enumerable = self->enumerable;
lhq.value = prop;
njs_string_get(&self->name, &lhq.key);
diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c
index 88f8083e..d78c5b71 100644
--- a/src/test/njs_unit_test.c
+++ b/src/test/njs_unit_test.c
@@ -21819,6 +21819,11 @@ static njs_unit_test_t njs_webcrypto_test[] =
{ njs_str("let buf = new Uint32Array(4);"
"buf === crypto.getRandomValues(buf)"),
njs_str("true") },
+
+ { njs_str("crypto.subtle;"
+ "var d = Object.getOwnPropertyDescriptor(crypto, 'subtle');"
+ "d.enumerable && !d.configurable && d.writable"),
+ njs_str("true") },
};
More information about the nginx-devel
mailing list