| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script id="target" type="module" src="resources/empty.js"></script> |
| <script> |
| var t = async_test('Makes sure that <script type="module"> preload resources'); |
| |
| target.onload = t.step_func(function() { |
| if (window.internals === undefined) { |
| throw new Error('This test requires internals.isPreloaded function.'); |
| } |
| |
| assert_true(internals.isPreloaded(target.src)); |
| |
| var absoluteUrl = new URL(target.src, location.href).href; |
| assert_equals(performance.getEntriesByName(absoluteUrl).length, 1, |
| 'empty.js should load only once'); |
| t.done(); |
| }); |
| </script> |