Commit 287195d2 authored by Ian Barkley-Yeung's avatar Ian Barkley-Yeung Committed by Commit Bot

Block SendJavaScriptErrorReport from Windows

Currently, SendJavaScriptErrorReport relies on
GetClientCollectStatsConsent which is broken on Windows (specifically,
it doesn't thunk over to the correct DLL before accessing globals).
Disable SendJavaScriptErrorReport on Windows until that is fixed.

Bug: chromium:1129544, chromium:1121816
Change-Id: I949af71855d012547aa2dc91cd87a98fa1de6cc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2417299
Auto-Submit: Ian Barkley-Yeung <iby@chromium.org>
Reviewed-by: default avatarMiriam Zimmerman <mutexlox@chromium.org>
Commit-Queue: Ian Barkley-Yeung <iby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808137}
parent af8f0d47
......@@ -21,7 +21,6 @@
#include "base/system/sys_info.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "components/crash/content/browser/error_reporting/javascript_error_report.h"
#include "components/crash/core/app/client_upload_info.h"
#include "components/feedback/redaction_tool.h"
......@@ -40,8 +39,6 @@ constexpr char kCrashEndpointUrl[] = "https://clients2.google.com/cr/report";
constexpr char kCrashEndpointUrl[] = "";
#endif
constexpr int kCrashEndpointResponseMaxSizeInBytes = 1024;
std::string& GetCrashEndpoint() {
static base::NoDestructor<std::string> crash_endpoint(kCrashEndpointUrl);
return *crash_endpoint;
......@@ -64,6 +61,10 @@ base::Optional<OsVersionOverride>& GetOsVersionOverrides() {
return *testing_override;
}
// TODO(crbug.com/1129544) This is currently disabled due to Windows DLL
// thunking issues. Fix & re-enable.
#if !defined(OS_WIN)
void OnRequestComplete(std::unique_ptr<network::SimpleURLLoader> url_loader,
base::ScopedClosureRunner callback_runner,
std::unique_ptr<std::string> response_body) {
......@@ -222,6 +223,7 @@ void SendReport(const GURL& url,
url_loader->AttachStringForUpload(body, "text/plain");
}
constexpr int kCrashEndpointResponseMaxSizeInBytes = 1024;
network::SimpleURLLoader* loader = url_loader.get();
loader->DownloadToString(
loader_factory,
......@@ -286,8 +288,14 @@ void OnConsentCheckCompleted(
SendReport(url, body, std::move(callback_runner), loader_factory.get());
}
#endif // !defined(OS_WIN)
} // namespace
// TODO(crbug.com/1129544) This is currently disabled due to Windows DLL
// thunking issues. Fix & re-enable.
#if !defined(OS_WIN)
void SendJavaScriptErrorReport(JavaScriptErrorReport error_report,
base::OnceClosure completion_callback,
content::BrowserContext* browser_context) {
......@@ -309,6 +317,8 @@ void SendJavaScriptErrorReport(JavaScriptErrorReport error_report,
std::move(loader_factory)));
}
#endif // !defined(OS_WIN)
void SetCrashEndpointForTesting(const std::string& endpoint) {
GetCrashEndpoint() = endpoint;
}
......
......@@ -10,12 +10,17 @@
#include <string>
#include "base/callback_forward.h"
#include "build/build_config.h"
namespace content {
class BrowserContext;
}
struct JavaScriptErrorReport;
// TODO(crbug.com/1129544) This is currently disabled due to Windows DLL
// thunking issues. Fix & re-enable.
#if !defined(OS_WIN)
// Sends a report of an error in JavaScript (such as an unhandled exception) to
// Google's error collection service. This should be called on the UI thread;
// it will return after the report sending is started. |completion_callback| is
......@@ -24,6 +29,8 @@ void SendJavaScriptErrorReport(JavaScriptErrorReport error_report,
base::OnceClosure completion_callback,
content::BrowserContext* browser_context);
#endif // !defined(OS_WIN)
// Override the URL we send the crashes to.
void SetCrashEndpointForTesting(const std::string& endpoint);
......
......@@ -18,6 +18,10 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
// TODO(crbug.com/1129544) The SendJavaScriptErrorReport function is currently
// disabled due to Windows DLL thunking issues. Fix & re-enable.
#if !defined(OS_WIN)
using ::testing::AllOf;
using ::testing::HasSubstr;
......@@ -222,3 +226,5 @@ TEST_F(SendJavaScriptErrorReportTest, NonGoogleChrome) {
endpoint_->last_report();
EXPECT_FALSE(actual_report);
}
#endif // !defined(OS_WIN)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment