Skip to content

Commit

Permalink
Add a runtime enabled feature for potential permissions policy violation
Browse files Browse the repository at this point in the history
Implements w3c/webappsec-permissions-policy#546

Bug: 40941424
Change-Id: I969a7ce326986b2a05f9417038f5d164ca6308dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925839
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Auto-Submit: Jun Kokatsu <jkokatsu@google.com>
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1403647}
  • Loading branch information
shhnjk authored and chromium-wpt-export-bot committed Jan 8, 2025
1 parent fed5fd6 commit 0da5f39
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<script>
var t = async_test("Camera Potential Report Format");

var check_report_format = (reports, observer) => {
let report = reports[0];
assert_equals(report.type, "potential-permissions-policy-violation");
assert_equals(report.url, document.location.href);
assert_equals(report.body.featureId, "camera");
assert_equals(report.body.disposition, "report");
};

new ReportingObserver(t.step_func_done(check_report_format),
{types: ['potential-permissions-policy-violation']}).observe();

const iframe = document.createElement('iframe');
iframe.allow = "camera";
iframe.src = "/";
document.body.appendChild(iframe);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Permissions-Policy-Report-Only: camera=()
28 changes: 28 additions & 0 deletions permissions-policy/reporting/camera-potential-reporting.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<script>
var t = async_test("Camera Potential Report Format");

var check_report_format = (reports, observer) => {
let report = reports[0];
assert_equals(report.type, "potential-permissions-policy-violation");
assert_equals(report.url, document.location.href);
assert_equals(report.body.featureId, "camera");
assert_equals(report.body.disposition, "enforce");
};

new ReportingObserver(t.step_func_done(check_report_format),
{types: ['potential-permissions-policy-violation']}).observe();

const iframe = document.createElement('iframe');
iframe.allow = "camera";
iframe.src = "/";
document.body.appendChild(iframe);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Permissions-Policy: camera=()

0 comments on commit 0da5f39

Please sign in to comment.