Automatic update from web-platform-tests Add more URL parser encoding parameter tests In particular for sendBeacon() and the Media Session API. (Inspired by a test from Kagami for the Notifications API where we also fix the spelling per feedback from Kagami.) -- wpt-commits: affe94c734e676a2a137825cc9d99109a278f77d wpt-pr: 59851
31 lines
1.1 KiB
HTML
31 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="euc-kr">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
// This file is actually ascii, because otherwise text editors would have hard time.
|
|
|
|
promise_test(async (t) => {
|
|
// "icon" in Korean language
|
|
const iconKorean = "\uc544\uc774\ucf58";
|
|
const id = crypto.randomUUID();
|
|
|
|
assert_true(navigator.sendBeacon(
|
|
`/beacon/resources/url-echo.py?cmd=store&id=${id}&icon=${iconKorean}`, "x"));
|
|
|
|
// Poll the echo endpoint until the beacon is received. The stored value
|
|
// is the raw query string sendBeacon() sent.
|
|
const statUrl = `/beacon/resources/url-echo.py?cmd=stat&id=${id}`;
|
|
for (let i = 0; i < 30; i++) {
|
|
const response = await fetch(statUrl);
|
|
const text = await response.text();
|
|
if (text) {
|
|
assert_equals(text, `cmd=store&id=${id}&icon=%EC%95%84%EC%9D%B4%EC%BD%98`, "URL encoded with utf-8");
|
|
return;
|
|
}
|
|
await new Promise(resolve => t.step_timeout(resolve, 200));
|
|
}
|
|
assert_unreached("sendBeacon was not received");
|
|
});
|
|
</script>
|