Automatic update from web-platform-tests [LNA] refactor sourceResolveOptions() to add permission info Add permissionName and permissionValue as options to sourceResolveOptions() function; in addition add getPermissionName() and getPermissionValue() to simplify logic in HTML resources. Changed dedicated worker and iframe tests to use these; fetch test files will be cleaned up later. Also renamed checkTestResult to checkFetchTestResult. Bug: 406991278 Change-Id: I7725b87bd89f000d10664ef50f86845afdb4db75 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7634201 Commit-Queue: Hubert Chao <hchao@chromium.org> Reviewed-by: Chris Thompson <cthomp@chromium.org> Cr-Commit-Position: refs/heads/main@{#1595107} -- wpt-commits: 75179bb2325cc825bcdc3f4710d2ee484d3a2e82 wpt-pr: 58305
88 lines
2.8 KiB
HTML
88 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>LNA Fetch tests: HTTPS </title>
|
|
<body>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script src="resources/support.sub.js"></script>
|
|
<script>
|
|
"use strict";
|
|
|
|
promise_test(t => {
|
|
const sourceUrl = resolveUrl("resources/fetch-local.html",
|
|
sourceResolveOptions({ server: Server.HTTPS_PUBLIC }));
|
|
|
|
function checkResult(evt) {
|
|
checkFetchTestResult(evt.data, FetchTestResult.SUCCESS);
|
|
t.done();
|
|
}
|
|
|
|
const promise = new Promise((resolve) => {
|
|
window.addEventListener('message', resolve, {once: true});
|
|
}).then(checkResult);
|
|
const popup = window.open(sourceUrl);
|
|
t.add_cleanup(() => popup.close());
|
|
|
|
return promise;
|
|
}, 'LNA Public to local with permission');
|
|
|
|
promise_test(t => {
|
|
// TODO(crbug.com/406991278): consider moving permission url param into
|
|
// options
|
|
const sourceUrl = resolveUrl("resources/fetch-local.html?permission=denied",
|
|
sourceResolveOptions({ server: Server.HTTPS_PUBLIC }));
|
|
|
|
function checkResult(evt) {
|
|
checkFetchTestResult(evt.data, FetchTestResult.FAILURE);
|
|
t.done();
|
|
}
|
|
|
|
const promise = new Promise((resolve) => {
|
|
window.addEventListener('message', resolve, {once: true});
|
|
}).then(checkResult);
|
|
const popup = window.open(sourceUrl);
|
|
t.add_cleanup(() => popup.close());
|
|
|
|
return promise;
|
|
}, 'LNA Public to local with permission denied');
|
|
|
|
promise_test(t => {
|
|
const sourceUrl = resolveUrl("resources/fetch-local-http.html",
|
|
sourceResolveOptions({ server: Server.HTTPS_PUBLIC }));
|
|
|
|
function checkResult(evt) {
|
|
checkFetchTestResult(evt.data, FetchTestResult.SUCCESS);
|
|
t.done();
|
|
}
|
|
|
|
const promise = new Promise((resolve) => {
|
|
window.addEventListener('message', resolve, {once: true});
|
|
}).then(checkResult);
|
|
const popup = window.open(sourceUrl);
|
|
t.add_cleanup(() => popup.close());
|
|
|
|
return promise;
|
|
}, 'LNA Public to local http mixed content bypass');
|
|
|
|
promise_test(t => {
|
|
const sourceUrl = resolveUrl("resources/fetch-public-http-wrong-address-space.html",
|
|
sourceResolveOptions({ server: Server.HTTPS_PUBLIC }));
|
|
|
|
function checkResult(evt) {
|
|
checkFetchTestResult(evt.data, FetchTestResult.FAILURE);
|
|
t.done();
|
|
}
|
|
|
|
const promise = new Promise((resolve) => {
|
|
window.addEventListener('message', resolve, {once: true});
|
|
}).then(checkResult);
|
|
const popup = window.open(sourceUrl);
|
|
t.add_cleanup(() => popup.close());
|
|
|
|
return promise;
|
|
}, 'LNA Public to public http mixed content bypass failure');
|
|
</script>
|
|
</body>
|