Skip to content

Commit

Permalink
fixup! bad(Swingset): Releasing a constrained Zalgo on syscall replay
Browse files Browse the repository at this point in the history
Address feedback: better isThenable check
  • Loading branch information
mhofman committed Jan 12, 2023
1 parent 89ef9af commit 3de2ea5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/SwingSet/src/kernel/vat-loader/async-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @returns {T extends PromiseLike<any> ? Promise<Awaited<R>> : R}
*/
export function maybeAsync(v, handle) {
if (typeof v === 'object' && v !== null && 'then' in v) {
if (Object(v) === v && typeof v.then === 'function') {
return Promise.resolve(v).then(handle);
} else {
return handle(v);
Expand All @@ -37,7 +37,7 @@ export function ensureSync(fn) {
// eslint-disable-next-line func-names
return function (...args) {
const result = Reflect.apply(fn, this, args);
if (typeof result === 'object' && result !== null && 'then' in result) {
if (Object(result) === result && typeof result.then === 'function') {
throw new Error('Unexpected async result');
} else {
return result;
Expand Down

0 comments on commit 3de2ea5

Please sign in to comment.