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

Unified Diff: templates/chromeInfo.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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: templates/chromeInfo.js.tmpl
diff --git a/templates/chromeInfo.js.tmpl b/templates/chromeInfo.js.tmpl
index b2ad41c79cb4a20a178e56b11ff6eb40283a3c2a..3f69480c97794f5b97fbd6ce83c8d819d0c2c58b 100644
--- a/templates/chromeInfo.js.tmpl
+++ b/templates/chromeInfo.js.tmpl
@@ -4,63 +4,60 @@
"use strict";
-(function() {
- var platform = "chromium";
- var platformVersion = null;
- var application = null;
- var applicationVersion;
+let platform = "chromium";
+let platformVersion = null;
+let application = null;
+let applicationVersion;
- var regexp = /(\S+)\/(\S+)(?:\s*\(.*?\))?/g;
- var match;
+let regexp = /(\S+)\/(\S+)(?:\s*\(.*?\))?/g;
+let match;
- while (match = regexp.exec(navigator.userAgent))
- {
- var app = match[1];
- var ver = match[2];
+while (match = regexp.exec(navigator.userAgent))
+{
+ let app = match[1];
+ let ver = match[2];
- if (app == "Chrome")
- {
- platformVersion = ver;
- }
- else if (app == "Edge")
- {
- platform = "edgehtml";
- platformVersion = ver;
- application = "edge";
- applicationVersion = "0";
- }
- else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari")
- {
- // For compatibility with legacy websites, Chrome's UA
- // also includes a Mozilla, AppleWebKit and Safari token.
- // Any further name/version pair indicates a fork.
- application = app == "OPR" ? "opera" : app.toLowerCase();
- applicationVersion = ver;
- }
+ if (app == "Chrome")
+ {
+ platformVersion = ver;
}
-
- // not a Chromium-based UA, probably modifed by the user
- if (!platformVersion)
+ else if (app == "Edge")
{
- application = "unknown";
- applicationVersion = platformVersion = "0";
+ platform = "edgehtml";
+ platformVersion = ver;
+ application = "edge";
+ applicationVersion = "0";
}
-
- // no additional name/version, so this is upstream Chrome
- if (!application)
+ else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari")
{
- application = "chrome";
- applicationVersion = platformVersion;
+ // For compatibility with legacy websites, Chrome's UA
+ // also includes a Mozilla, AppleWebKit and Safari token.
+ // Any further name/version pair indicates a fork.
+ application = app == "OPR" ? "opera" : app.toLowerCase();
+ applicationVersion = ver;
}
+}
+
+// not a Chromium-based UA, probably modifed by the user
+if (!platformVersion)
+{
+ application = "unknown";
+ applicationVersion = platformVersion = "0";
+}
+
+// no additional name/version, so this is upstream Chrome
+if (!application)
+{
+ application = "chrome";
+ applicationVersion = platformVersion;
+}
+
- require.scopes.info = {
- addonName: {{ metadata.get('general', 'basename')|json }},
- addonVersion: {{ version|json }},
+exports.addonName = {{ basename|json }};
+exports.addonVersion = {{ version|json }};
- application: application,
- applicationVersion: applicationVersion,
+exports.application = application;
+exports.applicationVersion = applicationVersion;
- platform: platform,
- platformVersion: platformVersion
- };
-})();
+exports.platform = platform;
+exports.platformVersion = platformVersion;
« no previous file with comments | « packagerEdge.py ('k') | templates/geckoInfo.js.tmpl » ('j') | templates/modules.js.tmpl » ('J')

Powered by Google App Engine
This is Rietveld