static-element.https.tentative.sub.html (2664B)
1 <!DOCTYPE html> 2 <title>WebBundle subresource loading for static elements</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/static-element.wbn", 13 "resources": [ 14 "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/script.js", 15 "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/style.css", 16 "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/style-imported-from-file.css", 17 "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/style-imported-from-tag.css" 18 ], 19 "scopes": [ 20 "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/scopes/" 21 ] 22 } 23 </script> 24 <style type="text/css"> 25 @import "../resources/wbn/static-element/resources/style-imported-from-tag.css"; 26 @import "../resources/wbn/static-element/scopes/style-imported-from-tag.css"; 27 </style> 28 <link 29 href="../resources/wbn/static-element/resources/style.css" 30 rel="stylesheet" 31 /> 32 <link 33 href="../resources/wbn/static-element/scopes/style.css" 34 rel="stylesheet" 35 /> 36 <script src="../resources/wbn/static-element/resources/script.js"></script> 37 <script src="../resources/wbn/static-element/scopes/script.js"></script> 38 <script src="../resources/wbn/static-element/out-of-scope/script.js"></script> 39 40 <script> 41 setup(() => { 42 assert_true(HTMLScriptElement.supports("webbundle")); 43 }); 44 45 promise_test(async () => { 46 assert_equals(resources_script_result, "loaded from webbundle"); 47 assert_equals(scopes_script_result, "loaded from webbundle"); 48 assert_equals(out_of_scope_script_result, "loaded from network"); 49 50 ["resources_", "scopes_"].forEach((type) => { 51 [ 52 "style_target", 53 "style_imported_from_file_target", 54 "style_imported_from_tag_target", 55 ].forEach((target) => { 56 const element = document.createElement("div"); 57 element.id = type + target; 58 document.body.appendChild(element); 59 assert_equals( 60 window.getComputedStyle(element).color, 61 "rgb(0, 0, 255)", 62 element.id + " color must be blue" 63 ); 64 }); 65 }); 66 }, "Subresources from static elements should be loaded from web bundle."); 67 </script> 68 </body>