diff --git a/browser/test/disabled_features/reporting_observer_browsertest.cc b/browser/test/disabled_features/reporting_observer_browsertest.cc index 0a763a463f54..1c7f24716753 100644 --- a/browser/test/disabled_features/reporting_observer_browsertest.cc +++ b/browser/test/disabled_features/reporting_observer_browsertest.cc @@ -32,11 +32,11 @@ class ReportingObserverTest : public InProcessBrowserTest { } }; -IN_PROC_BROWSER_TEST_F(ReportingObserverTest, IsDisabled) { +IN_PROC_BROWSER_TEST_F(ReportingObserverTest, IsNoop) { GURL url = embedded_test_server()->GetURL(kReportingObserver); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - EXPECT_EQ(true, EvalJs(contents, "isReportingObserverDisabled();")); + EXPECT_EQ(true, EvalJs(contents, "isReportingObserverNoop();")); } diff --git a/chromium_src/third_party/blink/renderer/core/context_features/context_feature_settings.h b/chromium_src/third_party/blink/renderer/core/context_features/context_feature_settings.h deleted file mode 100644 index 1a890f51f0cd..000000000000 --- a/chromium_src/third_party/blink/renderer/core/context_features/context_feature_settings.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2020 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_CONTEXT_FEATURES_CONTEXT_FEATURE_SETTINGS_H_ -#define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_CONTEXT_FEATURES_CONTEXT_FEATURE_SETTINGS_H_ - -// ContextEnabled=ReportingObservers feature methods need to be added since we -// patched ReportingObservers as ContextEnabled into -// third_party/blink/renderer/core/frame/reporting_observer.idl -#define BRAVE_CONTEXT_FEATURE_SETTINGS_H_ \ - public: \ - void enableReportingObservers(bool enable) { \ - enable_reporting_observers_ = enable; \ - } \ - bool isReportingObserversEnabled() const { \ - return enable_reporting_observers_; \ - } \ - \ - private: \ - bool enable_reporting_observers_ = false; \ - \ - public: -// #define BRAVE_CONTEXT_FEATURE_SETTINGS_H_ - -#include "src/third_party/blink/renderer/core/context_features/context_feature_settings.h" // IWYU pragma: export -#undef BRAVE_CONTEXT_FEATURE_SETTINGS_H_ - -#endif // BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_CONTEXT_FEATURES_CONTEXT_FEATURE_SETTINGS_H_ diff --git a/chromium_src/third_party/blink/renderer/core/frame/reporting_observer.cc b/chromium_src/third_party/blink/renderer/core/frame/reporting_observer.cc new file mode 100644 index 000000000000..60708af53918 --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/frame/reporting_observer.cc @@ -0,0 +1,19 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "third_party/blink/renderer/core/frame/reporting_observer.h" + +#define QueueReport QueueReport_Unused +#include "src/third_party/blink/renderer/core/frame/reporting_observer.cc" +#undef QueueReport + +namespace blink { + +// Don't add reports. We previously used to disable ReportingObserver in +// Brave, but for webcompat reasons, we now just no-op it. This makes +// takeRecords() always return an empty list. +void ReportingObserver::QueueReport(Report* report) {} + +} // namespace blink diff --git a/chromium_src/third_party/blink/renderer/core/frame/reporting_observer.h b/chromium_src/third_party/blink/renderer/core/frame/reporting_observer.h new file mode 100644 index 000000000000..c859462458fd --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/frame/reporting_observer.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_OBSERVER_H_ +#define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_OBSERVER_H_ + +#define QueueReport \ + QueueReport_Unused(Report* report); \ + void QueueReport + +#include "src/third_party/blink/renderer/core/frame/reporting_observer.h" // IWYU pragma: export + +#undef QueueReport + +#endif // BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_OBSERVER_H_ diff --git a/patches/third_party-blink-renderer-core-context_features-context_feature_settings.h.patch b/patches/third_party-blink-renderer-core-context_features-context_feature_settings.h.patch deleted file mode 100644 index fd0574ea6140..000000000000 --- a/patches/third_party-blink-renderer-core-context_features-context_feature_settings.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/third_party/blink/renderer/core/context_features/context_feature_settings.h b/third_party/blink/renderer/core/context_features/context_feature_settings.h -index 096d49ecd53d7e17811ad7d70ea6a9b2af9acd6f..eed64a36e45779db4a16e75f40b02b76b480673a 100644 ---- a/third_party/blink/renderer/core/context_features/context_feature_settings.h -+++ b/third_party/blink/renderer/core/context_features/context_feature_settings.h -@@ -64,6 +64,7 @@ class CORE_EXPORT ContextFeatureSettings final - } - - void Trace(Visitor*) const override; -+ BRAVE_CONTEXT_FEATURE_SETTINGS_H_ - - private: - bool enable_mojo_js_ = false; diff --git a/patches/third_party-blink-renderer-core-frame-reporting_observer.idl.patch b/patches/third_party-blink-renderer-core-frame-reporting_observer.idl.patch deleted file mode 100644 index 341fe1e7bac9..000000000000 --- a/patches/third_party-blink-renderer-core-frame-reporting_observer.idl.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/third_party/blink/renderer/core/frame/reporting_observer.idl b/third_party/blink/renderer/core/frame/reporting_observer.idl -index 90d04d7f35828629d71124cdd0024baebd7d4fb3..094d82aa0d3ba6b70c112907c94edc49f1003506 100644 ---- a/third_party/blink/renderer/core/frame/reporting_observer.idl -+++ b/third_party/blink/renderer/core/frame/reporting_observer.idl -@@ -7,6 +7,7 @@ - callback ReportingObserverCallback = void (sequence reports, ReportingObserver observer); - - [ -+ ContextEnabled=ReportingObservers, - ActiveScriptWrappable, - Exposed=(Window,Worker) - ] interface ReportingObserver { diff --git a/test/data/reporting_observer.html b/test/data/reporting_observer.html index b8aab550560e..9c98ecc89e06 100644 --- a/test/data/reporting_observer.html +++ b/test/data/reporting_observer.html @@ -1,11 +1,21 @@