mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibWeb: Add basic Navigator send beacon support
This commit is contained in:
parent
d262670729
commit
9939b028c6
9 changed files with 156 additions and 0 deletions
23
Tests/LibWeb/Text/input/HTML/navigator-beacon.html
Normal file
23
Tests/LibWeb/Text/input/HTML/navigator-beacon.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let testCounter = 1;
|
||||
function testPart(part) {
|
||||
try {
|
||||
println(`${testCounter}. ${JSON.stringify(part())}`);
|
||||
} catch (e) {
|
||||
println(`${testCounter}. Exception: ${e.name}`);
|
||||
}
|
||||
testCounter++;
|
||||
}
|
||||
|
||||
// 1. Send beacon
|
||||
testPart(() => navigator.sendBeacon('https://example.com/') == true);
|
||||
|
||||
// 2. Send beacon with wrong URL
|
||||
testPart(() => navigator.sendBeacon('dsfhdsaklfhdasklf'));
|
||||
|
||||
// 3. Send beacon with wrong scheme
|
||||
testPart(() => navigator.sendBeacon('wss://example.com/'));
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue