Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /fetch/private-network-access/preflight-cache.https.tentative.window.html - WPT Dashboard Interop Dashboard
// META: script=/common/utils.js
// META: script=resources/support.sub.js
//
//
// These tests verify that PNA preflight responses are cached.
//
// entries are keyed by target IP address space because that requires
// loading the same URL from different IP address spaces, and the WPT
// framework does not allow that.
promise_test(async t => {
let uuid = token();
await fetchTest(t, {
source: { server: Server.HTTPS_PRIVATE },
target: {
server: Server.HTTPS_LOCAL,
behavior: {
preflight: PreflightBehavior.singlePreflight(uuid),
response: ResponseBehavior.allowCrossOrigin(),
},
},
expected: FetchTestResult.SUCCESS,
});
await fetchTest(t, {
source: { server: Server.HTTPS_PRIVATE },
target: {
server: Server.HTTPS_LOCAL,
behavior: {
preflight: PreflightBehavior.singlePreflight(uuid),
response: ResponseBehavior.allowCrossOrigin(),
},
},
expected: FetchTestResult.SUCCESS,
});
}, "private to local: success.");
promise_test(async t => {
let uuid = token();
await fetchTest(t, {
source: { server: Server.HTTPS_PUBLIC },
target: {
server: Server.HTTPS_LOCAL,
behavior: {
preflight: PreflightBehavior.singlePreflight(uuid),
response: ResponseBehavior.allowCrossOrigin(),
},
},
expected: FetchTestResult.SUCCESS,
});
await fetchTest(t, {
source: { server: Server.HTTPS_PUBLIC },
target: {
server: Server.HTTPS_LOCAL,
behavior: {
preflight: PreflightBehavior.singlePreflight(uuid),
response: ResponseBehavior.allowCrossOrigin(),
},
},
expected: FetchTestResult.SUCCESS,
});
}, "public to local: success.");
promise_test(async t => {
let uuid = token();
await fetchTest(t, {
source: { server: Server.HTTPS_PUBLIC },
target: {
server: Server.HTTPS_PRIVATE,
behavior: {
preflight: PreflightBehavior.singlePreflight(uuid),
response: ResponseBehavior.allowCrossOrigin(),
},
},
expected: FetchTestResult.SUCCESS,
});
await fetchTest(t, {
source: { server: Server.HTTPS_PUBLIC },
target: {
server: Server.HTTPS_PRIVATE,
behavior: {
preflight: PreflightBehavior.singlePreflight(uuid),
response: ResponseBehavior.allowCrossOrigin(),
},
},
expected: FetchTestResult.SUCCESS,
});
}, "public to private: success.");