diff --git a/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html b/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html index 3741390548abea..c17dc55906eb26 100644 --- a/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html +++ b/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html @@ -49,7 +49,7 @@ getRemoteHostUrl(`${kRegisterDictionaryPath}?save_header=${dict_token}`); addLinkRelCompressionDictionaryElement(url, 'anonymous'); const headers = await waitUntilPreviousRequestHeaders( - t, dict_token, /*check_remote=*/ true); + t, dict_token, {check_remote: true}); assert_true(headers !== undefined, 'Headers should be available'); assert_equals(headers['sec-fetch-mode'], 'cors'); diff --git a/fetch/compression-dictionary/dictionary-fetch-with-link-header-in-early-hints.tentative.https.h2.html b/fetch/compression-dictionary/dictionary-fetch-with-link-header-in-early-hints.tentative.https.h2.html new file mode 100644 index 00000000000000..dfc6222a60328d --- /dev/null +++ b/fetch/compression-dictionary/dictionary-fetch-with-link-header-in-early-hints.tentative.https.h2.html @@ -0,0 +1,9 @@ + + + + diff --git a/fetch/compression-dictionary/resources/compression-dictionary-util.sub.js b/fetch/compression-dictionary/resources/compression-dictionary-util.sub.js index d86f534fbd040d..bd63c8b60709ad 100644 --- a/fetch/compression-dictionary/resources/compression-dictionary-util.sub.js +++ b/fetch/compression-dictionary/resources/compression-dictionary-util.sub.js @@ -96,8 +96,9 @@ async function waitUntilAvailableDictionaryHeader(test, { // Checks the HTTP request headers which was sent to the server with `token` // to register a dictionary. -async function checkPreviousRequestHeaders(token, check_remote = false) { - let url = `./resources/register-dictionary.py?get_previous_header=${token}`; +async function checkPreviousRequestHeaders(token, options = {}) { + const { check_remote = false, use_http2 = false } = options; + let url = `${use_http2 ? kRegisterDictionaryHttp2Path : kRegisterDictionaryPath}?get_previous_header=${token}`; if (check_remote) { url = getRemoteHostUrl(url); } @@ -108,12 +109,12 @@ async function checkPreviousRequestHeaders(token, check_remote = false) { // `token` to register a dictionary is available, and returns the header. If the // header is not available after the specified number of retries, returns // `undefined`. -async function waitUntilPreviousRequestHeaders( - test, token, check_remote = false) { +async function waitUntilPreviousRequestHeaders(test, token, options = {}) { + const { check_remote = false, use_http2 = false } = options; for (let retry_count = 0; retry_count <= kCheckPreviousRequestHeadersMaxRetry; retry_count++) { const header = - (await checkPreviousRequestHeaders(token, check_remote))['headers']; + (await checkPreviousRequestHeaders(token, {check_remote, use_http2}))['headers']; if (header) { return header; } @@ -156,3 +157,11 @@ async function registerAltDictionaryAndWait(t) { await waitUntilAvailableDictionaryHeader(t, {use_alt_path: true}), kDefaultDictionaryHashBase64); } + +function navigateToTestWithCompressionDictionaryEarlyHints(test_url, dictionary_url) { + const params = new URLSearchParams(); + params.set("test_url", test_url); + params.set("dictionary_url", dictionary_url); + const url = `${RESOURCES_PATH}/early-hint-for-compression-dictionary-test-loader.h2.py?${params.toString()}`; + window.location.replace(new URL(url, window.location)); +} diff --git a/fetch/compression-dictionary/resources/dictionary-fetch-with-link-header-in-early-hints.tentative.https.h2.html b/fetch/compression-dictionary/resources/dictionary-fetch-with-link-header-in-early-hints.tentative.https.h2.html new file mode 100644 index 00000000000000..5265d3993352c1 --- /dev/null +++ b/fetch/compression-dictionary/resources/dictionary-fetch-with-link-header-in-early-hints.tentative.https.h2.html @@ -0,0 +1,34 @@ + +
+ + + + + + + +