blob: 5a71eaa4abf359008d84d1f219083ec1a91a6458 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="help" href="https://github.com/w3c/web-share/pull/113" />
<title>WebShare Test: only one share at a time</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
</head>
<body>
<script>
promise_test(async t => {
const [, promise2, promise3] = await test_driver.bless(
"share needs user activation",
() => {
return [
navigator.share({ title: "should be pending" }),
navigator.share({ title: "should reject" }),
navigator.share({ title: "should also reject" }),
];
}
);
await Promise.all([
promise_rejects(t, "InvalidStateError", promise2),
promise_rejects(t, "InvalidStateError", promise3),
]);
}, "Only allow one share call at a time, which is controlled by the [[sharePromise]] internal slot.");
</script>
</body>
</html>