Skip to content

Commit

Permalink
WebShare: Introduce web-share feature policy
Browse files Browse the repository at this point in the history
share() requests fail with a rejected promise if the 'web-share'
feature is not enabled.

We define 'self' as the default feature policy for web-share.

The spec has been updated
w3c/web-share#166

Intent to Ship
https://groups.google.com/a/chromium.org/g/blink-dev/c/fgme9KOd8CU/m/TCYPKQAXAwAJ

Bug: 1079104
Change-Id: Id4030448a54589eddb45185cbd6fd8970aee34c3
  • Loading branch information
ericwilligers authored and chromium-wpt-export-bot committed Jul 18, 2020
1 parent 421cc5e commit d8e1b3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions web-share/disabled-by-feature-policy.https.sub.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>WebShare Test: Can be disabled by feature policy</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 => {
await test_driver.bless("web share");

await promise_rejects_dom(t, "NotAllowedError", navigator.share({title: 'the title', text: 'the message'}));
}, "share can be disabled by feature policy");
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Feature-Policy: web-share 'none'

0 comments on commit d8e1b3c

Please sign in to comment.