Skip to content

Commit 37abdce

Browse files
Uzlopakgithub-actions[bot]
authored andcommitted
chore: update WPT
1 parent c8acc81 commit 37abdce

File tree

13 files changed

+322
-24
lines changed

13 files changed

+322
-24
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
features:
2+
- name: fetch-request-streams
3+
files:
4+
- request-upload*

test/fixtures/wpt/fetch/http-cache/heuristic.any.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,33 @@ var tests = [
3232
],
3333
},
3434
{
35-
expected_type: "not_cached"
35+
expected_type: "not_cached",
3636
}
3737
]
38-
}
38+
},
39+
{
40+
name: "HTTP cache does not reuse a redirected response with no max-age and no Last-Modified header",
41+
requests: [
42+
{
43+
response_status: [301, "Moved Permanently"],
44+
response_headers: [
45+
["Cache-Control", "private"],
46+
["Location", "redirect_target"]
47+
],
48+
},
49+
{ skip: true}, // Response to first redirect
50+
{
51+
response_status: [301, "Moved Permanently"],
52+
response_headers: [
53+
["Cache-Control", "private"],
54+
["Location", "redirect_target"]
55+
],
56+
expected_type: "not_cached",
57+
},
58+
{ skip: true}, // response to second redirect
59+
],
60+
check_count: true,
61+
},
3962
];
4063

4164
function check_status(status) {

test/fixtures/wpt/fetch/http-cache/http-cache.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,25 @@ function makeTest (test) {
4343
var uuid = token()
4444
var requests = expandTemplates(test)
4545
var fetchFunctions = makeFetchFunctions(requests, uuid)
46-
return runTest(fetchFunctions, requests, uuid)
46+
return runTest(fetchFunctions, test, requests, uuid)
4747
}
4848
}
4949

5050
function makeFetchFunctions(requests, uuid) {
5151
var fetchFunctions = []
5252
for (let i = 0; i < requests.length; ++i) {
53+
var config = requests[i];
54+
if (config.skip) {
55+
// Skip request are ones that we expect the browser to make in
56+
// response to a redirect. We don't fetch them again, but
57+
// the server needs them in the config to be able to respond to
58+
// them.
59+
continue;
60+
}
5361
fetchFunctions.push({
5462
code: function (idx) {
5563
var config = requests[idx]
56-
var url = makeTestUrl(uuid, config)
64+
var url = makeTestUrl(uuid, config);
5765
var init = fetchInit(requests, config)
5866
return fetch(url, init)
5967
.then(makeCheckResponse(idx, config))
@@ -71,7 +79,7 @@ function makeFetchFunctions(requests, uuid) {
7179
return fetchFunctions
7280
}
7381

74-
function runTest(fetchFunctions, requests, uuid) {
82+
function runTest(fetchFunctions, test, requests, uuid) {
7583
var idx = 0
7684
function runNextStep () {
7785
if (fetchFunctions.length) {
@@ -93,7 +101,7 @@ function runTest(fetchFunctions, requests, uuid) {
93101
.then(function () {
94102
return getServerState(uuid)
95103
}).then(function (testState) {
96-
checkRequests(requests, testState)
104+
checkRequests(test, requests, testState)
97105
return Promise.resolve()
98106
})
99107
}
@@ -153,7 +161,7 @@ function makeCheckResponse (idx, config) {
153161
if ('expected_status' in config) {
154162
assert_equals(response.status, config.expected_status,
155163
`Response ${reqNum} status is ${response.status}, not ${config.expected_status}`)
156-
} else if ('response_status' in config) {
164+
} else if ('response_status' in config && config.response_status[0] != 301) {
157165
assert_equals(response.status, config.response_status[0],
158166
`Response ${reqNum} status is ${response.status}, not ${config.response_status[0]}`)
159167
} else {
@@ -197,7 +205,7 @@ function makeCheckResponseBody (config, uuid) {
197205
}
198206
}
199207

200-
function checkRequests (requests, testState) {
208+
function checkRequests (test, requests, testState) {
201209
var testIdx = 0
202210
for (let i = 0; i < requests.length; ++i) {
203211
var expectedValidatingHeaders = []
@@ -225,6 +233,9 @@ function checkRequests (requests, testState) {
225233
})
226234
}
227235
}
236+
if (test?.check_count && testState) {
237+
assert_equals(requests.length, testState.length);
238+
}
228239
}
229240

230241
function pause () {

test/fixtures/wpt/fetch/http-cache/split-cache.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
function check_server_info() {
129129
return getServerState(uuid)
130130
.then(function (testState) {
131-
checkRequests(local_requests, testState)
131+
checkRequests(undefined, local_requests, testState)
132132
return Promise.resolve()
133133
})
134134
}

test/fixtures/wpt/interfaces/ppa.idl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ dictionary PrivateAttributionConversionOptions {
5151
unsigned long maxValue = 1;
5252
};
5353

54+
enum PrivateAttributionLogic {
55+
"last-touch",
56+
};
57+
5458
dictionary PrivateAttributionConversionResult {
5559
required Uint8Array report;
5660
};
@@ -59,7 +63,3 @@ dictionary PrivateAttributionConversionResult {
5963
partial interface PrivateAttribution {
6064
Promise<PrivateAttributionConversionResult> measureConversion(PrivateAttributionConversionOptions options);
6165
};
62-
63-
enum PrivateAttributionLogic {
64-
"last-touch",
65-
};

test/fixtures/wpt/interfaces/screen-capture.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ partial dictionary MediaTrackSettings {
7171
DOMString cursor;
7272
boolean restrictOwnAudio;
7373
boolean suppressLocalAudioPlayback;
74+
double screenPixelRatio;
7475
};
7576

7677
partial dictionary MediaTrackCapabilities {

test/fixtures/wpt/interfaces/speech-api.idl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface SpeechRecognition : EventTarget {
1919
undefined start(MediaStreamTrack audioTrack);
2020
undefined stop();
2121
undefined abort();
22-
static Promise<boolean> availableOnDevice(DOMString lang);
22+
static Promise<AvailabilityStatus> availableOnDevice(DOMString lang);
2323
static Promise<boolean> installOnDevice(DOMString lang);
2424

2525
// event methods
@@ -52,6 +52,13 @@ enum SpeechRecognitionMode {
5252
"cloud-only", // Cloud speech recognition only.
5353
};
5454

55+
enum AvailabilityStatus {
56+
"unavailable",
57+
"downloadable",
58+
"downloading",
59+
"available"
60+
};
61+
5562
[Exposed=Window]
5663
interface SpeechRecognitionErrorEvent : Event {
5764
constructor(DOMString type, SpeechRecognitionErrorEventInit eventInitDict);

test/fixtures/wpt/interfaces/webrtc-stats.idl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ dictionary RTCCodecStats : RTCStats {
3838

3939
dictionary RTCReceivedRtpStreamStats : RTCRtpStreamStats {
4040
unsigned long long packetsReceived;
41+
unsigned long long packetsReceivedWithEct1;
42+
unsigned long long packetsReceivedWithCe;
43+
unsigned long long packetsReportedAsLost;
44+
unsigned long long packetsReportedAsLostButRecovered;
4145
long long packetsLost;
4246
double jitter;
4347
};
@@ -107,18 +111,21 @@ dictionary RTCRemoteInboundRtpStreamStats : RTCReceivedRtpStreamStats {
107111
double totalRoundTripTime;
108112
double fractionLost;
109113
unsigned long long roundTripTimeMeasurements;
114+
unsigned long long packetsWithBleachedEct1Marking;
110115
};
111116

112117
dictionary RTCSentRtpStreamStats : RTCRtpStreamStats {
113-
unsigned long long packetsSent;
114-
unsigned long long bytesSent;
118+
unsigned long long packetsSent;
119+
unsigned long long bytesSent;
120+
unsigned long long packetsSentWithEct1;
115121
};
116122

117123
dictionary RTCOutboundRtpStreamStats : RTCSentRtpStreamStats {
118124
DOMString mid;
119125
DOMString mediaSourceId;
120126
DOMString remoteId;
121127
DOMString rid;
128+
unsigned long encodingIndex;
122129
unsigned long long headerBytesSent;
123130
unsigned long long retransmittedPacketsSent;
124131
unsigned long long retransmittedBytesSent;
@@ -225,6 +232,8 @@ dictionary RTCTransportStats : RTCStats {
225232
RTCDtlsRole dtlsRole;
226233
DOMString srtpCipher;
227234
unsigned long selectedCandidatePairChanges;
235+
unsigned long ccfbMessagesSent;
236+
unsigned long ccfbMessagesReceived;
228237
};
229238

230239
enum RTCDtlsRole {

test/fixtures/wpt/interfaces/webrtc.idl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ dictionary RTCLocalSessionDescriptionInit {
163163

164164
[Exposed=Window]
165165
interface RTCIceCandidate {
166-
constructor(optional RTCIceCandidateInit candidateInitDict = {});
166+
constructor(optional RTCLocalIceCandidateInit candidateInitDict = {});
167167
readonly attribute DOMString candidate;
168168
readonly attribute DOMString? sdpMid;
169169
readonly attribute unsigned short? sdpMLineIndex;
@@ -179,7 +179,7 @@ interface RTCIceCandidate {
179179
readonly attribute unsigned short? relatedPort;
180180
readonly attribute DOMString? usernameFragment;
181181
readonly attribute RTCIceServerTransportProtocol? relayProtocol;
182-
readonly attribute DOMString? url;
182+
readonly attribute USVString? url;
183183
RTCIceCandidateInit toJSON();
184184
};
185185

@@ -190,6 +190,11 @@ dictionary RTCIceCandidateInit {
190190
DOMString? usernameFragment = null;
191191
};
192192

193+
dictionary RTCLocalIceCandidateInit : RTCIceCandidateInit {
194+
RTCIceServerTransportProtocol? relayProtocol = null;
195+
USVString? url = null;
196+
};
197+
193198
enum RTCIceProtocol {
194199
"udp",
195200
"tcp"
@@ -218,7 +223,7 @@ enum RTCIceServerTransportProtocol {
218223
interface RTCPeerConnectionIceEvent : Event {
219224
constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {});
220225
readonly attribute RTCIceCandidate? candidate;
221-
readonly attribute DOMString? url;
226+
readonly attribute USVString? url;
222227
};
223228

224229
dictionary RTCPeerConnectionIceEventInit : EventInit {
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<!DOCTYPE html>
2+
<title>Service Worker: Client.url is Window creation URL tests</title>
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
<script src="resources/test-helpers.sub.js"></script>
6+
<script>
7+
// These tests all validate that the Service Worker's Client.url property is
8+
// correct for different types of Window client navigations.
9+
// All test cases involve an iframe navigating in some manner and then
10+
// the service worker validating that the Client.url property is correct.
11+
12+
// Waits for and returns the next postMessage from `frame` to this window.
13+
function wait_for_message_from_frame(frame) {
14+
return new Promise(resolve => {
15+
const message_handler = e => {
16+
if (e.source === frame.contentWindow) {
17+
frame.removeEventListener('message', message_handler);
18+
resolve(e.data);
19+
}
20+
};
21+
window.addEventListener('message', message_handler);
22+
});
23+
}
24+
25+
// Returns a promise to get a client URL under the ServiceWorker's
26+
// (client-url-creation-url-sw.js) control. `target` should be an active
27+
// ServiceWorker to post message. We expect it to send back the client URL
28+
// via the given channel.
29+
function post_message_and_wait_for_response(
30+
target, data) {
31+
return new Promise(resolve => {
32+
const channel = new MessageChannel();
33+
channel.port1.onmessage = e => {
34+
resolve(e.data);
35+
};
36+
target.postMessage(
37+
{message: data, port: channel.port2},
38+
[channel.port2]);
39+
});
40+
}
41+
42+
const SCOPE = 'resources/client-url-creation-url';
43+
const IFRAME_URL = SCOPE + '-iframe.html?step=1';
44+
45+
// The test helper function implements a test case by
46+
// using an iframe to navigate in various ways described by `navigation_kinds`
47+
// and then validates the ServiceWorker Client.url property of the iframe
48+
// against the provided `expected_client_url`.
49+
// `navigation_kinds` is an array of strings each of which is one of the
50+
// navigation actions supported by client-url-creation-url-iframe.html.
51+
async function test_client_url_helper(
52+
t, navigation_kinds, expected_client_url) {
53+
const registration = await service_worker_unregister_and_register(
54+
t, 'resources/client-url-creation-url-sw.js', SCOPE);
55+
t.add_cleanup(_ => registration.unregister());
56+
await wait_for_state(t, registration.installing, 'activated');
57+
58+
const frame = await with_iframe(IFRAME_URL);
59+
t.add_cleanup(_ => frame.remove());
60+
const message = await wait_for_message_from_frame(frame);
61+
assert_equals(message, 'done', 'iframe loaded successfully');
62+
63+
for (let navigation_kind_idx = 0;
64+
navigation_kind_idx < navigation_kinds.length;
65+
++navigation_kind_idx) {
66+
const navigation_kind = navigation_kinds[navigation_kind_idx];
67+
68+
frame.contentWindow.postMessage(navigation_kind);
69+
const result = await wait_for_message_from_frame(frame);
70+
assert_equals(result, 'done', 'iframe navigation successfully completed');
71+
}
72+
73+
const actual_client_url = await post_message_and_wait_for_response(
74+
registration.active, "get_client_url");
75+
76+
assert_equals(
77+
actual_client_url, expected_client_url, 'Client.url should match');
78+
}
79+
80+
const EXPECTED_URL_STEP_1 = new URL(
81+
'./resources/client-url-creation-url-iframe.html?step=1', location).href;
82+
const EXPECTED_URL_STEP_2 = new URL(
83+
'./resources/client-url-creation-url-iframe.html?step=2', location).href;
84+
85+
// Tests that perform navigations that don't create a new document
86+
promise_test(async t => {
87+
await test_client_url_helper(t, [], EXPECTED_URL_STEP_1);
88+
}, 'No navigation creation URL is same as window URL');
89+
90+
promise_test(async t => {
91+
await test_client_url_helper(t, ['fragment'], EXPECTED_URL_STEP_1);
92+
}, 'Fragment only navigation doesn\'t change creation URL');
93+
94+
promise_test(async t => {
95+
await test_client_url_helper(t, ['pushstate'], EXPECTED_URL_STEP_1);
96+
}, 'Pushstate doesn\'t change creation URL');
97+
98+
promise_test(async t => {
99+
await test_client_url_helper(t, ['replacestate'], EXPECTED_URL_STEP_1);
100+
}, 'Replacestate doesn\'t change creation URL');
101+
102+
promise_test(async t => {
103+
await test_client_url_helper(
104+
t, ['pushstate', 'pushstate', 'back-within-same-document'], EXPECTED_URL_STEP_1);
105+
}, 'Going back over pushstate to other pushstate via back');
106+
107+
// Tests that perform navigations that create new document(s)
108+
promise_test(async t => {
109+
await test_client_url_helper(t, ['query'], EXPECTED_URL_STEP_2);
110+
}, 'Query navigation changes creation URL');
111+
112+
promise_test(async t => {
113+
await test_client_url_helper(t, ['reload'], EXPECTED_URL_STEP_1);
114+
}, 'Reloading doesn\'t change creation URL');
115+
116+
promise_test(async t => {
117+
await test_client_url_helper(t, ['pushstate', 'reload'], EXPECTED_URL_STEP_2);
118+
}, 'Reloading pushstate URL changes creation URL');
119+
120+
promise_test(async t => {
121+
await test_client_url_helper(
122+
t, ['query', 'pushstate', 'back-within-same-document'], EXPECTED_URL_STEP_2);
123+
}, 'Going back over pushstate to creation URL');
124+
125+
promise_test(async t => {
126+
await test_client_url_helper(
127+
t, ['query', 'query', 'back-cross-document'], EXPECTED_URL_STEP_2);
128+
}, 'Going back to new document changes creation URL');
129+
</script>

0 commit comments

Comments
 (0)