| OLD | NEW |
| (Empty) | |
| 1 <?php |
| 2 header("Link: <http://127.0.0.1:8000/resources/square.png>;rel=prefetch", |
| 3 false); |
| 4 ?> |
| 5 <!DOCTYPE html> |
| 6 <html> |
| 7 <head></head> |
| 8 <body> |
| 9 <script src="/resources/testharness.js"></script> |
| 10 <script src="/resources/testharnessreport.js"></script> |
| 11 <script> |
| 12 var observer = new PerformanceObserver(function(list) { |
| 13 list.getEntries().forEach(function(entry) { |
| 14 if (entry.name.indexOf("square.png") != -1) { |
| 15 // If we found a resource timing entry of the prefetched image, |
| 16 // the test passes. |
| 17 t.done(); |
| 18 } |
| 19 }); |
| 20 }); |
| 21 observer.observe({entryTypes: ["resource"]}); |
| 22 var t = async_test('Makes sure that Link headers prefetch resources'); |
| 23 </script> |
| 24 <script> |
| 25 window.addEventListener("load", t.step_func(function() { |
| 26 var entries = |
| 27 performance.getEntriesByName( |
| 28 "http://127.0.0.1:8000/resources/square.png"); |
| 29 if (entries.length) { |
| 30 assert_equals(entries.length, 1); |
| 31 t.done(); |
| 32 } |
| 33 })); |
| 34 </script> |
| 35 </body> |
| 36 </html> |
| OLD | NEW |