Commit 821c5a89 authored by Mugdha Lakhani's avatar Mugdha Lakhani Committed by Commit Bot

[Background Fetch] Ship it!

This removes all checks for feature flags, removes the feature flags
themselves, and updates any affected tests.

Intent to Ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/-iAATJCpcNY

Bug: 704729
Change-Id: I69bfd29787ad5d3299991cfa1b77f33c597a8e57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508092
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Commit-Queue: Peter Beverloo <peter@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarTobias Sargeant <tobiasjs@chromium.org>
Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638711}
parent 26bd514d
......@@ -294,8 +294,6 @@ AwBrowserContext::GetClientHintsControllerDelegate() {
content::BackgroundFetchDelegate*
AwBrowserContext::GetBackgroundFetchDelegate() {
// TODO(crbug.com/766077): Resolve whether to support or disable background
// fetch on WebView.
return nullptr;
}
......
......@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
......@@ -229,12 +228,6 @@ class BackgroundFetchBrowserTest : public InProcessBrowserTest {
std::make_unique<OfflineContentProviderObserver>()) {}
~BackgroundFetchBrowserTest() override = default;
void SetUpCommandLine(base::CommandLine* command_line) override {
// Background Fetch is available as an experimental Web Platform feature.
command_line->AppendSwitch(
switches::kEnableExperimentalWebPlatformFeatures);
}
void SetUpOnMainThread() override {
https_server_ = std::make_unique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS);
......
......@@ -7,7 +7,7 @@
[
Constructor(DOMString type, BackgroundFetchEventInit init),
Exposed=ServiceWorker,
OriginTrialEnabled=BackgroundFetch
RuntimeEnabled=BackgroundFetch
] interface BackgroundFetchEvent : ExtendableEvent {
readonly attribute BackgroundFetchRegistration registration;
};
......@@ -6,7 +6,7 @@
[
Exposed=(Window,Worker),
OriginTrialEnabled=BackgroundFetch
RuntimeEnabled=BackgroundFetch
] interface BackgroundFetchManager {
[CallWith=ScriptState, RaisesException, MeasureAs=BackgroundFetchManagerFetch] Promise<BackgroundFetchRegistration> fetch(DOMString id, (RequestInfo or sequence<RequestInfo>) requests, optional BackgroundFetchOptions options);
[CallWith=ScriptState, MeasureAs=BackgroundFetchManagerGet] Promise<BackgroundFetchRegistration?> get(DOMString id);
......
......@@ -6,7 +6,7 @@
[
Exposed=(Window,Worker),
OriginTrialEnabled=BackgroundFetch
RuntimeEnabled=BackgroundFetch
] interface BackgroundFetchRecord {
readonly attribute Request request;
[CallWith=ScriptState] readonly attribute Promise<Response> responseReady;
......
......@@ -5,7 +5,7 @@
// https://wicg.github.io/background-fetch/#background-fetch-registration
[
Exposed=(Window,Worker),
OriginTrialEnabled=BackgroundFetch,
RuntimeEnabled=BackgroundFetch,
ActiveScriptWrappable
] interface BackgroundFetchRegistration : EventTarget {
readonly attribute DOMString id;
......
......@@ -7,7 +7,7 @@
[
Constructor(DOMString type, BackgroundFetchEventInit init),
Exposed=ServiceWorker,
OriginTrialEnabled=BackgroundFetch
RuntimeEnabled=BackgroundFetch
] interface BackgroundFetchUpdateUIEvent : BackgroundFetchEvent {
[CallWith=ScriptState] Promise<void> updateUI(BackgroundFetchUIOptions options);
};
\ No newline at end of file
......@@ -6,7 +6,7 @@
[
ImplementedAs=ServiceWorkerGlobalScopeBackgroundFetch,
OriginTrialEnabled=BackgroundFetch
RuntimeEnabled=BackgroundFetch
] partial interface ServiceWorkerGlobalScope {
attribute EventHandler onbackgroundfetchsuccess;
attribute EventHandler onbackgroundfetchfail;
......
......@@ -7,7 +7,7 @@
[
Exposed=(Window,Worker),
ImplementedAs=ServiceWorkerRegistrationBackgroundFetch,
OriginTrialEnabled=BackgroundFetch
RuntimeEnabled=BackgroundFetch
] partial interface ServiceWorkerRegistration {
readonly attribute BackgroundFetchManager backgroundFetch;
};
......@@ -140,11 +140,6 @@ PermissionDescriptorPtr ParsePermission(ScriptState* script_state,
if (name == "payment-handler")
return CreatePermissionDescriptor(PermissionName::PAYMENT_HANDLER);
if (name == "background-fetch") {
if (!origin_trials::BackgroundFetchEnabled(
ExecutionContext::From(script_state))) {
exception_state.ThrowTypeError("Background Fetch is not enabled.");
return nullptr;
}
return CreatePermissionDescriptor(PermissionName::BACKGROUND_FETCH);
}
if (name == "idle-detection")
......
......@@ -138,8 +138,7 @@
},
{
name: "BackgroundFetch",
origin_trial_feature_name: "BackgroundFetch",
status: "experimental",
status: "stable",
},
{
name: "BackgroundVideoTrackOptimization",
......
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Generate token with the command:
generate_token.py http://127.0.0.1:8000 BackgroundFetch --expire-timestamp=2000000000
-->
<meta http-equiv="origin-trial" content="AtDl/AukAuUX0Sw7KRz+mrV2vpSYrfDyVS4vdO3I1clqoNgKGqCX5Np5KIhlC6oQl8XcULXJz5bc9Y4CcYj9xA4AAABXeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQmFja2dyb3VuZEZldGNoIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9" />
<title>Background Fetch API - interfaces exposed by origin trial</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/origin-trials-helper.js"></script>
<script src="/serviceworker/resources/test-helpers.js"></script>
<script>
test(t => {
OriginTrialsHelper.check_properties(this, {
'BackgroundFetchManager': ['fetch', 'get', 'getIds'],
'BackgroundFetchUpdateUIEvent': ['updateUI'],
'BackgroundFetchRegistration': ['id', 'uploadTotal', 'uploaded',
'downloadTotal', 'downloaded', 'result',
'failureReason', 'recordsAvailable',
'onprogress', 'match', 'matchAll'],
'ServiceWorkerRegistration': ['backgroundFetch'],
});
}, 'Background Fetch API interfaces and properties in Origin-Trial enabled document.');
fetch_tests_from_worker(new Worker('resources/backgroundfetch-origin-trial-interfaces-worker.js'));
// Only run "disabled" tests if the feature is not enabled via runtime flags.
if (!self.internals.runtimeFlags.backgroundFetchEnabled) {
service_worker_test('resources/backgroundfetch-origin-trial-interfaces-serviceworker-disabled.js');
}
service_worker_test('resources/backgroundfetch-origin-trial-interfaces-serviceworker-enabled.php');
</script>
importScripts('/resources/testharness.js',
'/resources/origin-trials-helper.js');
test(t => {
OriginTrialsHelper.check_interfaces_missing(
self,
['BackgroundFetchEvent', 'BackgroundFetchFetch', 'BackgroundFetchManager',
'BackgroundFetchUpdateUIEvent', 'BackgroundFetchRecord',
'BackgroundFetchRegistration']);
}, 'Background Fetch API interfaces in Origin-Trial disabled worker.');
done();
<?php
// Generate token with the command:
// generate_token.py http://127.0.0.1:8000 BackgroundFetch --expire-timestamp=2000000000
header('Origin-Trial: AtDl/AukAuUX0Sw7KRz+mrV2vpSYrfDyVS4vdO3I1clqoNgKGqCX5Np5KIhlC6oQl8XcULXJz5bc9Y4CcYj9xA4AAABXeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQmFja2dyb3VuZEZldGNoIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9');
header('Content-Type: application/javascript');
?>
importScripts('/resources/testharness.js',
'/resources/origin-trials-helper.js');
test(t => {
OriginTrialsHelper.check_properties(this, {
'ServiceWorkerRegistration': ['backgroundFetch'],
'BackgroundFetchManager': ['fetch', 'get', 'getIds'],
'BackgroundFetchEvent': ['registration'],
'BackgroundFetchUpdateUIEvent': ['updateUI'],
'BackgroundFetchRecord': ['request', 'responseReady'],
'BackgroundFetchRegistration': ['id', 'uploadTotal', 'uploaded',
'downloadTotal', 'downloaded', 'result',
'failureReason', 'recordsAvailable',
'onprogress', 'abort', 'match', 'matchAll'],
});
});
test(t => {
assert_true('onbackgroundfetchsuccess' in self, 'onbackgroundfetchsuccess property exists on global');
assert_true('onbackgroundfetchfail' in self, 'onbackgroundfetchfail property exists on global');
assert_true('onbackgroundfetchabort' in self, 'onbackgroundfetchabort property exists on global');
assert_true('onbackgroundfetchclick' in self, 'onbackgroundfetchclick property exists on global');
}, 'Background Fetch API entry points in Origin-Trial enabled serviceworker.');
done();
importScripts('/resources/testharness.js',
'/resources/origin-trials-helper.js');
test(t => {
OriginTrialsHelper.check_properties(this, {
'ServiceWorkerRegistration': ['backgroundFetch'],
'BackgroundFetchManager': ['fetch', 'get', 'getIds'],
'BackgroundFetchRegistration': ['id', 'uploadTotal', 'uploaded',
'downloadTotal', 'downloaded', 'result',
'failureReason', 'recordsAvailable',
'onprogress'],
});
}, 'Background Fetch API interfaces in an Origin-Trial enabled worker.');
done();
......@@ -14,6 +14,41 @@ interface AbortSignal : EventTarget
getter onabort
method constructor
setter onabort
interface BackgroundFetchEvent : ExtendableEvent
attribute @@toStringTag
getter registration
method constructor
interface BackgroundFetchManager
attribute @@toStringTag
method constructor
method fetch
method get
method getIds
interface BackgroundFetchRecord
attribute @@toStringTag
getter request
getter responseReady
method constructor
interface BackgroundFetchRegistration : EventTarget
attribute @@toStringTag
getter downloadTotal
getter downloaded
getter failureReason
getter id
getter onprogress
getter recordsAvailable
getter result
getter uploadTotal
getter uploaded
method abort
method constructor
method match
method matchAll
setter onprogress
interface BackgroundFetchUpdateUIEvent : BackgroundFetchEvent
attribute @@toStringTag
method constructor
method updateUI
interface Blob
attribute @@toStringTag
getter size
......@@ -1021,6 +1056,7 @@ interface ServiceWorkerGlobalScope : WorkerGlobalScope
interface ServiceWorkerRegistration : EventTarget
attribute @@toStringTag
getter active
getter backgroundFetch
getter installing
getter navigationPreload
getter onupdatefound
......@@ -2527,6 +2563,10 @@ interface WritableStream
getter clients
getter onabortpayment
getter onactivate
getter onbackgroundfetchabort
getter onbackgroundfetchclick
getter onbackgroundfetchfail
getter onbackgroundfetchsuccess
getter oncanmakepayment
getter onfetch
getter oninstall
......@@ -2542,6 +2582,10 @@ interface WritableStream
method skipWaiting
setter onabortpayment
setter onactivate
setter onbackgroundfetchabort
setter onbackgroundfetchclick
setter onbackgroundfetchfail
setter onbackgroundfetchsuccess
setter oncanmakepayment
setter onfetch
setter oninstall
......
......@@ -15,6 +15,33 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] getter onabort
[Worker] method constructor
[Worker] setter onabort
[Worker] interface BackgroundFetchManager
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] method fetch
[Worker] method get
[Worker] method getIds
[Worker] interface BackgroundFetchRecord
[Worker] attribute @@toStringTag
[Worker] getter request
[Worker] getter responseReady
[Worker] method constructor
[Worker] interface BackgroundFetchRegistration : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter downloadTotal
[Worker] getter downloaded
[Worker] getter failureReason
[Worker] getter id
[Worker] getter onprogress
[Worker] getter recordsAvailable
[Worker] getter result
[Worker] getter uploadTotal
[Worker] getter uploaded
[Worker] method abort
[Worker] method constructor
[Worker] method match
[Worker] method matchAll
[Worker] setter onprogress
[Worker] interface Blob
[Worker] attribute @@toStringTag
[Worker] getter size
......@@ -961,6 +988,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] interface ServiceWorkerRegistration : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter active
[Worker] getter backgroundFetch
[Worker] getter installing
[Worker] getter navigationPreload
[Worker] getter onupdatefound
......
......@@ -228,6 +228,33 @@ interface AuthenticatorResponse
attribute @@toStringTag
getter clientDataJSON
method constructor
interface BackgroundFetchManager
attribute @@toStringTag
method constructor
method fetch
method get
method getIds
interface BackgroundFetchRecord
attribute @@toStringTag
getter request
getter responseReady
method constructor
interface BackgroundFetchRegistration : EventTarget
attribute @@toStringTag
getter downloadTotal
getter downloaded
getter failureReason
getter id
getter onprogress
getter recordsAvailable
getter result
getter uploadTotal
getter uploaded
method abort
method constructor
method match
method matchAll
setter onprogress
interface BarProp
attribute @@toStringTag
getter visible
......@@ -6362,6 +6389,7 @@ interface ServiceWorkerContainer : EventTarget
interface ServiceWorkerRegistration : EventTarget
attribute @@toStringTag
getter active
getter backgroundFetch
getter installing
getter navigationPreload
getter onupdatefound
......
......@@ -15,6 +15,33 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] getter onabort
[Worker] method constructor
[Worker] setter onabort
[Worker] interface BackgroundFetchManager
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] method fetch
[Worker] method get
[Worker] method getIds
[Worker] interface BackgroundFetchRecord
[Worker] attribute @@toStringTag
[Worker] getter request
[Worker] getter responseReady
[Worker] method constructor
[Worker] interface BackgroundFetchRegistration : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter downloadTotal
[Worker] getter downloaded
[Worker] getter failureReason
[Worker] getter id
[Worker] getter onprogress
[Worker] getter recordsAvailable
[Worker] getter result
[Worker] getter uploadTotal
[Worker] getter uploaded
[Worker] method abort
[Worker] method constructor
[Worker] method match
[Worker] method matchAll
[Worker] setter onprogress
[Worker] interface Blob
[Worker] attribute @@toStringTag
[Worker] getter size
......@@ -956,6 +983,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] interface ServiceWorkerRegistration : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter active
[Worker] getter backgroundFetch
[Worker] getter installing
[Worker] getter navigationPreload
[Worker] getter onupdatefound
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment