Page MenuHomePhabricator

D8040.id27461.diff
No OneTemporary

D8040.id27461.diff

diff --git a/lib/utils/report-utils.js b/lib/utils/report-utils.js
--- a/lib/utils/report-utils.js
+++ b/lib/utils/report-utils.js
@@ -13,18 +13,29 @@
return useSelector(state => state.reportStore.enabledReports[reportType]);
}
+// maximum size of reports without std::string overhead
+const MAX_REPORT_LENGTH = 200_000_000 - 90000;
+function isReportSizeValid(report: ClientReportCreationRequest): boolean {
+ try {
+ return JSON.stringify(report).length < MAX_REPORT_LENGTH;
+ } catch (e) {
+ return false;
+ }
+}
+
function isReportEnabled(
report: ClientReportCreationRequest,
enabledReports: EnabledReports,
): boolean {
- return (
+ const isReportTypeEnabled =
(report.type === reportTypes.MEDIA_MISSION &&
enabledReports.mediaReports) ||
(report.type === reportTypes.ERROR && enabledReports.crashReports) ||
((report.type === reportTypes.ENTRY_INCONSISTENCY ||
report.type === reportTypes.THREAD_INCONSISTENCY) &&
- enabledReports.inconsistencyReports)
- );
+ enabledReports.inconsistencyReports);
+
+ return isReportTypeEnabled && isReportSizeValid(report);
}
function generateReportID(): string {

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 2:58 AM (13 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2835406
Default Alt Text
D8040.id27461.diff (1 KB)

Event Timeline