WebKit Bugzilla
Attachment 348512 Details for
Bug 187773
: Add Web API Statistics Collection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187773-20180830111024.patch (text/plain), 136.59 KB, created by
Woodrow Wang
on 2018-08-30 11:10:25 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Woodrow Wang
Created:
2018-08-30 11:10:25 PDT
Size:
136.59 KB
patch
obsolete
>Subversion Revision: 235509 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 724ed19e61ed15f174da30d7a0628a591b9a7bd3..537bc22a9ed480cbcff3b7668355377644d157a2 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-28 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added web API statistics collection >+ https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new flag ENABLE_WEB_API_STATISTICS to wrap all code in compile time flags for when >+ we would like to collect various web API statistics for analysis. >+ >+ * Configurations/FeatureDefines.xcconfig: >+ > 2018-08-29 Mark Lam <mark.lam@apple.com> > > Add some missing exception checks in JSRopeString::resolveRopeToAtomicString(). >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f950ca9559df3119b9988010803f549dbedbb551..57e1680672d6d9dc3e35452b68011f6b7792fa3b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,123 @@ >+2018-08-30 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added web API statistics collection >+ https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new flag ENABLE_WEB_API_STATISTICS to wrap all code in compile time flags for when >+ we would like to collect various web API statistics for analysis. >+ >+ Added data collection for web API statistics, specifically regarding the canvas, font loads, >+ screen functions, and navigator functions. All of the code is placed under the compile time flag >+ ENABLE_WEB_API_STATISTICS. The statistics are stored in a ResourceLoadStatistics object and written >+ to a plist on disk. Added a new file CanvasActivityRecord.h and CanvasActivityRecord.cpp which >+ includes a struct to keep track of HTML5 canvas element read and writes. >+ >+ Tests: http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html >+ http/tests/webAPIStatistics/font-load-data-collection.html >+ http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html >+ http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html >+ >+ * Configurations/FeatureDefines.xcconfig: >+ * WebCore.xcodeproj/project.pbxproj: >+ * css/CSSFontFaceSource.cpp: >+ (WebCore::CSSFontFaceSource::load): >+ * css/CSSFontSelector.cpp: >+ (WebCore::CSSFontSelector::fontRangesForFamily): >+ (WebCore::CSSFontSelector::fallbackFontAt): >+ >+ The following are the functions where we'd like to record a canvas read. >+ >+ * html/HTMLCanvasElement.cpp: >+ (WebCore::HTMLCanvasElement::toDataURL): >+ (WebCore::HTMLCanvasElement::toBlob): >+ (WebCore::HTMLCanvasElement::getImageData): >+ (WebCore::HTMLCanvasElement::toMediaSample): >+ (WebCore::HTMLCanvasElement::captureStream): >+ >+ The following are the functions where we'd like to record a canvas write. >+ >+ * html/canvas/CanvasRenderingContext2D.cpp: >+ (WebCore::CanvasRenderingContext2D::measureText): >+ (WebCore::CanvasRenderingContext2D::drawTextInternal): >+ >+ The following files and functions handle the CanvasActivityRecord struct and >+ its respective functions. >+ >+ * loader/CanvasActivityRecord.cpp: Copied from Source/WebCore/platform/cf/KeyedEncoderCF.h. >+ (WebCore::CanvasActivityRecord::recordWrittenOrMeasuredText): >+ (WebCore::CanvasActivityRecord::mergeWith): >+ * loader/CanvasActivityRecord.h: Copied from Source/WebCore/platform/cf/KeyedEncoderCF.h. >+ (WebCore::CanvasActivityRecord::encode const): >+ (WebCore::CanvasActivityRecord::decode): >+ >+ * loader/ResourceLoadObserver.cpp: >+ (WebCore::ResourceLoadObserver::logFontLoad): >+ (WebCore::ResourceLoadObserver::logCanvasRead): >+ (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure): >+ (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed): >+ (WebCore::ResourceLoadObserver::logScreenAPIAccessed): >+ >+ Before, entries in the ResourceLoadStatistics involving HashSets used "origin" as the key. >+ Now the encodeHashSet function has been generalized to take any key to encode the entries >+ in the HashSet. Also added functionality to encode an OptionSet by converting it to its >+ raw bitmask state. >+ >+ * loader/ResourceLoadObserver.h: >+ * loader/ResourceLoadStatistics.cpp: >+ (WebCore::encodeHashSet): >+ (WebCore::encodeOriginHashSet): >+ (WebCore::encodeOptionSet): >+ (WebCore::encodeFontHashSet): >+ (WebCore::encodeCanvasActivityRecord): >+ (WebCore::ResourceLoadStatistics::encode const): >+ (WebCore::decodeHashSet): >+ (WebCore::decodeOriginHashSet): >+ (WebCore::decodeOptionSet): >+ (WebCore::decodeFontHashSet): >+ (WebCore::decodeCanvasActivityRecord): >+ (WebCore::ResourceLoadStatistics::decode): >+ (WebCore::navigatorEnumToString): >+ (WebCore::screenEnumToString): >+ (WebCore::appendNavigatorOptionSet): >+ (WebCore::appendScreenOptionSet): >+ (WebCore::ResourceLoadStatistics::toString const): >+ (WebCore::ResourceLoadStatistics::merge): >+ * loader/ResourceLoadStatistics.h: >+ >+ The following are the navigator functions recorded for the web API statistics. >+ >+ * page/Navigator.cpp: >+ (WebCore::Navigator::appVersion const): >+ (WebCore::Navigator::userAgent const): >+ (WebCore::Navigator::plugins): >+ (WebCore::Navigator::mimeTypes): >+ (WebCore::Navigator::cookieEnabled const): >+ (WebCore::Navigator::javaEnabled const): >+ >+ The following are the screen functions recorded for the web API statistics. >+ >+ * page/Screen.cpp: >+ (WebCore::Screen::height const): >+ (WebCore::Screen::width const): >+ (WebCore::Screen::colorDepth const): >+ (WebCore::Screen::pixelDepth const): >+ (WebCore::Screen::availLeft const): >+ (WebCore::Screen::availTop const): >+ (WebCore::Screen::availHeight const): >+ (WebCore::Screen::availWidth const): >+ >+ Added logic to encode values of type UInt64 in a dictionary format. >+ >+ * platform/KeyedCoding.h: >+ * platform/cf/KeyedDecoderCF.cpp: >+ (WebCore::KeyedDecoderCF::decodeUInt64): >+ * platform/cf/KeyedDecoderCF.h: >+ * platform/cf/KeyedEncoderCF.cpp: >+ (WebCore::KeyedEncoderCF::encodeUInt64): >+ * platform/cf/KeyedEncoderCF.h: >+ > 2018-08-30 Zalan Bujtas <zalan@apple.com> > > [LFC][Floating] Block formatting context roots avoid floats. >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index 7cc5f633dad3e8eecd5ed8638c89c009bfc88110..355295c14d0adf99dd027bd32989cdb842cb5c70 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-28 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added web API statistics collection >+ https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new flag ENABLE_WEB_API_STATISTICS to wrap all code in compile time flags for when >+ we would like to collect various web API statistics for analysis. >+ >+ * Configurations/FeatureDefines.xcconfig: >+ > 2018-08-29 Jer Noble <jer.noble@apple.com> > > Muted elements do not have their Now Playing status updated when unmuted. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index bd7561140e2a3a5b880bce0670ed48dc903bf3bd..b8e3675c42d14397272bf14b684f5e00b1b49e79 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,35 @@ >+2018-08-28 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added web API statistics collection >+ https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new flag ENABLE_WEB_API_STATISTICS to wrap all code in compile time flags for when >+ we would like to collect various web API statistics for analysis. >+ >+ Updated the resource load statistics model version to 13. >+ >+ Added encode and decode functions for the respective web API statistics. >+ >+ * Configurations/FeatureDefines.xcconfig: >+ * Shared/WebCoreArgumentCoders.cpp: >+ (IPC::ArgumentCoder<ResourceLoadStatistics>::encode): >+ (IPC::ArgumentCoder<ResourceLoadStatistics>::decode): >+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: >+ (WKWebsiteDataStoreDumpResourceLoadStatistics): >+ * UIProcess/API/C/WKWebsiteDataStoreRef.h: >+ >+ Added functionality to dump the entire resource load statistics map for testing >+ purposes. >+ >+ * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: >+ (WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics const): >+ * UIProcess/ResourceLoadStatisticsMemoryStore.h: >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::dumpResourceLoadStatistics): >+ * UIProcess/WebResourceLoadStatisticsStore.h: >+ > 2018-08-30 Aditya Keerthi <akeerthi@apple.com> > > [macOS] Color picker layout is broken if suggested colors are specified >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 99b64c09886fc42c52d9dbb6cf989d7df41db1f1..7b35296ea71088f02b128aea1ca3cdc041ecbc65 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-28 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added web API statistics collection >+ https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new flag ENABLE_WEB_API_STATISTICS to wrap all code in compile time flags for when >+ we would like to collect various web API statistics for analysis. >+ >+ * Configurations/FeatureDefines.xcconfig: >+ > 2018-08-29 Olivia Barnett <obarnett@apple.com> > > Implement the Web Share API >diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig >index dfa4a259773f597db7eae6005dd81beb3d68de87..75739d69e14f4e5fd9c08781c0b9fc7e65cfaaa1 100644 >--- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig >+++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig >@@ -358,6 +358,8 @@ ENABLE_WEBGPU_watchos = ENABLE_WEBGPU; > ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU; > ENABLE_WEBGPU_macosx = ENABLE_WEBGPU; > >+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS; >+ > ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; > > ENABLE_WEB_AUTHN = $(ENABLE_WEB_AUTHN_$(WK_PLATFORM_NAME)); >@@ -374,4 +376,4 @@ ENABLE_WIRELESS_PLAYBACK_TARGET = ENABLE_WIRELESS_PLAYBACK_TARGET; > > ENABLE_XSLT = ENABLE_XSLT; > >-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >diff --git a/Source/WebCore/Configurations/FeatureDefines.xcconfig b/Source/WebCore/Configurations/FeatureDefines.xcconfig >index dfa4a259773f597db7eae6005dd81beb3d68de87..75739d69e14f4e5fd9c08781c0b9fc7e65cfaaa1 100644 >--- a/Source/WebCore/Configurations/FeatureDefines.xcconfig >+++ b/Source/WebCore/Configurations/FeatureDefines.xcconfig >@@ -358,6 +358,8 @@ ENABLE_WEBGPU_watchos = ENABLE_WEBGPU; > ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU; > ENABLE_WEBGPU_macosx = ENABLE_WEBGPU; > >+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS; >+ > ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; > > ENABLE_WEB_AUTHN = $(ENABLE_WEB_AUTHN_$(WK_PLATFORM_NAME)); >@@ -374,4 +376,4 @@ ENABLE_WIRELESS_PLAYBACK_TARGET = ENABLE_WIRELESS_PLAYBACK_TARGET; > > ENABLE_XSLT = ENABLE_XSLT; > >-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >diff --git a/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig b/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig >index dfa4a259773f597db7eae6005dd81beb3d68de87..75739d69e14f4e5fd9c08781c0b9fc7e65cfaaa1 100644 >--- a/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig >+++ b/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig >@@ -358,6 +358,8 @@ ENABLE_WEBGPU_watchos = ENABLE_WEBGPU; > ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU; > ENABLE_WEBGPU_macosx = ENABLE_WEBGPU; > >+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS; >+ > ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; > > ENABLE_WEB_AUTHN = $(ENABLE_WEB_AUTHN_$(WK_PLATFORM_NAME)); >@@ -374,4 +376,4 @@ ENABLE_WIRELESS_PLAYBACK_TARGET = ENABLE_WIRELESS_PLAYBACK_TARGET; > > ENABLE_XSLT = ENABLE_XSLT; > >-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 20e2892663a1b7c3c6e1d4dc0f0ad8a8b8031b3a..396661f32f95347be432e5d63891f434860d53aa 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -4798,6 +4798,8 @@ > ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */; settings = {ATTRIBUTES = (Private, ); }; }; > EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE3A4FF0C7A430600956A37 /* ColorMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; > EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEC98020AED7E170059137F /* WebCorePrefix.h */; }; >+ EFB728812124CA38005C2558 /* CanvasActivityRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EFB7287B2124C73D005C2558 /* CanvasActivityRecord.cpp */; }; >+ EFCC6C8F20FE914400A2321B /* CanvasActivityRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = EFCC6C8D20FE914000A2321B /* CanvasActivityRecord.h */; settings = {ATTRIBUTES = (Private, ); }; }; > F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F12171F316A8BC63000053CA /* WebVTTElement.cpp */; }; > F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F12171F416A8BC63000053CA /* WebVTTElement.h */; }; > F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -14441,6 +14443,8 @@ > ED501DC50B249F2900AE18D9 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorMac.mm; sourceTree = "<group>"; }; > EDE3A4FF0C7A430600956A37 /* ColorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorMac.h; sourceTree = "<group>"; }; > EDEC98020AED7E170059137F /* WebCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCorePrefix.h; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; }; >+ EFB7287B2124C73D005C2558 /* CanvasActivityRecord.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasActivityRecord.cpp; sourceTree = "<group>"; }; >+ EFCC6C8D20FE914000A2321B /* CanvasActivityRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasActivityRecord.h; sourceTree = "<group>"; }; > F12171F316A8BC63000053CA /* WebVTTElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebVTTElement.cpp; sourceTree = "<group>"; }; > F12171F416A8BC63000053CA /* WebVTTElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVTTElement.h; sourceTree = "<group>"; }; > F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendClient.h; sourceTree = "<group>"; }; >@@ -24121,6 +24125,8 @@ > 93A1EAA20A5634D8006960A0 /* mac */, > 63152D181F9531EE007A5E4B /* ApplicationManifestLoader.cpp */, > 63152D171F9531EE007A5E4B /* ApplicationManifestLoader.h */, >+ EFB7287B2124C73D005C2558 /* CanvasActivityRecord.cpp */, >+ EFCC6C8D20FE914000A2321B /* CanvasActivityRecord.h */, > A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */, > A149786D1ABAF33800CEF7E4 /* ContentFilter.h */, > E1424C91164B52C800F32D40 /* CookieJar.cpp */, >@@ -27203,6 +27209,7 @@ > 7C1E8D011ED0C2DA00B1D983 /* CallbackResult.h in Headers */, > 952076051F2675FE007D2AAB /* CallTracer.h in Headers */, > 952076061F2675FE007D2AAB /* CallTracerTypes.h in Headers */, >+ EFCC6C8F20FE914400A2321B /* CanvasActivityRecord.h in Headers */, > 313171561FB079E5008D91FC /* CanvasBase.h in Headers */, > 415CDAF51E6B8F8B004F11EE /* CanvasCaptureMediaStreamTrack.h in Headers */, > 7C193BBB1F5E0EED0088F3E6 /* CanvasDirection.h in Headers */, >@@ -31333,6 +31340,7 @@ > 070363E7181A1CDC00C074A5 /* AVVideoCaptureSource.mm in Sources */, > 7A45032F18DB717200377B34 /* BufferedLineReader.cpp in Sources */, > 0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */, >+ EFB728812124CA38005C2558 /* CanvasActivityRecord.cpp in Sources */, > CDF4B7151E00B7E500E235A2 /* CDM.cpp in Sources */, > CD94A5DD1F71D5D800F525C5 /* CDMClearKey.cpp in Sources */, > CDB7045B1F7465A1003923DF /* CDMFairPlayStreaming.cpp in Sources */, >diff --git a/Source/WebCore/css/CSSFontFaceSource.cpp b/Source/WebCore/css/CSSFontFaceSource.cpp >index 4d603b5769587cad4cd6669ad2a65ba37baeb8e8..4f532d69d3cc31531ee4c5369cd8237cfe73946e 100644 >--- a/Source/WebCore/css/CSSFontFaceSource.cpp >+++ b/Source/WebCore/css/CSSFontFaceSource.cpp >@@ -37,6 +37,10 @@ > #include "SVGToOTFFontConversion.h" > #include "SharedBuffer.h" > >+#if ENABLE(WEB_API_STATISTICS) >+#include "ResourceLoadObserver.h" >+#endif >+ > #if ENABLE(SVG_FONTS) > #include "CachedSVGFont.h" > #include "FontCustomPlatformData.h" >@@ -181,6 +185,10 @@ void CSSFontFaceSource::load(CSSFontSelector* fontSelector) > fontDescription.setComputedSize(1); > fontDescription.setShouldAllowUserInstalledFonts(m_face.allowUserInstalledFonts()); > success = FontCache::singleton().fontForFamily(fontDescription, m_familyNameOrURI, nullptr, nullptr, FontSelectionSpecifiedCapabilities(), true); >+#if ENABLE(WEB_API_STATISTICS) >+ if (auto document = fontSelector->document()) >+ ResourceLoadObserver::shared().logFontLoad(*document, m_familyNameOrURI.string(), success); >+#endif > } > setStatus(success ? Status::Success : Status::Failure); > } >diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp >index 9ad88a2a4df62a851786c0f34a9541d0a3cffdcc..a1bfa0d844d4f97e123781590be03edb114a8efc 100644 >--- a/Source/WebCore/css/CSSFontSelector.cpp >+++ b/Source/WebCore/css/CSSFontSelector.cpp >@@ -54,6 +54,10 @@ > #include <wtf/SetForScope.h> > #include <wtf/text/AtomicString.h> > >+#if ENABLE(WEB_API_STATISTICS) >+#include "ResourceLoadObserver.h" >+#endif >+ > namespace WebCore { > > static unsigned fontSelectorId; >@@ -304,13 +308,22 @@ FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription& fontDescr > > AtomicString familyForLookup = resolveGenericFamilyFirst ? resolveGenericFamily(m_document, fontDescription, familyName) : familyName; > auto* face = m_cssFontFaceSet->fontFace(fontDescription.fontSelectionRequest(), familyForLookup); >- if (!face) { >- if (!resolveGenericFamilyFirst) >- familyForLookup = resolveGenericFamily(m_document, fontDescription, familyName); >- return FontRanges(FontCache::singleton().fontForFamily(fontDescription, familyForLookup)); >+ if (face) { >+#if ENABLE(WEB_API_STATISTICS) >+ // This logs an attempted font load by setting the loadStatus boolean to true >+ if (m_document) >+ ResourceLoadObserver::shared().logFontLoad(*m_document, familyName.string(), true); >+#endif >+ return face->fontRanges(fontDescription); > } >- >- return face->fontRanges(fontDescription); >+ if (!resolveGenericFamilyFirst) >+ familyForLookup = resolveGenericFamily(m_document, fontDescription, familyName); >+ auto font = FontCache::singleton().fontForFamily(fontDescription, familyForLookup); >+#if ENABLE(WEB_API_STATISTICS) >+ if (m_document) >+ ResourceLoadObserver::shared().logFontLoad(*m_document, familyName.string(), !!font); >+#endif >+ return FontRanges { WTFMove(font) }; > } > > void CSSFontSelector::clearDocument() >@@ -390,8 +403,13 @@ RefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDescript > > if (!m_document->settings().fontFallbackPrefersPictographs()) > return nullptr; >- >- return FontCache::singleton().fontForFamily(fontDescription, m_document->settings().pictographFontFamily()); >+ RefPtr<Font> font = FontCache::singleton().fontForFamily(fontDescription, m_document->settings().pictographFontFamily()); >+#if ENABLE(WEB_API_STATISTICS) >+ if (m_document) >+ ResourceLoadObserver::shared().logFontLoad(*m_document, m_document->settings().pictographFontFamily().string(), !!font); >+#endif >+ >+ return font; > } > > } >diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp >index 6298643a2d96092a4cfee988dd28b6d937c5da73..a564f80ea60e14eea009c23fbd91f5f6f4d186d3 100644 >--- a/Source/WebCore/html/HTMLCanvasElement.cpp >+++ b/Source/WebCore/html/HTMLCanvasElement.cpp >@@ -64,6 +64,10 @@ > #include "MediaStream.h" > #endif > >+#if ENABLE(WEB_API_STATISTICS) >+#include "ResourceLoadObserver.h" >+#endif >+ > #if ENABLE(WEBGL) > #include "WebGLContextAttributes.h" > #include "WebGLRenderingContext.h" >@@ -698,6 +702,9 @@ ExceptionOr<UncachedString> HTMLCanvasElement::toDataURL(const String& mimeType, > > if (m_size.isEmpty() || !buffer()) > return UncachedString { "data:,"_s }; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logCanvasRead(document()); >+#endif > > auto encodingMIMEType = toEncodingMimeType(mimeType); > auto quality = qualityFromJSValue(qualityValue); >@@ -727,6 +734,9 @@ ExceptionOr<void> HTMLCanvasElement::toBlob(ScriptExecutionContext& context, Ref > callback->scheduleCallback(context, nullptr); > return { }; > } >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logCanvasRead(document()); >+#endif > > auto encodingMIMEType = toEncodingMimeType(mimeType); > auto quality = qualityFromJSValue(qualityValue); >@@ -755,8 +765,12 @@ ExceptionOr<void> HTMLCanvasElement::toBlob(ScriptExecutionContext& context, Ref > RefPtr<ImageData> HTMLCanvasElement::getImageData() > { > #if ENABLE(WEBGL) >- if (is<WebGLRenderingContextBase>(m_context.get())) >+ if (is<WebGLRenderingContextBase>(m_context.get())) { >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logCanvasRead(document()); >+#endif > return downcast<WebGLRenderingContextBase>(*m_context).paintRenderingResultsToImageData(); >+ } > #endif > return nullptr; > } >@@ -768,6 +782,9 @@ RefPtr<MediaSample> HTMLCanvasElement::toMediaSample() > auto* imageBuffer = buffer(); > if (!imageBuffer) > return nullptr; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logCanvasRead(document()); >+#endif > > #if PLATFORM(COCOA) > makeRenderingResultsAvailable(); >@@ -781,6 +798,9 @@ ExceptionOr<Ref<MediaStream>> HTMLCanvasElement::captureStream(ScriptExecutionCo > { > if (!originClean()) > return Exception(SecurityError, "Canvas is tainted"_s); >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logCanvasRead(document()); >+#endif > > if (frameRequestRate && frameRequestRate.value() < 0) > return Exception(NotSupportedError, "frameRequestRate is negative"_s); >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >index e27d95194819b02e9414d49bfa8faff2ea1761de..88860497462a249293d4969effa6bed0008a4c31 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >@@ -49,6 +49,10 @@ > #include <wtf/MathExtras.h> > #include <wtf/text/StringBuilder.h> > >+#if ENABLE(WEB_API_STATISTICS) >+#include "ResourceLoadObserver.h" >+#endif >+ > namespace WebCore { > > using namespace HTMLNames; >@@ -363,6 +367,12 @@ static void normalizeSpaces(String& text) > > Ref<TextMetrics> CanvasRenderingContext2D::measureText(const String& text) > { >+#if ENABLE(WEB_API_STATISTICS) >+ HTMLCanvasElement& canvas = this->canvas(); >+ ResourceLoadObserver::shared().logCanvasWriteOrMeasure(canvas.document(), text); >+ ResourceLoadObserver::shared().logCanvasRead(canvas.document()); >+#endif >+ > Ref<TextMetrics> metrics = TextMetrics::create(); > > String normalizedText = text; >@@ -451,6 +461,11 @@ FloatPoint CanvasRenderingContext2D::textOffset(float width, TextDirection direc > > void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, std::optional<float> maxWidth) > { >+#if ENABLE(WEB_API_STATISTICS) >+ HTMLCanvasElement& canvas = this->canvas(); >+ ResourceLoadObserver::shared().logCanvasWriteOrMeasure(canvas.document(), text); >+#endif >+ > auto& fontProxy = this->fontProxy(); > const auto& fontMetrics = fontProxy.fontMetrics(); > >diff --git a/Source/WebCore/loader/CanvasActivityRecord.cpp b/Source/WebCore/loader/CanvasActivityRecord.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..16057845fc5abd5126f6246b61a86b555e2a5906 >--- /dev/null >+++ b/Source/WebCore/loader/CanvasActivityRecord.cpp >@@ -0,0 +1,43 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "CanvasActivityRecord.h" >+ >+const unsigned textCapacity = 10; >+namespace WebCore { >+bool CanvasActivityRecord::recordWrittenOrMeasuredText(const String& text) >+{ >+ if (textWritten.size() < textCapacity && textWritten.add(text).isNewEntry) >+ return true; >+ return false; >+} >+ >+void CanvasActivityRecord::mergeWith(const CanvasActivityRecord& otherCanvasActivityRecord) >+{ >+ textWritten.add(otherCanvasActivityRecord.textWritten.begin(), otherCanvasActivityRecord.textWritten.end()); >+ wasDataRead |= otherCanvasActivityRecord.wasDataRead; >+} >+} // namespace WebCore >diff --git a/Source/WebCore/loader/CanvasActivityRecord.h b/Source/WebCore/loader/CanvasActivityRecord.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1e13f48cba6d2c83f0e7a30f3d361950bc124e51 >--- /dev/null >+++ b/Source/WebCore/loader/CanvasActivityRecord.h >@@ -0,0 +1,59 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+#include <wtf/HashSet.h> >+#include <wtf/text/StringHash.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+struct CanvasActivityRecord { >+ HashSet<String> textWritten; >+ bool wasDataRead { false }; >+ >+ bool recordWrittenOrMeasuredText(const String&); >+ void mergeWith(const CanvasActivityRecord&); >+ >+ template <class Encoder> void encode(Encoder&) const; >+ template <class Decoder> static bool decode(Decoder&, CanvasActivityRecord&); >+}; >+ >+template <class Encoder> >+void CanvasActivityRecord::encode(Encoder& encoder) const >+{ >+ encoder << textWritten; >+ encoder << wasDataRead; >+} >+ >+template <class Decoder> >+bool CanvasActivityRecord::decode(Decoder& decoder, CanvasActivityRecord& canvasActivityRecord) >+{ >+ if (!decoder.decode(canvasActivityRecord.textWritten)) >+ return false; >+ if (!decoder.decode(canvasActivityRecord.wasDataRead)) >+ return false; >+ return true; >+} >+} // namespace WebCore >diff --git a/Source/WebCore/loader/ResourceLoadObserver.cpp b/Source/WebCore/loader/ResourceLoadObserver.cpp >index 8d03ba06755fa4570650f4e6d9b03bb68483df3a..f1e7f7f1990d9a00fb2bf4afa00a57609e5ee420 100644 >--- a/Source/WebCore/loader/ResourceLoadObserver.cpp >+++ b/Source/WebCore/loader/ResourceLoadObserver.cpp >@@ -242,6 +242,86 @@ void ResourceLoadObserver::requestStorageAccessUnderOpener(const String& domainI > } > #endif > >+#if ENABLE(WEB_API_STATISTICS) >+void ResourceLoadObserver::logFontLoad(const Document& document, const String& familyName, bool loadStatus) >+{ >+ if (!shouldLog(document.sessionID().isEphemeral()) || !document.frame()) >+ return; >+ auto registrableDomain = primaryDomain(document.url()); >+ auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain); >+ if (!loadStatus) >+ statistics.fontsFailedToLoad.add(familyName); >+ statistics.fontsLoaded.add(familyName); >+ auto mainFrameRegistrableDomain = primaryDomain(document.frame()->mainFrame().document()->url()); >+ if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry) >+ scheduleNotificationIfNeeded(); >+} >+ >+void ResourceLoadObserver::logCanvasRead(const Document& document) >+{ >+ if (!shouldLog(document.sessionID().isEphemeral()) || !document.frame()) >+ return; >+ auto registrableDomain = primaryDomain(document.url()); >+ auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain); >+ auto mainFrameRegistrableDomain = primaryDomain(document.frame()->mainFrame().document()->url()); >+ statistics.canvasActivityRecord.wasDataRead = true; >+ if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry) >+ scheduleNotificationIfNeeded(); >+} >+ >+void ResourceLoadObserver::logCanvasWriteOrMeasure(const Document& document, const String& textWritten) >+{ >+ if (!shouldLog(document.sessionID().isEphemeral()) || !document.frame()) >+ return; >+ auto registrableDomain = primaryDomain(document.url()); >+ auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain); >+ bool shouldCallNotificationCallback = false; >+ auto mainFrameRegistrableDomain = primaryDomain(document.frame()->mainFrame().document()->url()); >+ if (statistics.canvasActivityRecord.recordWrittenOrMeasuredText(textWritten)) >+ shouldCallNotificationCallback = true; >+ if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry) >+ shouldCallNotificationCallback = true; >+ if (shouldCallNotificationCallback) >+ scheduleNotificationIfNeeded(); >+} >+ >+void ResourceLoadObserver::logNavigatorAPIAccessed(const Document& document, const ResourceLoadStatistics::NavigatorFunctionName functionName) >+{ >+ if (!shouldLog(document.sessionID().isEphemeral()) || !document.frame()) >+ return; >+ auto registrableDomain = primaryDomain(document.url()); >+ auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain); >+ bool shouldCallNotificationCallback = false; >+ if (!statistics.navigatorFunctionsAccessed.contains(functionName)) { >+ statistics.navigatorFunctionsAccessed |= functionName; >+ shouldCallNotificationCallback = true; >+ } >+ auto mainFrameRegistrableDomain = primaryDomain(document.frame()->mainFrame().document()->url()); >+ if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry) >+ shouldCallNotificationCallback = true; >+ if (shouldCallNotificationCallback) >+ scheduleNotificationIfNeeded(); >+} >+ >+void ResourceLoadObserver::logScreenAPIAccessed(const Document& document, const ResourceLoadStatistics::ScreenFunctionName functionName) >+{ >+ if (!shouldLog(document.sessionID().isEphemeral()) || !document.frame()) >+ return; >+ auto registrableDomain = primaryDomain(document.url()); >+ auto& statistics = ensureResourceStatisticsForPrimaryDomain(registrableDomain); >+ bool shouldCallNotificationCallback = false; >+ if (!statistics.screenFunctionsAccessed.contains(functionName)) { >+ statistics.screenFunctionsAccessed |= functionName; >+ shouldCallNotificationCallback = true; >+ } >+ auto mainFrameRegistrableDomain = primaryDomain(document.frame()->mainFrame().document()->url()); >+ if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry) >+ shouldCallNotificationCallback = true; >+ if (shouldCallNotificationCallback) >+ scheduleNotificationIfNeeded(); >+} >+#endif >+ > ResourceLoadStatistics& ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain(const String& primaryDomain) > { > auto addResult = m_resourceStatisticsMap.ensure(primaryDomain, [&primaryDomain] { >diff --git a/Source/WebCore/loader/ResourceLoadObserver.h b/Source/WebCore/loader/ResourceLoadObserver.h >index 5b6d9188fbd2228a913f81f33ad7dbc90534bb26..75a8e35a2631b494bc8ddfa8043204a3337a203e 100644 >--- a/Source/WebCore/loader/ResourceLoadObserver.h >+++ b/Source/WebCore/loader/ResourceLoadObserver.h >@@ -31,6 +31,11 @@ > #include <wtf/NeverDestroyed.h> > #include <wtf/text/WTFString.h> > >+#if ENABLE(WEB_API_STATISTICS) >+#include "CanvasActivityRecord.h" >+#include "ResourceLoadStatistics.h" >+#endif >+ > namespace WTF { > class Lock; > class WorkQueue; >@@ -58,6 +63,14 @@ public: > void logWebSocketLoading(const URL& targetURL, const URL& mainFrameURL, bool usesEphemeralSession); > void logUserInteractionWithReducedTimeResolution(const Document&); > void logWindowCreation(const URL& popupUrl, uint64_t openerPageID, Document& openerDocument); >+ >+#if ENABLE(WEB_API_STATISTICS) >+ void logFontLoad(const Document&, const String& familyName, bool loadStatus); >+ void logCanvasRead(const Document&); >+ void logCanvasWriteOrMeasure(const Document&, const String& textWritten); >+ void logNavigatorAPIAccessed(const Document&, const ResourceLoadStatistics::NavigatorFunctionName); >+ void logScreenAPIAccessed(const Document&, const ResourceLoadStatistics::ScreenFunctionName); >+#endif > > WEBCORE_EXPORT String statisticsForOrigin(const String&); > >diff --git a/Source/WebCore/loader/ResourceLoadStatistics.cpp b/Source/WebCore/loader/ResourceLoadStatistics.cpp >index 9e2b7cf31519ceb3856c38616c75720724f70ede..f0219123ec6d81a9768fd4c4af93d2e041393d18 100644 >--- a/Source/WebCore/loader/ResourceLoadStatistics.cpp >+++ b/Source/WebCore/loader/ResourceLoadStatistics.cpp >@@ -49,16 +49,48 @@ static void encodeHashCountedSet(KeyedEncoder& encoder, const String& label, con > }); > } > >-static void encodeHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet) >+static void encodeHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet, const String& key) > { > if (hashSet.isEmpty()) > return; > >- encoder.encodeObjects(label, hashSet.begin(), hashSet.end(), [](KeyedEncoder& encoderInner, const String& origin) { >- encoderInner.encodeString("origin", origin); >+ encoder.encodeObjects(label, hashSet.begin(), hashSet.end(), [&key](KeyedEncoder& encoderInner, const String& origin) { >+ encoderInner.encodeString(key, origin); > }); > } > >+static void encodeOriginHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet) >+{ >+ encodeHashSet(encoder, label, hashSet, "origin"); >+} >+ >+#if ENABLE(WEB_API_STATISTICS) >+template<typename T> >+static void encodeOptionSet(KeyedEncoder& encoder, const String& label, const OptionSet<T>& optionSet) >+{ >+ if (optionSet.isEmpty()) >+ return; >+ >+ uint64_t optionSetBitMask = optionSet.toRaw(); >+ encoder.encodeUInt64(label, optionSetBitMask); >+} >+ >+static void encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet) >+{ >+ encodeHashSet(encoder, label, hashSet, "font"); >+} >+ >+static void encodeCanvasActivityRecord(KeyedEncoder& encoder, const String& label, const CanvasActivityRecord& canvasActivityRecord) >+{ >+ encoder.encodeObject(label, canvasActivityRecord, [] (KeyedEncoder& encoderInner, const CanvasActivityRecord& canvasActivityRecord) { >+ encoderInner.encodeBool("wasDataRead", canvasActivityRecord.wasDataRead); >+ encoderInner.encodeObjects("textWritten", canvasActivityRecord.textWritten.begin(), canvasActivityRecord.textWritten.end(), [] (KeyedEncoder& encoderInner2, const String& text) { >+ encoderInner2.encodeString("text", text); >+ }); >+ }); >+} >+#endif >+ > void ResourceLoadStatistics::encode(KeyedEncoder& encoder) const > { > encoder.encodeString("PrevalentResourceOrigin", highLevelDomain); >@@ -71,7 +103,7 @@ void ResourceLoadStatistics::encode(KeyedEncoder& encoder) const > encoder.encodeBool("grandfathered", grandfathered); > > // Storage access >- encodeHashSet(encoder, "storageAccessUnderTopFrameOrigins", storageAccessUnderTopFrameOrigins); >+ encodeOriginHashSet(encoder, "storageAccessUnderTopFrameOrigins", storageAccessUnderTopFrameOrigins); > > // Top frame stats > encodeHashCountedSet(encoder, "topFrameUniqueRedirectsTo", topFrameUniqueRedirectsTo); >@@ -92,6 +124,15 @@ void ResourceLoadStatistics::encode(KeyedEncoder& encoder) const > > encoder.encodeUInt32("timesAccessedAsFirstPartyDueToUserInteraction", timesAccessedAsFirstPartyDueToUserInteraction); > encoder.encodeUInt32("timesAccessedAsFirstPartyDueToStorageAccessAPI", timesAccessedAsFirstPartyDueToStorageAccessAPI); >+ >+#if ENABLE(WEB_API_STATISTICS) >+ encodeFontHashSet(encoder, "fontsFailedToLoad", fontsFailedToLoad); >+ encodeFontHashSet(encoder, "fontsLoaded", fontsLoaded); >+ encodeHashCountedSet(encoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs); >+ encodeCanvasActivityRecord(encoder, "canvasActivityRecord", canvasActivityRecord); >+ encodeOptionSet(encoder, "navigatorFunctionsAccessedBitMask", navigatorFunctionsAccessed); >+ encodeOptionSet(encoder, "screenFunctionsAccessedBitMask", screenFunctionsAccessed); >+#endif > } > > static void decodeHashCountedSet(KeyedDecoder& decoder, const String& label, HashCountedSet<String>& hashCountedSet) >@@ -110,11 +151,11 @@ static void decodeHashCountedSet(KeyedDecoder& decoder, const String& label, Has > }); > } > >-static void decodeHashSet(KeyedDecoder& decoder, const String& label, HashSet<String>& hashSet) >+static void decodeHashSet(KeyedDecoder& decoder, const String& label, HashSet<String>& hashSet, const String& key) > { > Vector<String> ignore; >- decoder.decodeObjects(label, ignore, [&hashSet](KeyedDecoder& decoderInner, String& origin) { >- if (!decoderInner.decodeString("origin", origin)) >+ decoder.decodeObjects(label, ignore, [&hashSet, &key](KeyedDecoder& decoderInner, String& origin) { >+ if (!decoderInner.decodeString(key, origin)) > return false; > > hashSet.add(origin); >@@ -122,6 +163,42 @@ static void decodeHashSet(KeyedDecoder& decoder, const String& label, HashSet<St > }); > } > >+static void decodeOriginHashSet(KeyedDecoder& decoder, const String& label, HashSet<String>& hashSet) >+{ >+ decodeHashSet(decoder, label, hashSet, "origin"); >+} >+ >+#if ENABLE(WEB_API_STATISTICS) >+template<typename T> >+static void decodeOptionSet(KeyedDecoder& decoder, const String& label, OptionSet<T>& optionSet) >+{ >+ uint64_t optionSetBitMask = 0; >+ decoder.decodeUInt64(label, optionSetBitMask); >+ optionSet |= OptionSet<T>::fromRaw(optionSetBitMask); >+} >+ >+static void decodeFontHashSet(KeyedDecoder& decoder, const String& label, HashSet<String>& hashSet) >+{ >+ decodeHashSet(decoder, label, hashSet, "font"); >+} >+ >+static void decodeCanvasActivityRecord(KeyedDecoder& decoder, const String& label, CanvasActivityRecord& canvasActivityRecord) >+{ >+ decoder.decodeObject(label, canvasActivityRecord, [] (KeyedDecoder& decoderInner, CanvasActivityRecord& canvasActivityRecord) { >+ if (!decoderInner.decodeBool("wasDataRead", canvasActivityRecord.wasDataRead)) >+ return false; >+ Vector<String> ignore; >+ decoderInner.decodeObjects("textWritten", ignore, [&canvasActivityRecord] (KeyedDecoder& decoderInner2, String& text) { >+ if (!decoderInner2.decodeString("text", text)) >+ return false; >+ canvasActivityRecord.textWritten.add(text); >+ return true; >+ }); >+ return true; >+ }); >+} >+#endif >+ > bool ResourceLoadStatistics::decode(KeyedDecoder& decoder, unsigned modelVersion) > { > if (!decoder.decodeString("PrevalentResourceOrigin", highLevelDomain)) >@@ -132,7 +209,7 @@ bool ResourceLoadStatistics::decode(KeyedDecoder& decoder, unsigned modelVersion > return false; > > // Storage access >- decodeHashSet(decoder, "storageAccessUnderTopFrameOrigins", storageAccessUnderTopFrameOrigins); >+ decodeOriginHashSet(decoder, "storageAccessUnderTopFrameOrigins", storageAccessUnderTopFrameOrigins); > > // Top frame stats > if (modelVersion >= 11) { >@@ -180,6 +257,18 @@ bool ResourceLoadStatistics::decode(KeyedDecoder& decoder, unsigned modelVersion > if (!decoder.decodeUInt32("timesAccessedAsFirstPartyDueToStorageAccessAPI", timesAccessedAsFirstPartyDueToStorageAccessAPI)) > timesAccessedAsFirstPartyDueToStorageAccessAPI = 0; > } >+ >+#if ENABLE(WEB_API_STATISTICS) >+ if (modelVersion >= 13) { >+ decodeFontHashSet(decoder, "fontsFailedToLoad", fontsFailedToLoad); >+ decodeFontHashSet(decoder, "fontsLoaded", fontsLoaded); >+ decodeHashCountedSet(decoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs); >+ decodeCanvasActivityRecord(decoder, "canvasActivityRecord", canvasActivityRecord); >+ decodeOptionSet(decoder, "navigatorFunctionsAccessedBitMask", navigatorFunctionsAccessed); >+ decodeOptionSet(decoder, "screenFunctionsAccessedBitMask", screenFunctionsAccessed); >+ } >+#endif >+ > return true; > } > >@@ -224,12 +313,86 @@ static void appendHashSet(StringBuilder& builder, const String& label, const Has > builder.append('\n'); > } > } >+ >+static String navigatorEnumToString(ResourceLoadStatistics::NavigatorFunctionName navigatorEnum) >+{ >+ switch (navigatorEnum) { >+ case ResourceLoadStatistics::NavigatorFunctionName::JavaEnabled: >+ return "javaEnabled"; >+ case ResourceLoadStatistics::NavigatorFunctionName::MimeTypes: >+ return "mimeTypes"; >+ case ResourceLoadStatistics::NavigatorFunctionName::CookieEnabled: >+ return "cookieEnabled"; >+ case ResourceLoadStatistics::NavigatorFunctionName::Plugins: >+ return "plugins"; >+ case ResourceLoadStatistics::NavigatorFunctionName::UserAgent: >+ return "userAgent"; >+ case ResourceLoadStatistics::NavigatorFunctionName::AppVersion: >+ return "appVersion"; >+ default: >+ return "Not a recognized navigator function"; >+ } >+} >+ >+static String screenEnumToString(ResourceLoadStatistics::ScreenFunctionName screenEnum) >+{ >+ switch (screenEnum) { >+ case ResourceLoadStatistics::ScreenFunctionName::Height: >+ return "height"; >+ case ResourceLoadStatistics::ScreenFunctionName::Width: >+ return "width"; >+ case ResourceLoadStatistics::ScreenFunctionName::ColorDepth: >+ return "colorDepth"; >+ case ResourceLoadStatistics::ScreenFunctionName::PixelDepth: >+ return "pixelDepth"; >+ case ResourceLoadStatistics::ScreenFunctionName::AvailLeft: >+ return "availLeft"; >+ case ResourceLoadStatistics::ScreenFunctionName::AvailTop: >+ return "availTop"; >+ case ResourceLoadStatistics::ScreenFunctionName::AvailHeight: >+ return "availHeight"; >+ case ResourceLoadStatistics::ScreenFunctionName::AvailWidth: >+ return "availWidth"; >+ default: >+ return "Not a recognized screen function"; >+ } >+} >+ >+static void appendNavigatorOptionSet(StringBuilder& builder, const OptionSet<ResourceLoadStatistics::NavigatorFunctionName>& optionSet) >+{ >+ if (optionSet.isEmpty()) >+ return; >+ builder.appendLiteral(" "); >+ builder.append("navigatorFunctionsAccessed:"); >+ builder.append('\n'); >+ for (OptionSet<ResourceLoadStatistics::NavigatorFunctionName>::iterator it = optionSet.begin(); it != optionSet.end(); ++it) { >+ builder.appendLiteral(" "); >+ builder.append(navigatorEnumToString(*it)); >+ builder.append('\n'); >+ } >+} >+ >+static void appendScreenOptionSet(StringBuilder& builder, const OptionSet<ResourceLoadStatistics::ScreenFunctionName>& optionSet) >+{ >+ if (optionSet.isEmpty()) >+ return; >+ builder.appendLiteral(" "); >+ builder.append("screenFunctionsAccessed:"); >+ builder.append('\n'); >+ for (OptionSet<ResourceLoadStatistics::ScreenFunctionName>::iterator it = optionSet.begin(); it != optionSet.end(); ++it) { >+ builder.appendLiteral(" "); >+ builder.append(screenEnumToString(*it)); >+ builder.append('\n'); >+ } >+} > > String ResourceLoadStatistics::toString() const > { > StringBuilder builder; >- >- builder.appendLiteral("lastSeen"); >+ builder.appendLiteral("High level domain: "); >+ builder.append(highLevelDomain); >+ builder.append('\n'); >+ builder.appendLiteral(" lastSeen: "); > builder.appendNumber(lastSeen.secondsSinceEpoch().value()); > builder.append('\n'); > >@@ -239,7 +402,7 @@ String ResourceLoadStatistics::toString() const > builder.appendLiteral(" mostRecentUserInteraction: "); > builder.appendNumber(mostRecentUserInteractionTime.secondsSinceEpoch().value()); > builder.append('\n'); >- appendBoolean(builder, " grandfathered", grandfathered); >+ appendBoolean(builder, "grandfathered", grandfathered); > builder.append('\n'); > > // Storage access >@@ -259,7 +422,9 @@ String ResourceLoadStatistics::toString() const > > // Prevalent Resource > appendBoolean(builder, "isPrevalentResource", isPrevalentResource); >- appendBoolean(builder, " isVeryPrevalentResource", isVeryPrevalentResource); >+ builder.append('\n'); >+ appendBoolean(builder, "isVeryPrevalentResource", isVeryPrevalentResource); >+ builder.append('\n'); > builder.appendLiteral(" dataRecordsRemoved: "); > builder.appendNumber(dataRecordsRemoved); > builder.append('\n'); >@@ -268,6 +433,16 @@ String ResourceLoadStatistics::toString() const > appendBoolean(builder, "isMarkedForCookieBlocking", isMarkedForCookieBlocking); > builder.append('\n'); > >+#if ENABLE(WEB_API_STATISTICS) >+ appendHashSet(builder, "fontsFailedToLoad", fontsFailedToLoad); >+ appendHashSet(builder, "fontsLoaded", fontsLoaded); >+ appendHashCountedSet(builder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs); >+ appendNavigatorOptionSet(builder, navigatorFunctionsAccessed); >+ appendScreenOptionSet(builder, screenFunctionsAccessed); >+ appendHashSet(builder, "canvasTextWritten", canvasActivityRecord.textWritten); >+ appendBoolean(builder, "canvasReadData", canvasActivityRecord.wasDataRead); >+ builder.append('\n'); >+#endif > builder.append('\n'); > > return builder.toString(); >@@ -330,6 +505,15 @@ void ResourceLoadStatistics::merge(const ResourceLoadStatistics& other) > > // In-memory only > isMarkedForCookieBlocking |= other.isMarkedForCookieBlocking; >+ >+#if ENABLE(WEB_API_STATISTICS) >+ mergeHashSet(fontsFailedToLoad, other.fontsFailedToLoad); >+ mergeHashSet(fontsLoaded, other.fontsLoaded); >+ mergeHashCountedSet(topFrameRegistrableDomainsWhichAccessedWebAPIs, other.topFrameRegistrableDomainsWhichAccessedWebAPIs); >+ canvasActivityRecord.mergeWith(other.canvasActivityRecord); >+ navigatorFunctionsAccessed |= other.navigatorFunctionsAccessed; >+ screenFunctionsAccessed |= other.screenFunctionsAccessed; >+#endif > } > > String ResourceLoadStatistics::primaryDomain(const URL& url) >diff --git a/Source/WebCore/loader/ResourceLoadStatistics.h b/Source/WebCore/loader/ResourceLoadStatistics.h >index 8c9ed4c2ba1fb34a59b6322d9beebaff83b62d40..4b6a8ac767331dc487b7f75acbe3a8616104ee51 100644 >--- a/Source/WebCore/loader/ResourceLoadStatistics.h >+++ b/Source/WebCore/loader/ResourceLoadStatistics.h >@@ -28,10 +28,15 @@ > #include "URL.h" > #include <wtf/HashCountedSet.h> > #include <wtf/HashSet.h> >+#include <wtf/OptionSet.h> > #include <wtf/WallTime.h> > #include <wtf/text/StringHash.h> > #include <wtf/text/WTFString.h> > >+#if ENABLE(WEB_API_STATISTICS) >+#include "CanvasActivityRecord.h" >+#endif >+ > namespace WebCore { > > class KeyedDecoder; >@@ -58,7 +63,7 @@ struct ResourceLoadStatistics { > WEBCORE_EXPORT void encode(KeyedEncoder&) const; > WEBCORE_EXPORT bool decode(KeyedDecoder&, unsigned modelVersion); > >- String toString() const; >+ WEBCORE_EXPORT String toString() const; > > WEBCORE_EXPORT void merge(const ResourceLoadStatistics&); > >@@ -96,6 +101,35 @@ struct ResourceLoadStatistics { > > // In-memory only > bool isMarkedForCookieBlocking { false }; >+ >+#if ENABLE(WEB_API_STATISTICS) >+ // This set represents the registrable domain of the top frame where web API >+ // were used in the top frame or one of its subframes. >+ HashCountedSet<String> topFrameRegistrableDomainsWhichAccessedWebAPIs; >+ HashSet<String> fontsFailedToLoad; >+ HashSet<String> fontsLoaded; >+ CanvasActivityRecord canvasActivityRecord; >+ enum class NavigatorFunctionName : uint64_t { >+ AppVersion = 1 << 0, >+ UserAgent = 1 << 1, >+ Plugins = 1 << 2, >+ MimeTypes = 1 << 3, >+ CookieEnabled = 1 << 4, >+ JavaEnabled = 1 << 5, >+ }; >+ enum class ScreenFunctionName : uint64_t { >+ Height = 1 << 0, >+ Width = 1 << 1, >+ ColorDepth = 1 << 2, >+ PixelDepth = 1 << 3, >+ AvailLeft = 1 << 4, >+ AvailTop = 1 << 5, >+ AvailHeight = 1 << 6, >+ AvailWidth = 1 << 7, >+ }; >+ OptionSet<NavigatorFunctionName> navigatorFunctionsAccessed; >+ OptionSet<ScreenFunctionName> screenFunctionsAccessed; >+#endif > }; > > } // namespace WebCore >diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp >index 2aef7a9cc5021e40c7195c882e400e339cfb348e..3db7ee17ca640677cd5d5c8e87e7bde53339a8bf 100644 >--- a/Source/WebCore/page/Navigator.cpp >+++ b/Source/WebCore/page/Navigator.cpp >@@ -44,6 +44,9 @@ > #include <wtf/StdLibExtras.h> > #include <wtf/WeakPtr.h> > >+#if ENABLE(WEB_API_STATISTICS) >+#include "ResourceLoadObserver.h" >+#endif > > namespace WebCore { > using namespace WTF; >@@ -74,6 +77,9 @@ String Navigator::appVersion() const > { > if (!m_frame) > return String(); >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logNavigatorAPIAccessed(*m_frame->document(), ResourceLoadStatistics::NavigatorFunctionName::AppVersion); >+#endif > String appVersion = NavigatorBase::appVersion(); > if (shouldHideFourDot(*m_frame)) > appVersion.replace("4.", "4_"); >@@ -82,7 +88,12 @@ String Navigator::appVersion() const > > const String& Navigator::userAgent() const > { >- if (m_userAgent.isNull() && m_frame && m_frame->page()) >+ if (!m_frame || !m_frame->page()) >+ return m_userAgent; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logNavigatorAPIAccessed(*m_frame->document(), ResourceLoadStatistics::NavigatorFunctionName::UserAgent); >+#endif >+ if (m_userAgent.isNull()) > m_userAgent = m_frame->loader().userAgent(m_frame->document()->url()); > return m_userAgent; > } >@@ -136,6 +147,10 @@ void Navigator::share(ScriptExecutionContext& context, ShareData data, Ref<Defer > > DOMPluginArray& Navigator::plugins() > { >+#if ENABLE(WEB_API_STATISTICS) >+ if (m_frame) >+ ResourceLoadObserver::shared().logNavigatorAPIAccessed(*m_frame->document(), ResourceLoadStatistics::NavigatorFunctionName::Plugins); >+#endif > if (!m_plugins) > m_plugins = DOMPluginArray::create(m_frame); > return *m_plugins; >@@ -143,6 +158,10 @@ DOMPluginArray& Navigator::plugins() > > DOMMimeTypeArray& Navigator::mimeTypes() > { >+#if ENABLE(WEB_API_STATISTICS) >+ if (m_frame) >+ ResourceLoadObserver::shared().logNavigatorAPIAccessed(*m_frame->document(), ResourceLoadStatistics::NavigatorFunctionName::MimeTypes); >+#endif > if (!m_mimeTypes) > m_mimeTypes = DOMMimeTypeArray::create(m_frame); > return *m_mimeTypes; >@@ -152,6 +171,10 @@ bool Navigator::cookieEnabled() const > { > if (!m_frame) > return false; >+ >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logNavigatorAPIAccessed(*m_frame->document(), ResourceLoadStatistics::NavigatorFunctionName::CookieEnabled); >+#endif > > if (m_frame->page() && !m_frame->page()->settings().cookieEnabled()) > return false; >@@ -167,6 +190,10 @@ bool Navigator::javaEnabled() const > { > if (!m_frame) > return false; >+ >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logNavigatorAPIAccessed(*m_frame->document(), ResourceLoadStatistics::NavigatorFunctionName::JavaEnabled); >+#endif > > if (!m_frame->settings().isJavaEnabled()) > return false; >diff --git a/Source/WebCore/page/Screen.cpp b/Source/WebCore/page/Screen.cpp >index ff487d7cad06c754f00fbbd0244bdaa87ae9d2c0..498377e3f0cce07be1f10ad331195580266ce480 100644 >--- a/Source/WebCore/page/Screen.cpp >+++ b/Source/WebCore/page/Screen.cpp >@@ -34,6 +34,10 @@ > #include "FrameView.h" > #include "PlatformScreen.h" > >+#if ENABLE(WEB_API_STATISTICS) >+#include "ResourceLoadObserver.h" >+#endif >+ > namespace WebCore { > > Screen::Screen(Frame* frame) >@@ -45,6 +49,9 @@ unsigned Screen::height() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::Height); >+#endif > long height = static_cast<long>(screenRect(m_frame->view()).height()); > return static_cast<unsigned>(height); > } >@@ -53,6 +60,9 @@ unsigned Screen::width() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::Width); >+#endif > long width = static_cast<long>(screenRect(m_frame->view()).width()); > return static_cast<unsigned>(width); > } >@@ -61,6 +71,9 @@ unsigned Screen::colorDepth() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::ColorDepth); >+#endif > return static_cast<unsigned>(screenDepth(m_frame->view())); > } > >@@ -68,6 +81,9 @@ unsigned Screen::pixelDepth() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::PixelDepth); >+#endif > return static_cast<unsigned>(screenDepth(m_frame->view())); > } > >@@ -75,6 +91,9 @@ int Screen::availLeft() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::AvailLeft); >+#endif > return static_cast<int>(screenAvailableRect(m_frame->view()).x()); > } > >@@ -82,6 +101,9 @@ int Screen::availTop() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::AvailTop); >+#endif > return static_cast<int>(screenAvailableRect(m_frame->view()).y()); > } > >@@ -89,6 +111,9 @@ unsigned Screen::availHeight() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::AvailHeight); >+#endif > return static_cast<unsigned>(screenAvailableRect(m_frame->view()).height()); > } > >@@ -96,6 +121,9 @@ unsigned Screen::availWidth() const > { > if (!m_frame) > return 0; >+#if ENABLE(WEB_API_STATISTICS) >+ ResourceLoadObserver::shared().logScreenAPIAccessed(*m_frame->document(), ResourceLoadStatistics::ScreenFunctionName::AvailWidth); >+#endif > return static_cast<unsigned>(screenAvailableRect(m_frame->view()).width()); > } > >diff --git a/Source/WebCore/platform/KeyedCoding.h b/Source/WebCore/platform/KeyedCoding.h >index 5e9e959325f8857ca2a4caf02d63cc98ad9f0552..21d4cef795516396335a3052c76670c4761fecb8 100644 >--- a/Source/WebCore/platform/KeyedCoding.h >+++ b/Source/WebCore/platform/KeyedCoding.h >@@ -42,6 +42,7 @@ public: > virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) = 0; > virtual bool decodeBool(const String& key, bool&) = 0; > virtual bool decodeUInt32(const String& key, uint32_t&) = 0; >+ virtual bool decodeUInt64(const String& key, uint64_t&) = 0; > virtual bool decodeInt32(const String& key, int32_t&) = 0; > virtual bool decodeInt64(const String& key, int64_t&) = 0; > virtual bool decodeFloat(const String& key, float&) = 0; >@@ -150,6 +151,7 @@ public: > virtual void encodeBytes(const String& key, const uint8_t*, size_t) = 0; > virtual void encodeBool(const String& key, bool) = 0; > virtual void encodeUInt32(const String& key, uint32_t) = 0; >+ virtual void encodeUInt64(const String& key, uint64_t) = 0; > virtual void encodeInt32(const String& key, int32_t) = 0; > virtual void encodeInt64(const String& key, int64_t) = 0; > virtual void encodeFloat(const String& key, float) = 0; >diff --git a/Source/WebCore/platform/cf/KeyedDecoderCF.cpp b/Source/WebCore/platform/cf/KeyedDecoderCF.cpp >index 0569031e514f790a18a99294017e32ee08c40491..4b728db21f8759056208cb1d03a7a6e31cf0cbb2 100644 >--- a/Source/WebCore/platform/cf/KeyedDecoderCF.cpp >+++ b/Source/WebCore/platform/cf/KeyedDecoderCF.cpp >@@ -81,6 +81,15 @@ bool KeyedDecoderCF::decodeUInt32(const String& key, uint32_t& result) > { > return decodeInt32(key, reinterpret_cast<int32_t&>(result)); > } >+ >+bool KeyedDecoderCF::decodeUInt64(const String& key, uint64_t& result) >+{ >+ auto number = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(m_dictionaryStack.last(), key.createCFString().get())); >+ if (!number) >+ return false; >+ >+ return CFNumberGetValue(number, kCFNumberLongLongType, &result); >+} > > bool KeyedDecoderCF::decodeInt32(const String& key, int32_t& result) > { >diff --git a/Source/WebCore/platform/cf/KeyedDecoderCF.h b/Source/WebCore/platform/cf/KeyedDecoderCF.h >index 576622ebcea2d59bec89d3d7f24e9d303d1bf5a8..2fca2209fdca192474a859e88e9e42a612a483b8 100644 >--- a/Source/WebCore/platform/cf/KeyedDecoderCF.h >+++ b/Source/WebCore/platform/cf/KeyedDecoderCF.h >@@ -41,6 +41,7 @@ private: > bool decodeBytes(const String& key, const uint8_t*&, size_t&) override; > bool decodeBool(const String& key, bool&) override; > bool decodeUInt32(const String& key, uint32_t&) override; >+ bool decodeUInt64(const String& key, uint64_t&) override; > bool decodeInt32(const String& key, int32_t&) override; > bool decodeInt64(const String& key, int64_t&) override; > bool decodeFloat(const String& key, float&) override; >diff --git a/Source/WebCore/platform/cf/KeyedEncoderCF.cpp b/Source/WebCore/platform/cf/KeyedEncoderCF.cpp >index d0f0c9e24acd575dbca39511f3e3718b8f601500..ebbbb05aefa6d1e18e7e6dec7796d3d01c913df4 100644 >--- a/Source/WebCore/platform/cf/KeyedEncoderCF.cpp >+++ b/Source/WebCore/platform/cf/KeyedEncoderCF.cpp >@@ -71,6 +71,12 @@ void KeyedEncoderCF::encodeUInt32(const String& key, uint32_t value) > auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value)); > CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get()); > } >+ >+void KeyedEncoderCF::encodeUInt64(const String& key, uint64_t value) >+{ >+ auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberLongLongType, &value)); >+ CFDictionarySetValue(m_dictionaryStack.last(), key.createCFString().get(), number.get()); >+} > > void KeyedEncoderCF::encodeInt32(const String& key, int32_t value) > { >diff --git a/Source/WebCore/platform/cf/KeyedEncoderCF.h b/Source/WebCore/platform/cf/KeyedEncoderCF.h >index 82b6b6156877e043cc61d836baa92a4b2c47125b..f586c02bb15bf39b7283fba9aa5e8a126b84fefe 100644 >--- a/Source/WebCore/platform/cf/KeyedEncoderCF.h >+++ b/Source/WebCore/platform/cf/KeyedEncoderCF.h >@@ -42,6 +42,7 @@ private: > void encodeBytes(const String& key, const uint8_t*, size_t) final; > void encodeBool(const String& key, bool) final; > void encodeUInt32(const String& key, uint32_t) final; >+ void encodeUInt64(const String& key, uint64_t) final; > void encodeInt32(const String& key, int32_t) final; > void encodeInt64(const String& key, int64_t) final; > void encodeFloat(const String& key, float) final; >diff --git a/Source/WebKit/Configurations/FeatureDefines.xcconfig b/Source/WebKit/Configurations/FeatureDefines.xcconfig >index dfa4a259773f597db7eae6005dd81beb3d68de87..75739d69e14f4e5fd9c08781c0b9fc7e65cfaaa1 100644 >--- a/Source/WebKit/Configurations/FeatureDefines.xcconfig >+++ b/Source/WebKit/Configurations/FeatureDefines.xcconfig >@@ -358,6 +358,8 @@ ENABLE_WEBGPU_watchos = ENABLE_WEBGPU; > ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU; > ENABLE_WEBGPU_macosx = ENABLE_WEBGPU; > >+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS; >+ > ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; > > ENABLE_WEB_AUTHN = $(ENABLE_WEB_AUTHN_$(WK_PLATFORM_NAME)); >@@ -374,4 +376,4 @@ ENABLE_WIRELESS_PLAYBACK_TARGET = ENABLE_WIRELESS_PLAYBACK_TARGET; > > ENABLE_XSLT = ENABLE_XSLT; > >-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >index 9dab37dd60302bf2ea0e296c396809ca6cd80d70..354ae209aad646c24c8cc46d0557fc99a13d4c12 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >@@ -2664,6 +2664,18 @@ void ArgumentCoder<ResourceLoadStatistics>::encode(Encoder& encoder, const WebCo > encoder << statistics.isPrevalentResource; > encoder << statistics.isVeryPrevalentResource; > encoder << statistics.dataRecordsRemoved; >+ >+#if ENABLE(WEB_API_STATISTICS) >+ encoder << statistics.fontsFailedToLoad; >+ encoder << statistics.fontsLoaded; >+ encoder << statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs; >+ >+ encoder << statistics.canvasActivityRecord; >+ >+ encoder << statistics.navigatorFunctionsAccessed; >+ encoder << statistics.screenFunctionsAccessed; >+#endif >+ > } > > std::optional<ResourceLoadStatistics> ArgumentCoder<ResourceLoadStatistics>::decode(Decoder& decoder) >@@ -2723,7 +2735,26 @@ std::optional<ResourceLoadStatistics> ArgumentCoder<ResourceLoadStatistics>::dec > > if (!decoder.decode(statistics.dataRecordsRemoved)) > return std::nullopt; >- >+#if ENABLE(WEB_API_STATISTICS) >+ if (!decoder.decode(statistics.fontsFailedToLoad)) >+ return std::nullopt; >+ >+ if (!decoder.decode(statistics.fontsLoaded)) >+ return std::nullopt; >+ >+ if (!decoder.decode(statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs)) >+ return std::nullopt; >+ >+ if (!decoder.decode(statistics.canvasActivityRecord)) >+ return std::nullopt; >+ >+ if (!decoder.decode(statistics.navigatorFunctionsAccessed)) >+ return std::nullopt; >+ >+ if (!decoder.decode(statistics.screenFunctionsAccessed)) >+ return std::nullopt; >+#endif >+ > return WTFMove(statistics); > } > >diff --git a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >index 802d1cd938d83022e061cdacfa4e3371f9c68966..38fa1b1512fdb0d24bcc83b308003c143a14ff69 100644 >--- a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >@@ -30,6 +30,7 @@ > #include "APIWebsiteDataStore.h" > #include "WKAPICast.h" > #include "WKSecurityOriginRef.h" >+#include "WKString.h" > #include "WebResourceLoadStatisticsStore.h" > #include "WebResourceLoadStatisticsTelemetry.h" > #include "WebsiteData.h" >@@ -143,6 +144,19 @@ void WKWebsiteDataStoreSetStatisticsVeryPrevalentResource(WKWebsiteDataStoreRef > }); > } > >+void WKWebsiteDataStoreDumpResourceLoadStatistics(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreDumpResourceLoadStatisticsFunction callback) >+{ >+ auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >+ if (!store) { >+ callback(WKStringCreateWithUTF8CString(""), context); >+ return; >+ } >+ >+ store->dumpResourceLoadStatistics([context, callback](String dumpResourceLoadStatistics) { >+ callback(WKStringCreateWithUTF8CString(dumpResourceLoadStatistics.utf8().data()), context); >+ }); >+} >+ > void WKWebsiteDataStoreIsStatisticsPrevalentResource(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreIsStatisticsPrevalentResourceFunction callback) > { > auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >diff --git a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h >index 0662dcf2807783c01912e8cdd77087fee1f9354f..81511e8be8544c7c1ece98176d875614eea23dfe 100644 >--- a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h >+++ b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h >@@ -49,6 +49,8 @@ typedef void (*WKWebsiteDataStoreStatisticsPrevalentResourceFunction)(void* func > WK_EXPORT void WKWebsiteDataStoreSetStatisticsPrevalentResource(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, bool value, void* context, WKWebsiteDataStoreStatisticsPrevalentResourceFunction completionHandler); > typedef void (*WKWebsiteDataStoreStatisticsVeryPrevalentResourceFunction)(void* functionContext); > WK_EXPORT void WKWebsiteDataStoreSetStatisticsVeryPrevalentResource(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, bool value, void* context, WKWebsiteDataStoreStatisticsVeryPrevalentResourceFunction completionHandler); >+typedef void (*WKWebsiteDataStoreDumpResourceLoadStatisticsFunction)(WKStringRef dumpResourceLoadStatistics, void* functionContext); >+WK_EXPORT void WKWebsiteDataStoreDumpResourceLoadStatistics(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreDumpResourceLoadStatisticsFunction callback); > typedef void (*WKWebsiteDataStoreIsStatisticsPrevalentResourceFunction)(bool isPrevalentResource, void* functionContext); > WK_EXPORT void WKWebsiteDataStoreIsStatisticsPrevalentResource(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreIsStatisticsPrevalentResourceFunction callback); > WK_EXPORT void WKWebsiteDataStoreIsStatisticsVeryPrevalentResource(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreIsStatisticsPrevalentResourceFunction callback); >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >index 17ce7bd05c9453985930ce4e362e3a542f539b2b..479001a0f7a54d3283642640ae0025d5b2a8e051 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >@@ -46,7 +46,7 @@ > namespace WebKit { > using namespace WebCore; > >-constexpr unsigned statisticsModelVersion { 12 }; >+constexpr unsigned statisticsModelVersion { 13 }; > constexpr unsigned maxNumberOfRecursiveCallsInRedirectTraceBack { 50 }; > constexpr Seconds minimumStatisticsProcessingInterval { 5_s }; > constexpr unsigned operatingDatesWindow { 30 }; >@@ -671,7 +671,22 @@ void ResourceLoadStatisticsMemoryStore::setPrevalentResource(WebCore::ResourceLo > mapEntry->value.isPrevalentResource = true; > } > } >- >+ >+String ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics() const >+{ >+ ASSERT(!RunLoop::isMain()); >+ >+ StringBuilder dumpNavigatorString; >+ dumpNavigatorString.appendLiteral("Begin resource load statistics map dump: "); >+ dumpNavigatorString.append('\n'); >+ dumpNavigatorString.append('\n'); >+ for (auto& mapEntry : m_resourceStatisticsMap.values()) >+ dumpNavigatorString.append(mapEntry.toString()); >+ dumpNavigatorString.appendLiteral("End resource load statistics map dump."); >+ dumpNavigatorString.append('\n'); >+ return dumpNavigatorString.toString(); >+} >+ > bool ResourceLoadStatisticsMemoryStore::isPrevalentResource(const String& primaryDomain) const > { > ASSERT(!RunLoop::isMain()); >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >index b79f0fe504f79283e3d6706092fa8e4a07ddc45b..634b82d1fe848e4175b4011d96c0531383dda5a4 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >@@ -83,6 +83,7 @@ public: > bool isRegisteredAsRedirectingTo(const String& hostRedirectedFromPrimaryDomain, const String& hostRedirectedToPrimaryDomain) const; > > void clearPrevalentResource(const String& primaryDomain); >+ String dumpResourceLoadStatistics() const; > bool isPrevalentResource(const String& primaryDomain) const; > bool isVeryPrevalentResource(const String& primaryDomain) const; > void setPrevalentResource(const String& primaryDomain); >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index 6cd9dc4b7d74e0087901b05903b3bd2336a7a40d..0837b3fe91a0c68e990d99d72b513f7de04dc66f 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -493,6 +493,18 @@ void WebResourceLoadStatisticsStore::setVeryPrevalentResource(const URL& url, Co > postTaskReply(WTFMove(completionHandler)); > }); > } >+ >+void WebResourceLoadStatisticsStore::dumpResourceLoadStatistics(CompletionHandler<void(String)>&& completionHandler) >+{ >+ ASSERT(RunLoop::isMain()); >+ >+ postTask([this, completionHandler = WTFMove(completionHandler)] () mutable { >+ String dumpResourceLoadStatistics = m_memoryStore ? m_memoryStore->dumpResourceLoadStatistics() : ""; >+ postTaskReply([dumpResourceLoadStatistics, completionHandler = WTFMove(completionHandler)] () mutable { >+ completionHandler(dumpResourceLoadStatistics); >+ }); >+ }); >+} > > void WebResourceLoadStatisticsStore::isPrevalentResource(const URL& url, CompletionHandler<void (bool)>&& completionHandler) > { >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >index fb2440887d6a28e626169197b69c916e286ea423..826086307ec17b09d619f25ab55045aa17e302e8 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >@@ -91,6 +91,7 @@ public: > void setLastSeen(const WebCore::URL&, Seconds, CompletionHandler<void()>&&); > void setPrevalentResource(const WebCore::URL&, CompletionHandler<void()>&&); > void setVeryPrevalentResource(const WebCore::URL&, CompletionHandler<void()>&&); >+ void dumpResourceLoadStatistics(CompletionHandler<void(String)>&&); > void isPrevalentResource(const WebCore::URL&, CompletionHandler<void(bool)>&&); > void isVeryPrevalentResource(const WebCore::URL&, CompletionHandler<void(bool)>&&); > void isRegisteredAsSubresourceUnder(const WebCore::URL& subresource, const WebCore::URL& topFrame, CompletionHandler<void(bool)>&&); >diff --git a/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig >index dfa4a259773f597db7eae6005dd81beb3d68de87..75739d69e14f4e5fd9c08781c0b9fc7e65cfaaa1 100644 >--- a/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig >+++ b/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig >@@ -358,6 +358,8 @@ ENABLE_WEBGPU_watchos = ENABLE_WEBGPU; > ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU; > ENABLE_WEBGPU_macosx = ENABLE_WEBGPU; > >+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS; >+ > ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; > > ENABLE_WEB_AUTHN = $(ENABLE_WEB_AUTHN_$(WK_PLATFORM_NAME)); >@@ -374,4 +376,4 @@ ENABLE_WIRELESS_PLAYBACK_TARGET = ENABLE_WIRELESS_PLAYBACK_TARGET; > > ENABLE_XSLT = ENABLE_XSLT; > >-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 7cec6187fe5500d5bf80f52d8061660ba32b4e7d..79cc7cf4da78849fe22ba2536458bdb6a8c4872d 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,32 @@ >+2018-08-28 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added web API statistics collection >+ https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new flag ENABLE_WEB_API_STATISTICS to wrap all code in compile time flags for when >+ we would like to collect various web API statistics for analysis. >+ >+ * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: >+ >+ Added a new function to set a boolean which will dump the entire resource load statistics >+ map exactly once at the conclusion of a test. >+ >+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: >+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp: >+ (WTR::TestRunner::setDumpResourceLoadStatistics): >+ * WebKitTestRunner/InjectedBundle/TestRunner.h: >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::resourceStatisticsStringResultCallback): >+ (WTR::TestController::dumpResourceLoadStatistics): >+ * WebKitTestRunner/TestController.h: >+ * WebKitTestRunner/TestInvocation.cpp: >+ (WTR::TestInvocation::dumpResults): >+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): >+ (WTR::TestInvocation::setDumpResourceLoadStatistics): >+ * WebKitTestRunner/TestInvocation.h: >+ > 2018-08-30 Sihui Liu <sihui_liu@apple.com> > > WKNavigation.ProcessCrashDuringCallback is failing on iOS >diff --git a/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig b/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig >index dfa4a259773f597db7eae6005dd81beb3d68de87..75739d69e14f4e5fd9c08781c0b9fc7e65cfaaa1 100644 >--- a/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig >+++ b/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig >@@ -358,6 +358,8 @@ ENABLE_WEBGPU_watchos = ENABLE_WEBGPU; > ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU; > ENABLE_WEBGPU_macosx = ENABLE_WEBGPU; > >+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS; >+ > ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; > > ENABLE_WEB_AUTHN = $(ENABLE_WEB_AUTHN_$(WK_PLATFORM_NAME)); >@@ -374,4 +376,4 @@ ENABLE_WIRELESS_PLAYBACK_TARGET = ENABLE_WIRELESS_PLAYBACK_TARGET; > > ENABLE_XSLT = ENABLE_XSLT; > >-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_ANIMATIONS_LEVEL_2) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FAST_JIT_PERMISSIONS) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FTL_JIT) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_INTL) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_JIT) $(ENABLE_JS_ASYNC_ITERATION) $(ENABLE_KEYBOARD_CODE_ATTRIBUTE) $(ENABLE_KEYBOARD_KEY_ATTRIBUTE) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MAC_VIDEO_TOOLBOX) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_USERSELECT_ALL) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_RTC) $(ENABLE_WEBASSEMBLY) $(ENABLE_WEBASSEMBLY_STREAMING_API) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >index a46c46e5b0f94533ff4511f298ea93fab32b4d07..ecdde6e5f4cf6cb5b9f88cd4a899a1d566ebf9eb 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >@@ -268,6 +268,7 @@ interface TestRunner { > void disconnectMockGamepad(unsigned long index); > > // Resource Load Statistics >+ void setDumpResourceLoadStatistics(boolean shouldDump); > void installStatisticsDidModifyDataRecordsCallback(object callback); > void installStatisticsDidScanDataRecordsCallback(object callback); > void installStatisticsDidRunTelemetryCallback(object callback); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index d4bcaaef023ac95122c1ef720c712d19c6ae20ba..57af92747e473215813afae21c1ce0ac88958ec6 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >@@ -1455,7 +1455,14 @@ void TestRunner::statisticsCallDidSetVeryPrevalentResourceCallback() > { > callTestRunnerCallback(SetStatisticsVeryPrevalentResourceCallbackID); > } >- >+ >+void TestRunner::setDumpResourceLoadStatistics(bool shouldDump) >+{ >+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("setDumpResourceLoadStatistics")); >+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(shouldDump)); >+ WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get(), nullptr); >+} >+ > bool TestRunner::isStatisticsPrevalentResource(JSStringRef hostName) > { > WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("IsStatisticsPrevalentResource")); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >index bb7a0cfd4e95873cecd2cee69159ad0cd79c1c8c..948cc008dd3d553755edfe130ad80decc1956998 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >@@ -391,6 +391,7 @@ public: > void statisticsCallDidSetPrevalentResourceCallback(); > void setStatisticsVeryPrevalentResource(JSStringRef hostName, bool value, JSValueRef completionHandler); > void statisticsCallDidSetVeryPrevalentResourceCallback(); >+ void setDumpResourceLoadStatistics(bool shouldDump); > bool isStatisticsPrevalentResource(JSStringRef hostName); > bool isStatisticsVeryPrevalentResource(JSStringRef hostName); > bool isStatisticsRegisteredAsSubresourceUnder(JSStringRef subresourceHost, JSStringRef topFrameHost); >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 41b95051202107b1ac6d8367fd72fb3b155b41cb..e04c75b75a01eb39ba5dfdfdc7e9ac757eeb1c1e 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -2804,7 +2804,16 @@ struct ResourceStatisticsCallbackContext { > TestController& testController; > bool done { false }; > bool result { false }; >+ WKStringRef dump; > }; >+ >+static void resourceStatisticsStringResultCallback(WKStringRef dump, void* userData) >+{ >+ auto* context = static_cast<ResourceStatisticsCallbackContext*>(userData); >+ context->dump = dump; >+ context->done = true; >+ context->testController.notifyDone(); >+} > > static void resourceStatisticsVoidResultCallback(void* userData) > { >@@ -2865,6 +2874,15 @@ void TestController::setStatisticsVeryPrevalentResource(WKStringRef host, bool v > runUntil(context.done, noTimeout); > m_currentInvocation->didSetVeryPrevalentResource(); > } >+ >+WKStringRef TestController::dumpResourceLoadStatistics() >+{ >+ auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); >+ ResourceStatisticsCallbackContext context(*this); >+ WKWebsiteDataStoreDumpResourceLoadStatistics(dataStore, &context, resourceStatisticsStringResultCallback); >+ runUntil(context.done, noTimeout); >+ return context.dump; >+} > > bool TestController::isStatisticsPrevalentResource(WKStringRef host) > { >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index cf75d6676bfb46135c640618306419de17c895ca..aa4e3fe907119e44a6857c243fcb837362416fad 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -191,6 +191,7 @@ public: > void setStatisticsLastSeen(WKStringRef hostName, double seconds); > void setStatisticsPrevalentResource(WKStringRef hostName, bool value); > void setStatisticsVeryPrevalentResource(WKStringRef hostName, bool value); >+ WKStringRef dumpResourceLoadStatistics(); > bool isStatisticsPrevalentResource(WKStringRef hostName); > bool isStatisticsVeryPrevalentResource(WKStringRef hostName); > bool isStatisticsRegisteredAsSubresourceUnder(WKStringRef subresourceHost, WKStringRef topFrameHost); >diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp >index 13b21bedd5174071bda7b61b390efd788533c409..d9fd30e0fdbe985776861e62aee831abb7035263 100644 >--- a/Tools/WebKitTestRunner/TestInvocation.cpp >+++ b/Tools/WebKitTestRunner/TestInvocation.cpp >@@ -250,6 +250,14 @@ void TestInvocation::forceRepaintDoneCallback(WKErrorRef error, void* context) > > void TestInvocation::dumpResults() > { >+ if (m_shouldDumpResourceLoadStatistics) { >+ if (m_dumpResourceLoadStatistics.isEmpty()) { >+ WKStringRef dumpResourceLoadStatistics = TestController::singleton().dumpResourceLoadStatistics(); >+ m_dumpResourceLoadStatistics.append(toWTFString(dumpResourceLoadStatistics)); >+ } >+ m_textOutput.append(m_dumpResourceLoadStatistics); >+ } >+ > if (m_textOutput.length() || !m_audioResult) > dump(m_textOutput.toString().utf8().data()); > else >@@ -1069,6 +1077,14 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB > return nullptr; > } > >+ if (WKStringIsEqualToUTF8CString(messageName, "setDumpResourceLoadStatistics")) { >+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); >+ >+ WKBooleanRef shouldDump = static_cast<WKBooleanRef>(messageBody); >+ setDumpResourceLoadStatistics(WKBooleanGetValue(shouldDump)); >+ return nullptr; >+ } >+ > if (WKStringIsEqualToUTF8CString(messageName, "IsStatisticsPrevalentResource")) { > ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); > >@@ -1351,6 +1367,8 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB > } > > if (WKStringIsEqualToUTF8CString(messageName, "StatisticsResetToConsistentState")) { >+ if (m_shouldDumpResourceLoadStatistics) >+ m_dumpResourceLoadStatistics.append(toWTFString(TestController::singleton().dumpResourceLoadStatistics())); > TestController::singleton().statisticsResetToConsistentState(); > return nullptr; > } >@@ -1579,5 +1597,10 @@ void TestInvocation::didRemoveAllSessionCredentials() > WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidRemoveAllSessionCredentialsCallback")); > WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0); > } >+ >+void TestInvocation::setDumpResourceLoadStatistics(bool shouldDump) >+{ >+ m_shouldDumpResourceLoadStatistics = shouldDump; >+} > > } // namespace WTR >diff --git a/Tools/WebKitTestRunner/TestInvocation.h b/Tools/WebKitTestRunner/TestInvocation.h >index 3c050edadb1cefda962a5c47319b8f11bcd26af3..2e906597c07139d26a80b6af5e8bf95227912d3f 100644 >--- a/Tools/WebKitTestRunner/TestInvocation.h >+++ b/Tools/WebKitTestRunner/TestInvocation.h >@@ -83,6 +83,8 @@ public: > > void didRemoveAllSessionCredentials(); > >+ void setDumpResourceLoadStatistics(bool shouldDump); >+ > private: > WKRetainPtr<WKMutableDictionaryRef> createTestSettingsDictionary(); > >@@ -129,9 +131,11 @@ private: > bool m_dumpFrameLoadCallbacks { false }; > bool m_dumpPixels { false }; > bool m_pixelResultIsPending { false }; >+ bool m_shouldDumpResourceLoadStatistics { false }; > WhatToDump m_whatToDump { WhatToDump::RenderTree }; > > StringBuilder m_textOutput; >+ StringBuilder m_dumpResourceLoadStatistics; > WKRetainPtr<WKDataRef> m_audioResult; > WKRetainPtr<WKImageRef> m_pixelResult; > WKRetainPtr<WKArrayRef> m_repaintRects; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 6553ed1c58209c8dfe9d410adf1b0303db74a3ac..7cf5db9e663e49cdafdf0ef730ad3b46aa2732cf 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,24 @@ >+2018-08-28 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Added web API statistics collection >+ https://bugs.webkit.org/show_bug.cgi?id=187773 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added new tests and expectations for the web API statistics data collection. >+ >+ * TestExpectations: >+ * http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt: Added. >+ * http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html: Added. >+ * http/tests/webAPIStatistics/font-load-data-collection-expected.txt: Added. >+ * http/tests/webAPIStatistics/font-load-data-collection.html: Added. >+ * http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt: Added. >+ * http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html: Added. >+ * http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt: Added. >+ * http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html: Added. >+ * platform/ios/TestExpectations: >+ * platform/mac/TestExpectations: >+ > 2018-08-30 Youenn Fablet <youenn@apple.com> > > fast/mediastream/RTCPeerConnection-overloaded-operations.html is flaky after r235484 >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 3193ba318f7c2e78767641b59922e8c4c6805e2e..c4be4578b07b6cbf0a911698f3c3a8762b2f314b 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -2241,3 +2241,5 @@ webkit.org/b/185308 legacy-animation-engine/animations/combo-transform-translate > > # This test is currently only relevant on mac-wk2 > fast/canvas/webgl/context-update-on-display-configuration.html [ Skip ] >+ >+webkit.org/b/187773 http/tests/webAPIStatistics [ Skip ] >diff --git a/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..465db0a24c422c613df8619a1269adf994b85f02 >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt >@@ -0,0 +1,31 @@ >+Tests for canvas read and write data collection in ResourceLoadStatistics plist by rendering and reading text on the canvas and dumping the entire resource load statistics map. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+Begin resource load statistics map dump: >+ >+High level domain: 127.0.0.1 >+ lastSeen: 0 >+ hadUserInteraction: No >+ mostRecentUserInteraction: -1 >+ grandfathered: No >+ isPrevalentResource: No >+ isVeryPrevalentResource: No >+ dataRecordsRemoved: 0 >+ isMarkedForCookieBlocking: No >+ fontsLoaded: >+ -webkit-standard >+ -webkit-sans-serif >+ -webkit-monospace >+ topFrameRegistrableDomainsWhichAccessedWebAPIs: >+ 127.0.0.1: 8 >+ canvasTextWritten: >+ suspicious invisible text >+ canvasReadData: Yes >+ >+End resource load statistics map dump. >diff --git a/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..456decea84ab7a24ca0b9a04003db884eb873557 >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <title>Test for canvas read and write data collection in resource load statistics</title> >+ <script src="/js-test-resources/js-test.js"></script> >+</head> >+<body> >+<script> >+ description("Tests for canvas read and write data collection in ResourceLoadStatistics plist by rendering and reading text on the canvas and dumping the entire resource load statistics map."); >+ const hostUnderTest = "127.0.0.1:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ function completeTest() { >+ testRunner.setDumpResourceLoadStatistics(true); >+ >+ testRunner.statisticsResetToConsistentState(function() { >+ testRunner.notifyDone(); >+ }); >+ } >+ >+ function runTestRunnerTest() { >+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); >+ >+ testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); >+ >+ var canvas = document.createElement('canvas'); >+ var context = canvas.getContext('2d'); >+ context.fillText('suspicious invisible text', 2, 15); >+ canvas.toDataURL(); >+ } >+ >+ if (document.location.host === hostUnderTest && window.testRunner && window.internals) { >+ testRunner.waitUntilDone(); >+ internals.setResourceLoadStatisticsEnabled(true); >+ runTestRunnerTest(); >+ } >+</script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..afab543f4edfd6ba9fe89870eb09f53074e127f1 >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt >@@ -0,0 +1,36 @@ >+Tests for font loading data collection in ResourceLoadStatistics plist by loading fonts and dumping the entire resource load statistics map. The test tries to load various fonts through a comma separated font-family list to draw a string with many m's since they differ in width more prominently among fonts. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+mmmmmmmmmmlli >+Begin resource load statistics map dump: >+ >+High level domain: 127.0.0.1 >+ lastSeen: 0 >+ hadUserInteraction: No >+ mostRecentUserInteraction: -1 >+ grandfathered: No >+ isPrevalentResource: No >+ isVeryPrevalentResource: No >+ dataRecordsRemoved: 0 >+ isMarkedForCookieBlocking: No >+ fontsFailedToLoad: >+ Fransiscan >+ Andale >+ notARealFont >+ fontsLoaded: >+ notARealFont >+ Andale >+ -webkit-monospace >+ Fransiscan >+ -webkit-standard >+ -webkit-serif >+ topFrameRegistrableDomainsWhichAccessedWebAPIs: >+ 127.0.0.1: 9 >+ canvasReadData: No >+ >+End resource load statistics map dump. >diff --git a/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1fdb7f31d2c1f3da0fe38ca10c376260ee654f9a >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html >@@ -0,0 +1,45 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <title>Test for font loading data collection in resource load statistics</title> >+ <script src="/js-test-resources/js-test.js"></script> >+</head> >+<body> >+<script> >+ description("Tests for font loading data collection in ResourceLoadStatistics plist by loading fonts and dumping the entire resource load statistics map. The test tries to load various fonts through a comma separated font-family list to draw a string with many m's since they differ in width more prominently among fonts."); >+ const hostUnderTest = "127.0.0.1:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ function completeTest() { >+ testRunner.setDumpResourceLoadStatistics(true); >+ >+ testRunner.statisticsResetToConsistentState(function() { >+ testRunner.notifyDone(); >+ }); >+ } >+ >+ function runTestRunnerTest() { >+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); >+ >+ testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); >+ >+ var body = document.getElementsByTagName('body')[0] >+ >+ var span = document.createElement('span'); >+ var testFontString = 'mmmmmmmmmmlli'; >+ >+ span.innerHTML = testFontString; >+ span.style.fontFamily = 'sans-serif'; >+ span.style.fontFamily = 'Andale, Fransiscan, notARealFont, serif'; >+ body.appendChild(span); >+ } >+ >+ if (document.location.host === hostUnderTest && window.testRunner && window.internals) { >+ testRunner.waitUntilDone(); >+ internals.setResourceLoadStatisticsEnabled(true); >+ runTestRunnerTest(); >+ } >+</script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1ce4512cf9506bef356cb281a4d6dd136e40baf5 >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt >@@ -0,0 +1,35 @@ >+Tests for navigator functions accessed data collection in ResourceLoadStatistics plist by querying for all the navigator properties and dumping the entire resource load statistics map. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+Begin resource load statistics map dump: >+ >+High level domain: 127.0.0.1 >+ lastSeen: 0 >+ hadUserInteraction: No >+ mostRecentUserInteraction: -1 >+ grandfathered: No >+ isPrevalentResource: No >+ isVeryPrevalentResource: No >+ dataRecordsRemoved: 0 >+ isMarkedForCookieBlocking: No >+ fontsLoaded: >+ -webkit-standard >+ -webkit-monospace >+ topFrameRegistrableDomainsWhichAccessedWebAPIs: >+ 127.0.0.1: 12 >+ navigatorFunctionsAccessed: >+ appVersion >+ userAgent >+ plugins >+ mimeTypes >+ cookieEnabled >+ javaEnabled >+ canvasReadData: No >+ >+End resource load statistics map dump. >diff --git a/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6afab2ce79020c186f1036465c6ad01009b676f8 >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html >@@ -0,0 +1,42 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <title>Test for navigator functions accessed data collection in resource load statistics</title> >+ <script src="/js-test-resources/js-test.js"></script> >+</head> >+<body> >+<script> >+ description("Tests for navigator functions accessed data collection in ResourceLoadStatistics plist by querying for all the navigator properties and dumping the entire resource load statistics map."); >+ const hostUnderTest = "127.0.0.1:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ function completeTest() { >+ testRunner.setDumpResourceLoadStatistics(true); >+ >+ testRunner.statisticsResetToConsistentState(function() { >+ testRunner.notifyDone(); >+ }); >+ } >+ >+ function runTestRunnerTest() { >+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); >+ >+ testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); >+ >+ var useragent = navigator.userAgent; >+ var javaenabled = navigator.javaEnabled(); >+ var cookieEnabled = navigator.cookieEnabled; >+ var mimetypes = navigator.mimeTypes; >+ var plugins = navigator.plugins; >+ var appversion = navigator.appVersion; >+ } >+ >+ if (document.location.host === hostUnderTest && window.testRunner && window.internals) { >+ testRunner.waitUntilDone(); >+ internals.setResourceLoadStatisticsEnabled(true); >+ runTestRunnerTest(); >+ } >+</script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..369de9172c4195138a13cf62478b4b5f4948a474 >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt >@@ -0,0 +1,37 @@ >+Tests for screen functions accessed data collection in ResourceLoadStatistics plist by querying for all the screen properties and dumping the entire resource load statistics map. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+Begin resource load statistics map dump: >+ >+High level domain: 127.0.0.1 >+ lastSeen: 0 >+ hadUserInteraction: No >+ mostRecentUserInteraction: -1 >+ grandfathered: No >+ isPrevalentResource: No >+ isVeryPrevalentResource: No >+ dataRecordsRemoved: 0 >+ isMarkedForCookieBlocking: No >+ fontsLoaded: >+ -webkit-standard >+ -webkit-monospace >+ topFrameRegistrableDomainsWhichAccessedWebAPIs: >+ 127.0.0.1: 13 >+ screenFunctionsAccessed: >+ height >+ width >+ colorDepth >+ pixelDepth >+ availLeft >+ availTop >+ availHeight >+ availWidth >+ canvasReadData: No >+ >+End resource load statistics map dump. >diff --git a/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b4a2620b1c630d006f7a7dccb2fc570475f2aacf >--- /dev/null >+++ b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html >@@ -0,0 +1,44 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <title>Test for screen functions accessed data collection in resource load statistics</title> >+ <script src="/js-test-resources/js-test.js"></script> >+</head> >+<body> >+<script> >+ description("Tests for screen functions accessed data collection in ResourceLoadStatistics plist by querying for all the screen properties and dumping the entire resource load statistics map."); >+ const hostUnderTest = "127.0.0.1:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ function completeTest() { >+ testRunner.setDumpResourceLoadStatistics(true); >+ >+ testRunner.statisticsResetToConsistentState(function() { >+ testRunner.notifyDone(); >+ }); >+ } >+ >+ function runTestRunnerTest() { >+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); >+ >+ testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); >+ >+ var availTop = screen.availTop; >+ var colorDepth = screen.colorDepth; >+ var pixelDepth = screen.pixelDepth; >+ var height = screen.height; >+ var width = screen.width; >+ var availLeft = screen.availLeft; >+ var availHeight = screen.availHeight; >+ var availWidth = screen.availWidth; >+ } >+ >+ if (document.location.host === hostUnderTest && window.testRunner && window.internals) { >+ testRunner.waitUntilDone(); >+ internals.setResourceLoadStatisticsEnabled(true); >+ runTestRunnerTest(); >+ } >+</script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/platform/ios-wk2/TestExpectations b/LayoutTests/platform/ios-wk2/TestExpectations >index cb19c7582bc29d4711149203d33c9c9293a00b63..378adbce24d0e277ff09f8d7755935d0007a1461 100644 >--- a/LayoutTests/platform/ios-wk2/TestExpectations >+++ b/LayoutTests/platform/ios-wk2/TestExpectations >@@ -65,6 +65,8 @@ http/tests/security/contentSecurityPolicy/manifest-src-allowed.html [ Pass ] > http/tests/security/contentSecurityPolicy/manifest-src-blocked.html [ Pass ] > applicationmanifest/ [ Pass ] > >+webkit.org/b/187773 http/tests/webAPIStatistics [ Pass ] >+ > #////////////////////////////////////////////////////////////////////////////////////////// > # End platform-specific directories. > #////////////////////////////////////////////////////////////////////////////////////////// >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index 8eebfdfff757c8c226aa1fc2b8f8c20c164395f2..f334c1b4b2724e62f254a8de57af72f1a8f840d2 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -51,6 +51,8 @@ applicationmanifest/ [ Pass ] > > webkit.org/b/187183 http/tests/security/pasteboard-file-url.html [ Pass ] > >+webkit.org/b/187773 http/tests/webAPIStatistics [ Pass ] >+ > #////////////////////////////////////////////////////////////////////////////////////////// > # End platform-specific directories. > #//////////////////////////////////////////////////////////////////////////////////////////
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187773
:
345263
|
345271
|
345272
|
345274
|
345278
|
345335
|
345578
|
345617
|
345851
|
345865
|
345969
|
346072
|
346089
|
346092
|
346108
|
346115
|
346123
|
346126
|
346127
|
346172
|
347273
|
347277
|
347282
|
348041
|
348057
|
348065
|
348067
|
348068
|
348070
|
348227
|
348230
|
348253
|
348309
|
348323
|
348326
|
348512
|
348523
|
348528
|
348542
|
348653
|
348660
|
348682
|
348693
|
348964
|
348968
|
348976
|
349156
|
349175
|
349193
|
349196
|
349314
|
349328
|
349330
|
349353