Bug 1496151 [wpt PR 13340] - [Background Fetch] Surface background-fetch permission., a=testonly
authorMugdha Lakhani <nator@chromium.org>
Thu, 11 Oct 2018 09:31:08 +0000
changeset 441024 ae5884fdd537dd3ebcffbd4a36d33f5284ada8b1
parent 441023 bcd7b358b492a08052588e078fb11a8c371c01d1
child 441025 c8098d6a8df2712260e25984e801f09a9da5f45f
push id34842
push useraciure@mozilla.com
push dateSat, 13 Oct 2018 09:36:47 +0000
treeherdermozilla-central@94a62c1aad52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1496151, 13340, 886896, 1233714, 597209
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 1496151 [wpt PR 13340] - [Background Fetch] Surface background-fetch permission., a=testonly Automatic update from web-platform-tests[Background Fetch] Surface background-fetch permission. "background-fetch" permission was added to the Permissions API with this commit: https://github.com/w3c/permissions/pull/183/commits/096436eb59caaa5b244b0514d84f287392cb069b Chrome uses Automatic Downloads for this permission, so as not to add yet another user facing permission to the UI. This CL: 1. Adds a background_fetch content setting, because that's needed by PermissionContext and allows us to decouple from Automatic Downloads content setting. 2. Adds a BackgroundFetch PermissionContext mapped to this content setting. 3. Makes this PermissionContext decide whether background fetch() is permitted, which we do by: a. Querying DownloadRequestLimiter when there' a top level frame. b. Querying the Automatic Downloads content setting in other cases. For context and details, please see this document: https://docs.google.com/document/d/1rPYSlbzScw_6PLUJ3m96ZLIkxXVAWyBSL75-VDJEMso/edit?usp=sharing Bug: 886896 Change-Id: Id0fcc64d4242290f3782c61ef11babe5717b409f Reviewed-on: https://chromium-review.googlesource.com/c/1233714 Commit-Queue: Mugdha Lakhani <nator@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: Rayan Kanso <rayankans@chromium.org> Reviewed-by: Tobias Sargeant <tobiasjs@chromium.org> Reviewed-by: Raymes Khoury <raymes@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Reviewed-by: Dominick Ng <dominickn@chromium.org> Reviewed-by: Steven Bennetts <stevenjb@chromium.org> Cr-Commit-Position: refs/heads/master@{#597209} -- wpt-commits: 4628f5216505689a175103d430e059d4f7eaac74 wpt-pr: 13340
--- a/testing/web-platform/tests/permissions/interfaces.any.js
+++ b/testing/web-platform/tests/permissions/interfaces.any.js
@@ -17,16 +17,17 @@ promise_test(async () => {
   const idl_array = new IdlArray();
   try {
     self.permissionStatus = await navigator.permissions.query({ name: "geolocation" });
+    self.permissionStatus = await navigator.permissions.query({ name: "background-fetch"});
   } catch (e) {
     // Will be surfaced in idlharness.js's test_object below.
   if (self.GLOBAL.isWorker()) {
     idl_array.add_objects({ WorkerNavigator: ['navigator'] });
   } else {
     idl_array.add_objects({ Navigator: ['navigator'] });
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/permissions/test-background-fetch-permission.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Test Background Fetch Permission.</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id="log"></div>
+  promise_test(function(test) {
+    internals.runtimeFlags.backgroundFetchEnabled = true;
+    return navigator.permissions.query({name:'background-fetch'}).then(function(result) {
+      assert_true(result instanceof PermissionStatus);
+    });
+  });