Skip to content

Commit 3de2ea5

Browse files
committed
fixup! bad(Swingset): Releasing a constrained Zalgo on syscall replay
Address feedback: better isThenable check
1 parent 89ef9af commit 3de2ea5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/SwingSet/src/kernel/vat-loader/async-helper.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @returns {T extends PromiseLike<any> ? Promise<Awaited<R>> : R}
2020
*/
2121
export function maybeAsync(v, handle) {
22-
if (typeof v === 'object' && v !== null && 'then' in v) {
22+
if (Object(v) === v && typeof v.then === 'function') {
2323
return Promise.resolve(v).then(handle);
2424
} else {
2525
return handle(v);
@@ -37,7 +37,7 @@ export function ensureSync(fn) {
3737
// eslint-disable-next-line func-names
3838
return function (...args) {
3939
const result = Reflect.apply(fn, this, args);
40-
if (typeof result === 'object' && result !== null && 'then' in result) {
40+
if (Object(result) === result && typeof result.then === 'function') {
4141
throw new Error('Unexpected async result');
4242
} else {
4343
return result;

0 commit comments

Comments
 (0)