[webkit-changes] [WebKit/WebKit] edc8cd: [Script Telemetry] Add initial client-layer plumbi...

Wenson Hsieh noreply at github.com
Thu Sep 12 17:59:26 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: edc8cd8540e65614888700493e06a00d0fc3923e
      https://github.com/WebKit/WebKit/commit/edc8cd8540e65614888700493e06a00d0fc3923e
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-09-12 (Thu, 12 Sep 2024)

  Changed paths:
    M Source/WebCore/PAL/pal/spi/cocoa/WebPrivacySPI.h
    M Source/WebKit/CMakeLists.txt
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/Platform/cocoa/WebPrivacyHelpers.h
    M Source/WebKit/Platform/cocoa/WebPrivacyHelpers.mm
    M Source/WebKit/Scripts/webkit/messages.py
    A Source/WebKit/Shared/ScriptTelemetry.cpp
    A Source/WebKit/Shared/ScriptTelemetry.h
    A Source/WebKit/Shared/ScriptTelemetry.serialization.in
    M Source/WebKit/Shared/WebProcessCreationParameters.h
    M Source/WebKit/Shared/WebProcessCreationParameters.serialization.in
    M Source/WebKit/Sources.txt
    M Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebProcess.cpp
    M Source/WebKit/WebProcess/WebProcess.h
    M Source/WebKit/WebProcess/WebProcess.messages.in

  Log Message:
  -----------
  [Script Telemetry] Add initial client-layer plumbing to support script telemetry
https://bugs.webkit.org/show_bug.cgi?id=279572
rdar://135846256

Reviewed by Charlie Wolfe.

Add support for a new remotely updatable list, whose purpose is to help provide telemetry in
internal builds (behind an off-by-default runtime setting) to monitor the impact of other privacy
mitigations shipped in Private Browsing mode in Safari 17. See below for more details.

* Source/WebCore/PAL/pal/spi/cocoa/WebPrivacySPI.h:

Add a new WebKitAdditions extension point.

* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Platform/cocoa/WebPrivacyHelpers.h:

Introduce a new helper class, `ScriptTelemetryController`, that requests and updates cached versions
of the new list data.

* Source/WebKit/Platform/cocoa/WebPrivacyHelpers.mm:

Add a new WebKitAdditions extension point.

(WebKit::ListDataControllerBase::initializeIfNeeded):

Minor drive-by refactoring: rename this to `initializeIfNeeded()` by hoisting the
`cachedListData().isEmpty()` checks out of the call site (see below) and into this method.

(WebKit::ScriptTelemetryController::updateList):
(WebKit::ScriptTelemetryController::resourceType const):
(WebKit::ScriptTelemetryController::didUpdateCachedListData):
(WebKit::ListDataControllerBase::initialize): Deleted.
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):

Add IPC serialization rules for the `ScriptTelemetryRules` struct.

* Source/WebKit/Shared/ScriptTelemetry.cpp: Added.
(WebKit::initializeFilterRules):
(WebKit::ScriptTelemetryFilter::ScriptTelemetryFilter):
(WebKit::ScriptTelemetryFilter::matches):
* Source/WebKit/Shared/ScriptTelemetry.h: Added.

Add helper classes that represent the raw list data (as several compact vectors, cached in the UI
process) and as multiple compact hash tables, intended for fast lookup.

(WebKit::ScriptTelemetryRules::isEmpty const):
* Source/WebKit/Shared/ScriptTelemetry.serialization.in: Added.
* Source/WebKit/Shared/WebProcessCreationParameters.h:
* Source/WebKit/Shared/WebProcessCreationParameters.serialization.in:
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):

Plumb `ScriptTelemetryRules` over to the web process upon initialization.

* Source/WebKit/UIProcess/WebProcessPool.cpp:
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::updateScriptTelemetryFilter):
(WebKit::WebProcess::requiresScriptTelemetryForURL const):

Add a helper method to return whether or not telemetry should be applied on the given script, in the
context of the given top origin. To be used in `WebChromeClient`, in the next patch.

* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/WebProcess.messages.in:

Canonical link: https://commits.webkit.org/283589@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