|
| 1 | +<!DOCTYPE html> |
| 2 | +<meta charset="utf-8"> |
| 3 | +<title>LNA Fetch tests: HTTPS </title> |
| 4 | +<body> |
| 5 | +<script src="/resources/testharness.js"></script> |
| 6 | +<script src="/resources/testharnessreport.js"></script> |
| 7 | +<script src="/resources/testdriver.js"></script> |
| 8 | +<script src="/resources/testdriver-vendor.js"></script> |
| 9 | +<script src="resources/support.sub.js"></script> |
| 10 | +<script> |
| 11 | + "use strict"; |
| 12 | + |
| 13 | + promise_test(t => { |
| 14 | + const sourceUrl = resolveUrl("resources/fetch-private.html", |
| 15 | + sourceResolveOptions({ server: Server.HTTPS_PUBLIC })); |
| 16 | + |
| 17 | + function checkResult(evt) { |
| 18 | + checkTestResult(evt.data, FetchTestResult.SUCCESS); |
| 19 | + t.done(); |
| 20 | + } |
| 21 | + |
| 22 | + const promise = new Promise((resolve) => { |
| 23 | + window.addEventListener('message', resolve, {once: true}); |
| 24 | + }).then(checkResult); |
| 25 | + const popup = window.open(sourceUrl); |
| 26 | + t.add_cleanup(() => popup.close()); |
| 27 | + |
| 28 | + return promise; |
| 29 | + }, 'LNA Public to private with permission'); |
| 30 | + |
| 31 | + promise_test(t => { |
| 32 | + // TODO(crbug.com/406991278): consider moving permission url param into |
| 33 | + // options |
| 34 | + const sourceUrl = resolveUrl("resources/fetch-private.html?permission=denied", |
| 35 | + sourceResolveOptions({ server: Server.HTTPS_PUBLIC })); |
| 36 | + |
| 37 | + function checkResult(evt) { |
| 38 | + checkTestResult(evt.data, FetchTestResult.FAILURE); |
| 39 | + t.done(); |
| 40 | + } |
| 41 | + |
| 42 | + const promise = new Promise((resolve) => { |
| 43 | + window.addEventListener('message', resolve, {once: true}); |
| 44 | + }).then(checkResult); |
| 45 | + const popup = window.open(sourceUrl); |
| 46 | + t.add_cleanup(() => popup.close()); |
| 47 | + |
| 48 | + return promise; |
| 49 | + }, 'LNA Public to private with permission denied'); |
| 50 | + |
| 51 | + promise_test(t => { |
| 52 | + const sourceUrl = resolveUrl("resources/fetch-private-http.html", |
| 53 | + sourceResolveOptions({ server: Server.HTTPS_PUBLIC })); |
| 54 | + |
| 55 | + function checkResult(evt) { |
| 56 | + checkTestResult(evt.data, FetchTestResult.SUCCESS); |
| 57 | + t.done(); |
| 58 | + } |
| 59 | + |
| 60 | + const promise = new Promise((resolve) => { |
| 61 | + window.addEventListener('message', resolve, {once: true}); |
| 62 | + }).then(checkResult); |
| 63 | + const popup = window.open(sourceUrl); |
| 64 | + t.add_cleanup(() => popup.close()); |
| 65 | + |
| 66 | + return promise; |
| 67 | + }, 'LNA Public to private http mixed content bypass'); |
| 68 | + |
| 69 | + promise_test(t => { |
| 70 | + const sourceUrl = resolveUrl("resources/fetch-public-http-wrong-address-space.html", |
| 71 | + sourceResolveOptions({ server: Server.HTTPS_PUBLIC })); |
| 72 | + |
| 73 | + function checkResult(evt) { |
| 74 | + checkTestResult(evt.data, FetchTestResult.FAILURE); |
| 75 | + t.done(); |
| 76 | + } |
| 77 | + |
| 78 | + const promise = new Promise((resolve) => { |
| 79 | + window.addEventListener('message', resolve, {once: true}); |
| 80 | + }).then(checkResult); |
| 81 | + const popup = window.open(sourceUrl); |
| 82 | + t.add_cleanup(() => popup.close()); |
| 83 | + |
| 84 | + return promise; |
| 85 | + }, 'LNA Public to public http mixed content bypass failure'); |
| 86 | +</script> |
| 87 | +</body> |
0 commit comments