Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 let platform = "chromium"; | 7 let platform = "chromium"; |
8 let platformVersion = null; | 8 let platformVersion = null; |
9 let application = null; | 9 let application = null; |
10 let applicationVersion; | 10 let applicationVersion; |
11 | 11 |
12 let regexp = /(\S+)\/(\S+)(?:\s*\(.*?\))?/g; | 12 let regexp = /(\S+)\/(\S+)(?:\s*\(.*?\))?/g; |
13 let match; | 13 let match; |
14 | 14 |
15 while (match = regexp.exec(navigator.userAgent)) | 15 while (match = regexp.exec(navigator.userAgent)) |
16 { | 16 { |
Sebastian Noack
2017/06/07 13:26:12
The "platform" variable defined above isn't necess
Jon Sonesen
2017/06/07 13:56:07
Acknowledged.
| |
17 let app = match[1]; | 17 let app = match[1]; |
18 let ver = match[2]; | 18 let ver = match[2]; |
19 | 19 |
20 if (app == "Chrome") | 20 if (app == "Chrome") |
21 { | 21 { |
22 platformVersion = ver; | 22 platformVersion = ver; |
23 } | 23 } |
24 else if (app == "Edge") | |
25 { | |
26 platform = "edgehtml"; | |
27 platformVersion = ver; | |
28 application = "edge"; | |
29 applicationVersion = "0"; | |
30 } | |
31 else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari") | 24 else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari") |
32 { | 25 { |
33 // For compatibility with legacy websites, Chrome's UA | 26 // For compatibility with legacy websites, Chrome's UA |
34 // also includes a Mozilla, AppleWebKit and Safari token. | 27 // also includes a Mozilla, AppleWebKit and Safari token. |
35 // Any further name/version pair indicates a fork. | 28 // Any further name/version pair indicates a fork. |
36 application = app == "OPR" ? "opera" : app.toLowerCase(); | 29 application = app == "OPR" ? "opera" : app.toLowerCase(); |
37 applicationVersion = ver; | 30 applicationVersion = ver; |
38 } | 31 } |
39 } | 32 } |
40 | 33 |
(...skipping 13 matching lines...) Expand all Loading... | |
54 | 47 |
55 | 48 |
56 exports.addonName = {{ basename|json }}; | 49 exports.addonName = {{ basename|json }}; |
57 exports.addonVersion = {{ version|json }}; | 50 exports.addonVersion = {{ version|json }}; |
58 | 51 |
59 exports.application = application; | 52 exports.application = application; |
60 exports.applicationVersion = applicationVersion; | 53 exports.applicationVersion = applicationVersion; |
61 | 54 |
62 exports.platform = platform; | 55 exports.platform = platform; |
63 exports.platformVersion = platformVersion; | 56 exports.platformVersion = platformVersion; |
OLD | NEW |