| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8" /> |
| <title>Resource Timing: image with a hash</title> |
| <link rel="help" href="http://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="resources/webperftestharness.js"></script> |
| <script src="resources/webperftestharnessextension.js"></script> |
| <script> |
| setup({explicit_done: true}); |
| |
| // explicitly test the namespace before we start testing |
| test_namespace("getEntriesByType"); |
| |
| function onload_test() { |
| if (window.performance.getEntriesByType === undefined) { |
| done(); |
| return; |
| } |
| |
| const url = "resources/fake_responses.py?tag=" + Math.random() + '#hash=1'; |
| const image = new Image(); |
| image.onload = image.onerror = () => { |
| const entries = window.performance.getEntriesByType('resource').filter(r => r.initiatorType === 'img'); |
| test_equals(entries.length, 1, "There should be one entry"); |
| if (entries.length === 1) { |
| test_true(entries[0].name.indexOf('#hash=1') > -1, "There should be a hash in the resource name"); |
| } |
| done(); |
| |
| } |
| image.src = url; |
| } |
| window.onload = onload_test; |
| </script> |
| </head> |
| <body> |
| <h1>Description</h1> |
| <p>This test validates that a hash in an image URL is preserved in resource timing API results.</p> |
| <div id="log"></div> |
| </body> |
| </html> |