| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3006302 commit 4cd9f39
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,9 @@ | |||
| 6 | 6 | const { | |
| 7 | 7 | Object, | |
| 8 | 8 | ObjectSetPrototypeOf, | |
| 9 | + ObjectDefineProperty, | ||
| 9 | 10 | Symbol, | |
| 11 | + SymbolToStringTag, | ||
| 10 | 12 | TypeError, | |
| 11 | 13 | } = primordials; | |
| 12 | 14 | ||
@@ -54,6 +56,13 @@ Object.defineProperties(AbortSignal.prototype, { | |||
| 54 | 56 | aborted: { enumerable: true } | |
| 55 | 57 | }); | |
| 56 | 58 | ||
| 59 | + ObjectDefineProperty(AbortSignal.prototype, SymbolToStringTag, { | ||
| 60 | + writable: false, | ||
| 61 | + enumerable: false, | ||
| 62 | + configurable: true, | ||
| 63 | + value: 'AbortSignal', | ||
| 64 | + }); | ||
| 65 | + | ||
| 57 | 66 | defineEventHandler(AbortSignal.prototype, 'abort'); | |
| 58 | 67 | ||
| 59 | 68 | function createAbortSignal() { | |
@@ -97,6 +106,13 @@ Object.defineProperties(AbortController.prototype, { | |||
| 97 | 106 | abort: { enumerable: true } | |
| 98 | 107 | }); | |
| 99 | 108 | ||
| 109 | + ObjectDefineProperty(AbortController.prototype, SymbolToStringTag, { | ||
| 110 | + writable: false, | ||
| 111 | + enumerable: false, | ||
| 112 | + configurable: true, | ||
| 113 | + value: 'AbortController', | ||
| 114 | + }); | ||
| 115 | + | ||
| 100 | 116 | module.exports = { | |
| 101 | 117 | AbortController, | |
| 102 | 118 | AbortSignal, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,3 +61,10 @@ const { Event } = require('internal/event_target'); | |||
| 61 | 61 | /^TypeError: Illegal constructor$/ | |
| 62 | 62 | ); | |
| 63 | 63 | } | |
| 64 | + { | ||
| 65 | + // Symbol.toStringTag | ||
| 66 | + const toString = (o) => Object.prototype.toString.call(o); | ||
| 67 | + const ac = new AbortController(); | ||
| 68 | + strictEqual(toString(ac), '[object AbortController]'); | ||
| 69 | + strictEqual(toString(ac.signal), '[object AbortSignal]'); | ||
| 70 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,7 @@ common.expectWarning({ | |||
| 23 | 23 | 'Use events.setMaxListeners() to increase ' + | |
| 24 | 24 | 'limit'], | |
| 25 | 25 | ['Possible EventTarget memory leak detected. 3 foo listeners added to ' + | |
| 26 | - '[AbortSignal [EventTarget]]. ' + | ||
| 26 | + '[AbortSignal]. ' + | ||
| 27 | 27 | 'Use events.setMaxListeners() to increase ' + | |
| 28 | 28 | 'limit'], | |
| 29 | 29 | ], | |
| Back | FazBrowse Home | New Git URL |
0 commit comments