It is useful to track a semi-performance metric by tracking how many potential violations exist on pages. This could serve as a strong signal for the FeaturePolicy effectiveness and adoption.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/246d85666a151d26eac19f9e910dcb4766239355 commit 246d85666a151d26eac19f9e910dcb4766239355 Author: Ehsan Karamad <ekaramad@chromium.org> Date: Fri Dec 21 00:14:12 2018 FeaturePolicy: Count potential feature violations This CL introduces a new enumeration metric for feature policies, namely, "PotentialViolation". This new metric tracks potential violations of each feature policy in a document; that is, for feature policy X this metric would emit a potential violation if the conditions to violate feature X are (regardless of the actual feature X being disabled in the document). In other words, the metric tracks the percentage of pages that would have violated the given feature X if it was disabled in all documents. Most current policies are covered by this CL. The few cases where a policy generates its own violation report, or does not support reporting violations yet, will be addressed in future CLs. Bug: 915788 Change-Id: Iccb77ee8f47995a0debe7bb1faafbee3686b2ed6 Reviewed-on: https://chromium-review.googlesource.com/c/1380933 Commit-Queue: Ehsan Karamad <ekaramad@chromium.org> Reviewed-by: David Bokan <bokan@chromium.org> Reviewed-by: Robert Kaplow <rkaplow@chromium.org> Cr-Commit-Position: refs/heads/master@{#618394} [modify] https://crrev.com/246d85666a151d26eac19f9e910dcb4766239355/third_party/blink/renderer/core/dom/document.cc [modify] https://crrev.com/246d85666a151d26eac19f9e910dcb4766239355/third_party/blink/renderer/core/dom/document.h [modify] https://crrev.com/246d85666a151d26eac19f9e910dcb4766239355/third_party/blink/renderer/core/execution_context/security_context.cc [modify] https://crrev.com/246d85666a151d26eac19f9e910dcb4766239355/third_party/blink/renderer/core/execution_context/security_context.h [modify] https://crrev.com/246d85666a151d26eac19f9e910dcb4766239355/third_party/blink/renderer/core/feature_policy/feature_policy_test.cc [modify] https://crrev.com/246d85666a151d26eac19f9e910dcb4766239355/tools/metrics/histograms/histograms.xml
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ce1cf8f2550d9515afa693efbb08e4ad6062908e commit ce1cf8f2550d9515afa693efbb08e4ad6062908e Author: Ehsan Karamad <ekaramad@chromium.org> Date: Thu Jan 17 00:47:39 2019 [ FeaturePolicy ] - Potential violations for "unsized-media" This CL adds the logic to support counting potential violations of "unsized-media" feature (Blink.UseCounter.FeaturePolicy.PotetialViolation). Bug: 915788 Change-Id: I523f8e4cd7dca4d640fd8c8c22b0e86c058bce99 Reviewed-on: https://chromium-review.googlesource.com/c/1409803 Reviewed-by: Steve Kobes <skobes@chromium.org> Commit-Queue: Ehsan Karamad <ekaramad@chromium.org> Cr-Commit-Position: refs/heads/master@{#623468} [modify] https://crrev.com/ce1cf8f2550d9515afa693efbb08e4ad6062908e/third_party/blink/renderer/core/html/media/media_element_parser_helpers.cc [modify] https://crrev.com/ce1cf8f2550d9515afa693efbb08e4ad6062908e/third_party/blink/renderer/core/html/media/media_element_parser_helpers.h [modify] https://crrev.com/ce1cf8f2550d9515afa693efbb08e4ad6062908e/third_party/blink/renderer/core/layout/layout_image.cc [modify] https://crrev.com/ce1cf8f2550d9515afa693efbb08e4ad6062908e/third_party/blink/renderer/core/layout/layout_video.cc [modify] https://crrev.com/ce1cf8f2550d9515afa693efbb08e4ad6062908e/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ad1066ce0df586d19daf9e43942db479a71a687c commit ad1066ce0df586d19daf9e43942db479a71a687c Author: Ehsan Karamad <ekaramad@chromium.org> Date: Fri Jan 18 16:52:55 2019 [ FeaturePolicy ] Potential violation for "layout-animation" This CL adds the logic to track potential violations for the "layout-animations" feature (Blink.UseCounter.FeaturePolicy.PotentialViolation). This CL counts all potential violations through CSS keyframes or use of element.animate() API. Similar to the real reporting for this policy, "transitions" are currently excluded (will be added in future CLs). Bug: 915788 Change-Id: I94e3356469ba4e65569c39f7a40592663ad8b0ae Reviewed-on: https://chromium-review.googlesource.com/c/1389024 Reviewed-by: Robert Flack <flackr@chromium.org> Commit-Queue: Ehsan Karamad <ekaramad@chromium.org> Cr-Commit-Position: refs/heads/master@{#624164} [modify] https://crrev.com/ad1066ce0df586d19daf9e43942db479a71a687c/third_party/blink/renderer/core/animation/element_animation.cc [modify] https://crrev.com/ad1066ce0df586d19daf9e43942db479a71a687c/third_party/blink/renderer/core/css/parser/css_parser_context.cc [modify] https://crrev.com/ad1066ce0df586d19daf9e43942db479a71a687c/third_party/blink/renderer/core/css/parser/css_parser_context.h [modify] https://crrev.com/ad1066ce0df586d19daf9e43942db479a71a687c/third_party/blink/renderer/core/css/parser/css_parser_impl.cc [modify] https://crrev.com/ad1066ce0df586d19daf9e43942db479a71a687c/third_party/blink/renderer/core/exported/web_view_test.cc [modify] https://crrev.com/ad1066ce0df586d19daf9e43942db479a71a687c/third_party/blink/renderer/core/feature_policy/layout_animations_policy.cc [modify] https://crrev.com/ad1066ce0df586d19daf9e43942db479a71a687c/third_party/blink/renderer/core/feature_policy/layout_animations_policy.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3488b4555d7bbe8777426b38fabaeecd248ae470 commit 3488b4555d7bbe8777426b38fabaeecd248ae470 Author: Ehsan Karamad <ekaramad@chromium.org> Date: Mon Jan 21 20:58:50 2019 [ FeaturePolicy ] - Report for "legacy-image-formats" This CL adds support for generating reports for violations of the "legacy-image-formats" feature policy. This also automatically starts counting the potential violations of this feature in web pages (Blink.UseCounter.FeaturePolicy.PotentialViolation). Bug: 915788 Change-Id: If72ec438b6038730907ac086bddd0c680cc60d97 Reviewed-on: https://chromium-review.googlesource.com/c/1409698 Reviewed-by: David Bokan <bokan@chromium.org> Reviewed-by: Ehsan Karamad <ekaramad@chromium.org> Commit-Queue: Ehsan Karamad <ekaramad@chromium.org> Cr-Commit-Position: refs/heads/master@{#624657} [modify] https://crrev.com/3488b4555d7bbe8777426b38fabaeecd248ae470/third_party/blink/renderer/core/layout/layout_image.cc [add] https://crrev.com/3488b4555d7bbe8777426b38fabaeecd248ae470/third_party/blink/web_tests/external/wpt/feature-policy/reporting/image.bmp [add] https://crrev.com/3488b4555d7bbe8777426b38fabaeecd248ae470/third_party/blink/web_tests/external/wpt/feature-policy/reporting/legacy-image-formats-reporting.html [add] https://crrev.com/3488b4555d7bbe8777426b38fabaeecd248ae470/third_party/blink/web_tests/external/wpt/feature-policy/reporting/legacy-image-formats-reporting.html.headers [add] https://crrev.com/3488b4555d7bbe8777426b38fabaeecd248ae470/third_party/blink/web_tests/http/tests/images/feature-policy-image-policies-with-border-radius-expected.txt [add] https://crrev.com/3488b4555d7bbe8777426b38fabaeecd248ae470/third_party/blink/web_tests/http/tests/images/feature-policy-legacy-formats-expected.txt
Comment 1 by bugdroid1@chromium.org
, Dec 21