[webkit-changes] [WebKit/WebKit] 5bf114: [Screen Time Refactoring] Previously opened websit...

Jessica Cheung noreply at github.com
Tue Feb 25 07:35:05 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5bf1140d588362632333f571f622a2ed9862b9ea
      https://github.com/WebKit/WebKit/commit/5bf1140d588362632333f571f622a2ed9862b9ea
  Author: Jessica Cheung <jcheung23 at apple.com>
  Date:   2025-02-25 (Tue, 25 Feb 2025)

  Changed paths:
    M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h
    M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ScreenTime.mm

  Log Message:
  -----------
  [Screen Time Refactoring] Previously opened website won’t be blocked after relaunching Chrome
https://bugs.webkit.org/show_bug.cgi?id=288148
rdar://145095487

Reviewed by Aditya Keerthi.

Currently, we only install STWebpageController in `WebPageProxy::prepareToLoadWebPage`.
This is an issue for webpages or tabs that were already loaded.
When we've navigated to a page, then quit Chrome and relaunch, the function
`WebPageProxy::prepareToLoadWebPage` does not get called again.
Chrome sets their session state and the webview's interaction state
which then calls into our WKWebView's `setInteractionState`that then calls
`WebPageProxy::restoreFromSessionState`.

Thus, we need to change where we call install STWebpageController. Instead, we will
create a controller if it does not exist when `didChangeScreenTimeWebpageControllerURL`
is called.

Also, we changed some API tests to wait until a controller is created as we do not
create a controller upon `WebPageProxy::prepareToLoadWebPage` but in
`WebPageProxy::didCommitLayerTree` which calls `didChangeScreenTimeWebpageControllerURL`.

Additionally, add an API test that mimics the state that Chrome is in.

* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::updateScreenTimeWebpageControllerURL):
(WebKit::PageClientImplCocoa::installScreenTimeWebpageController): Deleted.
* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::installScreenTimeWebpageController): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::prepareToLoadWebPage):
(WebKit::WebPageProxy::hasVideoInPictureInPictureDidChange):
(WebKit::WebPageProxy::updatePlayingMediaDidChange):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ScreenTime.mm:
(testShowsSystemScreenTimeBlockingView):
(TEST(ScreenTime, IsBlockedByScreenTimeTrue)):
(TEST(ScreenTime, IsBlockedByScreenTimeFalse)):
(TEST(ScreenTime, IsBlockedByScreenTimeMultiple)):
(TEST(ScreenTime, IsBlockedByScreenTimeKVO)):
(TEST(ScreenTime, IdentifierString)):
(TEST(ScreenTime, OffscreenSystemScreenTimeBlockingView)):
(TEST(ScreenTime, OffscreenBlurredScreenTimeBlockingView)):
(TEST(ScreenTime, DoNotDonateURLsInOffscreenWebView)):
(TEST(ScreenTime, ScreenTimeControllerInstalledAfterRestoreFromSessionState)):

Canonical link: https://commits.webkit.org/291022@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list