Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 7645: Enable remote debugging by default and proxy devtools request #5500

Merged
merged 1 commit into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion browser/brave_local_state_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace brave {
void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
brave_shields::RegisterPrefsForAdBlockService(registry);
RegisterPrefsForBraveStatsUpdater(registry);
registry->RegisterBooleanPref(kRemoteDebuggingEnabled, false);
registry->RegisterBooleanPref(kRemoteDebuggingEnabled, true);
ntp_background_images::NTPBackgroundImagesService::RegisterLocalStatePrefs(
registry);
#if BUILDFLAG(ENABLE_BRAVE_REFERRALS)
Expand Down
11 changes: 11 additions & 0 deletions chromium_src/chrome/browser/devtools/url_constants.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* 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/. */

#include "chrome/browser/devtools/url_constants.h"

const char kRemoteFrontendDomain[] = "devtools.brave.com";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we not use the normal static redirect? My concern is that we're changing urls in different places and that makes it harder to find how/where/what we're changing

Copy link
Contributor Author

@jumde jumde May 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridiver - I was trying that first, but it requires a much bigger re-write of the code.

Currently, the brave-proxy code lives in brave_proxying_url_loader_factory.cc which lives in //brave/browser/net. To use static redirect we need to invoke MaybeProxyRequest from devtools_instrumentation::WillCreateURLLoaderFactory which is present in //content/browser and we cannot add a deps for //brave/browser/net to //content/browser.

So for static redirect to work, we'll need to move the proxying code to //content/ or //net.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jumde do you remember if we have an issue for moving proxying code to //net? At least brave_system_request_handler.cc. I guess this is not the first layering problem with this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iefremov - Filed one: brave/brave-browser#9770 - Thanks for the reminder.

const char kRemoteFrontendBase[] =
"https://devtools.brave.com/";
const char kRemoteFrontendPath[] = "serve_file";
13 changes: 13 additions & 0 deletions chromium_src/chrome/browser/devtools/url_constants_unittest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* 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/. */

#include "chrome/browser/ui/webui/devtools_ui.h"
#include "testing/gtest/include/gtest/gtest.h"

const char kBraveDevtoolsURLHost[] = "devtools.brave.com";

TEST(BraveDevtoolsURLConstants, TestDevtoolsURL) {
EXPECT_EQ(DevToolsUI::GetRemoteBaseURL().host(), kBraveDevtoolsURLHost);
}
1 change: 1 addition & 0 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ test("brave_unit_tests") {
"//brave/browser/net/brave_site_hacks_network_delegate_helper_unittest.cc",
"//brave/browser/net/brave_static_redirect_network_delegate_helper_unittest.cc",
"//brave/browser/net/brave_system_request_handler_unittest.cc",
"//brave/chromium_src/chrome/browser/devtools/url_constants_unittest.cc",
"//brave/chromium_src/chrome/browser/history/history_utils_unittest.cc",
"//brave/chromium_src/chrome/browser/shell_integration_unittest_mac.cc",
"//brave/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc",
Expand Down