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

Unified Diff: issue-reporter.js

Issue 29587626: Issue 5893 - Issue reports should include browser vendor and capitalize browser/platform name (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Created Oct. 24, 2017, 12:10 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
« 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: issue-reporter.js
===================================================================
--- a/issue-reporter.js
+++ b/issue-reporter.js
@@ -86,16 +86,21 @@ function censorURL(url)
return url.replace(/([?;&/#][^?;&/#]+?=)[^?;&/#]+/g, "$1*");
}
function encodeHTML(str)
{
return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
}
+function capitalize(str)
+{
+ return str[0].toUpperCase() + str.slice(1);
+}
+
function serializeReportData()
{
let result = new XMLSerializer().serializeToString(reportData);
// Insert line breaks before each new tag
result = result.replace(/(<[^/]([^"<>]*|"[^"]*")*>)/g, "\n$1");
result = result.replace(/^\n+/, "");
return result;
@@ -124,38 +129,39 @@ function retrieveAddonInfo()
function retrieveApplicationInfo()
{
let element = reportData.createElement("application");
return browser.runtime.sendMessage({
type: "app.get",
what: "application"
}).then(application =>
{
- element.setAttribute("name", application);
+ element.setAttribute("name", capitalize(application));
return browser.runtime.sendMessage({
type: "app.get",
what: "applicationVersion"
});
}).then(applicationVersion =>
{
element.setAttribute("version", applicationVersion);
+ element.setAttribute("vendor", navigator.vendor);
element.setAttribute("userAgent", navigator.userAgent);
reportData.documentElement.appendChild(element);
});
}
function retrievePlatformInfo()
{
let element = reportData.createElement("platform");
return browser.runtime.sendMessage({
type: "app.get",
what: "platform"
}).then(platform =>
{
- element.setAttribute("name", platform);
+ element.setAttribute("name", capitalize(platform));
return browser.runtime.sendMessage({
type: "app.get",
what: "platformVersion"
});
}).then(platformVersion =>
{
element.setAttribute("version", platformVersion);
reportData.documentElement.appendChild(element);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld