Commit 5b2dd55d authored by Yuzu Saijo's avatar Yuzu Saijo Committed by Commit Bot

[bfcache] Remove ServiceWorker blocklisting

ServiceWorker has now been supported properly for bfcache, and no longer
needs to be blocklisted.
This CL removes the blocklisting and removes the test.

Bug: 1105351
Change-Id: I3dbcefa9400fc9d443e087ac2bd7854981924c94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2296553
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791729}
parent ca3424ad
...@@ -3276,41 +3276,6 @@ std::unique_ptr<net::test_server::HttpResponse> RequestHandlerForUpdateWorker( ...@@ -3276,41 +3276,6 @@ std::unique_ptr<net::test_server::HttpResponse> RequestHandlerForUpdateWorker(
} // namespace } // namespace
IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest,
DoesNotCachePagesWithServiceWorkers) {
ASSERT_TRUE(CreateHttpsServer()->Start());
// 1) Navigate to A.
EXPECT_TRUE(NavigateToURL(
shell(),
https_server()->GetURL("a.com", "/back_forward_cache/empty.html")));
// Register a service worker.
RegisterServiceWorker(current_frame_host());
RenderFrameHostImpl* rfh_a = current_frame_host();
RenderFrameDeletedObserver deleted(rfh_a);
// 2) Navigate away.
shell()->LoadURL(https_server()->GetURL("b.com", "/title1.html"));
// The page is controlled by a service worker, so it shouldn't have been
// cached.
deleted.WaitUntilDeleted();
ExpectOutcomeDidNotChange(FROM_HERE);
// 3) Go back to A.
web_contents()->GetController().GoBack();
EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
ExpectNotRestored(
{BackForwardCacheMetrics::NotRestoredReason::kBlocklistedFeatures},
FROM_HERE);
ExpectBlocklistedFeature(blink::scheduler::WebSchedulerTrackedFeature::
kServiceWorkerControlledPage,
FROM_HERE);
}
class BackForwardCacheBrowserTestWithVibration class BackForwardCacheBrowserTestWithVibration
: public BackForwardCacheBrowserTest, : public BackForwardCacheBrowserTest,
public device::mojom::VibrationManager { public device::mojom::VibrationManager {
......
...@@ -72,14 +72,6 @@ const base::FeatureParam<ChildProcessImportance> kChildProcessImportanceParam{ ...@@ -72,14 +72,6 @@ const base::FeatureParam<ChildProcessImportance> kChildProcessImportanceParam{
ChildProcessImportance::MODERATE, &child_process_importance_options}; ChildProcessImportance::MODERATE, &child_process_importance_options};
#endif #endif
bool IsServiceWorkerSupported() {
if (!DeviceHasEnoughMemoryForBackForwardCache())
return false;
static constexpr base::FeatureParam<bool> service_worker_supported(
&features::kBackForwardCache, "service_worker_supported", false);
return service_worker_supported.Get();
}
bool IsGeolocationSupported() { bool IsGeolocationSupported() {
if (!DeviceHasEnoughMemoryForBackForwardCache()) if (!DeviceHasEnoughMemoryForBackForwardCache())
return false; return false;
...@@ -163,11 +155,6 @@ uint64_t GetDisallowedFeatures(RenderFrameHostImpl* rfh) { ...@@ -163,11 +155,6 @@ uint64_t GetDisallowedFeatures(RenderFrameHostImpl* rfh) {
uint64_t result = kAlwaysDisallowedFeatures; uint64_t result = kAlwaysDisallowedFeatures;
if (!IsServiceWorkerSupported()) {
result |=
FeatureToBit(WebSchedulerTrackedFeature::kServiceWorkerControlledPage);
}
if (!IsGeolocationSupported()) { if (!IsGeolocationSupported()) {
result |= FeatureToBit( result |= FeatureToBit(
WebSchedulerTrackedFeature::kRequestedGeolocationPermission); WebSchedulerTrackedFeature::kRequestedGeolocationPermission);
......
...@@ -47,8 +47,6 @@ const char* FeatureToString(WebSchedulerTrackedFeature feature) { ...@@ -47,8 +47,6 @@ const char* FeatureToString(WebSchedulerTrackedFeature feature) {
return "outstanding network request (XHR)"; return "outstanding network request (XHR)";
case WebSchedulerTrackedFeature::kOutstandingNetworkRequestOthers: case WebSchedulerTrackedFeature::kOutstandingNetworkRequestOthers:
return "outstanding network request (others)"; return "outstanding network request (others)";
case WebSchedulerTrackedFeature::kServiceWorkerControlledPage:
return "ServiceWorker-controlled page";
case WebSchedulerTrackedFeature::kOutstandingIndexedDBTransaction: case WebSchedulerTrackedFeature::kOutstandingIndexedDBTransaction:
return "outstanding IndexedDB transaction"; return "outstanding IndexedDB transaction";
case WebSchedulerTrackedFeature::kRequestedGeolocationPermission: case WebSchedulerTrackedFeature::kRequestedGeolocationPermission:
......
...@@ -43,9 +43,8 @@ enum class WebSchedulerTrackedFeature { ...@@ -43,9 +43,8 @@ enum class WebSchedulerTrackedFeature {
// specific context types down below. // specific context types down below.
kOutstandingNetworkRequestOthers = 15, kOutstandingNetworkRequestOthers = 15,
// TODO(altimin): This doesn't include service worker-controlled origins. // kServiceWorkerControlledPage = 16. Removed after implementing ServiceWorker
// We need to track them too. // support.
kServiceWorkerControlledPage = 16,
kOutstandingIndexedDBTransaction = 17, kOutstandingIndexedDBTransaction = 17,
......
...@@ -492,9 +492,6 @@ void ServiceWorkerContainer::SetController( ...@@ -492,9 +492,6 @@ void ServiceWorkerContainer::SetController(
MaybeRecordThirdPartyServiceWorkerUsage(GetExecutionContext()); MaybeRecordThirdPartyServiceWorkerUsage(GetExecutionContext());
UseCounter::Count(GetExecutionContext(), UseCounter::Count(GetExecutionContext(),
WebFeature::kServiceWorkerControlledPage); WebFeature::kServiceWorkerControlledPage);
GetExecutionContext()->GetScheduler()->RegisterStickyFeature(
SchedulingPolicy::Feature::kServiceWorkerControlledPage,
{SchedulingPolicy::RecordMetricsForBackForwardCache()});
} }
if (should_notify_controller_change) if (should_notify_controller_change)
DispatchEvent(*Event::Create(event_type_names::kControllerchange)); DispatchEvent(*Event::Create(event_type_names::kControllerchange));
......
...@@ -41,7 +41,6 @@ bool SchedulingPolicy::IsFeatureSticky(SchedulingPolicy::Feature feature) { ...@@ -41,7 +41,6 @@ bool SchedulingPolicy::IsFeatureSticky(SchedulingPolicy::Feature feature) {
case Feature::kResumeEventListener: case Feature::kResumeEventListener:
case Feature::kContainsPlugins: case Feature::kContainsPlugins:
case Feature::kDocumentLoaded: case Feature::kDocumentLoaded:
case Feature::kServiceWorkerControlledPage:
case Feature::kRequestedGeolocationPermission: case Feature::kRequestedGeolocationPermission:
case Feature::kRequestedNotificationsPermission: case Feature::kRequestedNotificationsPermission:
case Feature::kRequestedMIDIPermission: case Feature::kRequestedMIDIPermission:
......
...@@ -73312,7 +73312,7 @@ Called by update_scheduler_enums.py.--> ...@@ -73312,7 +73312,7 @@ Called by update_scheduler_enums.py.-->
<int value="49" label="PaymentManager"/> <int value="49" label="PaymentManager"/>
<int value="50" label="SpeechSynthesis"/> <int value="50" label="SpeechSynthesis"/>
<int value="51" label="KeyboardLock"/> <int value="51" label="KeyboardLock"/>
<int value="52" label="SMSService"/> <int value="52" label="SmsService"/>
</enum> </enum>
<enum name="WebShareMethod"> <enum name="WebShareMethod">
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