| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 WebInspector.BrowserVersionInfo = { |
| 6 /** |
| 7 * @param {string} uaString |
| 8 * @return {string} |
| 9 */ |
| 10 patchUserAgentWithChromeVersion: function(uaString) |
| 11 { |
| 12 // Patches Chrome/CriOS version from user agent ("1.2.3.4" when user age
nt is: "Chrome/1.2.3.4"). |
| 13 var chromeRegex = new RegExp("((?:^|\\W)Chrome/)(\\S+)"); |
| 14 var criosRegex = new RegExp("((?:^|\\W)CriOS/)(\\S+)"); |
| 15 var chromeMatch = navigator.userAgent.match(chromeRegex); |
| 16 if (chromeMatch && chromeMatch.length > 2) |
| 17 return uaString.replace(chromeRegex, "$1" + chromeMatch[2]).replace(
criosRegex, "$1" + chromeMatch[2]); |
| 18 return uaString; |
| 19 } |
| 20 }; |
| OLD | NEW |