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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 function censorURL(url) 84 function censorURL(url)
85 { 85 {
86 return url.replace(/([?;&/#][^?;&/#]+?=)[^?;&/#]+/g, "$1*"); 86 return url.replace(/([?;&/#][^?;&/#]+?=)[^?;&/#]+/g, "$1*");
87 } 87 }
88 88
89 function encodeHTML(str) 89 function encodeHTML(str)
90 { 90 {
91 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 91 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
92 } 92 }
93 93
94 function capitalize(str)
95 {
96 return str[0].toUpperCase() + str.slice(1);
97 }
98
94 function serializeReportData() 99 function serializeReportData()
95 { 100 {
96 let result = new XMLSerializer().serializeToString(reportData); 101 let result = new XMLSerializer().serializeToString(reportData);
97 102
98 // Insert line breaks before each new tag 103 // Insert line breaks before each new tag
99 result = result.replace(/(<[^/]([^"<>]*|"[^"]*")*>)/g, "\n$1"); 104 result = result.replace(/(<[^/]([^"<>]*|"[^"]*")*>)/g, "\n$1");
100 result = result.replace(/^\n+/, ""); 105 result = result.replace(/^\n+/, "");
101 return result; 106 return result;
102 } 107 }
103 108
(...skipping 18 matching lines...) Expand all
122 } 127 }
123 128
124 function retrieveApplicationInfo() 129 function retrieveApplicationInfo()
125 { 130 {
126 let element = reportData.createElement("application"); 131 let element = reportData.createElement("application");
127 return browser.runtime.sendMessage({ 132 return browser.runtime.sendMessage({
128 type: "app.get", 133 type: "app.get",
129 what: "application" 134 what: "application"
130 }).then(application => 135 }).then(application =>
131 { 136 {
132 element.setAttribute("name", application); 137 element.setAttribute("name", capitalize(application));
133 return browser.runtime.sendMessage({ 138 return browser.runtime.sendMessage({
134 type: "app.get", 139 type: "app.get",
135 what: "applicationVersion" 140 what: "applicationVersion"
136 }); 141 });
137 }).then(applicationVersion => 142 }).then(applicationVersion =>
138 { 143 {
139 element.setAttribute("version", applicationVersion); 144 element.setAttribute("version", applicationVersion);
145 element.setAttribute("vendor", navigator.vendor);
140 element.setAttribute("userAgent", navigator.userAgent); 146 element.setAttribute("userAgent", navigator.userAgent);
141 reportData.documentElement.appendChild(element); 147 reportData.documentElement.appendChild(element);
142 }); 148 });
143 } 149 }
144 150
145 function retrievePlatformInfo() 151 function retrievePlatformInfo()
146 { 152 {
147 let element = reportData.createElement("platform"); 153 let element = reportData.createElement("platform");
148 return browser.runtime.sendMessage({ 154 return browser.runtime.sendMessage({
149 type: "app.get", 155 type: "app.get",
150 what: "platform" 156 what: "platform"
151 }).then(platform => 157 }).then(platform =>
152 { 158 {
153 element.setAttribute("name", platform); 159 element.setAttribute("name", capitalize(platform));
154 return browser.runtime.sendMessage({ 160 return browser.runtime.sendMessage({
155 type: "app.get", 161 type: "app.get",
156 what: "platformVersion" 162 what: "platformVersion"
157 }); 163 });
158 }).then(platformVersion => 164 }).then(platformVersion =>
159 { 165 {
160 element.setAttribute("version", platformVersion); 166 element.setAttribute("version", platformVersion);
161 reportData.documentElement.appendChild(element); 167 reportData.documentElement.appendChild(element);
162 }); 168 });
163 } 169 }
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 progress.value = event.loaded; 475 progress.value = event.loaded;
470 } 476 }
471 }); 477 });
472 request.send(serializeReportData()); 478 request.send(serializeReportData());
473 } 479 }
474 480
475 function leaveSendPage() 481 function leaveSendPage()
476 { 482 {
477 window.close(); 483 window.close();
478 } 484 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld