⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284875 in webkit


Ignore:
Timestamp:
Oct 26, 2021, 10:06:43 AM (5 years ago)
Author:
Kate Cheney
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:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r284874 r284875  
     12021-10-26  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        [ App Privacy Report ] Restoring a session after clearing the cache results in app initiated loads in Safari
     4        https://bugs.webkit.org/show_bug.cgi?id=232292
     5        <rdar://problem/84597422>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Update session restore code to also set the app initiated value on
     10        the current document loader. Previously, this was only set on the new
     11        document loader. This is a problem because the main resource load
     12        uses the old document loader, so if we restore from a previous session
     13        state, the main resource load will have the incorrect attribution
     14        value.
     15
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::goToBackForwardItem):
     18
    1192021-10-26  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r284628 r284875  
    18951895
    18961896    m_lastNavigationWasAppInitiated = lastNavigationWasAppInitiated;
     1897    if (auto* documentLoader = corePage()->mainFrame().loader().documentLoader())
     1898        documentLoader->setLastNavigationWasAppInitiated(lastNavigationWasAppInitiated);
    18971899
    18981900    ASSERT(isBackForwardLoadType(backForwardType));
  • trunk/Tools/ChangeLog

    r284870 r284875  
     12021-10-26  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        [ App Privacy Report ] Restoring a session after clearing the cache results in app initiated loads in Safari
     4        https://bugs.webkit.org/show_bug.cgi?id=232292
     5        <rdar://problem/84597422>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Update API test in 2 ways. First, close the original WebView to
     10        destroy the page's document loader as if the application was being
     11        quit. Second, clear history to make sure there are no cached loads.
     12
     13        * TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm:
     14
    1152021-10-26  Simon Fraser  <simon.fraser@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm

    r284721 r284875  
    748748    RetainPtr<_WKSessionState> sessionState = [webView1 _sessionState];
    749749    sessionState.get().isAppInitiated = isAppInitiated == IsAppInitiated::Yes ? true : false;
    750     webView1 = nullptr;
     750    [webView1 _close];
     751
     752    static bool isDone = false;
     753    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
     754        isDone = true;
     755    }];
     756    TestWebKitAPI::Util::run(&isDone);
    751757
    752758    auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
    753 
    754759    [webView2 _restoreSessionState:sessionState.get() andNavigate:YES];
    755760    [webView2 _test_waitForDidFinishNavigation];
     
    757762    EXPECT_WK_STREQ(@"https://www.apple.com/", [[webView2 URL] absoluteString]);
    758763
    759     static bool isDone = false;
     764    isDone = false;
    760765    bool expectingAppInitiatedRequests = isAppInitiated == IsAppInitiated::Yes ? true : false;
    761766    [webView2 _appPrivacyReportTestingData:^(struct WKAppPrivacyReportTestingData data) {
Note: See TracChangeset for help on using the changeset viewer.