Files
sousa-gecko/testing/web-platform/tests/service-workers/service-worker/request-end-to-end.https.html
T
Hiroshige Hayashizaki a578378ead Bug 1951836 [wpt PR 51119] - [WPT] stabilize request-end-to-end.https.html failure text, a=testonly
Automatic update from web-platform-tests
[WPT] stabilize request-end-to-end.https.html failure text

To create a stable baseline to precisely specify how the test fails,
this CL modifies the test so that the version-specific string doesn't
appear on the -expected.txt.

Bug: 40614733
Change-Id: I62f3b7e6b5b66a0fade4a8c1d9eccda6b6b696f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6324606
Auto-Submit: Hiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1428061}

--

wpt-commits: 9d172e972bc1c6d5fb0b79ea7641142b5bd501e5
wpt-pr: 51119
2025-03-11 08:17:17 +00:00

45 lines
2.1 KiB
HTML

<!DOCTYPE html>
<title>Service Worker: FetchEvent.request passed to onfetch</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script>
'use strict';
promise_test(t => {
var url = 'resources/request-end-to-end-worker.js';
var scope = 'resources/blank.html';
return service_worker_unregister_and_register(t, url, scope)
.then(r => {
add_completion_callback(() => { r.unregister(); });
return wait_for_state(t, r.installing, 'activated');
})
.then(() => { return with_iframe(scope); })
.then(frame => {
add_completion_callback(() => { frame.remove(); });
var result = JSON.parse(frame.contentDocument.body.textContent);
assert_equals(result.url, frame.src, 'request.url');
assert_equals(result.method, 'GET', 'request.method');
assert_equals(result.referrer, location.href, 'request.referrer');
assert_equals(result.mode, 'navigate', 'request.mode');
assert_equals(result.request_construct_error, '',
'Constructing a Request with a Request whose mode ' +
'is navigate and non-empty RequestInit must not throw a ' +
'TypeError.')
assert_equals(result.credentials, 'include', 'request.credentials');
assert_equals(result.redirect, 'manual', 'request.redirect');
assert_equals(result.append_header_error, 'TypeError',
'Appending a new header to the request must throw a ' +
'TypeError.')
// `assert_equals()` is not used here to create a stable failure
// baseline, because the User-Agent header would be version-dependent
// if set.
assert_true(result.headers['user-agent'] === undefined,
'Default User-Agent header should not be passed to ' +
'onfetch event.')
});
}, 'Test FetchEvent.request passed to onfetch');
</script>