Skip to content

Commit 5fecf35

Browse files
committed
Fix worker onmessage dropping falsy results, hanging failed verify
The e.data guard used a falsy check, so a legitimate falsy result (verify posts boolean false on signature mismatch) was treated as an empty message and dropped, leaving the operation promise unsettled. Use a null/undefined check so falsy-but-valid results still complete the operation.
1 parent f4f5b68 commit 5fecf35

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

dist/msrcrypto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9299,7 +9299,7 @@ var workerManager = (function() {
92999299

93009300
worker.onmessage = function( e) {
93019301

9302-
if (!e.data) {
9302+
if (e.data == null) {
93039303
return;
93049304
}
93059305

dist/msrcrypto.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/subtle/workerManager.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,12 @@ var workerManager = (function() {
215215
worker.onmessage = function(/*@type(typeEvent)*/ e) {
216216

217217
// Guard against messages that arrive without a data payload. A
218-
// well-behaved worker always posts a data object, but a malformed
219-
// or empty event must not throw while reading e.data.* below.
220-
if (!e.data) {
218+
// well-behaved worker always posts a result, but a malformed or
219+
// empty event must not throw while reading e.data.* below. Use a
220+
// null/undefined check (not a falsy check): a legitimate result can
221+
// itself be falsy, e.g. `verify` posts the boolean `false`, which
222+
// must still complete the operation rather than be dropped.
223+
if (e.data == null) {
221224
return;
222225
}
223226

0 commit comments

Comments
 (0)