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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/common/BrowserVersionInfo.js

Issue 2300403003: DevTools: patch browser's Chrome version into Chrome user agents for emulation (Closed)
Patch Set: Simpler navigator.userAgent method Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(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 = {
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.
6 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.
7
8 /**
9 * @param {string} uaString
10 * @return {string}
11 */
12 patchUserAgentWithChromeVersion: function(uaString)
13 {
14 // Extracts Chrome version from user agent ("1.2.3.4" when user agent is : "Chrome/1.2.3.4").
15 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
16 var sectionMatch = navigator.userAgent.match(sectionRegex);
17 var version = WebInspector.BrowserVersionInfo.DefaultChromeVersion;
18 if (sectionMatch && sectionMatch.length > 1)
19 version = sectionMatch[1];
20 return String.sprintf(uaString, version);
21 }
22 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698