blob: e2141fe5ee5b19ed1ea6fe883967caab2bd1ca0c [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>Insecure inscope page</title>
<script>
// The top window messages us when it wants to check for a controller.
window.onmessage = (async e => {
if (navigator.serviceWorker) {
window.top.postMessage('FAIL: navigator.serviceWorker is defined on an insecure context', '*');
return;
}
// Perform a fetch() to detect whether a service worker controls this page.
const response = await fetch('simple.txt');
const text = await response.text();
if (text != 'a simple text file\n') {
window.top.postMessage('FAIL: fetched ' + text, '*');
return;
}
window.top.postMessage('PASS', '*');
});
</script>