path-restriction.https.tentative.html (1737B)
1 <!DOCTYPE html> 2 <title>Path restriction on subresource loading with WebBundles</title> 3 <link 4 rel="help" 5 href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md" 6 /> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <body> 10 <script type="webbundle"> 11 { 12 "source": "../resources/wbn/path-restriction.wbn", 13 "resources": [ 14 "/web-bundle/resources/wbn/resource.js", 15 "/web-bundle/resources/wbn/sub/resource.js", 16 "/web-bundle/resources/wbn-resource.js", 17 "/web-bundle/resources/wbn1/resource.js", 18 "/web-bundle/resources/other/resource.js", 19 "/web-bundle/resources/resource.js" 20 ] 21 } 22 </script> 23 <script> 24 setup(() => { 25 assert_true(HTMLScriptElement.supports("webbundle")); 26 }); 27 28 promise_test(async () => { 29 const resources = [ 30 "/web-bundle/resources/wbn/resource.js", 31 "/web-bundle/resources/wbn/sub/resource.js", 32 ]; 33 for (const resource of resources) { 34 const response = await fetch(resource); 35 assert_true(response.ok, resource + " should be loaded"); 36 } 37 }, "Subresources should be loaded."); 38 39 promise_test(async () => { 40 const resources = [ 41 "/web-bundle/resources/wbn-resource.js", 42 "/web-bundle/resources/wbn1/resource.js", 43 "/web-bundle/resources/other/resource.js", 44 "/web-bundle/resources/resource.js", 45 ]; 46 for (const resource of resources) { 47 const response = await fetch(resource); 48 assert_false(response.ok, resource + " should not be loaded"); 49 } 50 }, "Subresources should not be loaded due to path restriction."); 51 </script> 52 </body>