corp.https.tentative.html (2228B)
1 <!DOCTYPE html> 2 <title>CORP for WebBundle subresource loading</title> 3 <link 4 rel="help" 5 href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md#cors-and-corp-for-subresource-requests" 6 /> 7 <link 8 rel="help" 9 href="https://fetch.spec.whatwg.org/#cross-origin-resource-policy-header" 10 /> 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 <script src="../resources/test-helpers.js"></script> 14 15 <body> 16 <!-- 17 This wpt should run on an origin different from https://www1.web-platform.test:8444/, 18 from where cross-orign WebBundles are served. 19 20 This test uses a cross-origin WebBundle, 21 https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/corp.wbn, 22 which is served with an Access-Control-Allow-Origin response header. 23 24 `corp.wbn` includes three subresources: 25 a. `no-corp.js`, which doesn't include a Cross-Origin-Resource-Policy response header. 26 b. `corp-same-origin.js`, which includes a Cross-Origin-Resource-Policy: same-origin response header. 27 c. `corp-cross-origin.js`, which includes a Cross-Origin-Resource-Policy: cross-origin response header. 28 --> 29 <script type="webbundle"> 30 { 31 "source": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/corp.wbn", 32 "resources": [ 33 "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/no-corp.js", 34 "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/corp-same-origin.js", 35 "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/corp-cross-origin.js" 36 ] 37 } 38 </script> 39 <script> 40 setup(() => { 41 assert_true(HTMLScriptElement.supports("webbundle")); 42 }); 43 44 promise_test(async () => { 45 const prefix = 46 "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/"; 47 await addScriptAndWaitForExecution(prefix + "no-corp.js"); 48 await addScriptAndWaitForError(prefix + "corp-same-origin.js"); 49 await addScriptAndWaitForExecution(prefix + "corp-cross-origin.js"); 50 }, "Subresource loading from WebBundles should respect Cross-Origin-Resource-Policy header."); 51 52 </script> 53 </body>