58 lines
2.3 KiB
HTML
58 lines
2.3 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Runtime live validation __TAB__</title>
|
|
<style>
|
|
body { font: 16px system-ui, sans-serif; margin: 2rem; max-width: 42rem; }
|
|
button { display: block; margin: 1rem 0; padding: .5rem .8rem; }
|
|
input { display: block; min-width: 20rem; padding: .4rem; }
|
|
</style>
|
|
</head>
|
|
<body data-tab="__TAB__">
|
|
<h1>Runtime fixture __TAB__</h1>
|
|
<p id="ready">Initial runtime fixture __TAB__</p>
|
|
<p id="readable">READABLE_SENTINEL___TAB__</p>
|
|
<label for="private-input">Input sentinel</label>
|
|
<input id="private-input" value="READ_INPUT_SENTINEL___TAB__" autocomplete="off">
|
|
<button id="popup" type="button">Open popup</button>
|
|
<script>
|
|
const tab = document.body.dataset.tab;
|
|
const peerOrigin = __PEER_ORIGIN__;
|
|
const selfOrigin = __SELF_ORIGIN__;
|
|
const ready = document.getElementById("ready");
|
|
const popup = document.getElementById("popup");
|
|
const consoleMarker = `RUNTIME_LIVE_CONSOLE_${tab}`;
|
|
const networkPath = `/runtime-live-network-${tab}`;
|
|
const shouldEmitDiagnostics = tab === "A" || new URL(window.location.href).searchParams.get("emit") === "1";
|
|
|
|
// These are intentionally owned-local requests. They produce origin-only
|
|
// evidence, while the console markers distinguish the two tabs. Tab B is
|
|
// silent until the validator explicitly navigates it with emit=1.
|
|
if (shouldEmitDiagnostics) {
|
|
console.error(consoleMarker);
|
|
void fetch(`${selfOrigin}${networkPath}?sentinel=${encodeURIComponent(consoleMarker)}`);
|
|
if (tab === "A" && new URL(window.location.href).searchParams.get("thirdparty") === "1") {
|
|
void fetch(`${peerOrigin}/runtime-live-third-party?sentinel=RUNTIME_LIVE_THIRD_PARTY_A`);
|
|
}
|
|
}
|
|
|
|
setTimeout(() => {
|
|
ready.textContent = `ASSERT_READY_${tab}`;
|
|
}, 150);
|
|
|
|
popup.addEventListener("click", () => {
|
|
if (tab === "A") {
|
|
ready.textContent = "POPUP_OPEN_REQUESTED";
|
|
window.open(`${peerOrigin}/runtime-live-validation.html?tab=B`, "runtime-live-popup", "popup,width=640,height=480");
|
|
}
|
|
});
|
|
|
|
if (new URL(window.location.href).searchParams.get("tab") === "NAV") {
|
|
ready.textContent = "NAVIGATION_READY";
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|