[webkit-changes] [WebKit/WebKit] 822bd9: [Script Telemetry] Deploy telemetry in document.(r...

Wenson Hsieh noreply at github.com
Wed Sep 18 13:08:24 PDT 2024


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

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/ScriptExecutionContext.cpp
    M Source/WebCore/page/LocalDOMWindow.cpp
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/page/Screen.cpp
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/ScriptTelemetryTests.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionContext.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WebTransport.mm

  Log Message:
  -----------
  [Script Telemetry] Deploy telemetry in document.(referrer|URL) and screen/window-related APIs
https://bugs.webkit.org/show_bug.cgi?id=279845
rdar://136178559

Reviewed by Abrar Rahman Protyasha.

Deploy script telemetry checks in a few contexts:

•   Various screen- and window-metrics APIs where existing fingerprinting protections in Private
    Browsing apply, such as `screen.width`, `screen.height`, and `outerWidth` / `outerHeight`.
•   `document.referrer`
•   `document.URL` (and other ways to programmatically request the full URL from bindings).

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:

Add a feature flag (off everywhere by default) to aid debugging and testing, by reporting script
telemetry observations. To avoid excessive console log, we also limit this to a single message per
script URL per telemetry category.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::urlForBindings):
(WebCore::Document::referrerForBindings):
(WebCore::Document::noiseInjectionPolicies const):
(WebCore::Document::urlForBindings const): Deleted.

This method becomes non-const, since it now calls into `requiresScriptExecutionTelemetry` which
may log a console message.

* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::requiresScriptExecutionTelemetry):
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::outerHeight const):
(WebCore::LocalDOMWindow::outerWidth const):
(WebCore::LocalDOMWindow::screenX const):
(WebCore::LocalDOMWindow::screenY const):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::screenSize const):

Add telemetry in all the same places where we currently lock down access to fine-grained screen and
window-related metrics, which are not critical to page layout.

* Source/WebCore/page/Page.cpp:
(WebCore::Page::didCommitLoad):
(WebCore::Page::shouldApplyScreenFingerprintingProtections const):

Rename `fingerprintingProtectionsEnabled` to `shouldApplyScreenFingerprintingProtections`, to better
reflect the fact that this is only used to guard screen-related fingerprinting protections.

(WebCore::Page::reportScriptTelemetry):
(WebCore::Page::fingerprintingProtectionsEnabled const): Deleted.
* Source/WebCore/page/Page.h:
* Source/WebCore/page/Screen.cpp:
(WebCore::shouldApplyScreenFingerprintingProtections):
(WebCore::Screen::availLeft const):
(WebCore::Screen::availTop const):
(WebCore::Screen::availHeight const):
(WebCore::Screen::availWidth const):
(WebCore::fingerprintingProtectionsEnabled): Deleted.
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ScriptTelemetryTests.mm: Added.

Add a new test suite, whose main implementation exists inside an additions file.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionContext.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebTransport.mm:

Apply several unified source build fixes to accommodate the new test source.

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