Return Chrome 'Browser' value for DevTools remote debugging (issue #2300)

This commit is contained in:
Marshall Greenblatt 2018-01-04 18:52:30 -05:00
parent 50ca6928c3
commit 232f6bc427
4 changed files with 38 additions and 0 deletions

View File

@ -235,6 +235,10 @@ std::string CefContentClient::GetProduct() const {
if (command_line->HasSwitch(switches::kProductVersion))
return command_line->GetSwitchValueASCII(switches::kProductVersion);
return GetChromeProduct();
}
std::string CefContentClient::GetChromeProduct() const {
return base::StringPrintf("Chrome/%d.%d.%d.%d", CHROME_VERSION_MAJOR,
CHROME_VERSION_MINOR, CHROME_VERSION_BUILD,
CHROME_VERSION_PATCH);

View File

@ -35,6 +35,7 @@ class CefContentClient : public content::ContentClient,
std::vector<content::PepperPluginInfo>* plugins) override;
void AddAdditionalSchemes(Schemes* schemes) override;
std::string GetProduct() const override;
std::string GetChromeProduct() const override;
std::string GetUserAgent() const override;
base::string16 GetLocalizedString(int message_id) const override;
base::StringPiece GetDataResource(

View File

@ -339,6 +339,11 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2274
'name': 'win_rt_2274',
},
{
# Always return the Chrome product value for DevTools.
# https://bitbucket.org/chromiumembedded/cef/issues/2300
'name': 'devtools_product_2300',
},
{
# macOS: Fix build of widevinecdmadapter.plugin.
# https://bitbucket.org/chromiumembedded/cef/issues/2314

View File

@ -0,0 +1,28 @@
diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc
index 72ffe59f522b..dcefb6cd9bb4 100644
--- content/browser/devtools/devtools_http_handler.cc
+++ content/browser/devtools/devtools_http_handler.cc
@@ -504,7 +504,7 @@ void DevToolsHttpHandler::OnJsonRequest(
version.SetString("Protocol-Version",
DevToolsAgentHost::GetProtocolVersion());
version.SetString("WebKit-Version", GetWebKitVersion());
- version.SetString("Browser", GetContentClient()->GetProduct());
+ version.SetString("Browser", GetContentClient()->GetChromeProduct());
version.SetString("User-Agent", GetContentClient()->GetUserAgent());
version.SetString("V8-Version", V8_VERSION_STRING);
std::string host = info.headers["host"];
diff --git content/public/common/content_client.h content/public/common/content_client.h
index 48ca775aa88e..cb268f412f61 100644
--- content/public/common/content_client.h
+++ content/public/common/content_client.h
@@ -138,6 +138,10 @@ class CONTENT_EXPORT ContentClient {
// Used as part of the user agent string.
virtual std::string GetProduct() const;
+ // Returns the Chrome-specific product string. This is used for compatibility
+ // purposes with external tools like Selenium.
+ virtual std::string GetChromeProduct() const { return GetProduct(); }
+
// Returns the user agent. Content may cache this value.
virtual std::string GetUserAgent() const;