Commit 433d1a41 authored by Hajime Hoshi's avatar Hajime Hoshi Committed by Commit Bot

BackForwardCache: Allow WebFilesystem with a flag

WebFilesystem doesn't have notions of handlers or connections, then it
should be safe to allow pages with WebFilesystem to be put into the
BFcache. Let's allow WebFilesystem for BFcache in order to improve the
BFcache hit rate.

This is implemented behind a flag and the feature is disabled by
default. This means that this CL doesn't change the behavior by default.
We might enable the feature later.

Bug: 1144133
Change-Id: Idf5d9cfb8a4365ae65743c2becc7a4ef8ec66999
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2531155
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829149}
parent 11936690
...@@ -8555,4 +8555,32 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, SandboxedFramesNotCached) { ...@@ -8555,4 +8555,32 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, SandboxedFramesNotCached) {
FROM_HERE); FROM_HERE);
} }
class BackForwardCacheBrowserTestWithFileSystemAPISupported
: public BackForwardCacheBrowserTest {
void SetUpCommandLine(base::CommandLine* command_line) override {
EnableFeatureAndSetParams(features::kBackForwardCache,
"file_system_api_supported", "true");
BackForwardCacheBrowserTest::SetUpCommandLine(command_line);
}
};
IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTestWithFileSystemAPISupported,
CacheWithFileSystemAPI) {
ASSERT_TRUE(embedded_test_server()->Start());
// 1) Navigate to a page with WebFileSystem usage.
GURL url(embedded_test_server()->GetURL("/fileapi/request_test.html"));
EXPECT_TRUE(NavigateToURL(shell(), url));
// 2) Navigate away.
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("b.com", "/title1.html")));
// 3) Go back to the page with WebFileSystem.
web_contents()->GetController().GoBack();
EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
ExpectOutcome(BackForwardCacheMetrics::HistoryNavigationOutcome::kRestored,
FROM_HERE);
}
} // namespace content } // namespace content
...@@ -88,6 +88,14 @@ bool IsGeolocationSupported() { ...@@ -88,6 +88,14 @@ bool IsGeolocationSupported() {
return geolocation_supported.Get(); return geolocation_supported.Get();
} }
bool IsFileSystemSupported() {
if (!DeviceHasEnoughMemoryForBackForwardCache())
return false;
static constexpr base::FeatureParam<bool> file_system_api_supported(
&features::kBackForwardCache, "file_system_api_supported", false);
return file_system_api_supported.Get();
}
bool IgnoresOutstandingNetworkRequestForTesting() { bool IgnoresOutstandingNetworkRequestForTesting() {
if (!DeviceHasEnoughMemoryForBackForwardCache()) if (!DeviceHasEnoughMemoryForBackForwardCache())
return false; return false;
...@@ -146,7 +154,6 @@ uint64_t GetDisallowedFeatures(RenderFrameHostImpl* rfh, ...@@ -146,7 +154,6 @@ uint64_t GetDisallowedFeatures(RenderFrameHostImpl* rfh,
FeatureToBit(WebSchedulerTrackedFeature::kSpeechSynthesis) | FeatureToBit(WebSchedulerTrackedFeature::kSpeechSynthesis) |
FeatureToBit(WebSchedulerTrackedFeature::kWakeLock) | FeatureToBit(WebSchedulerTrackedFeature::kWakeLock) |
FeatureToBit(WebSchedulerTrackedFeature::kWebDatabase) | FeatureToBit(WebSchedulerTrackedFeature::kWebDatabase) |
FeatureToBit(WebSchedulerTrackedFeature::kWebFileSystem) |
FeatureToBit(WebSchedulerTrackedFeature::kWebHID) | FeatureToBit(WebSchedulerTrackedFeature::kWebHID) |
FeatureToBit(WebSchedulerTrackedFeature::kWebLocks) | FeatureToBit(WebSchedulerTrackedFeature::kWebLocks) |
FeatureToBit(WebSchedulerTrackedFeature::kWebRTC) | FeatureToBit(WebSchedulerTrackedFeature::kWebRTC) |
...@@ -171,6 +178,10 @@ uint64_t GetDisallowedFeatures(RenderFrameHostImpl* rfh, ...@@ -171,6 +178,10 @@ uint64_t GetDisallowedFeatures(RenderFrameHostImpl* rfh,
FeatureToBit(WebSchedulerTrackedFeature::kOutstandingNetworkRequestXHR); FeatureToBit(WebSchedulerTrackedFeature::kOutstandingNetworkRequestXHR);
} }
if (!IsFileSystemSupported()) {
result |= FeatureToBit(WebSchedulerTrackedFeature::kWebFileSystem);
}
if (requested_features == RequestedFeatures::kOnlySticky) { if (requested_features == RequestedFeatures::kOnlySticky) {
// Remove all non-sticky features from |result|. // Remove all non-sticky features from |result|.
result &= blink::scheduler::StickyFeaturesBitmask(); result &= blink::scheduler::StickyFeaturesBitmask();
......
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