Bug 1497323 [wpt PR 13366] - Enable FP reporting for EME policy violations., a=testonly
authorIan Clelland <iclelland@chromium.org>
Thu, 11 Oct 2018 09:30:36 +0000
changeset 499459 b8e822211da2d7b707f8b89b4d28146ad5e0f141
parent 499458 7f9995d90affed02070d111f906f7fa676f285cc
child 499460 629151c9becabbb8648e3badcce0fb96335c08c6
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1497323, 13366, 867471, 1261921, 596965
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1497323 [wpt PR 13366] - Enable FP reporting for EME policy violations., a=testonly Automatic update from web-platform-testsEnable FP reporting for EME policy violations. This queues a report through the Reporting API whenever requestMediaKeySystemAccess is called in a frame in which the 'encrypted-media' feature is not allowed according to feature policy. Bug: 867471 Change-Id: I781cf9d9719bcbaffe0b328c2b6bfa5ca197920a Reviewed-on: https://chromium-review.googlesource.com/c/1261921 Reviewed-by: David Dorwin <ddorwin@chromium.org> Commit-Queue: Ian Clelland <iclelland@chromium.org> Cr-Commit-Position: refs/heads/master@{#596965} -- wpt-commits: 45fe4bda8ce30614d0935b11b7d27e269401361c wpt-pr: 13366
testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html
testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html.headers
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script src='/resources/testharness.js'></script>
+    <script src='/resources/testharnessreport.js'></script>
+  </head>
+  <body>
+    <script>
+var check_report_format = (reports, observer) => {
+  let report = reports[0];
+  assert_equals(report.type, "feature-policy");
+  assert_equals(report.url, document.location.href);
+  assert_equals(report.body.feature, "encrypted-media");
+  assert_equals(report.body.sourceFile, document.location.href);
+  assert_equals(typeof report.body.message, "string");
+  assert_equals(typeof report.body.lineNumber, "number");
+  assert_equals(typeof report.body.columnNumber, "number");
+};
+
+promise_test(async t => {
+  const report = new Promise(resolve => {
+    new ReportingObserver((reports, observer) => resolve([reports, observer]),
+                          {types: ['feature-policy']}).observe();
+  });
+  await promise_rejects(t, "SecurityError",
+    navigator.requestMediaKeySystemAccess("org.w3.clearkey",
+      [{
+        initDataTypes: ["webm"],
+        videoCapabilities: [{contentType: 'video/webm;codecs="vp8"'}],
+      }]),
+      "requestMediaKeySystemAccess() should not be allowed in this document.");
+  const [reports, observer] = await report;
+  check_report_format(reports, observer);
+}, "Encrypted Media report format");
+    </script>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html.headers
@@ -0,0 +1,1 @@
+Feature-Policy: encrypted-media 'none'