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 { |
17 let app = match[1]; | 17 let app = match[1]; |
18 let ver = match[2]; | 18 let ver = match[2]; |
19 platformVersion = ver; | |
19 | 20 |
20 if (app == "Chrome") | 21 if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari") |
Sebastian Noack
2017/06/07 11:14:13
This part is still relevant on Chrome, only the ap
Jon Sonesen
2017/06/07 11:41:38
Acknowledged.
| |
21 { | |
22 platformVersion = ver; | |
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") | |
32 { | 22 { |
33 // For compatibility with legacy websites, Chrome's UA | 23 // For compatibility with legacy websites, Chrome's UA |
34 // also includes a Mozilla, AppleWebKit and Safari token. | 24 // also includes a Mozilla, AppleWebKit and Safari token. |
35 // Any further name/version pair indicates a fork. | 25 // Any further name/version pair indicates a fork. |
36 application = app == "OPR" ? "opera" : app.toLowerCase(); | 26 application = app == "OPR" ? "opera" : app.toLowerCase(); |
37 applicationVersion = ver; | 27 applicationVersion = ver; |
38 } | 28 } |
39 } | 29 } |
40 | 30 |
41 // not a Chromium-based UA, probably modifed by the user | 31 // not a Chromium-based UA, probably modifed by the user |
(...skipping 12 matching lines...) Expand all Loading... | |
54 | 44 |
55 | 45 |
56 exports.addonName = {{ basename|json }}; | 46 exports.addonName = {{ basename|json }}; |
57 exports.addonVersion = {{ version|json }}; | 47 exports.addonVersion = {{ version|json }}; |
58 | 48 |
59 exports.application = application; | 49 exports.application = application; |
60 exports.applicationVersion = applicationVersion; | 50 exports.applicationVersion = applicationVersion; |
61 | 51 |
62 exports.platform = platform; | 52 exports.platform = platform; |
63 exports.platformVersion = platformVersion; | 53 exports.platformVersion = platformVersion; |
OLD | NEW |