Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1781)

Unified Diff: chrome/browser/ui/webui/devtools_ui.cc

Issue 27693002: DevTools: Display a warning when trying to open untrusted frontend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed the other CHECK Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/devtools_ui.cc
diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc
index 0a71d19a72532425cb45299c91a1d1640c557173..f75527214f1d7f4f9618f8e3d0a71fc2d4589943 100644
--- a/chrome/browser/ui/webui/devtools_ui.cc
+++ b/chrome/browser/ui/webui/devtools_ui.cc
@@ -40,10 +40,15 @@ const char kHttpNotFound[] = "HTTP/1.1 404 Not Found\n\n";
#if defined(DEBUG_DEVTOOLS)
// Local frontend url provided by InspectUI.
-const char kLocalFrontendURL[] =
+const char kFallbackFrontendURL[] =
"chrome-devtools://devtools/bundled/devtools.html";
+#else
+// URL causing the DevTools window to display a plain text warning.
+const char kFallbackFrontendURL[] =
+ "data:text/plain,Cannot load DevTools frontend from an untrusted origin";
#endif // defined(DEBUG_DEVTOOLS)
+
class FetchRequest : public net::URLFetcherDelegate {
public:
FetchRequest(net::URLRequestContextGetter* request_context,
@@ -190,13 +195,9 @@ class DevToolsDataSource : public content::URLDataSource {
// static
GURL DevToolsUI::GetProxyURL(const std::string& frontend_url) {
GURL url(frontend_url);
-#if defined(DEBUG_DEVTOOLS)
if (!url.is_valid() || url.host() != kRemoteFrontendDomain) {
- return GURL(kLocalFrontendURL);
+ return GURL(kFallbackFrontendURL);
}
-#endif // defined(DEBUG_DEVTOOLS)
- CHECK(url.is_valid());
- CHECK_EQ(url.host(), kRemoteFrontendDomain);
return GURL(base::StringPrintf("%s://%s/%s/%s",
chrome::kChromeDevToolsScheme,
chrome::kChromeUIDevToolsHost,
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698