|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | const { |
| 4 | + FunctionPrototypeBind, |
4 | 5 | Promise, |
5 | 6 | PromisePrototypeFinally, |
6 | 7 | PromiseReject, |
@@ -69,8 +70,9 @@ function setTimeout(after, value, options = {}) { |
69 | 70 | if (!ref) timeout.unref(); |
70 | 71 | insert(timeout, timeout._idleTimeout); |
71 | 72 | if (signal) { |
72 | | - // eslint-disable-next-line no-undef |
73 | | - oncancel = cancelListenerHandler.bind(timeout, clearTimeout, reject); |
| 73 | + oncancel = FunctionPrototypeBind(cancelListenerHandler, |
| 74 | + // eslint-disable-next-line no-undef |
| 75 | + timeout, clearTimeout, reject); |
74 | 76 | signal.addEventListener('abort', oncancel); |
75 | 77 | } |
76 | 78 | }); |
@@ -113,8 +115,9 @@ function setImmediate(value, options = {}) { |
113 | 115 | const immediate = new Immediate(resolve, [value]); |
114 | 116 | if (!ref) immediate.unref(); |
115 | 117 | if (signal) { |
116 | | - // eslint-disable-next-line no-undef |
117 | | - oncancel = cancelListenerHandler.bind(immediate, clearImmediate, reject); |
| 118 | + oncancel = FunctionPrototypeBind(cancelListenerHandler, |
| 119 | + // eslint-disable-next-line no-undef |
| 120 | + immediate, clearImmediate, reject); |
118 | 121 | signal.addEventListener('abort', oncancel); |
119 | 122 | } |
120 | 123 | }); |
|
0 commit comments