Test uses legacy Report-To. It's only intended for NEL, which is a different context. The actual documents and workers also need to be served with Reporting-Endpoints, you can't just make a request for a document or worker and have that request update the fetching document's endpoint lists, that is not how Reporting API works anymore. Differential Revision: https://phabricator.services.mozilla.com/D282134
48 lines
1.1 KiB
HTML
48 lines
1.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test for delivering reports</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
|
|
<script type="application/javascript">
|
|
|
|
// Setting prefs.
|
|
SpecialPowers.pushPrefEnv({ set: [
|
|
["dom.reporting.enabled", true],
|
|
["dom.reporting.header.enabled", true],
|
|
["dom.reporting.delivering.timeout", 1],
|
|
["dom.reporting.delivering.maxFailures", 2],
|
|
["dom.reporting.delivering.maxReports", 3],
|
|
]})
|
|
|
|
// Tests run in iframes because the origin must be secure for Reporting-Endpoints header.
|
|
.then(_ => {
|
|
window.addEventListener("message", e => {
|
|
if (e.data.type == "finish") {
|
|
SimpleTest.finish();
|
|
return;
|
|
}
|
|
|
|
if (e.data.type == "test") {
|
|
ok(e.data.check, e.data.msg);
|
|
return;
|
|
}
|
|
|
|
ok(false, "Invalid message");
|
|
});
|
|
|
|
let ifr = document.createElement("iframe");
|
|
ifr.src = "https://example.org/tests/dom/reporting/tests/delivering.sjs?task=iframe";
|
|
|
|
document.body.appendChild(ifr);
|
|
});
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|