2026-10-09 09:39:37 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<title>confinement</title>
|
|
|
|
|
<style>
|
2026-10-09 10:03:30 +00:00
|
|
|
@import url('@HTTP@style.css');
|
|
|
|
|
@font-face { font-family: probe; src: url('@HTTP@font.woff'); }
|
2026-10-09 09:39:37 +00:00
|
|
|
html, body { margin: 0; height: 100%; }
|
2026-10-09 10:03:30 +00:00
|
|
|
body { display: flex; flex-direction: column; font-family: probe; }
|
2026-10-09 09:39:37 +00:00
|
|
|
div { flex: 1; background: #808080; }
|
2026-10-09 10:03:30 +00:00
|
|
|
iframe { position: absolute; width: 1px; height: 1px; border: 0; }
|
2026-10-09 09:39:37 +00:00
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div id="own-image"></div>
|
|
|
|
|
<div id="bridge"></div>
|
|
|
|
|
<div id="outside-image"></div>
|
|
|
|
|
<div id="other-image"></div>
|
2026-10-09 10:03:30 +00:00
|
|
|
<div id="linked-image"></div>
|
2026-10-09 09:39:37 +00:00
|
|
|
<div id="http-image"></div>
|
|
|
|
|
<div id="http-fetch"></div>
|
|
|
|
|
<div id="websocket"></div>
|
2026-10-09 10:03:30 +00:00
|
|
|
<div id="worker-fetch"></div>
|
|
|
|
|
<div id="srcdoc-internals"></div>
|
|
|
|
|
<span>probe</span>
|
|
|
|
|
<iframe srcdoc="<img src='@HTTP@srcdoc.png'><script>parent.postMessage('servo:' + typeof navigator.servo, '*');</script>"></iframe>
|
2026-10-09 09:39:37 +00:00
|
|
|
<script>
|
|
|
|
|
// One band per probe: green when the outcome matches the policy, red when it
|
|
|
|
|
// does not. Every refused probe would succeed without the policy: the images
|
2026-10-09 10:03:30 +00:00
|
|
|
// are valid PNG files, the fetches use no-cors, so an opaque response would
|
|
|
|
|
// resolve them, and the WebSocket listener completes the handshake. The
|
|
|
|
|
// stylesheet import, the font, the frame's image and the beacon have no band;
|
|
|
|
|
// the harness requires that none of them reaches its server. The harness
|
|
|
|
|
// substitutes the server URLs and the path of a file outside the package.
|
|
|
|
|
var HTTP = '@HTTP@';
|
|
|
|
|
var WS = '@WS@';
|
2026-10-09 09:39:37 +00:00
|
|
|
var OTHER = '@OTHER_URL@';
|
|
|
|
|
|
|
|
|
|
function mark(id, ok) {
|
|
|
|
|
document.getElementById(id).style.background = ok ? '#00c000' : '#e00000';
|
|
|
|
|
}
|
|
|
|
|
function image(id, src, shouldLoad) {
|
|
|
|
|
var img = new Image();
|
|
|
|
|
img.onload = function () { mark(id, shouldLoad); };
|
|
|
|
|
img.onerror = function () { mark(id, !shouldLoad); };
|
|
|
|
|
img.src = src;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
image('own-image', 'own.png', true);
|
|
|
|
|
image('outside-image', '../outside.png', false);
|
|
|
|
|
image('other-image', OTHER, false);
|
2026-10-09 10:03:30 +00:00
|
|
|
image('linked-image', 'linked/other.png', false);
|
2026-10-09 09:39:37 +00:00
|
|
|
image('http-image', HTTP + 'image.png', false);
|
|
|
|
|
fetch(HTTP + 'probe', { mode: 'no-cors' }).then(
|
|
|
|
|
function () { mark('http-fetch', false); },
|
|
|
|
|
function () { mark('http-fetch', true); });
|
|
|
|
|
|
|
|
|
|
try {
|
2026-10-09 10:03:30 +00:00
|
|
|
var ws = new WebSocket(WS);
|
2026-10-09 09:39:37 +00:00
|
|
|
ws.onopen = function () { mark('websocket', false); };
|
|
|
|
|
ws.onerror = function () { mark('websocket', true); };
|
|
|
|
|
} catch (e) {
|
|
|
|
|
mark('websocket', true);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-09 10:03:30 +00:00
|
|
|
try {
|
|
|
|
|
var worker = new Worker('worker.js');
|
|
|
|
|
worker.onmessage = function (event) { mark('worker-fetch', event.data === 'refused'); };
|
|
|
|
|
worker.onerror = function () { mark('worker-fetch', false); };
|
|
|
|
|
worker.postMessage(HTTP + 'worker');
|
|
|
|
|
} catch (e) {
|
|
|
|
|
mark('worker-fetch', false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A srcdoc frame holds this page's content and must not reach the engine's
|
|
|
|
|
// privileged navigator.servo interface.
|
|
|
|
|
addEventListener('message', function (event) {
|
|
|
|
|
if (typeof event.data === 'string' && event.data.indexOf('servo:') === 0) {
|
|
|
|
|
mark('srcdoc-internals', event.data === 'servo:undefined');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
try { navigator.sendBeacon(HTTP + 'beacon', 'probe'); } catch (e) {}
|
|
|
|
|
|
2026-10-09 09:39:37 +00:00
|
|
|
(function bridge() {
|
|
|
|
|
if (!window.weftIpc) { setTimeout(bridge, 50); return; }
|
|
|
|
|
window.weftIpc.onmessage = function (raw) {
|
|
|
|
|
try { mark('bridge', typeof JSON.parse(raw).count === 'number'); } catch (_) {}
|
|
|
|
|
};
|
|
|
|
|
window.weftIpc.send('get');
|
|
|
|
|
})();
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|