undici 6.20.0 → 7.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -10
- package/docs/docs/api/Agent.md +0 -3
- package/docs/docs/api/Client.md +1 -3
- package/docs/docs/api/Debug.md +1 -1
- package/docs/docs/api/Dispatcher.md +60 -8
- package/docs/docs/api/EnvHttpProxyAgent.md +0 -1
- package/docs/docs/api/Fetch.md +1 -0
- package/docs/docs/api/MockAgent.md +2 -0
- package/docs/docs/api/MockPool.md +2 -1
- package/docs/docs/api/Pool.md +0 -1
- package/docs/docs/api/RetryAgent.md +1 -1
- package/docs/docs/api/RetryHandler.md +1 -1
- package/docs/docs/api/WebSocket.md +45 -3
- package/index.js +6 -6
- package/lib/api/abort-signal.js +2 -0
- package/lib/api/api-connect.js +3 -1
- package/lib/api/api-pipeline.js +7 -6
- package/lib/api/api-request.js +32 -47
- package/lib/api/api-stream.js +39 -50
- package/lib/api/api-upgrade.js +5 -3
- package/lib/api/readable.js +261 -64
- package/lib/api/util.js +2 -0
- package/lib/core/constants.js +11 -9
- package/lib/core/diagnostics.js +122 -128
- package/lib/core/errors.js +4 -4
- package/lib/core/request.js +11 -9
- package/lib/core/symbols.js +2 -1
- package/lib/core/tree.js +9 -1
- package/lib/core/util.js +219 -48
- package/lib/dispatcher/agent.js +3 -17
- package/lib/dispatcher/balanced-pool.js +5 -8
- package/lib/dispatcher/client-h1.js +278 -54
- package/lib/dispatcher/client-h2.js +1 -1
- package/lib/dispatcher/client.js +23 -34
- package/lib/dispatcher/dispatcher-base.js +2 -34
- package/lib/dispatcher/dispatcher.js +3 -24
- package/lib/dispatcher/fixed-queue.js +91 -49
- package/lib/dispatcher/pool-stats.js +2 -0
- package/lib/dispatcher/pool.js +3 -6
- package/lib/dispatcher/proxy-agent.js +6 -7
- package/lib/handler/decorator-handler.js +24 -0
- package/lib/handler/redirect-handler.js +11 -2
- package/lib/handler/retry-handler.js +12 -3
- package/lib/interceptor/dns.js +346 -0
- package/lib/interceptor/dump.js +2 -2
- package/lib/interceptor/redirect.js +11 -14
- package/lib/interceptor/response-error.js +4 -1
- package/lib/llhttp/constants.d.ts +97 -0
- package/lib/llhttp/constants.js +412 -192
- package/lib/llhttp/constants.js.map +1 -0
- package/lib/llhttp/llhttp-wasm.js +11 -1
- package/lib/llhttp/llhttp_simd-wasm.js +11 -1
- package/lib/llhttp/utils.d.ts +2 -0
- package/lib/llhttp/utils.js +9 -9
- package/lib/llhttp/utils.js.map +1 -0
- package/lib/mock/mock-agent.js +5 -8
- package/lib/mock/mock-client.js +9 -4
- package/lib/mock/mock-errors.js +3 -1
- package/lib/mock/mock-interceptor.js +8 -6
- package/lib/mock/mock-pool.js +9 -4
- package/lib/mock/mock-symbols.js +3 -1
- package/lib/mock/mock-utils.js +29 -5
- package/lib/web/cache/cache.js +24 -21
- package/lib/web/cache/cachestorage.js +1 -1
- package/lib/web/cookies/index.js +17 -13
- package/lib/web/cookies/parse.js +2 -2
- package/lib/web/eventsource/eventsource-stream.js +9 -8
- package/lib/web/eventsource/eventsource.js +10 -6
- package/lib/web/fetch/body.js +42 -36
- package/lib/web/fetch/constants.js +35 -26
- package/lib/web/fetch/data-url.js +1 -1
- package/lib/web/fetch/formdata-parser.js +2 -2
- package/lib/web/fetch/formdata.js +65 -54
- package/lib/web/fetch/headers.js +117 -85
- package/lib/web/fetch/index.js +55 -62
- package/lib/web/fetch/request.js +135 -77
- package/lib/web/fetch/response.js +86 -56
- package/lib/web/fetch/util.js +90 -64
- package/lib/web/fetch/webidl.js +99 -64
- package/lib/web/websocket/connection.js +76 -147
- package/lib/web/websocket/constants.js +3 -4
- package/lib/web/websocket/events.js +4 -2
- package/lib/web/websocket/frame.js +45 -3
- package/lib/web/websocket/receiver.js +29 -33
- package/lib/web/websocket/sender.js +18 -13
- package/lib/web/websocket/stream/websocketerror.js +83 -0
- package/lib/web/websocket/stream/websocketstream.js +485 -0
- package/lib/web/websocket/util.js +128 -77
- package/lib/web/websocket/websocket.js +234 -135
- package/package.json +20 -33
- package/scripts/strip-comments.js +3 -1
- package/types/agent.d.ts +7 -7
- package/types/api.d.ts +24 -24
- package/types/balanced-pool.d.ts +11 -11
- package/types/client.d.ts +11 -12
- package/types/diagnostics-channel.d.ts +10 -10
- package/types/dispatcher.d.ts +96 -97
- package/types/env-http-proxy-agent.d.ts +2 -2
- package/types/errors.d.ts +53 -47
- package/types/fetch.d.ts +8 -8
- package/types/formdata.d.ts +7 -7
- package/types/global-dispatcher.d.ts +4 -4
- package/types/global-origin.d.ts +5 -5
- package/types/handlers.d.ts +4 -4
- package/types/header.d.ts +157 -1
- package/types/index.d.ts +42 -46
- package/types/interceptors.d.ts +22 -8
- package/types/mock-agent.d.ts +21 -18
- package/types/mock-client.d.ts +4 -4
- package/types/mock-errors.d.ts +3 -3
- package/types/mock-interceptor.d.ts +19 -19
- package/types/mock-pool.d.ts +4 -4
- package/types/patch.d.ts +0 -4
- package/types/pool-stats.d.ts +8 -8
- package/types/pool.d.ts +12 -12
- package/types/proxy-agent.d.ts +4 -4
- package/types/readable.d.ts +22 -14
- package/types/retry-agent.d.ts +1 -1
- package/types/retry-handler.d.ts +8 -8
- package/types/util.d.ts +3 -3
- package/types/utility.d.ts +7 -0
- package/types/webidl.d.ts +44 -6
- package/types/websocket.d.ts +34 -1
- package/docs/docs/api/DispatchInterceptor.md +0 -60
- package/lib/interceptor/redirect-interceptor.js +0 -21
- package/lib/mock/pluralizer.js +0 -29
- package/lib/web/cache/symbols.js +0 -5
- package/lib/web/fetch/file.js +0 -126
- package/lib/web/fetch/symbols.js +0 -9
- package/lib/web/fileapi/encoding.js +0 -290
- package/lib/web/fileapi/filereader.js +0 -344
- package/lib/web/fileapi/progressevent.js +0 -78
- package/lib/web/fileapi/symbols.js +0 -10
- package/lib/web/fileapi/util.js +0 -391
- package/lib/web/websocket/symbols.js +0 -12
- package/types/file.d.ts +0 -39
- package/types/filereader.d.ts +0 -54
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
staticPropertyDescriptors,
|
|
5
|
-
readOperation,
|
|
6
|
-
fireAProgressEvent
|
|
7
|
-
} = require('./util')
|
|
8
|
-
const {
|
|
9
|
-
kState,
|
|
10
|
-
kError,
|
|
11
|
-
kResult,
|
|
12
|
-
kEvents,
|
|
13
|
-
kAborted
|
|
14
|
-
} = require('./symbols')
|
|
15
|
-
const { webidl } = require('../fetch/webidl')
|
|
16
|
-
const { kEnumerableProperty } = require('../../core/util')
|
|
17
|
-
|
|
18
|
-
class FileReader extends EventTarget {
|
|
19
|
-
constructor () {
|
|
20
|
-
super()
|
|
21
|
-
|
|
22
|
-
this[kState] = 'empty'
|
|
23
|
-
this[kResult] = null
|
|
24
|
-
this[kError] = null
|
|
25
|
-
this[kEvents] = {
|
|
26
|
-
loadend: null,
|
|
27
|
-
error: null,
|
|
28
|
-
abort: null,
|
|
29
|
-
load: null,
|
|
30
|
-
progress: null,
|
|
31
|
-
loadstart: null
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer
|
|
37
|
-
* @param {import('buffer').Blob} blob
|
|
38
|
-
*/
|
|
39
|
-
readAsArrayBuffer (blob) {
|
|
40
|
-
webidl.brandCheck(this, FileReader)
|
|
41
|
-
|
|
42
|
-
webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsArrayBuffer')
|
|
43
|
-
|
|
44
|
-
blob = webidl.converters.Blob(blob, { strict: false })
|
|
45
|
-
|
|
46
|
-
// The readAsArrayBuffer(blob) method, when invoked,
|
|
47
|
-
// must initiate a read operation for blob with ArrayBuffer.
|
|
48
|
-
readOperation(this, blob, 'ArrayBuffer')
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @see https://w3c.github.io/FileAPI/#readAsBinaryString
|
|
53
|
-
* @param {import('buffer').Blob} blob
|
|
54
|
-
*/
|
|
55
|
-
readAsBinaryString (blob) {
|
|
56
|
-
webidl.brandCheck(this, FileReader)
|
|
57
|
-
|
|
58
|
-
webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsBinaryString')
|
|
59
|
-
|
|
60
|
-
blob = webidl.converters.Blob(blob, { strict: false })
|
|
61
|
-
|
|
62
|
-
// The readAsBinaryString(blob) method, when invoked,
|
|
63
|
-
// must initiate a read operation for blob with BinaryString.
|
|
64
|
-
readOperation(this, blob, 'BinaryString')
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @see https://w3c.github.io/FileAPI/#readAsDataText
|
|
69
|
-
* @param {import('buffer').Blob} blob
|
|
70
|
-
* @param {string?} encoding
|
|
71
|
-
*/
|
|
72
|
-
readAsText (blob, encoding = undefined) {
|
|
73
|
-
webidl.brandCheck(this, FileReader)
|
|
74
|
-
|
|
75
|
-
webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsText')
|
|
76
|
-
|
|
77
|
-
blob = webidl.converters.Blob(blob, { strict: false })
|
|
78
|
-
|
|
79
|
-
if (encoding !== undefined) {
|
|
80
|
-
encoding = webidl.converters.DOMString(encoding, 'FileReader.readAsText', 'encoding')
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// The readAsText(blob, encoding) method, when invoked,
|
|
84
|
-
// must initiate a read operation for blob with Text and encoding.
|
|
85
|
-
readOperation(this, blob, 'Text', encoding)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL
|
|
90
|
-
* @param {import('buffer').Blob} blob
|
|
91
|
-
*/
|
|
92
|
-
readAsDataURL (blob) {
|
|
93
|
-
webidl.brandCheck(this, FileReader)
|
|
94
|
-
|
|
95
|
-
webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsDataURL')
|
|
96
|
-
|
|
97
|
-
blob = webidl.converters.Blob(blob, { strict: false })
|
|
98
|
-
|
|
99
|
-
// The readAsDataURL(blob) method, when invoked, must
|
|
100
|
-
// initiate a read operation for blob with DataURL.
|
|
101
|
-
readOperation(this, blob, 'DataURL')
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @see https://w3c.github.io/FileAPI/#dfn-abort
|
|
106
|
-
*/
|
|
107
|
-
abort () {
|
|
108
|
-
// 1. If this's state is "empty" or if this's state is
|
|
109
|
-
// "done" set this's result to null and terminate
|
|
110
|
-
// this algorithm.
|
|
111
|
-
if (this[kState] === 'empty' || this[kState] === 'done') {
|
|
112
|
-
this[kResult] = null
|
|
113
|
-
return
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// 2. If this's state is "loading" set this's state to
|
|
117
|
-
// "done" and set this's result to null.
|
|
118
|
-
if (this[kState] === 'loading') {
|
|
119
|
-
this[kState] = 'done'
|
|
120
|
-
this[kResult] = null
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 3. If there are any tasks from this on the file reading
|
|
124
|
-
// task source in an affiliated task queue, then remove
|
|
125
|
-
// those tasks from that task queue.
|
|
126
|
-
this[kAborted] = true
|
|
127
|
-
|
|
128
|
-
// 4. Terminate the algorithm for the read method being processed.
|
|
129
|
-
// TODO
|
|
130
|
-
|
|
131
|
-
// 5. Fire a progress event called abort at this.
|
|
132
|
-
fireAProgressEvent('abort', this)
|
|
133
|
-
|
|
134
|
-
// 6. If this's state is not "loading", fire a progress
|
|
135
|
-
// event called loadend at this.
|
|
136
|
-
if (this[kState] !== 'loading') {
|
|
137
|
-
fireAProgressEvent('loadend', this)
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* @see https://w3c.github.io/FileAPI/#dom-filereader-readystate
|
|
143
|
-
*/
|
|
144
|
-
get readyState () {
|
|
145
|
-
webidl.brandCheck(this, FileReader)
|
|
146
|
-
|
|
147
|
-
switch (this[kState]) {
|
|
148
|
-
case 'empty': return this.EMPTY
|
|
149
|
-
case 'loading': return this.LOADING
|
|
150
|
-
case 'done': return this.DONE
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @see https://w3c.github.io/FileAPI/#dom-filereader-result
|
|
156
|
-
*/
|
|
157
|
-
get result () {
|
|
158
|
-
webidl.brandCheck(this, FileReader)
|
|
159
|
-
|
|
160
|
-
// The result attribute’s getter, when invoked, must return
|
|
161
|
-
// this's result.
|
|
162
|
-
return this[kResult]
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @see https://w3c.github.io/FileAPI/#dom-filereader-error
|
|
167
|
-
*/
|
|
168
|
-
get error () {
|
|
169
|
-
webidl.brandCheck(this, FileReader)
|
|
170
|
-
|
|
171
|
-
// The error attribute’s getter, when invoked, must return
|
|
172
|
-
// this's error.
|
|
173
|
-
return this[kError]
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
get onloadend () {
|
|
177
|
-
webidl.brandCheck(this, FileReader)
|
|
178
|
-
|
|
179
|
-
return this[kEvents].loadend
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
set onloadend (fn) {
|
|
183
|
-
webidl.brandCheck(this, FileReader)
|
|
184
|
-
|
|
185
|
-
if (this[kEvents].loadend) {
|
|
186
|
-
this.removeEventListener('loadend', this[kEvents].loadend)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (typeof fn === 'function') {
|
|
190
|
-
this[kEvents].loadend = fn
|
|
191
|
-
this.addEventListener('loadend', fn)
|
|
192
|
-
} else {
|
|
193
|
-
this[kEvents].loadend = null
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
get onerror () {
|
|
198
|
-
webidl.brandCheck(this, FileReader)
|
|
199
|
-
|
|
200
|
-
return this[kEvents].error
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
set onerror (fn) {
|
|
204
|
-
webidl.brandCheck(this, FileReader)
|
|
205
|
-
|
|
206
|
-
if (this[kEvents].error) {
|
|
207
|
-
this.removeEventListener('error', this[kEvents].error)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (typeof fn === 'function') {
|
|
211
|
-
this[kEvents].error = fn
|
|
212
|
-
this.addEventListener('error', fn)
|
|
213
|
-
} else {
|
|
214
|
-
this[kEvents].error = null
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
get onloadstart () {
|
|
219
|
-
webidl.brandCheck(this, FileReader)
|
|
220
|
-
|
|
221
|
-
return this[kEvents].loadstart
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
set onloadstart (fn) {
|
|
225
|
-
webidl.brandCheck(this, FileReader)
|
|
226
|
-
|
|
227
|
-
if (this[kEvents].loadstart) {
|
|
228
|
-
this.removeEventListener('loadstart', this[kEvents].loadstart)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (typeof fn === 'function') {
|
|
232
|
-
this[kEvents].loadstart = fn
|
|
233
|
-
this.addEventListener('loadstart', fn)
|
|
234
|
-
} else {
|
|
235
|
-
this[kEvents].loadstart = null
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
get onprogress () {
|
|
240
|
-
webidl.brandCheck(this, FileReader)
|
|
241
|
-
|
|
242
|
-
return this[kEvents].progress
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
set onprogress (fn) {
|
|
246
|
-
webidl.brandCheck(this, FileReader)
|
|
247
|
-
|
|
248
|
-
if (this[kEvents].progress) {
|
|
249
|
-
this.removeEventListener('progress', this[kEvents].progress)
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (typeof fn === 'function') {
|
|
253
|
-
this[kEvents].progress = fn
|
|
254
|
-
this.addEventListener('progress', fn)
|
|
255
|
-
} else {
|
|
256
|
-
this[kEvents].progress = null
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
get onload () {
|
|
261
|
-
webidl.brandCheck(this, FileReader)
|
|
262
|
-
|
|
263
|
-
return this[kEvents].load
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
set onload (fn) {
|
|
267
|
-
webidl.brandCheck(this, FileReader)
|
|
268
|
-
|
|
269
|
-
if (this[kEvents].load) {
|
|
270
|
-
this.removeEventListener('load', this[kEvents].load)
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (typeof fn === 'function') {
|
|
274
|
-
this[kEvents].load = fn
|
|
275
|
-
this.addEventListener('load', fn)
|
|
276
|
-
} else {
|
|
277
|
-
this[kEvents].load = null
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
get onabort () {
|
|
282
|
-
webidl.brandCheck(this, FileReader)
|
|
283
|
-
|
|
284
|
-
return this[kEvents].abort
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
set onabort (fn) {
|
|
288
|
-
webidl.brandCheck(this, FileReader)
|
|
289
|
-
|
|
290
|
-
if (this[kEvents].abort) {
|
|
291
|
-
this.removeEventListener('abort', this[kEvents].abort)
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (typeof fn === 'function') {
|
|
295
|
-
this[kEvents].abort = fn
|
|
296
|
-
this.addEventListener('abort', fn)
|
|
297
|
-
} else {
|
|
298
|
-
this[kEvents].abort = null
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// https://w3c.github.io/FileAPI/#dom-filereader-empty
|
|
304
|
-
FileReader.EMPTY = FileReader.prototype.EMPTY = 0
|
|
305
|
-
// https://w3c.github.io/FileAPI/#dom-filereader-loading
|
|
306
|
-
FileReader.LOADING = FileReader.prototype.LOADING = 1
|
|
307
|
-
// https://w3c.github.io/FileAPI/#dom-filereader-done
|
|
308
|
-
FileReader.DONE = FileReader.prototype.DONE = 2
|
|
309
|
-
|
|
310
|
-
Object.defineProperties(FileReader.prototype, {
|
|
311
|
-
EMPTY: staticPropertyDescriptors,
|
|
312
|
-
LOADING: staticPropertyDescriptors,
|
|
313
|
-
DONE: staticPropertyDescriptors,
|
|
314
|
-
readAsArrayBuffer: kEnumerableProperty,
|
|
315
|
-
readAsBinaryString: kEnumerableProperty,
|
|
316
|
-
readAsText: kEnumerableProperty,
|
|
317
|
-
readAsDataURL: kEnumerableProperty,
|
|
318
|
-
abort: kEnumerableProperty,
|
|
319
|
-
readyState: kEnumerableProperty,
|
|
320
|
-
result: kEnumerableProperty,
|
|
321
|
-
error: kEnumerableProperty,
|
|
322
|
-
onloadstart: kEnumerableProperty,
|
|
323
|
-
onprogress: kEnumerableProperty,
|
|
324
|
-
onload: kEnumerableProperty,
|
|
325
|
-
onabort: kEnumerableProperty,
|
|
326
|
-
onerror: kEnumerableProperty,
|
|
327
|
-
onloadend: kEnumerableProperty,
|
|
328
|
-
[Symbol.toStringTag]: {
|
|
329
|
-
value: 'FileReader',
|
|
330
|
-
writable: false,
|
|
331
|
-
enumerable: false,
|
|
332
|
-
configurable: true
|
|
333
|
-
}
|
|
334
|
-
})
|
|
335
|
-
|
|
336
|
-
Object.defineProperties(FileReader, {
|
|
337
|
-
EMPTY: staticPropertyDescriptors,
|
|
338
|
-
LOADING: staticPropertyDescriptors,
|
|
339
|
-
DONE: staticPropertyDescriptors
|
|
340
|
-
})
|
|
341
|
-
|
|
342
|
-
module.exports = {
|
|
343
|
-
FileReader
|
|
344
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { webidl } = require('../fetch/webidl')
|
|
4
|
-
|
|
5
|
-
const kState = Symbol('ProgressEvent state')
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @see https://xhr.spec.whatwg.org/#progressevent
|
|
9
|
-
*/
|
|
10
|
-
class ProgressEvent extends Event {
|
|
11
|
-
constructor (type, eventInitDict = {}) {
|
|
12
|
-
type = webidl.converters.DOMString(type, 'ProgressEvent constructor', 'type')
|
|
13
|
-
eventInitDict = webidl.converters.ProgressEventInit(eventInitDict ?? {})
|
|
14
|
-
|
|
15
|
-
super(type, eventInitDict)
|
|
16
|
-
|
|
17
|
-
this[kState] = {
|
|
18
|
-
lengthComputable: eventInitDict.lengthComputable,
|
|
19
|
-
loaded: eventInitDict.loaded,
|
|
20
|
-
total: eventInitDict.total
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get lengthComputable () {
|
|
25
|
-
webidl.brandCheck(this, ProgressEvent)
|
|
26
|
-
|
|
27
|
-
return this[kState].lengthComputable
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get loaded () {
|
|
31
|
-
webidl.brandCheck(this, ProgressEvent)
|
|
32
|
-
|
|
33
|
-
return this[kState].loaded
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get total () {
|
|
37
|
-
webidl.brandCheck(this, ProgressEvent)
|
|
38
|
-
|
|
39
|
-
return this[kState].total
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
webidl.converters.ProgressEventInit = webidl.dictionaryConverter([
|
|
44
|
-
{
|
|
45
|
-
key: 'lengthComputable',
|
|
46
|
-
converter: webidl.converters.boolean,
|
|
47
|
-
defaultValue: () => false
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
key: 'loaded',
|
|
51
|
-
converter: webidl.converters['unsigned long long'],
|
|
52
|
-
defaultValue: () => 0
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
key: 'total',
|
|
56
|
-
converter: webidl.converters['unsigned long long'],
|
|
57
|
-
defaultValue: () => 0
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
key: 'bubbles',
|
|
61
|
-
converter: webidl.converters.boolean,
|
|
62
|
-
defaultValue: () => false
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
key: 'cancelable',
|
|
66
|
-
converter: webidl.converters.boolean,
|
|
67
|
-
defaultValue: () => false
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
key: 'composed',
|
|
71
|
-
converter: webidl.converters.boolean,
|
|
72
|
-
defaultValue: () => false
|
|
73
|
-
}
|
|
74
|
-
])
|
|
75
|
-
|
|
76
|
-
module.exports = {
|
|
77
|
-
ProgressEvent
|
|
78
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
kState: Symbol('FileReader state'),
|
|
5
|
-
kResult: Symbol('FileReader result'),
|
|
6
|
-
kError: Symbol('FileReader error'),
|
|
7
|
-
kLastProgressEventFired: Symbol('FileReader last progress event fired timestamp'),
|
|
8
|
-
kEvents: Symbol('FileReader events'),
|
|
9
|
-
kAborted: Symbol('FileReader aborted')
|
|
10
|
-
}
|