Skip to content

Truly independent web browser

912 B
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
    asyncTest(async done => {
        await internals.setPermission("notifications", "granted");
        const notification = new Notification("Hello", { body: "World", tag: "t1" });
        notification.onshow = () => {
            const state = JSON.parse(internals.notificationsStateForTesting());
            println(`shown: ${state.shown.length}`);
            const shown = state.shown[0];
            println(`title: ${shown.title}`);
            println(`body: ${shown.body}`);
            println(`tag: ${shown.tag}`);
            println(`hasIcon: ${shown.hasIcon}`);
            println(`silent: ${shown.silent}`);
            println(`requireInteraction: ${shown.requireInteraction}`);
            notification.close();
            done();
        };
        notification.onerror = () => { println("error"); done(); };
    });
</script>