| <html> |
| <!-- |
| A page that fetches only "prefetch.js" when scanned by NoStatePrefetch, and |
| fetches "prefetch_meta.js" in addition to that if javascript execution happens |
| on the page. In all cases the scripts are executed in a blocking manner. |
| |
| By prefetching this page, a browsertest can verify that javascript was not |
| executed (prefetch_meta.js should not be requested to load even after the page |
| has been fully prefetched (or loaded)). |
| |
| Note: there is no way to ensure that the script loaded via .appendChild() or a |
| sync XHR happens before a preload-scannable request because preload scanner is |
| racy and often fetches resources it sees before the inline script has a chance |
| to execute. |
| --> |
| <body> |
| <script> |
| var s = document.createElement("script"); |
| s.src = "prefetch_meta.js"; |
| document.body.appendChild(s); |
| </script> |
| |
| <!-- Ordering is imporant here because the test harness relies on sequential |
| parsing of this page. When a fetch request for prefetch.js happens, it can |
| be safely assumed that the browser has parsed the inline script above. --> |
| <script src="prefetch.js"></script> |
| |
| Some content that is necessary for registering paint metrics. |
| </body> |
| |
| <head> |
| <!-- Ordering on the page is important. --> |
| <title>Prefetch Page</title> |
| </head> |
| </html> |