Skip to content

Commit

Permalink
Throw Exception when a Promise tries to resolve with another Promise (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jan 15, 2024
1 parent bfc0b66 commit 149bbb7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2v21 : nRF52: free up 800b more flash by removing vector table padding
Throw Exception when a Promise tries to resolve with another Promise (#2450)

2v20 : Ensure String.charCodeAt returns NaN for out of bounds chars
Bangle.js2: When rendering overlays, *do not* use the current FG/BG color for 1 bit overlays
Expand Down
4 changes: 4 additions & 0 deletions src/jswrap_promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ void _jswrap_promise_resolve_or_reject(JsVar *promise, JsVar *data, JsVar *fn) {
}
void _jswrap_promise_resolve_or_reject_chain(JsVar *promise, JsVar *data, bool resolve) {
const char *eventName = resolve ? JS_PROMISE_THEN_NAME : JS_PROMISE_CATCH_NAME;
if (_jswrap_promise_is_promise(data)) {
jsExceptionHere(JSET_ERROR, "Resolving a Promise with a value that is a Promise is not currently supported");
return;
}
// if we didn't have a catch, traverse the chain looking for one
JsVar *fn = jsvObjectGetChildIfExists(promise, eventName);
if (!fn) {
Expand Down

0 comments on commit 149bbb7

Please sign in to comment.