Skip to content

Commit a0ef761

Browse files
Guy BedfordJakeChampion
authored andcommitted
respondWithNewView, handle all wpt expectations
1 parent 5356116 commit a0ef761

File tree

7 files changed

+130
-26
lines changed

7 files changed

+130
-26
lines changed

c-dependencies/spidermonkey

integration-tests/js-compute/fixtures/byob/bin/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/* eslint-env serviceworker */
22
/* global fastly */
3-
function strictEqual (a, b) {
3+
function strictEqual (a, b, description) {
44
if (a !== b) {
5+
if (description)
6+
console.log('-- ' + description + ' --');
57
console.log('ACTUAL: ', a);
68
console.log('EXPECTED: ', b);
79
throw new Error(`Assertion failure`);
@@ -17,6 +19,8 @@ addEventListener("fetch", async (event) => {
1719
const view = controller.byobRequest.view;
1820
cnt++;
1921
if (cnt === 1) {
22+
}
23+
else if (cnt === 2) {
2024
let cnt = 0;
2125
const stream = new ReadableStream({
2226
type: 'bytes',
@@ -72,7 +76,7 @@ addEventListener("fetch", async (event) => {
7276
view[3] = 49;
7377
controller.byobRequest.respond(4);
7478
}
75-
else if (cnt === 2) {
79+
else if (cnt === 3) {
7680
let cnt = 0;
7781
const stream = new ReadableStream({
7882
type: 'bytes',
@@ -111,7 +115,7 @@ addEventListener("fetch", async (event) => {
111115
controller.byobRequest.respond(4);
112116
}
113117
}
114-
else if (cnt === 3) {
118+
else if (cnt === 4) {
115119
view[0] = 104;
116120
view[1] = 101;
117121
view[2] = 121;

tests/wpt-harness/expectations/streams/readable-byte-streams/bad-buffers-and-views.any.js.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,46 +24,46 @@
2424
"status": "PASS"
2525
},
2626
"ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state)": {
27-
"status": "FAIL"
27+
"status": "PASS"
2828
},
2929
"ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state)": {
30-
"status": "FAIL"
30+
"status": "PASS"
3131
},
3232
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state)": {
33-
"status": "FAIL"
33+
"status": "PASS"
3434
},
3535
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer is zero-length (in the readable state)": {
36-
"status": "FAIL"
36+
"status": "PASS"
3737
},
3838
"ReadableStream with byte source: respondWithNewView() throws if the supplied view is zero-length on a non-zero-length buffer (in the readable state)": {
39-
"status": "FAIL"
39+
"status": "PASS"
4040
},
4141
"ReadableStream with byte source: respondWithNewView() throws if the supplied view has a different offset (in the readable state)": {
42-
"status": "FAIL"
42+
"status": "PASS"
4343
},
4444
"ReadableStream with byte source: respondWithNewView() throws if the supplied view has a different offset (in the closed state)": {
45-
"status": "FAIL"
45+
"status": "PASS"
4646
},
4747
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has a different length (in the readable state)": {
48-
"status": "FAIL"
48+
"status": "PASS"
4949
},
5050
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has a different length (autoAllocateChunkSize)": {
51-
"status": "FAIL"
51+
"status": "PASS"
5252
},
5353
"ReadableStream with byte source: respondWithNewView() throws if the supplied view has a larger length (in the readable state)": {
54-
"status": "FAIL"
54+
"status": "PASS"
5555
},
5656
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state)": {
57-
"status": "FAIL"
57+
"status": "PASS"
5858
},
5959
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer is zero-length (in the closed state)": {
6060
"status": "FAIL"
6161
},
6262
"ReadableStream with byte source: respondWithNewView() throws if the supplied view is non-zero-length (in the closed state)": {
63-
"status": "FAIL"
63+
"status": "PASS"
6464
},
6565
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has a different length (in the closed state)": {
66-
"status": "FAIL"
66+
"status": "PASS"
6767
},
6868
"ReadableStream with byte source: enqueue() throws if the BYOB request's buffer has been detached (in the readable state)": {
6969
"status": "PASS"
Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
1-
{}
1+
{
2+
"ReadableStreamBYOBRequest constructor should throw when passed a undefined ReadableByteStreamController and a undefined view": {
3+
"status": "FAIL"
4+
},
5+
"ReadableStreamBYOBRequest constructor should throw when passed a undefined ReadableByteStreamController and a null view": {
6+
"status": "FAIL"
7+
},
8+
"ReadableStreamBYOBRequest constructor should throw when passed a undefined ReadableByteStreamController and a fake view": {
9+
"status": "FAIL"
10+
},
11+
"ReadableStreamBYOBRequest constructor should throw when passed a undefined ReadableByteStreamController and a real view": {
12+
"status": "FAIL"
13+
},
14+
"ReadableStreamBYOBRequest constructor should throw when passed a null ReadableByteStreamController and a undefined view": {
15+
"status": "FAIL"
16+
},
17+
"ReadableStreamBYOBRequest constructor should throw when passed a null ReadableByteStreamController and a null view": {
18+
"status": "FAIL"
19+
},
20+
"ReadableStreamBYOBRequest constructor should throw when passed a null ReadableByteStreamController and a fake view": {
21+
"status": "FAIL"
22+
},
23+
"ReadableStreamBYOBRequest constructor should throw when passed a null ReadableByteStreamController and a real view": {
24+
"status": "FAIL"
25+
},
26+
"ReadableStreamBYOBRequest constructor should throw when passed a fake ReadableByteStreamController and a undefined view": {
27+
"status": "FAIL"
28+
},
29+
"ReadableStreamBYOBRequest constructor should throw when passed a fake ReadableByteStreamController and a null view": {
30+
"status": "FAIL"
31+
},
32+
"ReadableStreamBYOBRequest constructor should throw when passed a fake ReadableByteStreamController and a fake view": {
33+
"status": "FAIL"
34+
},
35+
"ReadableStreamBYOBRequest constructor should throw when passed a fake ReadableByteStreamController and a real view": {
36+
"status": "FAIL"
37+
},
38+
"ReadableStreamBYOBRequest constructor should throw when passed a real ReadableByteStreamController and a undefined view": {
39+
"status": "FAIL"
40+
},
41+
"ReadableStreamBYOBRequest constructor should throw when passed a real ReadableByteStreamController and a null view": {
42+
"status": "FAIL"
43+
},
44+
"ReadableStreamBYOBRequest constructor should throw when passed a real ReadableByteStreamController and a fake view": {
45+
"status": "FAIL"
46+
},
47+
"ReadableStreamBYOBRequest constructor should throw when passed a real ReadableByteStreamController and a real view": {
48+
"status": "FAIL"
49+
}
50+
}

tests/wpt-harness/expectations/streams/readable-byte-streams/general.any.js.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
"ReadableStream with byte source: read(view), then respond()": {
9999
"status": "FAIL"
100100
},
101+
"ReadableStream with byte source: read(view), then respondWithNewView() with a transferred ArrayBuffer": {
102+
"status": "FAIL"
103+
},
101104
"ReadableStream with byte source: read(view), then respond() with too big value": {
102105
"status": "PASS"
103106
},
@@ -113,6 +116,12 @@
113116
"ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB)": {
114117
"status": "PASS"
115118
},
119+
"ReadableStream with byte source: getReader(), read(view), then cancel()": {
120+
"status": "PASS"
121+
},
122+
"ReadableStream with byte source: cancel() with partially filled pending pull() request": {
123+
"status": "PASS"
124+
},
116125
"ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view": {
117126
"status": "FAIL"
118127
},
@@ -155,6 +164,9 @@
155164
"ReadableStream with byte source: read() twice, then enqueue() twice": {
156165
"status": "FAIL"
157166
},
167+
"ReadableStream with byte source: Multiple read(view), close() and respond()": {
168+
"status": "PASS"
169+
},
158170
"ReadableStream with byte source: Multiple read(view), big enqueue()": {
159171
"status": "PASS"
160172
},
@@ -197,6 +209,15 @@
197209
"calling respond() twice on the same byobRequest should throw": {
198210
"status": "PASS"
199211
},
212+
"calling respondWithNewView() twice on the same byobRequest should throw": {
213+
"status": "FAIL"
214+
},
215+
"calling respond(0) twice on the same byobRequest should throw even when closed": {
216+
"status": "PASS"
217+
},
218+
"calling respond() should throw when canceled": {
219+
"status": "FAIL"
220+
},
200221
"pull() resolving should not resolve read()": {
201222
"status": "FAIL"
202223
},
@@ -218,6 +239,24 @@
218239
"ReadableStreamBYOBReader constructor requires a ReadableStream with type \"bytes\"": {
219240
"status": "PASS"
220241
},
242+
"ReadableStream constructor should not accept a strategy with a size defined if type is \"bytes\"": {
243+
"status": "FAIL"
244+
},
245+
"ReadableStream with byte source: respondWithNewView() with a smaller view": {
246+
"status": "FAIL"
247+
},
248+
"ReadableStream with byte source: respondWithNewView() with a zero-length view (in the closed state)": {
249+
"status": "FAIL"
250+
},
251+
"ReadableStream with byte source: respondWithNewView() with a transferred non-zero-length view (in the readable state)": {
252+
"status": "FAIL"
253+
},
254+
"ReadableStream with byte source: respondWithNewView() with a transferred zero-length view (in the closed state)": {
255+
"status": "FAIL"
256+
},
257+
"ReadableStream with byte source: enqueue() discards auto-allocated BYOB request": {
258+
"status": "FAIL"
259+
},
221260
"ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader, respond()": {
222261
"status": "FAIL"
223262
},
@@ -227,6 +266,9 @@
227266
"ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader with 2 element Uint8Array, respond(3)": {
228267
"status": "FAIL"
229268
},
269+
"ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader, respondWithNewView()": {
270+
"status": "FAIL"
271+
},
230272
"ReadableStream with byte source: releaseLock() with pending read(view), read(view) on second reader, enqueue()": {
231273
"status": "FAIL"
232274
},
@@ -250,5 +292,8 @@
250292
},
251293
"ReadableStream with byte source: read(view) with 1 element Uint16Array, respond(1), releaseLock(), read() on second reader, enqueue()": {
252294
"status": "FAIL"
295+
},
296+
"ReadableStream with byte source: autoAllocateChunkSize, read(), respondWithNewView()": {
297+
"status": "FAIL"
253298
}
254-
}
299+
}

tests/wpt-harness/expectations/streams/readable-byte-streams/tee.any.js.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@
88
"ReadableStream teeing with byte source: chunks should be cloned for each branch": {
99
"status": "FAIL"
1010
},
11+
"ReadableStream teeing with byte source: chunks for BYOB requests from branch 1 should be cloned to branch 2": {
12+
"status": "FAIL"
13+
},
1114
"ReadableStream teeing with byte source: errors in the source should propagate to both branches": {
1215
"status": "FAIL"
1316
},
17+
"ReadableStream teeing with byte source: canceling branch1 should not impact branch2": {
18+
"status": "PASS"
19+
},
20+
"ReadableStream teeing with byte source: canceling branch2 should not impact branch1": {
21+
"status": "PASS"
22+
},
1423
"Running templatedRSTeeCancel with ReadableStream teeing with byte source": {
1524
"status": "PASS"
1625
},
@@ -26,12 +35,6 @@
2635
"ReadableStream teeing with byte source: erroring a teed stream should properly handle canceled branches": {
2736
"status": "PASS"
2837
},
29-
"ReadableStream teeing with byte source: canceling branch1 should not impact branch2": {
30-
"status": "PASS"
31-
},
32-
"ReadableStream teeing with byte source: canceling branch2 should not impact branch1": {
33-
"status": "PASS"
34-
},
3538
"ReadableStream teeing with byte source: closing the original should close the branches": {
3639
"status": "FAIL"
3740
},
@@ -110,4 +113,4 @@
110113
"ReadableStream teeing with byte source: respond() and close() while both branches are pulling": {
111114
"status": "FAIL"
112115
}
113-
}
116+
}

tests/wpt-harness/pre-harness.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ globalThis.GLOBAL = {
44
isShadowRealm: function() { return false; },
55
};
66

7+
function transferArrayBufferView () {}
8+
function ReadableByteStreamController () {}
9+
710
globalThis.Window=self;
811
let originalAEL = addEventListener;
912
addEventListener = function addEventListener_wpt(type, handler) {

0 commit comments

Comments
 (0)