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: Don't redeclare require Created March 31, 2017, 6:48 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 = module.exports = {
8 let info = require.scopes.info = { 8 addonName: {{ basename|json }},
9 addonName: {{ metadata.get('general', 'basename')|json }}, 9 addonVersion: {{ version|json }},
10 addonVersion: {{ version|json }},
11 10
12 application: "unknown", 11 application: "unknown",
13 applicationVersion: "0", 12 applicationVersion: "0",
14 13
15 platform: "gecko", 14 platform: "gecko",
16 platformVersion: "0" 15 platformVersion: "0"
17 }; 16 };
18 17
19 let match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent); 18 let match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent);
20 if (match) 19 if (match)
21 info.platformVersion = match[1]; 20 exports.platformVersion = match[1];
22 21
23 browser.runtime.getBrowserInfo().then(function(browserInfo) 22 browser.runtime.getBrowserInfo().then(browserInfo =>
24 { 23 {
25 info.application = browserInfo.name.toLowerCase(); 24 exports.application = browserInfo.name.toLowerCase();
26 info.applicationVersion = browserInfo.version; 25 exports.applicationVersion = browserInfo.version;
27 }); 26 });
28 })();
OLDNEW

Powered by Google App Engine
This is Rietveld