-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-enable ReportingObserver and make noop (uplift to 1.69.x) (#24779)
Uplift of #24726 (squashed) to beta
- Loading branch information
1 parent
c0a1a1e
commit 377b733
Showing
7 changed files
with
54 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
chromium_src/third_party/blink/renderer/core/context_features/context_feature_settings.h
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
chromium_src/third_party/blink/renderer/core/frame/reporting_observer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
17 changes: 17 additions & 0 deletions
17
chromium_src/third_party/blink/renderer/core/frame/reporting_observer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ |
12 changes: 0 additions & 12 deletions
12
patches/third_party-blink-renderer-core-context_features-context_feature_settings.h.patch
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
patches/third_party-blink-renderer-core-frame-reporting_observer.idl.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
<script> | ||
function isReportingObserverDisabled() { | ||
function isReportingObserverNoop() { | ||
try { | ||
new ReportingObserver(function(reports, observer) { | ||
return false; | ||
}, {}); | ||
} catch (err) { | ||
return true; | ||
const observer = new ReportingObserver(() => {}, | ||
{ types: ['deprecation'], buffered: true } | ||
); | ||
observer.observe(); | ||
const xhr = new XMLHttpRequest(); | ||
// false makes it synchronous, which is deprecated. | ||
xhr.open('GET', '/', false); | ||
xhr.send(null); | ||
const reports = observer.takeRecords(); | ||
console.log("Reports:", reports); | ||
// Even though we made a synchronous request, we should not have any reports. | ||
return reports.length === 0; | ||
} catch (error) { | ||
console.error("Error occurred:", error); | ||
return false; | ||
} | ||
} | ||
</script> |