| <!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) { |
| checkTestResult(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) { |
| checkTestResult(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) { |
| checkTestResult(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) { |
| checkTestResult(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> |