Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: templates/geckoInfo.js.tmpl

Issue 29399569: Issue 5060 - Move require into modules template, make info a module (Closed)
Patch Set: Improve check for require Created April 1, 2017, 1:27 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 exports.addonName = {{ basename|json }};
8 let info = require.scopes.info = { 8 exports.addonVersion = {{ version|json }};
9 addonName: {{ metadata.get('general', 'basename')|json }},
10 addonVersion: {{ version|json }},
11 9
12 application: "unknown", 10 exports.application = "unknown";
13 applicationVersion: "0", 11 exports.applicationVersion = "0";
14 12
15 platform: "gecko", 13 exports.platform = "gecko";
16 platformVersion: "0" 14 exports.platformVersion = "0";
17 };
18 15
19 let match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent); 16 let match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent);
20 if (match) 17 if (match)
21 info.platformVersion = match[1]; 18 exports.platformVersion = match[1];
22 19
23 browser.runtime.getBrowserInfo().then(function(browserInfo) 20 browser.runtime.getBrowserInfo().then(browserInfo =>
24 { 21 {
25 info.application = browserInfo.name.toLowerCase(); 22 exports.application = browserInfo.name.toLowerCase();
26 info.applicationVersion = browserInfo.version; 23 exports.applicationVersion = browserInfo.version;
27 }); 24 });
28 })();
OLDNEW

Powered by Google App Engine
This is Rietveld