Skip to content

Commit 4f0db94

Browse files
authored
Merge pull request #369 from XmiliaH/fix-368
Fix problem with promise
2 parents d9af94c + 4675e51 commit 4f0db94

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/fixasync.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,18 @@ global.eval = new host.Proxy(eval_, makeCheckFunction('eval'));
6666
if (Promise) {
6767

6868
Promise.prototype.then = new host.Proxy(Promise.prototype.then, makeCheckFunction('promise_then'));
69-
Contextify.connect(host.Promise.prototype.then, Promise.prototype.then);
69+
// This seems not to work, and will produce
70+
// UnhandledPromiseRejectionWarning: TypeError: Method Promise.prototype.then called on incompatible receiver [object Object].
71+
// This is likely caused since the host.Promise.prototype.then cannot use the VM Proxy object.
72+
// Contextify.connect(host.Promise.prototype.then, Promise.prototype.then);
7073

7174
if (Promise.prototype.finally) {
7275
Promise.prototype.finally = new host.Proxy(Promise.prototype.finally, makeCheckFunction('promise_finally'));
73-
Contextify.connect(host.Promise.prototype.finally, Promise.prototype.finally);
76+
// Contextify.connect(host.Promise.prototype.finally, Promise.prototype.finally);
7477
}
7578
if (Promise.prototype.catch) {
7679
Promise.prototype.catch = new host.Proxy(Promise.prototype.catch, makeCheckFunction('promise_catch'));
77-
Contextify.connect(host.Promise.prototype.catch, Promise.prototype.catch);
80+
// Contextify.connect(host.Promise.prototype.catch, Promise.prototype.catch);
7881
}
7982

8083
}

0 commit comments

Comments
 (0)