Skip to content

Commit

Permalink
URLSearchParams, u so good lookin
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed May 23, 2017
1 parent bf73d66 commit f73b4ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lighthouse-extension/app/src/popup.js
Expand Up @@ -71,14 +71,15 @@ ${err.stack}
\`\`\`
`;

const base = 'https://github.com/GoogleChrome/lighthouse/issues/new?';
const url = new URL('https://github.com/GoogleChrome/lighthouse/issues/new');

const errorTitle = err.message.substring(0, MAX_ISSUE_ERROR_LENGTH);
const title = encodeURI('title=Extension Error: ' + errorTitle);
const body = '&body=' + encodeURI(issueBody.trim());
url.searchParams.append('title', `Extension Error: ${errorTitle}`);
url.searchParams.append('body', issueBody.trim());

const reportErrorEl = document.createElement('a');
reportErrorEl.className = 'button button--report-error';
reportErrorEl.href = base + title + body;
reportErrorEl.href = url;
reportErrorEl.textContent = 'Report Error';
reportErrorEl.target = '_blank';

Expand Down

0 comments on commit f73b4ea

Please sign in to comment.