Title: [284875] trunk
- Revision
- 284875
- Author
- katherine_che...@apple.com
- Date
- 2021-10-26 10:06:43 -0700 (Tue, 26 Oct 2021)
Log Message
[ App Privacy Report ] Restoring a session after clearing the cache results in app initiated loads in Safari
https://bugs.webkit.org/show_bug.cgi?id=232292
<rdar://problem/84597422>
Reviewed by Brent Fulgham.
Source/WebKit:
Update session restore code to also set the app initiated value on
the current document loader. Previously, this was only set on the new
document loader. This is a problem because the main resource load
uses the old document loader, so if we restore from a previous session
state, the main resource load will have the incorrect attribution
value.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::goToBackForwardItem):
Tools:
Update API test in 2 ways. First, close the original WebView to
destroy the page's document loader as if the application was being
quit. Second, clear history to make sure there are no cached loads.
* TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (284874 => 284875)
--- trunk/Source/WebKit/ChangeLog 2021-10-26 16:24:04 UTC (rev 284874)
+++ trunk/Source/WebKit/ChangeLog 2021-10-26 17:06:43 UTC (rev 284875)
@@ -1,3 +1,21 @@
+2021-10-26 Kate Cheney <katherine_che...@apple.com>
+
+ [ App Privacy Report ] Restoring a session after clearing the cache results in app initiated loads in Safari
+ https://bugs.webkit.org/show_bug.cgi?id=232292
+ <rdar://problem/84597422>
+
+ Reviewed by Brent Fulgham.
+
+ Update session restore code to also set the app initiated value on
+ the current document loader. Previously, this was only set on the new
+ document loader. This is a problem because the main resource load
+ uses the old document loader, so if we restore from a previous session
+ state, the main resource load will have the incorrect attribution
+ value.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::goToBackForwardItem):
+
2021-10-26 Chris Dumez <cdu...@apple.com>
Improve didFailProvisionalLoadForFrame logging to indicate if it is for the main frame
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (284874 => 284875)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-10-26 16:24:04 UTC (rev 284874)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-10-26 17:06:43 UTC (rev 284875)
@@ -1894,6 +1894,8 @@
SendStopResponsivenessTimer stopper;
m_lastNavigationWasAppInitiated = lastNavigationWasAppInitiated;
+ if (auto* documentLoader = corePage()->mainFrame().loader().documentLoader())
+ documentLoader->setLastNavigationWasAppInitiated(lastNavigationWasAppInitiated);
ASSERT(isBackForwardLoadType(backForwardType));
Modified: trunk/Tools/ChangeLog (284874 => 284875)
--- trunk/Tools/ChangeLog 2021-10-26 16:24:04 UTC (rev 284874)
+++ trunk/Tools/ChangeLog 2021-10-26 17:06:43 UTC (rev 284875)
@@ -1,3 +1,17 @@
+2021-10-26 Kate Cheney <katherine_che...@apple.com>
+
+ [ App Privacy Report ] Restoring a session after clearing the cache results in app initiated loads in Safari
+ https://bugs.webkit.org/show_bug.cgi?id=232292
+ <rdar://problem/84597422>
+
+ Reviewed by Brent Fulgham.
+
+ Update API test in 2 ways. First, close the original WebView to
+ destroy the page's document loader as if the application was being
+ quit. Second, clear history to make sure there are no cached loads.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm:
+
2021-10-26 Simon Fraser <simon.fra...@apple.com>
Have ImageDiff print the diff image when any pixel is different
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm (284874 => 284875)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm 2021-10-26 16:24:04 UTC (rev 284874)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm 2021-10-26 17:06:43 UTC (rev 284875)
@@ -747,16 +747,21 @@
RetainPtr<_WKSessionState> sessionState = [webView1 _sessionState];
sessionState.get().isAppInitiated = isAppInitiated == IsAppInitiated::Yes ? true : false;
- webView1 = nullptr;
+ [webView1 _close];
+ static bool isDone = false;
+ [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
+ isDone = true;
+ }];
+ TestWebKitAPI::Util::run(&isDone);
+
auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-
[webView2 _restoreSessionState:sessionState.get() andNavigate:YES];
[webView2 _test_waitForDidFinishNavigation];
EXPECT_WK_STREQ(@"https://www.apple.com/", [[webView2 URL] absoluteString]);
- static bool isDone = false;
+ isDone = false;
bool expectingAppInitiatedRequests = isAppInitiated == IsAppInitiated::Yes ? true : false;
[webView2 _appPrivacyReportTestingData:^(struct WKAppPrivacyReportTestingData data) {
EXPECT_EQ(data.hasLoadedAppInitiatedRequestTesting, expectingAppInitiatedRequests);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes