-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(tsc): update to latest tsc #5581
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,9 @@ async function runLighthouseInExtension(flags, categoryIDs) { | |
throw new Error('no runnerResult generated by Lighthouse'); | ||
} | ||
|
||
const blobURL = createReportPageAsBlob(runnerResult); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why does ts require us to do this now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
// Report is always a singular string since {output: 'html'}, above. | ||
const reportHtml = /** @type {string} */ (runnerResult.report); | ||
const blobURL = createReportPageAsBlob(reportHtml); | ||
await new Promise(resolve => chrome.windows.create({url: blobURL}, resolve)); | ||
} | ||
|
||
|
@@ -91,15 +93,13 @@ async function runLighthouseAsInCLI(connection, url, flags, categoryIDs, {logAss | |
return results.report; | ||
} | ||
|
||
|
||
/** | ||
* @param {LH.RunnerResult} runnerResult Lighthouse results object | ||
* @param {string} reportHtml | ||
* @return {string} Blob URL of the report (or error page) HTML | ||
*/ | ||
function createReportPageAsBlob(runnerResult) { | ||
function createReportPageAsBlob(reportHtml) { | ||
performance.mark('report-start'); | ||
const html = runnerResult.report; | ||
const blob = new Blob([html], {type: 'text/html'}); | ||
const blob = new Blob([reportHtml], {type: 'text/html'}); | ||
const blobURL = URL.createObjectURL(blob); | ||
|
||
performance.mark('report-end'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,7 +226,13 @@ class LighthouseReportViewer { | |
return new Promise((resolve, reject) => { | ||
const reader = new FileReader(); | ||
reader.onload = function(e) { | ||
resolve(e.target && e.target.result); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? is new ts stricter on this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically it's somewhat more correct. They had a custom However, the event should be generic, parameterized on the element itself so that the type is known and it isn't just an |
||
const readerTarget = /** @type {?FileReader} */ (e.target); | ||
const result = /** @type {?string} */ (readerTarget && readerTarget.result); | ||
if (!result) { | ||
reject('Could not read file'); | ||
return; | ||
} | ||
resolve(result); | ||
}; | ||
reader.onerror = reject; | ||
reader.readAsText(file); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a really weird bug. Any characters changed or added to either the
en
oren-US
keys makes the error go away