]> git.kaiwu.me - njs.git/commit
WebCrypto: preserve pending exceptions in QuickJS master
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 17 Nov 2026 21:23:52 +0000 (13:23 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Tue, 17 Nov 2026 22:09:33 +0000 (14:09 -0800)
commit810d959b7888194b862dc7043d0c328394141900
treef6a7bba72b13d4a117740f269e29e20b692a5049
parent932aadb95b9a444b4f79e14208c20cbc745183f5
WebCrypto: preserve pending exceptions in QuickJS

Previously, failed string conversions were reported as out of memory,
although toString() can throw or the input can be a Symbol.  A Symbol
in keyUsages therefore raised a false, uncatchable OOM in QuickJS-NG.
RSA and EC JWK import also replaced existing conversion, validation
and native exceptions with a generic "Invalid JWK ... key" error
from shared cleanup.

Keep the exception set by the failed operation.  Throw the generic
JWK error only for invalid key members, not from shared cleanup.

The issues were introduced in 75ca26f8 (0.8.10).
external/qjs_webcrypto_module.c
test/webcrypto/jwk_errors.t.mjs [new file with mode: 0644]
test/webcrypto/key_usages.t.mjs [new file with mode: 0644]