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: Addressed some feedback Created March 31, 2017, 1:57 p.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..4217d8375640591d67621f7a7f57ad901b39493e 100644
--- a/templates/chromeInfo.js.tmpl
+++ b/templates/chromeInfo.js.tmpl
@@ -4,63 +4,61 @@
"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 }},
+module.exports = {
+ addonName: {{ basename|json }},
+ addonVersion: {{ version|json }},
- application: application,
- applicationVersion: applicationVersion,
+ application,
+ applicationVersion,
- platform: platform,
- platformVersion: platformVersion
- };
-})();
+ platform,
+ 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