File tree Expand file tree Collapse file tree 11 files changed +88
-22
lines changed
Sources/ContentScopeScripts/dist Expand file tree Collapse file tree 11 files changed +88
-22
lines changed Original file line number Diff line number Diff line change 534534 "harmfulApis" ,
535535 "webCompat" ,
536536 "windowsPermissionUsage" ,
537- "brokerProtection"
537+ "brokerProtection" ,
538+ "performanceMetrics"
538539 ]
539540 ) ;
540541 const platformSupport = {
544545 ] ,
545546 "apple-isolated" : [
546547 "duckPlayer" ,
547- "brokerProtection"
548+ "brokerProtection" ,
549+ "performanceMetrics"
548550 ] ,
549551 android : [
550552 ...baseFeatures ,
Original file line number Diff line number Diff line change 417417 'harmfulApis' ,
418418 'webCompat' ,
419419 'windowsPermissionUsage' ,
420- 'brokerProtection'
420+ 'brokerProtection' ,
421+ 'performanceMetrics'
421422 ] ) ;
422423
423424 /** @typedef {baseFeatures[number]|otherFeatures[number] } FeatureName */
429430 ] ,
430431 'apple-isolated' : [
431432 'duckPlayer' ,
432- 'brokerProtection'
433+ 'brokerProtection' ,
434+ 'performanceMetrics'
433435 ] ,
434436 android : [
435437 ...baseFeatures ,
1080310805 }
1080410806 }
1080510807
10808+ class PerformanceMetrics extends ContentFeature {
10809+ init ( ) {
10810+ this . messaging . subscribe ( 'getVitals' , ( ) => {
10811+ const paintResources = performance . getEntriesByType ( 'paint' ) ;
10812+ const firstPaint = paintResources . find ( ( entry ) => entry . name === 'first-contentful-paint' ) ;
10813+ const vitals = firstPaint ? [ firstPaint . startTime ] : [ ] ;
10814+ this . messaging . notify ( 'vitalsResult' , { vitals } ) ;
10815+ } ) ;
10816+ }
10817+ }
10818+
1080610819 var platformFeatures = {
1080710820 ddg_feature_duckPlayer : DuckPlayerFeature ,
10808- ddg_feature_brokerProtection : BrokerProtection
10821+ ddg_feature_brokerProtection : BrokerProtection ,
10822+ ddg_feature_performanceMetrics : PerformanceMetrics
1080910823 } ;
1081010824
1081110825 /* global false */
Original file line number Diff line number Diff line change 745745 'harmfulApis',
746746 'webCompat',
747747 'windowsPermissionUsage',
748- 'brokerProtection'
748+ 'brokerProtection',
749+ 'performanceMetrics'
749750 ]);
750751
751752 /** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */
757758 ],
758759 'apple-isolated': [
759760 'duckPlayer',
760- 'brokerProtection'
761+ 'brokerProtection',
762+ 'performanceMetrics'
761763 ],
762764 android: [
763765 ...baseFeatures,
Original file line number Diff line number Diff line change 701701 'harmfulApis',
702702 'webCompat',
703703 'windowsPermissionUsage',
704- 'brokerProtection'
704+ 'brokerProtection',
705+ 'performanceMetrics'
705706 ]);
706707
707708 /** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */
713714 ],
714715 'apple-isolated': [
715716 'duckPlayer',
716- 'brokerProtection'
717+ 'brokerProtection',
718+ 'performanceMetrics'
717719 ],
718720 android: [
719721 ...baseFeatures,
Original file line number Diff line number Diff line change 698698 'harmfulApis',
699699 'webCompat',
700700 'windowsPermissionUsage',
701- 'brokerProtection'
701+ 'brokerProtection',
702+ 'performanceMetrics'
702703 ]);
703704
704705 /** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */
710711 ],
711712 'apple-isolated': [
712713 'duckPlayer',
713- 'brokerProtection'
714+ 'brokerProtection',
715+ 'performanceMetrics'
714716 ],
715717 android: [
716718 ...baseFeatures,
2068620688 }
2068720689 }
2068820690
20691+ class PerformanceMetrics extends ContentFeature {
20692+ init () {
20693+ this.messaging.subscribe('getVitals', () => {
20694+ const paintResources = performance.getEntriesByType('paint');
20695+ const firstPaint = paintResources.find((entry) => entry.name === 'first-contentful-paint');
20696+ const vitals = firstPaint ? [firstPaint.startTime] : [];
20697+ this.messaging.notify('vitalsResult', { vitals });
20698+ });
20699+ }
20700+ }
20701+
2068920702 var platformFeatures = {
2069020703 ddg_feature_runtimeChecks: RuntimeChecks,
2069120704 ddg_feature_fingerprintingAudio: FingerprintingAudio,
2070620719 ddg_feature_harmfulApis: HarmfulApis,
2070720720 ddg_feature_webCompat: WebCompat,
2070820721 ddg_feature_windowsPermissionUsage: WindowsPermissionUsage,
20709- ddg_feature_brokerProtection: BrokerProtection
20722+ ddg_feature_brokerProtection: BrokerProtection,
20723+ ddg_feature_performanceMetrics: PerformanceMetrics
2071020724 };
2071120725
2071220726 /* global false */
Original file line number Diff line number Diff line change 711711 'harmfulApis',
712712 'webCompat',
713713 'windowsPermissionUsage',
714- 'brokerProtection'
714+ 'brokerProtection',
715+ 'performanceMetrics'
715716 ]);
716717
717718 /** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */
723724 ],
724725 'apple-isolated': [
725726 'duckPlayer',
726- 'brokerProtection'
727+ 'brokerProtection',
728+ 'performanceMetrics'
727729 ],
728730 android: [
729731 ...baseFeatures,
Original file line number Diff line number Diff line change 698698 'harmfulApis',
699699 'webCompat',
700700 'windowsPermissionUsage',
701- 'brokerProtection'
701+ 'brokerProtection',
702+ 'performanceMetrics'
702703 ]);
703704
704705 /** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */
710711 ],
711712 'apple-isolated': [
712713 'duckPlayer',
713- 'brokerProtection'
714+ 'brokerProtection',
715+ 'performanceMetrics'
714716 ],
715717 android: [
716718 ...baseFeatures,
2068620688 }
2068720689 }
2068820690
20691+ class PerformanceMetrics extends ContentFeature {
20692+ init () {
20693+ this.messaging.subscribe('getVitals', () => {
20694+ const paintResources = performance.getEntriesByType('paint');
20695+ const firstPaint = paintResources.find((entry) => entry.name === 'first-contentful-paint');
20696+ const vitals = firstPaint ? [firstPaint.startTime] : [];
20697+ this.messaging.notify('vitalsResult', { vitals });
20698+ });
20699+ }
20700+ }
20701+
2068920702 var platformFeatures = {
2069020703 ddg_feature_runtimeChecks: RuntimeChecks,
2069120704 ddg_feature_fingerprintingAudio: FingerprintingAudio,
2070620719 ddg_feature_harmfulApis: HarmfulApis,
2070720720 ddg_feature_webCompat: WebCompat,
2070820721 ddg_feature_windowsPermissionUsage: WindowsPermissionUsage,
20709- ddg_feature_brokerProtection: BrokerProtection
20722+ ddg_feature_brokerProtection: BrokerProtection,
20723+ ddg_feature_performanceMetrics: PerformanceMetrics
2071020724 };
2071120725
2071220726 /* global false */
Original file line number Diff line number Diff line change 760760 'harmfulApis',
761761 'webCompat',
762762 'windowsPermissionUsage',
763- 'brokerProtection'
763+ 'brokerProtection',
764+ 'performanceMetrics'
764765 ]);
765766
766767 /** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */
772773 ],
773774 'apple-isolated': [
774775 'duckPlayer',
775- 'brokerProtection'
776+ 'brokerProtection',
777+ 'performanceMetrics'
776778 ],
777779 android: [
778780 ...baseFeatures,
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ const otherFeatures = /** @type {const} */([
2121 'harmfulApis',
2222 'webCompat',
2323 'windowsPermissionUsage',
24- 'brokerProtection'
24+ 'brokerProtection',
25+ 'performanceMetrics'
2526])
2627
2728/** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */
@@ -33,7 +34,8 @@ export const platformSupport = {
3334 ],
3435 'apple-isolated': [
3536 'duckPlayer',
36- 'brokerProtection'
37+ 'brokerProtection',
38+ 'performanceMetrics'
3739 ],
3840 android: [
3941 ...baseFeatures,
You can’t perform that action at this time.
0 commit comments