-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Use sourcemaps to revert stacktrace in extension #995
Conversation
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.
perhaps you know of another library
I don't, but maybe @addyosmani or @paulirish (when he's back) know of one or a simpler way to do this?
@@ -23,5 +23,8 @@ | |||
"gulp-zip": "^3.2.0", | |||
"run-sequence": "^1.1.5", | |||
"through2": "^2.0.1" | |||
}, | |||
"dependencies": { | |||
"sourcemapped-stacktrace": "^1.1.3" |
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.
should be in devDependencies
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.
i require it inside browserify doesn't that make it a dependency?
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.
i think in practical terms it doesnt matter, but i agree that semantically it fits in deps more than devDeps
@@ -157,7 +166,10 @@ document.addEventListener('DOMContentLoaded', _ => { | |||
|
|||
if (!multipleTabs && !debuggerExists) { | |||
feedbackEl.className = 'feedback-error'; | |||
feedbackEl.appendChild(buildReportErrorLink(err)); | |||
buildReportErrorLink(err) |
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.
ideally we'd want the error passed to background.console.error
below to also be source mapped
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.
done :)
const body = '&body=' + encodeURI(qsBody); | ||
return new Promise(resolve => { | ||
sourcemapStacktrace.mapStackTrace(err.stack, function(mapped) { | ||
qsBody += '**Stack Trace**:\n ```' + mapped.join('\n') + '```'; |
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.
will need to rebase this after #992
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.
done :)
d94a610
to
3917aba
Compare
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.
don't know of a better library or simpler way to do this, myself. (unless we use devtools frontend for the same resolution, which won't be very fun IMO)
this seems generally on point tho
@@ -23,5 +23,8 @@ | |||
"gulp-zip": "^3.2.0", | |||
"run-sequence": "^1.1.5", | |||
"through2": "^2.0.1" | |||
}, | |||
"dependencies": { | |||
"sourcemapped-stacktrace": "^1.1.3" |
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.
i think in practical terms it doesnt matter, but i agree that semantically it fits in deps more than devDeps
@@ -23,5 +23,8 @@ | |||
"gulp-zip": "^3.2.0", | |||
"run-sequence": "^1.1.5", | |||
"through2": "^2.0.1" | |||
}, | |||
"dependencies": { |
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.
do we need to wait for your PR to land upstream first?
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.
if necessary I can publish the github repo under my name in npm repo until the pr is accepted
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.
@paulirish PR got accepted ^^
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.
in that case you'll want to bump to 1.1.4 ;)
@@ -122,6 +126,21 @@ document.addEventListener('DOMContentLoaded', _ => { | |||
return listItem; | |||
} | |||
|
|||
function showError(err, message, includeReportLink) { | |||
sourcemapStacktrace.mapStackTrace(err.stack, stackWithSourcemaps => { |
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.
can we do a try/catch around the mapStackTrace call? I want to make sure we gracefully degrade and still show the error reporting stuff even if the sourcemap resolution fails.
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.
Need to test my new approach :)
3917aba
to
f64ef53
Compare
I like the added benefit this PR gives our error stack traces. The impact on our bundle size for adding this new module is ~90kb which is similar to the jszip that we removed. However on the other hand, this means including sourcemaps for our entire bundle which takes the filesize from 2.4mb to 6.5mb. |
mmh I don't think we can fix the sourcemap issue but I might be able to pick relevant pieces of the library and put them in lighthouse but probably won't save that much because I will still be dependent on the sourcemap dependency |
@paulirish don't forget we are also removing url and whatwg-url from the extension. |
e31080f
to
c9137d7
Compare
@paulirish I did a new check with a rebase of master and got the following results Is it that bad? We could also do a better issue tracking and use the report viewer to convert stacktraces so the extension stays 2MB and the heavy lifting is done by the viewer but than we need to build a small ui for it. |
c9137d7
to
f296a22
Compare
should we close this? Looks like the impact on code size would be too great? It seems like it hasn't been too hard to backtrack from extension strack traces to original source code |
@brendankenny yeah think closing is ok :) |
Should fix #972, downside is that I had to fix an issue with browserify sourcemaps inside novocaine/sourcemapped-stacktrace#19
perhaps you know of another library? (didn't want to write it myself)