|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | const { |
| 4 | + FunctionPrototypeBind, |
4 | 5 | Promise, |
5 | 6 | PromisePrototypeFinally, |
6 | 7 | PromiseReject, |
@@ -72,8 +73,9 @@ function setTimeout(after, value, options = {}) { |
72 | 73 | if (!ref) timeout.unref(); |
73 | 74 | insert(timeout, timeout._idleTimeout); |
74 | 75 | if (signal) { |
75 | | - // eslint-disable-next-line no-undef |
76 | | - oncancel = cancelListenerHandler.bind(timeout, clearTimeout, reject); |
| 76 | + oncancel = FunctionPrototypeBind(cancelListenerHandler, |
| 77 | + // eslint-disable-next-line no-undef |
| 78 | + timeout, clearTimeout, reject); |
77 | 79 | signal.addEventListener('abort', oncancel); |
78 | 80 | } |
79 | 81 | }); |
@@ -121,8 +123,9 @@ function setImmediate(value, options = {}) { |
121 | 123 | const immediate = new Immediate(resolve, [value]); |
122 | 124 | if (!ref) immediate.unref(); |
123 | 125 | if (signal) { |
124 | | - // eslint-disable-next-line no-undef |
125 | | - oncancel = cancelListenerHandler.bind(immediate, clearImmediate, reject); |
| 126 | + oncancel = FunctionPrototypeBind(cancelListenerHandler, |
| 127 | + // eslint-disable-next-line no-undef |
| 128 | + immediate, clearImmediate, reject); |
126 | 129 | signal.addEventListener('abort', oncancel); |
127 | 130 | } |
128 | 131 | }); |
|
0 commit comments