From 5d3d5c996b7c9e702b7a78ccd01b626318b44851 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Sun, 16 Jul 2023 10:14:58 +0200 Subject: [PATCH] add more log --- ...ing-attributes-in-some-html-elements.patch | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/build/patches/00Log-dangling-attributes-in-some-html-elements.patch b/build/patches/00Log-dangling-attributes-in-some-html-elements.patch index d366ec38..155abf47 100644 --- a/build/patches/00Log-dangling-attributes-in-some-html-elements.patch +++ b/build/patches/00Log-dangling-attributes-in-some-html-elements.patch @@ -11,6 +11,7 @@ under enable-log-dangling-attributes about flag .../blink/renderer/core/dom/document.cc | 18 +++++++++++++++++ .../blink/renderer/core/dom/element.cc | 20 ++++++++++++++++++- third_party/blink/renderer/core/dom/element.h | 3 ++- + .../editing/serializers/markup_formatter.cc | 9 +++++++++ .../renderer/core/html/html_base_element.cc | 6 ++++++ .../renderer/core/html/html_base_element.h | 2 ++ .../core/html/html_frame_element_base.cc | 10 ++++++++++ @@ -18,7 +19,7 @@ under enable-log-dangling-attributes about flag .../renderer/core/html/html_iframe_element.h | 2 ++ .../blink/renderer/core/page/frame_tree.cc | 16 +++++++++++++++ .../platform/runtime_enabled_features.json5 | 10 ++++++++-- - 11 files changed, 103 insertions(+), 5 deletions(-) + 12 files changed, 112 insertions(+), 5 deletions(-) diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc --- a/chrome/browser/about_flags.cc @@ -121,6 +122,32 @@ diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/r // Remove attributes that might introduce scripting from the vector leaving // the element unchanged. +diff --git a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc +--- a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc ++++ b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc +@@ -28,6 +28,8 @@ + #include "third_party/blink/renderer/core/editing/serializers/markup_formatter.h" + + #include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-shared.h" ++#include "third_party/blink/renderer/platform/heap/garbage_collected.h" ++#include "third_party/blink/renderer/core/inspector/console_message.h" + #include "third_party/blink/renderer/core/dom/cdata_section.h" + #include "third_party/blink/renderer/core/dom/comment.h" + #include "third_party/blink/renderer/core/dom/document.h" +@@ -216,6 +218,13 @@ void MarkupFormatter::AppendAttributeValue(StringBuilder& result, + const Document& document) { + if (attribute.Contains('<') || attribute.Contains('>')) { + document.CountUse(mojom::blink::WebFeature::kAttributeValueContainsLtOrGt); ++ if (RuntimeEnabledFeatures::LogDanglingAttributesEnabled()) { ++ document.AddConsoleMessage(MakeGarbageCollected( ++ mojom::ConsoleMessageSource::kSecurity, ++ mojom::ConsoleMessageLevel::kInfo, ++ "Bromite Dangling Markup Prevention: '" + attribute + ++ "' is not allowed as parameter value.")); ++ } + } + + EntityMask entity_mask = diff --git a/third_party/blink/renderer/core/html/html_base_element.cc b/third_party/blink/renderer/core/html/html_base_element.cc --- a/third_party/blink/renderer/core/html/html_base_element.cc +++ b/third_party/blink/renderer/core/html/html_base_element.cc