Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/common/BrowserVersionInfo.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/common/BrowserVersionInfo.js b/third_party/WebKit/Source/devtools/front_end/common/BrowserVersionInfo.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b3daae0f0d2e83d1d6080ac9bade8dda9ff4c010 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/devtools/front_end/common/BrowserVersionInfo.js |
| @@ -0,0 +1,22 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +WebInspector.BrowserVersionInfo = { |
|
pfeldman
2016/09/14 21:47:09
This is no longer browser version info, also you d
luoe
2016/09/14 22:49:13
There are 2 places where we could use this patchin
pfeldman
2016/09/15 21:44:06
"sdk" would be the common denominator then, you ca
luoe
2016/09/15 23:18:08
Done.
|
| + DefaultChromeVersion: "54.0.2834.0", |
|
pfeldman
2016/09/14 21:47:09
I'd leave these hardcoded in the config view and o
luoe
2016/09/14 22:49:13
Done.
|
| + |
| + /** |
| + * @param {string} uaString |
| + * @return {string} |
| + */ |
| + patchUserAgentWithChromeVersion: function(uaString) |
| + { |
| + // Extracts Chrome version from user agent ("1.2.3.4" when user agent is: "Chrome/1.2.3.4"). |
| + var sectionRegex = new RegExp("(?:^|\\W)Chrome/(\\S+)"); |
|
pfeldman
2016/09/14 21:47:09
var regex = /Chrome\/[\d.]+/;
var version = naviga
luoe
2016/09/14 22:49:13
Regex: I think the "(?:^|\\W)" is warranted so tha
pfeldman
2016/09/15 21:44:06
- If XChrome gets into the UA string, this means t
luoe
2016/09/15 23:18:08
If there is an XChrome in the staleAgent, we will
|
| + var sectionMatch = navigator.userAgent.match(sectionRegex); |
| + var version = WebInspector.BrowserVersionInfo.DefaultChromeVersion; |
| + if (sectionMatch && sectionMatch.length > 1) |
| + version = sectionMatch[1]; |
| + return String.sprintf(uaString, version); |
| + } |
| +}; |