File
Blob: src/wpt/streams-test.ts
| 1 | // Copyright (c) 2017-2022 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | |
| 5 | import { type TestRunnerConfig } from 'harness/harness'; |
| 6 | |
| 7 | export default { |
| 8 | 'idlharness.any.js': { |
| 9 | comment: |
| 10 | 'Some IDL operation/attribute tests still fail due to missing method .length or promise-returning signatures', |
| 11 | expectedFailures: [ |
| 12 | 'ReadableStream interface: operation cancel(optional any)', |
| 13 | 'ReadableStream interface: operation pipeTo(WritableStream, optional StreamPipeOptions)', |
| 14 | 'ReadableStreamDefaultReader interface: operation read()', |
| 15 | 'ReadableStreamDefaultReader interface: attribute closed', |
| 16 | 'ReadableStreamDefaultReader interface: operation cancel(optional any)', |
| 17 | 'ReadableStreamBYOBReader interface: operation read(ArrayBufferView, optional ReadableStreamBYOBReaderReadOptions)', |
| 18 | 'ReadableStreamBYOBReader interface: attribute closed', |
| 19 | 'ReadableStreamBYOBReader interface: operation cancel(optional any)', |
| 20 | 'ReadableStreamDefaultController interface: operation error(optional any)', |
| 21 | 'ReadableByteStreamController interface: operation error(optional any)', |
| 22 | 'WritableStream interface: operation abort(optional any)', |
| 23 | 'WritableStream interface: operation close()', |
| 24 | 'WritableStreamDefaultWriter interface: attribute closed', |
| 25 | 'WritableStreamDefaultWriter interface: attribute ready', |
| 26 | 'WritableStreamDefaultWriter interface: operation abort(optional any)', |
| 27 | 'WritableStreamDefaultWriter interface: operation close()', |
| 28 | 'WritableStreamDefaultWriter interface: operation write(optional any)', |
| 29 | 'TransformStreamDefaultController interface: operation enqueue(optional any)', |
| 30 | 'TransformStreamDefaultController interface: operation error(optional any)', |
| 31 | ], |
| 32 | }, |
| 33 | |
| 34 | 'piping/abort.any.js': { |
| 35 | comment: 'To be investigated', |
| 36 | expectedFailures: [ |
| 37 | "(reason: 'null') all pending writes should complete on abort", |
| 38 | "(reason: 'undefined') all pending writes should complete on abort", |
| 39 | "(reason: 'error1: error1') all pending writes should complete on abort", |
| 40 | 'abort signal takes priority over errored writable', |
| 41 | 'a rejection from underlyingSource.cancel() should be returned by pipeTo()', |
| 42 | 'a rejection from underlyingSink.abort() should be preferred to one from underlyingSource.cancel()', |
| 43 | 'abort should do nothing after the readable is errored, even with pending writes', |
| 44 | 'abort should do nothing after the writable is errored', |
| 45 | 'pipeTo on a teed readable byte stream should only be aborted when both branches are aborted', |
| 46 | "(reason: 'null') underlyingSource.cancel() should called when abort, even with pending pull", |
| 47 | "(reason: 'undefined') underlyingSource.cancel() should called when abort, even with pending pull", |
| 48 | "(reason: 'error1: error1') underlyingSource.cancel() should called when abort, even with pending pull", |
| 49 | ], |
| 50 | }, |
| 51 | 'piping/close-propagation-backward.any.js': { |
| 52 | comment: 'A hanging Promise was canceled.', |
| 53 | disabledTests: true, |
| 54 | }, |
| 55 | 'piping/close-propagation-forward.any.js': {}, |
| 56 | 'piping/error-propagation-backward.any.js': { |
| 57 | comment: 'A hanging Promise was canceled.', |
| 58 | disabledTests: true, |
| 59 | }, |
| 60 | 'piping/error-propagation-forward.any.js': { |
| 61 | comment: 'To be investigated', |
| 62 | expectedFailures: [ |
| 63 | 'Errors must be propagated forward: starts errored; preventAbort = true (truthy)', |
| 64 | 'Errors must be propagated forward: starts errored; preventAbort = a (truthy)', |
| 65 | 'Errors must be propagated forward: starts errored; preventAbort = 1 (truthy)', |
| 66 | 'Errors must be propagated forward: starts errored; preventAbort = Symbol() (truthy)', |
| 67 | 'Errors must be propagated forward: starts errored; preventAbort = [object Object] (truthy)', |
| 68 | 'Errors must be propagated forward: starts errored; preventAbort = true, preventCancel = true', |
| 69 | 'Errors must be propagated forward: starts errored; preventAbort = true, preventCancel = true, preventClose = true', |
| 70 | 'Errors must be propagated forward: starts errored; preventAbort = false; rejected abort promise', |
| 71 | 'Errors must be propagated forward: starts errored; preventAbort = false; fulfilled abort promise', |
| 72 | 'Errors must be propagated forward: starts errored; preventAbort = undefined (falsy); fulfilled abort promise', |
| 73 | 'Errors must be propagated forward: starts errored; preventAbort = null (falsy); fulfilled abort promise', |
| 74 | 'Errors must be propagated forward: starts errored; preventAbort = false (falsy); fulfilled abort promise', |
| 75 | 'Errors must be propagated forward: starts errored; preventAbort = 0 (falsy); fulfilled abort promise', |
| 76 | 'Errors must be propagated forward: starts errored; preventAbort = -0 (falsy); fulfilled abort promise', |
| 77 | 'Errors must be propagated forward: starts errored; preventAbort = NaN (falsy); fulfilled abort promise', |
| 78 | 'Errors must be propagated forward: starts errored; preventAbort = (falsy); fulfilled abort promise', |
| 79 | 'Errors must be propagated forward: shutdown must not occur until the final write completes; becomes errored after first write', |
| 80 | 'Errors must be propagated forward: shutdown must not occur until the final write completes; becomes errored after first write; preventAbort = true', |
| 81 | 'Errors must be propagated forward: becomes errored after one chunk; dest never desires chunks; preventAbort = false; fulfilled abort promise', |
| 82 | 'Errors must be propagated forward: becomes errored after one chunk; dest never desires chunks; preventAbort = false; rejected abort promise', |
| 83 | 'Errors must be propagated forward: becomes errored after one chunk; dest never desires chunks; preventAbort = true', |
| 84 | ], |
| 85 | }, |
| 86 | 'piping/flow-control.any.js': { |
| 87 | comment: 'To be investigated', |
| 88 | expectedFailures: [ |
| 89 | 'Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks', |
| 90 | 'Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks, but then does', |
| 91 | 'Piping from a ReadableStream to a WritableStream that desires more chunks before finishing with previous ones', |
| 92 | ], |
| 93 | }, |
| 94 | 'piping/general-addition.any.js': {}, |
| 95 | 'piping/general.any.js': { |
| 96 | comment: |
| 97 | 'Illegal invocation: function called with incorrect `this` reference.', |
| 98 | expectedFailures: [ |
| 99 | 'pipeTo must check the brand of its ReadableStream this value', |
| 100 | ], |
| 101 | }, |
| 102 | 'piping/multiple-propagation.any.js': { |
| 103 | comment: 'TypeError: Cannot close a writer that is already being closed', |
| 104 | expectedFailures: [ |
| 105 | 'Piping from a closed readable stream to a closed writable stream', |
| 106 | ], |
| 107 | }, |
| 108 | 'piping/pipe-through.any.js': { |
| 109 | comment: 'Windows has different property access order', |
| 110 | expectedFailures: |
| 111 | process.platform === 'win32' |
| 112 | ? ['pipeThrough() should throw if readable/writable getters throw'] |
| 113 | : [], |
| 114 | }, |
| 115 | 'piping/then-interception.any.js': { |
| 116 | comment: |
| 117 | 'failed: expected Wrappable::tryUnwrapOpaque(isolate, handle) != nullptr', |
| 118 | expectedFailures: [ |
| 119 | 'piping should not be observable', |
| 120 | 'tee should not be observable', |
| 121 | ], |
| 122 | }, |
| 123 | 'piping/throwing-options.any.js': {}, |
| 124 | 'piping/transform-streams.any.js': {}, |
| 125 | |
| 126 | 'queuing-strategies-size-function-per-global.window.js': { |
| 127 | comment: 'document is not defined', |
| 128 | disabledTests: true, |
| 129 | }, |
| 130 | 'queuing-strategies.any.js': { |
| 131 | comment: 'Likely missing validation', |
| 132 | expectedFailures: [ |
| 133 | 'CountQueuingStrategy: Constructor behaves as expected with strange arguments', |
| 134 | 'CountQueuingStrategy: size is the same function across all instances', |
| 135 | 'CountQueuingStrategy: size should have the right name', |
| 136 | 'CountQueuingStrategy: size should not have a prototype property', |
| 137 | 'ByteLengthQueuingStrategy: Constructor behaves as expected with strange arguments', |
| 138 | 'ByteLengthQueuingStrategy: size is the same function across all instances', |
| 139 | 'ByteLengthQueuingStrategy: size should have the right name', |
| 140 | 'ByteLengthQueuingStrategy: size should not have a prototype property', |
| 141 | 'CountQueuingStrategy: size should not be a constructor', |
| 142 | 'ByteLengthQueuingStrategy: size should not be a constructor', |
| 143 | 'ByteLengthQueuingStrategy: size should have the right length', |
| 144 | 'ByteLengthQueuingStrategy: size behaves as expected with strange arguments', |
| 145 | ], |
| 146 | }, |
| 147 | |
| 148 | 'readable-byte-streams/bad-buffers-and-views.any.js': {}, |
| 149 | 'readable-byte-streams/construct-byob-request.any.js': {}, |
| 150 | 'readable-byte-streams/crashtests/tee-locked-stream.any.js': {}, |
| 151 | 'readable-byte-streams/enqueue-with-detached-buffer.any.js': {}, |
| 152 | 'readable-byte-streams/general.any.js': { |
| 153 | comment: 'See individual comments', |
| 154 | expectedFailures: [ |
| 155 | // TODO(conform): The spec expects that errors thrown synchronously in the start |
| 156 | // algorithm should cause the ReadableStream constructor to throw. We currently |
| 157 | // don't do that but we do error the stream. |
| 158 | // assert_throws_js(Error, () => new ReadableStream({ start() { throw new Error(); }, type:'bytes' }), |
| 159 | // 'start() can throw an exception with type: bytes'); |
| 160 | 'ReadableStream with byte source: start() throws an exception', |
| 161 | // TODO(conform): The spec expects pull not to have been called yet, but as an optimization |
| 162 | // since start is not provided we treat is synchronously and pull proactively, making this |
| 163 | // next check invalid. |
| 164 | // assert_equals(pullCount, 0, 'No pull as start() just finished and is not yet reflected to the state of the stream'); |
| 165 | 'ReadableStream with byte source: Automatic pull() after start()', |
| 166 | // TODO(conform): The spec expects pull not to have been called yet, but as an optimization |
| 167 | // since start is not provided we treat is synchronously and pull proactively, making this |
| 168 | // next check invalid. |
| 169 | //assert_equals(pullCount, 0, 'No pull as start() just finished and is not yet reflected to the state of the stream'); |
| 170 | 'ReadableStream with byte source: Automatic pull() after start() and read()', |
| 171 | 'ReadableStream with byte source: autoAllocateChunkSize', |
| 172 | 'ReadableStream with byte source: Automatic pull() after start() and read(view)', |
| 173 | 'ReadableStream with byte source: Respond to pull() by enqueue() asynchronously', |
| 174 | 'ReadableStream with byte source: Respond to multiple pull() by separate enqueue()', |
| 175 | 'ReadableStream with byte source: read() twice, then enqueue() twice', |
| 176 | // TODO(conform): The spec would not expect pull to be called because of the close, |
| 177 | // but because our implementation calls pull immediately on the first read, we |
| 178 | // differ slightly here. |
| 179 | // assert_unreached("pull() should not have been called"); |
| 180 | // TODO(conform): The spec would allow the byobRequest to still be used here, but |
| 181 | // our implementation throws when accessed after close. |
| 182 | // controller.byobRequest.respond(0); |
| 183 | 'ReadableStream with byte source: Multiple read(view), close() and respond()', |
| 184 | 'ReadableStream constructor should not accept a strategy with a size defined if type is "bytes"', |
| 185 | 'ReadableStream with byte source: enqueue(), getReader(), then read()', |
| 186 | // TODO(conform): This is a case where our implementation intentionally |
| 187 | // diverges from the spec due to the tee backpressure implementation. |
| 188 | // Specifically, the input view is a Uint16Array with one element -- |
| 189 | // meaning it expects us to provide 2 bytes. The enqueue() only gives |
| 190 | // it one byte. Because of how we handle these internally, the read will |
| 191 | // not be fulfilled until another byte is provided, but the byobRequest |
| 192 | // still is invalidated. In the standard, the byobRequest would still |
| 193 | // be valid here. |
| 194 | // |
| 195 | // Generally speaking, in our implementation, using enqueue() and byobRequest |
| 196 | // together is not something that should be done. |
| 197 | 'ReadableStream with byte source: cancel() with partially filled pending pull() request', |
| 198 | "ReadableStream with byte source: Push source that doesn't understand pull signal", |
| 199 | 'ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read()', |
| 200 | // TODO(conform): Our implementation ends up immediately calling pull |
| 201 | // when the read() is called, before the cancel() is able to run. The |
| 202 | // spec expects the cancel to happen first. |
| 203 | //assert_unreached("pull should not have been called"); |
| 204 | // TODO(conform): The spec expects the result.value here to be undefined since the read |
| 205 | // is canceled. Our impl returns an empty ArrayBuffer... |
| 206 | //assert_equals(result.value, undefined, 'result.value'); |
| 207 | 'ReadableStream with byte source: getReader(), read(view), then cancel()', |
| 208 | 'ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple enqueue() calls', |
| 209 | 'ReadableStream with byte source: enqueue(), read(view) partially, then read()', |
| 210 | 'ReadableStream with byte source: read(view), then respond() and close() in pull()', |
| 211 | // TODO(conform): The spec expects the read to fail here. Instead, we end up cancelling |
| 212 | // it with a zero-length result, with the subsequent read marked as done. |
| 213 | 'ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail', |
| 214 | // TODO(conform): Per the spec, desiredSize should be zero here |
| 215 | // but since we are handling the backpressure a bit differently |
| 216 | // it won't be zero until the actual read is resolved. |
| 217 | //desiredSize = controller.desiredSize; |
| 218 | 'ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array', |
| 219 | 'ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it', |
| 220 | 'ReadableStream with byte source: Throwing in pull function must error the stream', |
| 221 | // TODO(conform): We handle things a bit differently here from the spec. The spec |
| 222 | // would have the enqueue() complete replace the byobRequest.view while we use it |
| 223 | // and fill it with the data from the enqueue. This means the following check is |
| 224 | // not valid in our implementation. |
| 225 | // assert_array_equals([...new Uint8Array(view1.buffer)], [1, 2, 3], 'first result.value.buffer'); |
| 226 | 'ReadableStream with byte source: enqueue() discards auto-allocated BYOB request', |
| 227 | // TODO(conform): Calling releaseLock() should cancel the pending reads. It currently does not. |
| 228 | 'ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader, respond()', |
| 229 | |
| 230 | // TODO(conform): Calling releaseLock() should cancel the pending reads. It currently does not. |
| 231 | 'ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader with 1 element Uint16Array, respond(1)', |
| 232 | |
| 233 | // TODO(conform): Calling releaseLock() should cancel the pending reads. It currently does not. |
| 234 | 'ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader with 2 element Uint8Array, respond(3)', |
| 235 | |
| 236 | // TODO(conform): Calling releaseLock() should cancel the pending reads. It currently does not. |
| 237 | 'ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader, respondWithNewView()', |
| 238 | |
| 239 | // TODO(conform): Calling releaseLock() should cancel the pending reads. It currently does not. |
| 240 | 'ReadableStream with byte source: autoAllocateChunkSize, releaseLock() with pending read(), read() on second reader, respond()', |
| 241 | |
| 242 | // TODO(conform): Calling releaseLock() should cancel the pending reads. It currently does not. |
| 243 | 'ReadableStream with byte source: autoAllocateChunkSize, releaseLock() with pending read(), read() on second reader, enqueue()', |
| 244 | |
| 245 | // TODO(conform): Calling releaseLock() should cancel the pending reads. It currently does not. |
| 246 | 'ReadableStream with byte source: autoAllocateChunkSize, releaseLock() with pending read(), read(view) on second reader, respond()', |
| 247 | // TODO(conform): The spec allows a byob read to be fulfilled incrementally over multiple |
| 248 | // respond calls, we currently do not. |
| 249 | 'ReadableStream with byte source: read(view) with 1 element Uint16Array, respond(1), releaseLock(), read(view) on second reader with 1 element Uint16Array, respond(1)', |
| 250 | // TODO(conform): The spec allows a byob read to be fulfilled incrementally over multiple |
| 251 | // respond calls, we currently do not. |
| 252 | 'ReadableStream with byte source: read(view) with 1 element Uint16Array, respond(1), releaseLock(), read() on second reader, enqueue()', |
| 253 | // TODO: investigate this |
| 254 | 'ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array', |
| 255 | // TODO: investigate this |
| 256 | 'ReadableStream with byte source: Multiple read(view), big enqueue()', |
| 257 | // TODO: investigate this |
| 258 | 'ReadableStream with byte source: Multiple read(view) and multiple enqueue()', |
| 259 | ], |
| 260 | }, |
| 261 | 'readable-byte-streams/non-transferable-buffers.any.js': {}, |
| 262 | 'readable-byte-streams/patched-global.any.js': { |
| 263 | comment: 'TODO investigate this', |
| 264 | expectedFailures: [ |
| 265 | 'Patched then() sees byobRequest after filling all pending pull-into descriptors', |
| 266 | ], |
| 267 | runInGlobalScope: true, |
| 268 | }, |
| 269 | 'readable-byte-streams/read-min.any.js': { |
| 270 | comment: 'A hanging Promise was canceled.', |
| 271 | disabledTests: true, |
| 272 | }, |
| 273 | 'readable-byte-streams/respond-after-enqueue.any.js': { |
| 274 | comment: 'To be investigated', |
| 275 | expectedFailures: [ |
| 276 | 'byobRequest.respond() after enqueue() with double read should not crash', |
| 277 | ], |
| 278 | }, |
| 279 | 'readable-byte-streams/tee.any.js': { |
| 280 | comment: 'To be investigated', |
| 281 | expectedFailures: [ |
| 282 | 'ReadableStream teeing with byte source: pull with default reader, then pull with BYOB reader', |
| 283 | 'ReadableStream teeing with byte source: chunks should be cloned for each branch', |
| 284 | 'ReadableStream teeing with byte source: reading an array with a byte offset should clone correctly', |
| 285 | 'ReadableStream teeing with byte source: chunks for BYOB requests from branch 1 should be cloned to branch 2', |
| 286 | 'ReadableStream teeing with byte source: canceling both branches should aggregate the cancel reasons into an array', |
| 287 | 'ReadableStream teeing with byte source: canceling both branches in reverse order should aggregate the cancel reasons into an array', |
| 288 | 'ReadableStream teeing with byte source: pull with BYOB reader, then pull with default reader', |
| 289 | 'ReadableStream teeing with byte source: failing to cancel the original stream should cause cancel() to reject on branches', |
| 290 | 'ReadableStream teeing with byte source: should be able to read one branch to the end without affecting the other', |
| 291 | 'ReadableStream teeing with byte source: canceling branch1 should not impact branch2', |
| 292 | 'ReadableStream teeing with byte source: canceling branch2 should not impact branch1', |
| 293 | 'ReadableStream teeing with byte source: canceling both branches in sequence with delay', |
| 294 | 'ReadableStream teeing with byte source: failing to cancel when canceling both branches in sequence with delay', |
| 295 | 'ReadableStream teeing with byte source: enqueue() and close() while both branches are pulling', |
| 296 | 'ReadableStream teeing with byte source: stops pulling when original stream errors while both branches are reading', |
| 297 | 'ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch1, cancel branch2', |
| 298 | 'ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch2, cancel branch1', |
| 299 | 'ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch2, enqueue to branch1', |
| 300 | 'ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch1, respond to branch2', |
| 301 | 'ReadableStream teeing with byte source: read from branch1 with default reader, then close while branch2 has pending BYOB read', |
| 302 | 'ReadableStream teeing with byte source: read from branch2 with default reader, then close while branch1 has pending BYOB read', |
| 303 | ], |
| 304 | }, |
| 305 | 'readable-byte-streams/templated.any.js': { |
| 306 | comment: 'To be investigated', |
| 307 | expectedFailures: [ |
| 308 | 'ReadableStream with byte source (empty) BYOB reader: canceling via the reader should cause the reader to act closed', |
| 309 | ], |
| 310 | }, |
| 311 | |
| 312 | 'readable-streams/async-iterator.any.js': { |
| 313 | comment: 'To be investigated', |
| 314 | expectedFailures: [ |
| 315 | 'Async iterator instances should have the correct list of properties', |
| 316 | 'return(); next() [no awaiting]', |
| 317 | 'return(); return() [no awaiting]', |
| 318 | 'return(); next() with delayed cancel() [no awaiting]', |
| 319 | 'next() that succeeds; return()', |
| 320 | 'next() that succeeds; next() that reports an error(); next() [no awaiting]', |
| 321 | 'next() that succeeds; next() that reports an error(); return() [no awaiting]', |
| 322 | 'next() that succeeds; return() [no awaiting]', |
| 323 | 'next() that succeeds; next() that reports an error; next()', |
| 324 | 'next() that succeeds; next() that reports an error(); return()', |
| 325 | ], |
| 326 | }, |
| 327 | 'readable-streams/bad-strategies.any.js': { |
| 328 | comment: 'See individual comments', |
| 329 | expectedFailures: [ |
| 330 | // TODO(conform): While we do error the stream, the spec expects us to throw the error |
| 331 | // thrown in the size() function here. We currently do not. |
| 332 | 'Readable stream: strategy.size errors the stream and then throws', |
| 333 | // TODO(conform): While we do error the stream, the spec expects us to throw the error |
| 334 | // thrown in the size() function here. We currently do not. |
| 335 | 'Readable stream: strategy.size errors the stream and then returns Infinity', |
| 336 | // TODO(conform): The spec expects this to be a TypeError, we currently throw |
| 337 | // a RangeError instead |
| 338 | 'Readable stream: invalid strategy.highWaterMark', |
| 339 | // TODO(conform): We currently do not error when the size function returns the wrong |
| 340 | // value. The spec expects us to. We do properly error the strea |
| 341 | 'Readable stream: invalid strategy.size return value', |
| 342 | 'Readable stream: invalid strategy.size return value when pulling', |
| 343 | ], |
| 344 | }, |
| 345 | 'readable-streams/bad-underlying-sources.any.js': { |
| 346 | comment: 'See individual comments', |
| 347 | disabledTests: [ |
| 348 | // TODO(conform): The spec expects pull to be called twice when the stream is created and |
| 349 | // a single read happens. We currently only call it once in this case, so we have to read |
| 350 | // again to trigger the error case. |
| 351 | 'Underlying source pull: throwing method (second pull)', |
| 352 | // TODO(conform): The spec expects pull() to be called twice when the stream is |
| 353 | // constructed and the first read occurs, we currently only call it once, so to |
| 354 | // trigger the error, we perform a read again. |
| 355 | 'read should not error if it dequeues and pull() throws', |
| 356 | ], |
| 357 | expectedFailures: [ |
| 358 | // TODO(conform): If the start function throws synchronously, the constructor |
| 359 | // should throw, per the spec. Currently we only error the stream and do not |
| 360 | // throw synchronously here. |
| 361 | 'Underlying source start: throwing method', |
| 362 | // TODO(conform): The spec says that a second call to error should be a non-op. |
| 363 | // We currently treat it an an error. |
| 364 | 'Underlying source: calling error twice should not throw', |
| 365 | // TODO(conform): The spec says that calling error() after close() should be a non-op. |
| 366 | // We currently treat it as an error. |
| 367 | 'Underlying source: calling error after close should not throw', |
| 368 | ], |
| 369 | }, |
| 370 | 'readable-streams/cancel.any.js': { |
| 371 | comment: 'See detailed explanation in comments', |
| 372 | disabledTests: [ |
| 373 | // underlyingSource is converted in prose in the method body, whereas queuingStrategy is done at the IDL layer. |
| 374 | // So the queuingStrategy exception should be encountered first. |
| 375 | // TODO(conform): We currently handle these differently and end up throwing error1 instead. |
| 376 | 'ReadableStream cancellation: underlyingSource.cancel() should called, even with pending pull', |
| 377 | ], |
| 378 | }, |
| 379 | 'readable-streams/constructor.any.js': { |
| 380 | comment: 'They want us to validate the args and throw in a different order', |
| 381 | expectedFailures: |
| 382 | process.platform === 'win32' |
| 383 | ? [] |
| 384 | : [ |
| 385 | 'underlyingSource argument should be converted after queuingStrategy argument', |
| 386 | ], |
| 387 | }, |
| 388 | 'readable-streams/count-queuing-strategy-integration.any.js': {}, |
| 389 | 'readable-streams/crashtests/empty.js': {}, |
| 390 | 'readable-streams/crashtests/garbage-collection.any.js': {}, |
| 391 | 'readable-streams/crashtests/strategy-worker.js': { |
| 392 | comment: 'ReferenceError: importScripts is not defined', |
| 393 | disabledTests: true, |
| 394 | }, |
| 395 | 'readable-streams/cross-realm-crash.window.js': { |
| 396 | comment: 'document is not defined', |
| 397 | expectedFailures: [ |
| 398 | 'should not crash on reading from stream cancelled in destroyed realm', |
| 399 | ], |
| 400 | }, |
| 401 | 'readable-streams/default-reader.any.js': { |
| 402 | comment: 'See individual comments', |
| 403 | expectedFailures: [ |
| 404 | // TODO(conform): When releaseLock() is called, the spec expects the readers original |
| 405 | // closed promise to be replaced. The original one should be resolved, but the new |
| 406 | // one should be rejected. We currently do not replace the closed promise in this case. |
| 407 | 'closed is replaced when stream closes and reader releases its lock', |
| 408 | // TODO(conform): When releaseLock() is called, the spec expects the readers original |
| 409 | // closed promise to be replaced. In this case, the original one should reject with |
| 410 | // theError, while the second should reject indicating that it was acquired after |
| 411 | // releasing the lock. We currently do not replace the closed promise in this case. |
| 412 | // assert_not_equals(promise1, promise2, '.closed should be replaced'); |
| 413 | 'closed is replaced when stream errors and reader releases its lock', |
| 414 | // TODO(conform): The spec allows error to be called with no argument at all, treating |
| 415 | // it as undefined, currently we require that undefined is passed explicitly. |
| 416 | 'ReadableStreamDefaultReader closed promise should be rejected with undefined if that is the error', |
| 417 | ], |
| 418 | }, |
| 419 | 'readable-streams/floating-point-total-queue-size.any.js': { |
| 420 | comment: 'Queue size needs to use double math', |
| 421 | expectedFailures: [ |
| 422 | 'Floating point arithmetic must manifest near NUMBER.MAX_SAFE_INTEGER (total ends up positive)', |
| 423 | 'Floating point arithmetic must manifest near 0 (total ends up positive, but clamped)', |
| 424 | 'Floating point arithmetic must manifest near 0 (total ends up positive, and not clamped)', |
| 425 | 'Floating point arithmetic must manifest near 0 (total ends up zero)', |
| 426 | ], |
| 427 | }, |
| 428 | 'readable-streams/from.any.js': {}, |
| 429 | 'readable-streams/garbage-collection.any.js': { |
| 430 | comment: 'See comments on individual tests', |
| 431 | disabledTests: [ |
| 432 | // A hanging promise was cancelled |
| 433 | 'ReadableStream closed promise should reject even if stream and reader JS references are lost', |
| 434 | 'Garbage-collecting a ReadableStreamDefaultReader should not unlock its stream', |
| 435 | 'A ReadableStream and its reader should not be garbage collected while there is a read promise pending', |
| 436 | ], |
| 437 | expectedFailures: [ |
| 438 | // Failed to execute 'error' on 'ReadableStreamDefaultController': parameter 1 is not of type 'Value' |
| 439 | 'ReadableStreamController methods should continue working properly when scripts lose their reference to the readable stream', |
| 440 | ], |
| 441 | }, |
| 442 | 'readable-streams/general.any.js': { |
| 443 | comment: 'See individual comments', |
| 444 | expectedFailures: [ |
| 445 | // TODO(conform): We currently allow `new ReadableStream(null)`... |
| 446 | "ReadableStream can't be constructed with garbage", |
| 447 | // TODO(conform): We currently allow the empty type value |
| 448 | "ReadableStream can't be constructed with an invalid type", |
| 449 | // TODO(conform): The spec expects us to call pull an extra time here despite. [Despite what? -NP] |
| 450 | 'ReadableStream: should pull after start, and after every read', |
| 451 | // TODO(conform): The standard generally anticipates that the closed |
| 452 | // promise rejection will happen before the read promise rejection. |
| 453 | // We don't follow that ordering currently. |
| 454 | 'ReadableStream: if pull rejects, it should error the stream', |
| 455 | // TODO(conform): The read above is fulfilled by the c.enqueue() in the start algorithm. |
| 456 | // The spec expects us to call pull() again to prime the queue again for the next read |
| 457 | // but we currently do not. We only pull when we get another read |
| 458 | 'ReadableStream: should only call pull once on a non-empty stream read from after start fulfills', |
| 459 | // TODO(conform): The spec expects us to call pull twice even tho we've only had a |
| 460 | // single read. We currently wait to pull again only when another read occurs. |
| 461 | 'ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining', |
| 462 | // TODO(conform): The spec expects us to call pull twice even tho we've only had a single |
| 463 | // read. We currently only call it when we have an actual read to fulfill. |
| 464 | "ReadableStream: should not call pull until the previous pull call's promise fulfills", |
| 465 | ], |
| 466 | }, |
| 467 | 'readable-streams/owning-type-message-port.any.js': { |
| 468 | comment: 'Enable once MessageChannel/MessagePort is implemented', |
| 469 | expectedFailures: [ |
| 470 | 'Transferred MessageChannel works as expected', |
| 471 | 'Second branch of owning ReadableStream tee should end up into errors with transfer only values', |
| 472 | ], |
| 473 | }, |
| 474 | 'readable-streams/owning-type-video-frame.any.js': { |
| 475 | comment: 'VideoFrame is not implemented', |
| 476 | expectedFailures: [ |
| 477 | 'ReadableStream of type owning should close serialized chunks', |
| 478 | 'ReadableStream of type owning should transfer JS chunks with transferred values', |
| 479 | 'ReadableStream of type owning should error when trying to enqueue not serializable values', |
| 480 | 'ReadableStream of type owning should clone serializable objects when teeing', |
| 481 | 'ReadableStream of type owning should clone JS Objects with serializables when teeing', |
| 482 | ], |
| 483 | }, |
| 484 | 'readable-streams/owning-type.any.js': { |
| 485 | comment: "Type 'owning' is not implemented", |
| 486 | expectedFailures: [ |
| 487 | 'ReadableStream can be constructed with owning type', |
| 488 | 'ReadableStream of type owning should call start with a ReadableStreamDefaultController', |
| 489 | 'ReadableStream should be able to call enqueue with an empty transfer list', |
| 490 | 'ReadableStream of type owning should transfer enqueued chunks', |
| 491 | ], |
| 492 | }, |
| 493 | 'readable-streams/patched-global.any.js': { |
| 494 | runInGlobalScope: true, |
| 495 | }, |
| 496 | 'readable-streams/read-task-handling.window.js': { |
| 497 | comment: 'document is not defined', |
| 498 | disabledTests: true, |
| 499 | }, |
| 500 | 'readable-streams/reentrant-strategies.any.js': { |
| 501 | comment: 'See individual comments', |
| 502 | expectedFailures: [ |
| 503 | // TODO(conform): Like the case above, the spec expects us to still successfully enqueue |
| 504 | // the chunk here. Unlike the previous case, we should still be able to read this chunk |
| 505 | // so this is a case we should definitely support. |
| 506 | 'close request inside size() should work', |
| 507 | // TODO(conform): The spec expects the enqueue() to still go through without an error |
| 508 | // here but we currently throw an error here. |
| 509 | 'cancel() inside size() should work', |
| 510 | // TODO(conform): We currently fail this test. Need to investigate why |
| 511 | 'read() inside of size() should behave as expected', |
| 512 | ], |
| 513 | }, |
| 514 | 'readable-streams/tee.any.js': { |
| 515 | comment: 'To be investigated', |
| 516 | expectedFailures: [ |
| 517 | 'ReadableStream teeing: errors in the source should propagate to both branches', |
| 518 | 'ReadableStreamTee should only pull enough to fill the emptiest queue', |
| 519 | 'ReadableStreamTee stops pulling when original stream errors while branch 1 is reading', |
| 520 | 'ReadableStreamTee stops pulling when original stream errors while branch 2 is reading', |
| 521 | 'ReadableStreamTee stops pulling when original stream errors while both branches are reading', |
| 522 | 'ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array', |
| 523 | 'ReadableStream teeing: canceling both branches in reverse order should aggregate the cancel reasons into an array', |
| 524 | 'ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches', |
| 525 | 'ReadableStream teeing: failing to cancel when canceling both branches in sequence with delay', |
| 526 | 'ReadableStreamTee should not pull more chunks than can fit in the branch queue', |
| 527 | ], |
| 528 | }, |
| 529 | 'readable-streams/templated.any.js': { |
| 530 | comment: 'To be investigated', |
| 531 | disabledTests: [ |
| 532 | // TODO(soon): This test appears to mess up the state of the workerd test case itself. Investigate why. |
| 533 | 'ReadableStream reader (closed via cancel after getting reader): closed should fulfill with undefined', |
| 534 | ], |
| 535 | expectedFailures: [ |
| 536 | 'ReadableStream reader (closed before getting reader): releasing the lock should cause closed to reject and change identity', |
| 537 | 'ReadableStream reader (closed after getting reader): releasing the lock should cause closed to reject and change identity', |
| 538 | 'ReadableStream reader (closed via cancel after getting reader): releasing the lock should cause closed to reject and change identity', |
| 539 | 'ReadableStream (errored via returning a rejected promise in start) reader: releasing the lock should cause closed to reject and change identity', |
| 540 | 'ReadableStream reader (errored before getting reader): releasing the lock should cause closed to reject and change identity', |
| 541 | 'ReadableStream reader (errored after getting reader): releasing the lock should cause closed to reject and change identity', |
| 542 | ], |
| 543 | }, |
| 544 | |
| 545 | 'transferable/deserialize-error.window.js': { |
| 546 | comment: 'ReferenceError: document is not defined', |
| 547 | disabledTests: true, |
| 548 | }, |
| 549 | 'transferable/transfer-with-messageport.window.js': { |
| 550 | comment: 'Enable once MessagePort is supported.', |
| 551 | expectedFailures: [ |
| 552 | 'ReadableStream must not be serializable', |
| 553 | 'WritableStream must not be serializable', |
| 554 | 'TransformStream must not be serializable', |
| 555 | 'Transferring a MessagePort with a ReadableStream should set `.ports`', |
| 556 | 'Transferring a MessagePort with a WritableStream should set `.ports`', |
| 557 | 'Transferring a MessagePort with a TransformStream should set `.ports`', |
| 558 | 'Transferring a MessagePort with a ReadableStream should set `.ports`, advanced', |
| 559 | 'Transferring a MessagePort with a WritableStream should set `.ports`, advanced', |
| 560 | 'Transferring a MessagePort with a TransformStream should set `.ports`, advanced', |
| 561 | 'Transferring a MessagePort with multiple streams should set `.ports`', |
| 562 | ], |
| 563 | }, |
| 564 | 'transferable/transform-stream-members.any.js': { |
| 565 | comment: 'Appears to be about the wrong type of error', |
| 566 | expectedFailures: [ |
| 567 | 'Transferring [object TransformStream],[object ReadableStream] should fail', |
| 568 | 'Transferring [object ReadableStream],[object TransformStream] should fail', |
| 569 | 'Transferring [object TransformStream],[object WritableStream] should fail', |
| 570 | 'Transferring [object WritableStream],[object TransformStream] should fail', |
| 571 | ], |
| 572 | }, |
| 573 | |
| 574 | 'transform-streams/backpressure.any.js': { |
| 575 | comment: 'A hanging Promise was canceled.', |
| 576 | disabledTests: true, |
| 577 | }, |
| 578 | 'transform-streams/cancel.any.js': { |
| 579 | comment: 'To be investigated', |
| 580 | expectedFailures: [ |
| 581 | 'readable.cancel() and a parallel writable.close() should reject if a transformer.cancel() calls controller.error()', |
| 582 | 'writable.abort() and readable.cancel() should reject if a transformer.cancel() calls controller.error()', |
| 583 | 'writable.abort() should not call cancel() again when already called from readable.cancel()', |
| 584 | ], |
| 585 | }, |
| 586 | 'transform-streams/errors.any.js': { |
| 587 | comment: 'To be investigated', |
| 588 | disabledTests: [ |
| 589 | // TODO(soon): This test appears to mess up the state of the workerd test case itself. Investigate why. |
| 590 | 'an exception from transform() should error the stream if terminate has been requested but not completed', |
| 591 | ], |
| 592 | expectedFailures: [ |
| 593 | 'TransformStream constructor should throw when start does', |
| 594 | 'when strategy.size throws inside start(), the constructor should throw the same error', |
| 595 | 'when strategy.size calls controller.error() then throws, the constructor should throw the first error', |
| 596 | 'controller.error() should do nothing after a transformer method has thrown an exception', |
| 597 | 'controller.error() should close writable immediately after readable.cancel()', |
| 598 | 'erroring during write with backpressure should result in the write failing', |
| 599 | ], |
| 600 | }, |
| 601 | 'transform-streams/flush.any.js': { |
| 602 | comment: 'To be investigated', |
| 603 | expectedFailures: [ |
| 604 | 'error() during flush should cause writer.close() to reject', |
| 605 | ], |
| 606 | }, |
| 607 | 'transform-streams/general.any.js': { |
| 608 | comment: 'To be investigated', |
| 609 | expectedFailures: [ |
| 610 | 'it should be possible to call transform() synchronously', |
| 611 | 'specifying a defined readableType should throw', |
| 612 | 'specifying a defined writableType should throw', |
| 613 | 'terminate() should abort writable immediately after readable.cancel()', |
| 614 | ], |
| 615 | }, |
| 616 | 'transform-streams/lipfuzz.any.js': {}, |
| 617 | 'transform-streams/patched-global.any.js': { |
| 618 | runInGlobalScope: true, |
| 619 | }, |
| 620 | 'transform-streams/properties.any.js': { |
| 621 | comment: 'The value cannot be converted because it is not an integer.', |
| 622 | expectedFailures: [ |
| 623 | 'transformer method start should be called with the right number of arguments', |
| 624 | "transformer method start should be called even when it's located on the prototype chain", |
| 625 | 'transformer method transform should be called with the right number of arguments', |
| 626 | "transformer method transform should be called even when it's located on the prototype chain", |
| 627 | 'transformer method flush should be called with the right number of arguments', |
| 628 | "transformer method flush should be called even when it's located on the prototype chain", |
| 629 | ], |
| 630 | }, |
| 631 | 'transform-streams/reentrant-strategies.any.js': { |
| 632 | comment: 'To be investigated', |
| 633 | expectedFailures: [ |
| 634 | 'enqueue() inside size() should work', |
| 635 | 'terminate() inside size() should work', |
| 636 | 'error() inside size() should work', |
| 637 | 'readable cancel() inside size() should work', |
| 638 | 'read() inside of size() should work', |
| 639 | 'writer.write() inside size() should work', |
| 640 | 'synchronous writer.write() inside size() should work', |
| 641 | 'writer.close() inside size() should work', |
| 642 | 'writer.abort() inside size() should work', |
| 643 | ], |
| 644 | }, |
| 645 | 'transform-streams/strategies.any.js': { |
| 646 | comment: 'To be investigated', |
| 647 | disabledTests: [ |
| 648 | // TODO(soon): This test appears to mess up the state of the workerd test case itself. Investigate why. |
| 649 | 'default readable strategy should be equivalent to { highWaterMark: 0 }', |
| 650 | ], |
| 651 | expectedFailures: [ |
| 652 | 'writable should have the correct size() function', |
| 653 | 'a RangeError should be thrown for an invalid highWaterMark', |
| 654 | 'a bad readableStrategy size function should error the stream on enqueue even when transformer.transform() catches the exception', |
| 655 | 'a bad readableStrategy size function should cause writer.write() to reject on an identity transform', |
| 656 | ], |
| 657 | }, |
| 658 | 'transform-streams/terminate.any.js': { |
| 659 | comment: 'To be investigated', |
| 660 | expectedFailures: [ |
| 661 | 'controller.error() after controller.terminate() with queued chunk should error the readable', |
| 662 | ], |
| 663 | }, |
| 664 | |
| 665 | 'writable-streams/aborting.any.js': { |
| 666 | comment: 'This is mostly nitpickiness about the type of error', |
| 667 | expectedFailures: [ |
| 668 | "Aborting a WritableStream before it starts should cause the writer's unsettled ready promise to reject", |
| 669 | "WritableStream if sink's abort throws, the promise returned by multiple writer.abort()s is the same and rejects", |
| 670 | 'when calling abort() twice on the same stream, both should give the same promise that fulfills with undefined', |
| 671 | 'Aborting a WritableStream causes any outstanding write() promises to be rejected with the reason supplied', |
| 672 | 'Aborting a WritableStream puts it in an errored state with the error passed to abort()', |
| 673 | 'sink abort() should not be called if stream was erroring due to bad strategy before abort() was called', |
| 674 | 'writer.abort() while there is an in-flight write, and then finish the write with rejection', |
| 675 | 'writer.abort(), controller.error() while there is an in-flight write, and then finish the write', |
| 676 | 'writer.abort(), controller.error() while there is an in-flight close, and then finish the close', |
| 677 | 'controller.error(), writer.abort() while there is an in-flight write, and then finish the write', |
| 678 | 'controller.error(), writer.abort() while there is an in-flight close, and then finish the close', |
| 679 | ], |
| 680 | }, |
| 681 | 'writable-streams/bad-strategies.any.js': { |
| 682 | comment: 'We have TypeError, they want RangeError', |
| 683 | expectedFailures: [ |
| 684 | 'Writable stream: invalid strategy.highWaterMark', |
| 685 | 'Writable stream: invalid strategy.size return value', |
| 686 | ], |
| 687 | }, |
| 688 | 'writable-streams/bad-underlying-sinks.any.js': { |
| 689 | comment: 'To be investigated', |
| 690 | expectedFailures: [ |
| 691 | 'start: errors in start cause WritableStream constructor to throw', |
| 692 | 'write: returning a rejected promise (second write) should cause writer write() and ready to reject', |
| 693 | ], |
| 694 | }, |
| 695 | 'writable-streams/byte-length-queuing-strategy.any.js': {}, |
| 696 | 'writable-streams/close.any.js': {}, |
| 697 | 'writable-streams/constructor.any.js': { |
| 698 | comment: 'These are mostly about validation of params', |
| 699 | expectedFailures: |
| 700 | process.platform === 'win32' |
| 701 | ? [ |
| 702 | 'WritableStream should be writable and ready should fulfill immediately if the strategy does not apply backpressure', |
| 703 | ] |
| 704 | : [ |
| 705 | 'WritableStream should be writable and ready should fulfill immediately if the strategy does not apply backpressure', |
| 706 | 'underlyingSink argument should be converted after queuingStrategy argument', |
| 707 | ], |
| 708 | }, |
| 709 | 'writable-streams/count-queuing-strategy.any.js': {}, |
| 710 | 'writable-streams/crashtests/garbage-collection.any.js': {}, |
| 711 | 'writable-streams/error.any.js': {}, |
| 712 | 'writable-streams/floating-point-total-queue-size.any.js': { |
| 713 | comment: 'Seems we should be using a double for queue size', |
| 714 | expectedFailures: [ |
| 715 | 'Floating point arithmetic must manifest near NUMBER.MAX_SAFE_INTEGER (total ends up positive)', |
| 716 | 'Floating point arithmetic must manifest near 0 (total ends up positive, and not clamped)', |
| 717 | 'Floating point arithmetic must manifest near 0 (total ends up zero)', |
| 718 | ], |
| 719 | }, |
| 720 | 'writable-streams/garbage-collection.any.js': {}, |
| 721 | 'writable-streams/general.any.js': {}, |
| 722 | 'writable-streams/properties.any.js': {}, |
| 723 | 'writable-streams/reentrant-strategy.any.js': {}, |
| 724 | 'writable-streams/start.any.js': { |
| 725 | comment: 'To be investigated', |
| 726 | expectedFailures: [ |
| 727 | "underlying sink's write or close should not be called if start throws", |
| 728 | ], |
| 729 | }, |
| 730 | 'writable-streams/write.any.js': {}, |
| 731 | } satisfies TestRunnerConfig; |