-
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(driver): add check to make sure Runtime.evaluate result exists #6089
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.
thanks for looking into this.
lighthouse-core/gather/driver.js
Outdated
return reject(new Error('an unexpected driver error occurred')); | ||
} | ||
|
||
// Protocol should always return a 'result' object, but it is sometimes undefined |
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.
...undefined. See #6026
lighthouse-core/gather/driver.js
Outdated
reject(new Error('an unexpected driver error occurred')); | ||
} if (value && value.__failedInBrowser) { | ||
reject(Object.assign(new Error(), value)); | ||
return reject(new Error('an unexpected driver error occurred')); |
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.
let's change this text. how about this?
`Evaluation exception: ${response.exceptionDetails.text}`
lighthouse-core/gather/driver.js
Outdated
// Protocol should always return a 'result' object, but it is sometimes undefined | ||
// see https://github.com/GoogleChrome/lighthouse/issues/6026 | ||
if (response.result === undefined) { | ||
return reject(new Error('Driver did not sent a result object')); |
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.
Runtime.evaluate response omits a result
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.
Nice!
lighthouse-core/gather/driver.js
Outdated
|
||
// Protocol should always return a 'result' object, but it is sometimes undefined. See #6026. | ||
if (response.result === undefined) { | ||
return reject(new Error('Runtime.evaluate response omits a result')); |
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 know @paulirish just said this, but "omits" is weird here. At least "omitted", maybe "did not contain"?
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 also felt like "a result" was confusing, so clarified it is a "result" object that wasn't there.
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.
lg. 'omitted' sgtm
Summary
Added an undefined check for driver results to catch an undefined result coming back from the Protocol, which shouldn't happen, but we check anyway to catch if it does.
Relevant Protocol
Related Issues/PRs
addresses: #6026