Commit 16cdb8b1 authored by Fadi Meawad's avatar Fadi Meawad Committed by Commit Bot

[PageLifecycle] Add sendBeacon to the freeze WPT test

navigator.sendBeacon should be allowed during the onfreeze callback,
there was no changes in the code needed to enable it since it is
implemented using fetch-keepalive, that is already allowed.

This CL adds a test to make sure that this does not regress.

Bugi: chromium:838684
Change-Id: I71b628ccce4dfbf1f2bd012c24866cd908f56d30
Reviewed-on: https://chromium-review.googlesource.com/1091638Reviewed-by: default avatarShubhie Panicker <panicker@chromium.org>
Commit-Queue: Fadi Meawad <fmeawad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565478}
parent e4d5118a
......@@ -45,6 +45,15 @@ function testXHR(async) {
};
}
function testSendBeacon() {
var name = 'testSendBeacon';
window.opener.add_step(name);
if (navigator.sendBeacon("foo.txt", "data=1"))
window.opener.step_success(name);
else
window.opener.step_fail(name);
}
window.document.addEventListener("freeze", () => {
// Testing fetch, only fetch keepalive should succeed.
testFetch(true /* keepalive */);
......@@ -52,6 +61,8 @@ window.document.addEventListener("freeze", () => {
// Testing XHR, both sync and async should fail.
testXHR(true /* async */);
testXHR(false /* sync */);
// Testing navigator.sendBeacon, which should be allowed.
testSendBeacon();
window.opener.step_success(freezingStepName);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment