We should resurrect the older patch that collects some statistics of web API calls
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2020 21:18:10 +0000 (21:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2020 21:18:10 +0000 (21:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=213319

Patch by Umar Iqbal <uiqbal@apple.com> on 2020-06-24
Reviewed by Brent Fulgham.
Source/JavaScriptCore:

+ Enabled ENABLE_WEB_API_STATISTICS flag

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

No new tests. Enabled existing tests.
Enabled http/tests/webAPIStatistics that test the functionality behind WEB_API_STATISTICS flag.

+ Brought back WebCore::encodeHashSet(KeyedEncoder& encoder, const String& label,
const String& key, const HashSet<String>& hashSet) because it was needed by
 WebCore::encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet)
+ Changed the type of HashCountedSet to HashSet because of earlier patch
 (https://bugs.webkit.org/attachment.cgi?id=363033) updated other HashCountedSet to HashSet,
 stating that the counted statistics were never used (see change log in the mentioned patch).
+ Also changed the type of topFrameRegistrableDomainsWhichAccessedWebAPIs HashSet
from String to RegistrableDomain. See the earlier bug (https://bugs.webkit.org/show_bug.cgi?id=194791)
that explains the switch from String to RegistrableDomain for eTLD+1's
+ Enabled WEB_API_STATISTICS flag in FeatureDefines.xcconfig and PlatformEnableCocoa.h
+ Added WTF::EnumTraits<> for OptionSet<> enum in ResourceLoadStatistics.h due to an earlier change.

* loader/ResourceLoadStatistics.h:
* Configurations/FeatureDefines.xcconfig:
* loader/CanvasActivityRecord.h:
* loader/ResourceLoadStatistics.cpp:
(WebCore::encodeHashSet):
(WebCore::ResourceLoadStatistics::encode const):
(WebCore::decodeHashSet):
(WebCore::decodeCanvasActivityRecord):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::appendHashSet):
(WebCore::ResourceLoadStatistics::toString const):

Source/WebCore/PAL:

+ Enabled ENABLE_WEB_API_STATISTICS flag

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

+ Enabled ENABLE_WEB_API_STATISTICS flag
+ Removed .string() from mainFrameRegistrableDomain to append it to topFrameRegistrableDomainsWhichAccessedWebAPIs
 because topFrameRegistrableDomainsWhichAccessedWebAPIs is a HashSet of WebCore::RegistrableDomain

* Configurations/FeatureDefines.xcconfig:
* WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
(WebKit::WebResourceLoadObserver::logFontLoad):
(WebKit::WebResourceLoadObserver::logCanvasRead):
(WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
(WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
(WebKit::WebResourceLoadObserver::logScreenAPIAccessed):

Source/WebKitLegacy/mac:

+ Enabled ENABLE_WEB_API_STATISTICS flag

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

+ Enabled ENABLE_WEB_API_STATISTICS flag

* wtf/PlatformEnableCocoa.h:

Tools:

+ Enabled ENABLE_WEB_API_STATISTICS flag.

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

We should resurrect the older patch that collects some statistics of web API calls

+ Enabled web API statistics tests in ios-wk2 and mac-wk2
+ Updated expectations for web API statistics and resrource load statistics tests.

* http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt:
* http/tests/webAPIStatistics/font-load-data-collection-expected.txt:
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt:
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt:
* platform/ios-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:

* http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access-expected.txt:
* http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt:
* http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt:
* http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-expected.txt:
* http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt:
* http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt:
* http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-expected.txt:
* http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-expected.txt:
* http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt:
* http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@263474 268f45cc-cd09-0410-ab3c-d52691b4dbfc

35 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt
LayoutTests/http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt
LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt
LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt
LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt
LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt
LayoutTests/platform/ios-wk2/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformEnableCocoa.h
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig
Source/WebCore/loader/CanvasActivityRecord.h
Source/WebCore/loader/ResourceLoadStatistics.cpp
Source/WebCore/loader/ResourceLoadStatistics.h
Source/WebKit/ChangeLog
Source/WebKit/Configurations/FeatureDefines.xcconfig
Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig
Tools/ChangeLog
Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig

index 655c792..5cda54c 100644 (file)
@@ -1,3 +1,33 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        
+        + Enabled web API statistics tests in ios-wk2 and mac-wk2
+        + Updated expectations for web API statistics and resrource load statistics tests.
+
+        * http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt:
+        * http/tests/webAPIStatistics/font-load-data-collection-expected.txt:
+        * http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt:
+        * http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt:
+        * platform/ios-wk2/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+        
+        * http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access-expected.txt:
+        * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt:
+        * http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt:
+        * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-expected.txt:
+        * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt:
+        * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt:
+        * http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-expected.txt:
+        * http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-expected.txt:
+        * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt:
+        * http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt:
+
 2020-06-24  Pinki Gyanchandani  <pgyanchandani@apple.com>
 
         Null Ptr Deref READ @ WTF::Optional<WTF::Seconds>::clear
index 39e11f8..ddce689 100644 (file)
@@ -16,6 +16,8 @@ Registrable domain: subframe1
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: subframe2
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -26,6 +28,8 @@ Registrable domain: subframe2
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: subframe3
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -41,6 +45,8 @@ Registrable domain: subframe3
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: topframe1
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -49,6 +55,8 @@ Registrable domain: topframe1
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: topframe2
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -57,6 +65,8 @@ Registrable domain: topframe2
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: topframe3
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -65,6 +75,8 @@ Registrable domain: topframe3
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: topframe4
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -73,6 +85,8 @@ Registrable domain: topframe4
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 
 ITP Data:
 Third Party Registrable Domain: subframe3
index 7071772..c76b8d7 100644 (file)
@@ -14,6 +14,8 @@ Registrable domain: 127.0.0.1
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: localhost
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -24,3 +26,5 @@ Registrable domain: localhost
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
index 7071772..c76b8d7 100644 (file)
@@ -14,6 +14,8 @@ Registrable domain: 127.0.0.1
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: localhost
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -24,3 +26,5 @@ Registrable domain: localhost
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
index ff6b212..891e3d6 100644 (file)
@@ -12,6 +12,8 @@ Registrable domain: 127.0.0.1
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: localhost
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -24,3 +26,5 @@ Registrable domain: localhost
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
index 92ade17..7a80d90 100644 (file)
@@ -12,6 +12,8 @@ Registrable domain: 127.0.0.1
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: localhost
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -22,3 +24,5 @@ Registrable domain: localhost
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
index 159370b..8b47b08 100644 (file)
@@ -25,6 +25,8 @@ Registrable domain: 127.0.0.1
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 1
+    canvasReadData: No
+
 Registrable domain: localhost
     hadUserInteraction: No
     mostRecentUserInteraction: -1
@@ -33,3 +35,5 @@ Registrable domain: localhost
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
index c87371c..0154c6f 100644 (file)
@@ -22,6 +22,8 @@ Registrable domain: 127.0.0.1
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 Registrable domain: localhost
     hadUserInteraction: Yes
     mostRecentUserInteraction: within 24 hours
@@ -38,6 +40,8 @@ Registrable domain: localhost
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
+    canvasReadData: No
+
 
 ITP Data:
 Third Party Registrable Domain: localhost
index 7464fd0..9493622 100644 (file)
@@ -1,11 +1,11 @@
 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.
 Resource load statistics:
 
-High level domain: 127.0.0.1
-    lastSeen: 0
+Registrable domain: 127.0.0.1
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    gotLinkDecorationFromPrevalentResource: No
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
@@ -13,7 +13,7 @@ High level domain: 127.0.0.1
         Helvetica
         Times
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 4
+        127.0.0.1
     canvasTextWritten:
         suspicious invisible text
     canvasReadData: Yes
index 11de7ad..ab163bf 100644 (file)
@@ -3,11 +3,11 @@ Tests for font loading data collection in ResourceLoadStatistics plist by loadin
 mmmmmmmmmmlli
 Resource load statistics:
 
-High level domain: 127.0.0.1
-    lastSeen: 0
+Registrable domain: 127.0.0.1
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    gotLinkDecorationFromPrevalentResource: No
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
@@ -18,6 +18,6 @@ High level domain: 127.0.0.1
     fontsSuccessfullyLoaded:
         Times
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 5
+        127.0.0.1
     canvasReadData: No
 
index dbc1222..87ea22b 100644 (file)
@@ -1,18 +1,18 @@
 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.
 Resource load statistics:
 
-High level domain: 127.0.0.1
-    lastSeen: 0
+Registrable domain: 127.0.0.1
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    gotLinkDecorationFromPrevalentResource: No
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
     fontsSuccessfullyLoaded:
         Times
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 8
+        127.0.0.1
     navigatorFunctionsAccessed:
         appVersion
         userAgent
index 51d4f49..63f205f 100644 (file)
@@ -1,18 +1,18 @@
 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.
 Resource load statistics:
 
-High level domain: 127.0.0.1
-    lastSeen: 0
+Registrable domain: 127.0.0.1
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    gotLinkDecorationFromPrevalentResource: No
     isPrevalentResource: No
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
     fontsSuccessfullyLoaded:
         Times
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 9
+        127.0.0.1
     screenFunctionsAccessed:
         height
         width
index ee96181..0761649 100644 (file)
@@ -69,7 +69,7 @@ http/tests/security/contentSecurityPolicy/manifest-src-blocked.html [ Pass ]
 applicationmanifest/ [ Pass ]
 
 # Skipped because of <rdar://problem/45388584>.
-http/tests/webAPIStatistics [ Skip ]
+http/tests/webAPIStatistics [ Pass ]
 
 # Non-fast scrollable region doesn't apply to iOS.
 scrollingcoordinator/non-fast-scrollable-region-scaled-iframe.html [ Skip ]
index 0372b42..f23ea94 100644 (file)
@@ -70,7 +70,7 @@ fast/canvas/webgl/context-update-on-display-configuration.html [ Pass ]
 fast/misc/valid-primary-screen-displayID.html [ Pass ]
 
 # Skipped because of <rdar://problem/45388584>.
-http/tests/webAPIStatistics [ Skip ]
+http/tests/webAPIStatistics [ Pass ]
 
 webkit.org/b/184569 storage/indexeddb/modern/transactions-stop-on-navigation.html [ Pass Failure ]
 
index f1b58a6..a912eee 100644 (file)
@@ -1,3 +1,14 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+
+        + Enabled ENABLE_WEB_API_STATISTICS flag
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2020-06-24  Alexey Shvayka  <shvaikalesh@gmail.com>
 
         Add DFG/FTL fast path for GetPrototypeOf based on OverridesGetPrototype flag
index e8beb1e..bd2cc28 100644 (file)
@@ -385,7 +385,7 @@ ENABLE_WEBGPU_MACOS_SINCE_1014 = ENABLE_WEBGPU;
 
 ENABLE_WEBXR = ;
 
-ENABLE_WEB_API_STATISTICS = ;
+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
 
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 
index 0779714..dd5f3ce 100644 (file)
@@ -1,3 +1,14 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+
+        + Enabled ENABLE_WEB_API_STATISTICS flag
+        
+        * wtf/PlatformEnableCocoa.h:
+
 2020-06-24  Geoffrey Garen  <ggaren@apple.com>
 
         Removed the 50ms rescheduling timeout from callOnMainThread
index fcaf60e..e323a11 100644 (file)
 #define ENABLE_RESOURCE_LOAD_STATISTICS 1
 #endif
 
+#if !defined(ENABLE_WEB_API_STATISTICS)
+#define ENABLE_WEB_API_STATISTICS 1
+#endif
+
 #if !defined(ENABLE_RESOURCE_USAGE)
 #define ENABLE_RESOURCE_USAGE 1
 #endif
index 2de6769..de9087d 100644 (file)
@@ -1,3 +1,37 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+
+        No new tests. Enabled existing tests.
+        Enabled http/tests/webAPIStatistics that test the functionality behind WEB_API_STATISTICS flag.
+        
+        + Brought back WebCore::encodeHashSet(KeyedEncoder& encoder, const String& label,
+        const String& key, const HashSet<String>& hashSet) because it was needed by
+         WebCore::encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet)
+        + Changed the type of HashCountedSet to HashSet because of earlier patch
+         (https://bugs.webkit.org/attachment.cgi?id=363033) updated other HashCountedSet to HashSet,
+         stating that the counted statistics were never used (see change log in the mentioned patch).
+        + Also changed the type of topFrameRegistrableDomainsWhichAccessedWebAPIs HashSet
+        from String to RegistrableDomain. See the earlier bug (https://bugs.webkit.org/show_bug.cgi?id=194791)
+        that explains the switch from String to RegistrableDomain for eTLD+1's
+        + Enabled WEB_API_STATISTICS flag in FeatureDefines.xcconfig and PlatformEnableCocoa.h
+        + Added WTF::EnumTraits<> for OptionSet<> enum in ResourceLoadStatistics.h due to an earlier change.
+        
+        * loader/ResourceLoadStatistics.h:
+        * Configurations/FeatureDefines.xcconfig:
+        * loader/CanvasActivityRecord.h:
+        * loader/ResourceLoadStatistics.cpp:
+        (WebCore::encodeHashSet):
+        (WebCore::ResourceLoadStatistics::encode const):
+        (WebCore::decodeHashSet):
+        (WebCore::decodeCanvasActivityRecord):
+        (WebCore::ResourceLoadStatistics::decode):
+        (WebCore::appendHashSet):
+        (WebCore::ResourceLoadStatistics::toString const):
+
 2020-06-24  Pinki Gyanchandani  <pgyanchandani@apple.com>
 
         Null Ptr Deref READ @ WTF::Optional<WTF::Seconds>::clear
index e8beb1e..bd2cc28 100644 (file)
@@ -385,7 +385,7 @@ ENABLE_WEBGPU_MACOS_SINCE_1014 = ENABLE_WEBGPU;
 
 ENABLE_WEBXR = ;
 
-ENABLE_WEB_API_STATISTICS = ;
+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
 
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 
index 6687ec9..39dc789 100644 (file)
@@ -1,3 +1,14 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+
+        + Enabled ENABLE_WEB_API_STATISTICS flag
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2020-06-22  Tim Horton  <timothy_horton@apple.com>
 
         Update macOS version macros
index e8beb1e..bd2cc28 100644 (file)
@@ -385,7 +385,7 @@ ENABLE_WEBGPU_MACOS_SINCE_1014 = ENABLE_WEBGPU;
 
 ENABLE_WEBXR = ;
 
-ENABLE_WEB_API_STATISTICS = ;
+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
 
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 
index 4046540..ed3735d 100644 (file)
@@ -33,7 +33,7 @@ struct CanvasActivityRecord {
     HashSet<String> textWritten;
     bool wasDataRead { false };
     
-    bool recordWrittenOrMeasuredText(const String&);
+    WEBCORE_EXPORT bool recordWrittenOrMeasuredText(const String&);
     void mergeWith(const CanvasActivityRecord&);
     
     template <class Encoder> void encode(Encoder&) const;
index 34a2280..9291192 100644 (file)
@@ -60,6 +60,16 @@ static void encodeOptionSet(KeyedEncoder& encoder, const String& label, const Op
 }
 
 #if ENABLE(WEB_API_STATISTICS)
+static void encodeHashSet(KeyedEncoder& encoder, const String& label,  const String& key, const HashSet<String>& hashSet)
+{
+    if (hashSet.isEmpty())
+        return;
+    
+    encoder.encodeObjects(label, hashSet.begin(), hashSet.end(), [&key](KeyedEncoder& encoderInner, const String& origin) {
+        encoderInner.encodeString(key, origin);
+    });
+}
+
 static void encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet)
 {
     encodeHashSet(encoder, label, "font", hashSet);
@@ -116,7 +126,7 @@ void ResourceLoadStatistics::encode(KeyedEncoder& encoder) const
 #if ENABLE(WEB_API_STATISTICS)
     encodeFontHashSet(encoder, "fontsFailedToLoad", fontsFailedToLoad);
     encodeFontHashSet(encoder, "fontsSuccessfullyLoaded", fontsSuccessfullyLoaded);
-    encodeHashCountedSet(encoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
+    encodeHashSet(encoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", "domain", topFrameRegistrableDomainsWhichAccessedWebAPIs);
     encodeCanvasActivityRecord(encoder, "canvasActivityRecord", canvasActivityRecord);
     encodeOptionSet(encoder, "navigatorFunctionsAccessedBitMask", navigatorFunctionsAccessed);
     encodeOptionSet(encoder, "screenFunctionsAccessedBitMask", screenFunctionsAccessed);
@@ -164,6 +174,20 @@ static void decodeOptionSet(KeyedDecoder& decoder, const String& label, OptionSe
 }
 
 #if ENABLE(WEB_API_STATISTICS)
+static void decodeHashSet(KeyedDecoder& decoder, const String& label, const String& key, HashSet<String>& hashSet)
+{
+    Vector<String> ignore;
+IGNORE_WARNINGS_BEGIN("unused-result")
+    decoder.decodeObjects(label, ignore, [&hashSet, &key](KeyedDecoder& decoderInner, String& origin) {
+        if (!decoderInner.decodeString(key, origin))
+            return false;
+        
+        hashSet.add(origin);
+        return true;
+    });
+IGNORE_WARNINGS_END
+}
+
 static void decodeFontHashSet(KeyedDecoder& decoder, const String& label, HashSet<String>& hashSet)
 {
     decodeHashSet(decoder, label, "font", hashSet);
@@ -171,6 +195,7 @@ static void decodeFontHashSet(KeyedDecoder& decoder, const String& label, HashSe
     
 static void decodeCanvasActivityRecord(KeyedDecoder& decoder, const String& label, CanvasActivityRecord& canvasActivityRecord)
 {
+IGNORE_WARNINGS_BEGIN("unused-result")
     decoder.decodeObject(label, canvasActivityRecord, [] (KeyedDecoder& decoderInner, CanvasActivityRecord& canvasActivityRecord) {
         if (!decoderInner.decodeBool("wasDataRead", canvasActivityRecord.wasDataRead))
             return false;
@@ -183,6 +208,7 @@ static void decodeCanvasActivityRecord(KeyedDecoder& decoder, const String& labe
         });
         return true;
     });
+IGNORE_WARNINGS_END
 }
 #endif
 
@@ -313,7 +339,7 @@ bool ResourceLoadStatistics::decode(KeyedDecoder& decoder, unsigned modelVersion
     if (modelVersion >= 13) {
         decodeFontHashSet(decoder, "fontsFailedToLoad", fontsFailedToLoad);
         decodeFontHashSet(decoder, "fontsSuccessfullyLoaded", fontsSuccessfullyLoaded);
-        decodeHashCountedSet(decoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
+        decodeHashSet(decoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", "domain", topFrameRegistrableDomainsWhichAccessedWebAPIs);
         decodeCanvasActivityRecord(decoder, "canvasActivityRecord", canvasActivityRecord);
         decodeOptionSet(decoder, "navigatorFunctionsAccessedBitMask", navigatorFunctionsAccessed);
         decodeOptionSet(decoder, "screenFunctionsAccessedBitMask", screenFunctionsAccessed);
@@ -348,6 +374,22 @@ static void appendHashSet(StringBuilder& builder, const String& label, const Has
 }
 
 #if ENABLE(WEB_API_STATISTICS)
+static void appendHashSet(StringBuilder& builder, const String& label, const HashSet<String>& hashSet)
+{
+    if (hashSet.isEmpty())
+        return;
+    
+    builder.appendLiteral("    ");
+    builder.append(label);
+    builder.appendLiteral(":\n");
+    
+    for (auto& entry : hashSet) {
+        builder.appendLiteral("        ");
+        builder.append(entry);
+        builder.append('\n');
+    }
+}
+
 static ASCIILiteral navigatorAPIEnumToString(ResourceLoadStatistics::NavigatorAPI navigatorEnum)
 {
     switch (navigatorEnum) {
@@ -472,7 +514,7 @@ String ResourceLoadStatistics::toString() const
 #if ENABLE(WEB_API_STATISTICS)
     appendHashSet(builder, "fontsFailedToLoad", fontsFailedToLoad);
     appendHashSet(builder, "fontsSuccessfullyLoaded", fontsSuccessfullyLoaded);
-    appendHashCountedSet(builder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
+    appendHashSet(builder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
     appendNavigatorAPIOptionSet(builder, navigatorFunctionsAccessed);
     appendScreenAPIOptionSet(builder, screenFunctionsAccessed);
     appendHashSet(builder, "canvasTextWritten", canvasActivityRecord.textWritten);
index d587a51..ec03c05 100644 (file)
@@ -123,7 +123,7 @@ struct ResourceLoadStatistics {
 #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<RegistrableDomain> topFrameRegistrableDomainsWhichAccessedWebAPIs;
     HashSet<String> fontsFailedToLoad;
     HashSet<String> fontsSuccessfullyLoaded;
     CanvasActivityRecord canvasActivityRecord;
@@ -133,3 +133,33 @@ struct ResourceLoadStatistics {
 };
 
 } // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::ResourceLoadStatistics::NavigatorAPI> {
+    using values = EnumValues<
+        WebCore::ResourceLoadStatistics::NavigatorAPI,
+        WebCore::ResourceLoadStatistics::NavigatorAPI::AppVersion,
+        WebCore::ResourceLoadStatistics::NavigatorAPI::UserAgent,
+        WebCore::ResourceLoadStatistics::NavigatorAPI::Plugins,
+        WebCore::ResourceLoadStatistics::NavigatorAPI::MimeTypes,
+        WebCore::ResourceLoadStatistics::NavigatorAPI::CookieEnabled,
+        WebCore::ResourceLoadStatistics::NavigatorAPI::JavaEnabled
+    >;
+};
+
+template<> struct EnumTraits<WebCore::ResourceLoadStatistics::ScreenAPI> {
+    using values = EnumValues<
+        WebCore::ResourceLoadStatistics::ScreenAPI,
+        WebCore::ResourceLoadStatistics::ScreenAPI::Height,
+        WebCore::ResourceLoadStatistics::ScreenAPI::Width,
+        WebCore::ResourceLoadStatistics::ScreenAPI::ColorDepth,
+        WebCore::ResourceLoadStatistics::ScreenAPI::PixelDepth,
+        WebCore::ResourceLoadStatistics::ScreenAPI::AvailLeft,
+        WebCore::ResourceLoadStatistics::ScreenAPI::AvailTop,
+        WebCore::ResourceLoadStatistics::ScreenAPI::AvailHeight,
+        WebCore::ResourceLoadStatistics::ScreenAPI::AvailWidth
+    >;
+};
+
+} // namespace WTF
index 4e165da..78a4f92 100644 (file)
@@ -1,3 +1,22 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+
+        + Enabled ENABLE_WEB_API_STATISTICS flag
+        + Removed .string() from mainFrameRegistrableDomain to append it to topFrameRegistrableDomainsWhichAccessedWebAPIs
+         because topFrameRegistrableDomainsWhichAccessedWebAPIs is a HashSet of WebCore::RegistrableDomain
+
+        * Configurations/FeatureDefines.xcconfig:
+        * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
+        (WebKit::WebResourceLoadObserver::logFontLoad):
+        (WebKit::WebResourceLoadObserver::logCanvasRead):
+        (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
+        (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
+        (WebKit::WebResourceLoadObserver::logScreenAPIAccessed):
+
 2020-06-24  Andy Estes  <aestes@apple.com>
 
         [iOS] Open element actions sometimes result in a hover instead of a click
index e8beb1e..bd2cc28 100644 (file)
@@ -385,7 +385,7 @@ ENABLE_WEBGPU_MACOS_SINCE_1014 = ENABLE_WEBGPU;
 
 ENABLE_WEBXR = ;
 
-ENABLE_WEB_API_STATISTICS = ;
+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
 
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 
index 7247a4e..e23c791 100644 (file)
@@ -163,7 +163,7 @@ void WebResourceLoadObserver::logFontLoad(const Document& document, const String
             shouldCallNotificationCallback = true;
     }
     RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
-    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
+    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
         shouldCallNotificationCallback = true;
     if (shouldCallNotificationCallback)
         scheduleNotificationIfNeeded();
@@ -184,7 +184,7 @@ void WebResourceLoadObserver::logCanvasRead(const Document& document)
     auto& statistics = ensureResourceStatisticsForRegistrableDomain(registrableDomain);
     RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
     statistics.canvasActivityRecord.wasDataRead = true;
-    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
+    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
         scheduleNotificationIfNeeded();
 #else
     UNUSED_PARAM(document);
@@ -203,7 +203,7 @@ void WebResourceLoadObserver::logCanvasWriteOrMeasure(const Document& document,
     RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
     if (statistics.canvasActivityRecord.recordWrittenOrMeasuredText(textWritten))
         shouldCallNotificationCallback = true;
-    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
+    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
         shouldCallNotificationCallback = true;
     if (shouldCallNotificationCallback)
         scheduleNotificationIfNeeded();
@@ -227,7 +227,7 @@ void WebResourceLoadObserver::logNavigatorAPIAccessed(const Document& document,
         shouldCallNotificationCallback = true;
     }
     RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
-    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
+    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
         shouldCallNotificationCallback = true;
     if (shouldCallNotificationCallback)
         scheduleNotificationIfNeeded();
@@ -251,7 +251,7 @@ void WebResourceLoadObserver::logScreenAPIAccessed(const Document& document, con
         shouldCallNotificationCallback = true;
     }
     RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
-    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
+    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
         shouldCallNotificationCallback = true;
     if (shouldCallNotificationCallback)
         scheduleNotificationIfNeeded();
index 22ec0e1..7310b55 100644 (file)
@@ -1,3 +1,14 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+
+        + Enabled ENABLE_WEB_API_STATISTICS flag
+        
+        * Configurations/FeatureDefines.xcconfig:
+
 2020-06-22  Tim Horton  <timothy_horton@apple.com>
 
         Update macOS version macros
index e8beb1e..bd2cc28 100644 (file)
@@ -385,7 +385,7 @@ ENABLE_WEBGPU_MACOS_SINCE_1014 = ENABLE_WEBGPU;
 
 ENABLE_WEBXR = ;
 
-ENABLE_WEB_API_STATISTICS = ;
+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
 
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 
index 929da15..44598c0 100644 (file)
@@ -1,3 +1,14 @@
+2020-06-24  Umar Iqbal  <uiqbal@apple.com>
+
+        We should resurrect the older patch that collects some statistics of web API calls
+        https://bugs.webkit.org/show_bug.cgi?id=213319
+
+        Reviewed by Brent Fulgham.
+        
+        + Enabled ENABLE_WEB_API_STATISTICS flag.
+        
+        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
+
 2020-06-24  Andy Estes  <aestes@apple.com>
 
         [iOS] Open element actions sometimes result in a hover instead of a click
index e8beb1e..bd2cc28 100644 (file)
@@ -385,7 +385,7 @@ ENABLE_WEBGPU_MACOS_SINCE_1014 = ENABLE_WEBGPU;
 
 ENABLE_WEBXR = ;
 
-ENABLE_WEB_API_STATISTICS = ;
+ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
 
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;