Skip to content

Commit

Permalink
Fixed attribute initialization for external properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
xeioex committed Jul 2, 2024
1 parent ed631d2 commit 286d00b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/njs_extern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/test/njs_unit_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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") },
};


Expand Down

0 comments on commit 286d00b

Please sign in to comment.