Skip to content

Commit

Permalink
Disable back/forward cache when site isolation is on
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265979
rdar://119287804

Reviewed by Chris Dumez.

This will make site isolation more useable while we continue to develop it.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/271659@main
  • Loading branch information
achristensen07 committed Dec 7, 2023
1 parent 6685cec commit d4cb1fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Source/WebCore/history/BackForwardCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static bool canCachePage(Page& page)
return false;
bool isCacheable = canCacheFrame(*localMainFrame, diagnosticLoggingClient, indentLevel + 1);

if (!page.settings().usesBackForwardCache() || page.isResourceCachingDisabledByWebInspector()) {
if (!page.settings().usesBackForwardCache() || page.isResourceCachingDisabledByWebInspector() || page.settings().siteIsolationEnabled()) {
PCLOG(" -Page settings says b/f cache disabled");
logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::isDisabledKey());
isCacheable = false;
Expand Down
4 changes: 3 additions & 1 deletion Source/WebKit/UIProcess/WebPageProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,9 @@ WebBackForwardCache& WebPageProxy::backForwardCache() const

bool WebPageProxy::shouldUseBackForwardCache() const
{
return m_preferences->usesBackForwardCache() && backForwardCache().capacity() > 0;
return m_preferences->usesBackForwardCache()
&& backForwardCache().capacity() > 0
&& !m_preferences->siteIsolationEnabled();
}

void WebPageProxy::swapToProvisionalPage(std::unique_ptr<ProvisionalPageProxy> provisionalPage)
Expand Down
4 changes: 2 additions & 2 deletions Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1414,8 +1414,8 @@ HTTPServer server({
[navigationDelegate waitForDidFinishNavigation];
checkFrameTreesInProcesses(webView.get(), { { "https://apple.com"_s } });

Util::runFor(100_ms);
EXPECT_TRUE(processStillRunning(iframePID));
while (processStillRunning(iframePID))
Util::spinRunLoop();
}

TEST(SiteIsolation, OpenerProcessSharing)
Expand Down

0 comments on commit d4cb1fe

Please sign in to comment.