From 0ed3fd339f0a183a7a4e5defe2be163754b7c514 Mon Sep 17 00:00:00 2001 From: Nick Olinger Date: Mon, 21 Nov 2016 09:57:36 -0500 Subject: [PATCH 1/4] Improve github issue title --- lighthouse-extension/app/src/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lighthouse-extension/app/src/popup.js b/lighthouse-extension/app/src/popup.js index 21d3b3ae346b..34f76866e68a 100644 --- a/lighthouse-extension/app/src/popup.js +++ b/lighthouse-extension/app/src/popup.js @@ -53,7 +53,7 @@ document.addEventListener('DOMContentLoaded', _ => { qsBody += '**Stack Trace**:\n ```' + err.stack + '```'; const base = 'https://github.com/googlechrome/lighthouse/issues/new?'; - const title = encodeURI('title=Lighthouse Extension Error'); + const title = encodeURI('title=Extension Error: ' + err.message); const body = '&body=' + encodeURI(qsBody); reportErrorEl.href = base + title + body; From 84548d301c4ba64f28393a7140b87bae97aa8e56 Mon Sep 17 00:00:00 2001 From: Nick Olinger Date: Mon, 21 Nov 2016 16:08:10 -0500 Subject: [PATCH 2/4] Truncate error messages longer than 60 chars --- lighthouse-extension/app/src/popup.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lighthouse-extension/app/src/popup.js b/lighthouse-extension/app/src/popup.js index 34f76866e68a..9e0ab9b13c6f 100644 --- a/lighthouse-extension/app/src/popup.js +++ b/lighthouse-extension/app/src/popup.js @@ -35,6 +35,8 @@ document.addEventListener('DOMContentLoaded', _ => { const optionsList = document.body.querySelector('.options__list'); const okButton = document.getElementById('ok'); + const MAX_ISSUE_ERROR_LENGTH = 60; + function getLighthouseVersion() { return chrome.runtime.getManifest().version; } @@ -53,7 +55,11 @@ document.addEventListener('DOMContentLoaded', _ => { qsBody += '**Stack Trace**:\n ```' + err.stack + '```'; const base = 'https://github.com/googlechrome/lighthouse/issues/new?'; - const title = encodeURI('title=Extension Error: ' + err.message); + let titleError = err.message; + if (titleError.length > MAX_ISSUE_ERROR_LENGTH) { + titleError = err.message.substring(0, MAX_ISSUE_ERROR_LENGTH - 3) + '...'; + } + const title = encodeURI('title=Extension Error: ' + titleError); const body = '&body=' + encodeURI(qsBody); reportErrorEl.href = base + title + body; From cd876a71ff6bc1b6f7a4b0cfa38bafe4655086fa Mon Sep 17 00:00:00 2001 From: Nick Olinger Date: Mon, 21 Nov 2016 16:17:15 -0500 Subject: [PATCH 3/4] Use template literal instead of concatentation --- lighthouse-extension/app/src/popup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lighthouse-extension/app/src/popup.js b/lighthouse-extension/app/src/popup.js index 9e0ab9b13c6f..06e330b3a24a 100644 --- a/lighthouse-extension/app/src/popup.js +++ b/lighthouse-extension/app/src/popup.js @@ -56,8 +56,8 @@ document.addEventListener('DOMContentLoaded', _ => { const base = 'https://github.com/googlechrome/lighthouse/issues/new?'; let titleError = err.message; - if (titleError.length > MAX_ISSUE_ERROR_LENGTH) { - titleError = err.message.substring(0, MAX_ISSUE_ERROR_LENGTH - 3) + '...'; + if (titleError.length > MAX_ISSUE_ERROR_LENGTH) {; + titleError = `${titleError.substring(0, MAX_ISSUE_ERROR_LENGTH - 3)}...`; } const title = encodeURI('title=Extension Error: ' + titleError); const body = '&body=' + encodeURI(qsBody); From 3074622ac102c1209abc6f83910415ef78b92086 Mon Sep 17 00:00:00 2001 From: Nick Olinger Date: Mon, 21 Nov 2016 18:45:58 -0500 Subject: [PATCH 4/4] fix typo semicolon --- lighthouse-extension/app/src/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lighthouse-extension/app/src/popup.js b/lighthouse-extension/app/src/popup.js index 06e330b3a24a..d6e001ed650b 100644 --- a/lighthouse-extension/app/src/popup.js +++ b/lighthouse-extension/app/src/popup.js @@ -56,7 +56,7 @@ document.addEventListener('DOMContentLoaded', _ => { const base = 'https://github.com/googlechrome/lighthouse/issues/new?'; let titleError = err.message; - if (titleError.length > MAX_ISSUE_ERROR_LENGTH) {; + if (titleError.length > MAX_ISSUE_ERROR_LENGTH) { titleError = `${titleError.substring(0, MAX_ISSUE_ERROR_LENGTH - 3)}...`; } const title = encodeURI('title=Extension Error: ' + titleError);