Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Errors
- This test gets skipped with pattern: xorigin
- This test failed 28 times in the preceding 30 days. quicksearch this test
- Manifest: dom/notification/test/mochitest/mochitest.toml
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/dom/notification/test/mochitest/MockAlertsService.js"></script>
<script type="text/javascript" src="/tests/dom/notification/test/mochitest/NotificationTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
<script src="/tests/dom/serviceworkers/test/utils.js"></script>
<script type="text/javascript">
SimpleTest.requestFlakyTimeout("Mock alert service dispatches show and click events.");
function testFrame(src) {
var iframe = document.createElement("iframe");
iframe.src = src;
window.callback = async function(result) {
window.callback = null;
document.body.removeChild(iframe);
iframe = null;
ok(result, "All tests passed.");
await registration.unregister();
SimpleTest.finish();
};
document.body.appendChild(iframe);
}
var registration;
async function runTest() {
try {
await NotificationTest.allowNotifications();
await MockAlertsService.register();
await MockAlertsService.enableAutoClick();
registration = await navigator.serviceWorker.register(
"notificationclick_focus.js",
{ scope: "notificationclick_focus.html" }
);
await waitForState(registration.installing, 'activated');
} catch (e) {
ok(false, "registration should have passed!");
SimpleTest.finish();
}
testFrame('notificationclick_focus.html');
};
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.serviceWorkers.disable_open_click_delay", 1000],
]}, runTest);
</script>
</body>
</html>