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

Unified Diff: templates/geckoInfo.js.tmpl

Issue 29542859: Issue 5660 - Check for runtime.getBrowserInfo API support (Closed) Base URL: https://hg.adblockplus.org/buildtools
Patch Set: Parse UA string for only version number Created Sept. 14, 2017, 6:04 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: templates/geckoInfo.js.tmpl
===================================================================
--- a/templates/geckoInfo.js.tmpl
+++ b/templates/geckoInfo.js.tmpl
@@ -12,13 +12,24 @@
exports.platform = "gecko";
exports.platformVersion = "0";
let match = /\brv:(\d+(?:\.\d+)?)\b/.exec(navigator.userAgent);
if (match)
exports.platformVersion = match[1];
-browser.runtime.getBrowserInfo().then(browserInfo =>
+// Firefox 50 does not support runtime.getBrowserInfo
+if ("getBrowserInfo" in browser.runtime)
{
- exports.application = browserInfo.name.toLowerCase();
- exports.applicationVersion = browserInfo.version;
-});
+ browser.runtime.getBrowserInfo().then(browserInfo =>
+ {
+ exports.application = browserInfo.name.toLowerCase();
+ exports.applicationVersion = browserInfo.version;
+ });
+}
+else
+{
+ let browserInfo = /\bFirefox\/(\S+)/.exec(navigator.userAgent);
+ exports.application = "firefox";
+ if (browserInfo)
+ exports.applicationVersion = browserInfo[1];
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld