-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #56072 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
- Loading branch information
1 parent
a4a8361
commit 041a490
Showing
11 changed files
with
161 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
test/fixtures/wpt/streams/readable-byte-streams/patched-global.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// META: global=window,worker,shadowrealm | ||
// META: script=../resources/test-utils.js | ||
'use strict'; | ||
|
||
// Tests which patch the global environment are kept separate to avoid | ||
// interfering with other tests. | ||
|
||
promise_test(async (t) => { | ||
let controller; | ||
const rs = new ReadableStream({ | ||
type: 'bytes', | ||
start(c) { | ||
controller = c; | ||
} | ||
}); | ||
const reader = rs.getReader({mode: 'byob'}); | ||
|
||
const length = 0x4000; | ||
const buffer = new ArrayBuffer(length); | ||
const bigArray = new BigUint64Array(buffer, length - 8, 1); | ||
|
||
const read1 = reader.read(new Uint8Array(new ArrayBuffer(0x100))); | ||
const read2 = reader.read(bigArray); | ||
|
||
let flag = false; | ||
Object.defineProperty(Object.prototype, 'then', { | ||
get: t.step_func(() => { | ||
if (!flag) { | ||
flag = true; | ||
assert_equals(controller.byobRequest, null, 'byobRequest should be null after filling both views'); | ||
} | ||
}), | ||
configurable: true | ||
}); | ||
t.add_cleanup(() => { | ||
delete Object.prototype.then; | ||
}); | ||
|
||
controller.enqueue(new Uint8Array(0x110).fill(0x42)); | ||
assert_true(flag, 'patched then() should be called'); | ||
|
||
// The first read() is filled entirely with 0x100 bytes | ||
const result1 = await read1; | ||
assert_false(result1.done, 'result1.done'); | ||
assert_typed_array_equals(result1.value, new Uint8Array(0x100).fill(0x42), 'result1.value'); | ||
|
||
// The second read() is filled with the remaining 0x10 bytes | ||
const result2 = await read2; | ||
assert_false(result2.done, 'result2.done'); | ||
assert_equals(result2.value.constructor, BigUint64Array, 'result2.value constructor'); | ||
assert_equals(result2.value.byteOffset, length - 8, 'result2.value byteOffset'); | ||
assert_equals(result2.value.length, 1, 'result2.value length'); | ||
assert_array_equals([...result2.value], [0x42424242_42424242n], 'result2.value contents'); | ||
}, 'Patched then() sees byobRequest after filling all pending pull-into descriptors'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/fixtures/wpt/streams/readable-streams/crashtests/from-cross-realm.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<html class="test-wait"> | ||
<meta charset="utf-8"> | ||
<script type="module"> | ||
let a = window.open() | ||
try { | ||
let dir = await a.navigator.storage.getDirectory() | ||
let hdl = await dir.getFileHandle("7399d8cf-9ff9-494d-89eb-d3045f229c27", {"create": true}) | ||
let map = new Map([[]]) | ||
let b = ReadableStream.from(map) | ||
let c = await hdl.createWritable({ }) | ||
await b.pipeTo(c, { }).catch(() => { | ||
// Error expected as we are not piping the right form of chunk to FileHandle | ||
}) | ||
} finally { | ||
document.documentElement.classList.remove("test-wait") | ||
a.close() | ||
} | ||
</script> |
2 changes: 1 addition & 1 deletion
2
test/fixtures/wpt/streams/readable-streams/owning-type-video-frame.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters