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 (function() { | 7 (function() { |
8 var platform = "chromium"; | 8 var platform = "chromium"; |
9 var platformVersion = null; | 9 var platformVersion = null; |
10 var application = null; | 10 var application = null; |
(...skipping 11 matching lines...) Expand all Loading... | |
22 { | 22 { |
23 platformVersion = ver; | 23 platformVersion = ver; |
24 } | 24 } |
25 else if (app == "Edge") | 25 else if (app == "Edge") |
26 { | 26 { |
27 platform = "edgehtml"; | 27 platform = "edgehtml"; |
28 platformVersion = ver; | 28 platformVersion = ver; |
29 application = "edge"; | 29 application = "edge"; |
30 applicationVersion = "0"; | 30 applicationVersion = "0"; |
31 } | 31 } |
32 else if (app == "Gecko") | |
33 { | |
34 platform = "gecko"; | |
35 match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent); | |
36 if (match) | |
37 platformVersion = match[1]; | |
38 browser.runtime.getBrowserInfo().then(function(info) | |
Sebastian Noack
2016/12/01 16:24:54
This will error out when running on Chrome with tw
Wladimir Palant
2016/12/01 21:39:31
Ok, let's add some more failsafes.
| |
39 { | |
40 require.scopes.info.application = info.name.toLowerCase(); | |
41 require.scopes.info.applicationVersion = info.version; | |
42 }); | |
43 } | |
32 else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari") | 44 else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari") |
33 { | 45 { |
34 // For compatibility with legacy websites, Chrome's UA | 46 // For compatibility with legacy websites, Chrome's UA |
35 // also includes a Mozilla, AppleWebKit and Safari token. | 47 // also includes a Mozilla, AppleWebKit and Safari token. |
36 // Any further name/version pair indicates a fork. | 48 // Any further name/version pair indicates a fork. |
37 application = app == "OPR" ? "opera" : app.toLowerCase(); | 49 application = app == "OPR" ? "opera" : app.toLowerCase(); |
38 applicationVersion = ver; | 50 applicationVersion = ver; |
39 } | 51 } |
40 } | 52 } |
41 | 53 |
(...skipping 15 matching lines...) Expand all Loading... | |
57 addonName: {{ metadata.get('general', 'basename')|json }}, | 69 addonName: {{ metadata.get('general', 'basename')|json }}, |
58 addonVersion: {{ version|json }}, | 70 addonVersion: {{ version|json }}, |
59 | 71 |
60 application: application, | 72 application: application, |
61 applicationVersion: applicationVersion, | 73 applicationVersion: applicationVersion, |
62 | 74 |
63 platform: platform, | 75 platform: platform, |
64 platformVersion: platformVersion | 76 platformVersion: platformVersion |
65 }; | 77 }; |
66 })(); | 78 })(); |
OLD | NEW |