Skip to content
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

Merged
merged 7 commits into from
Sep 24, 2018

Conversation

exterkamp
Copy link
Member

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

@exterkamp exterkamp changed the title core(driver): add check to make sure Protocol Runtime evaluate result exists. core(driver): add check to make sure Protocol Runtime evaluate result exists Sep 21, 2018
@exterkamp exterkamp changed the title core(driver): add check to make sure Protocol Runtime evaluate result exists core(driver): add check to make sure DevTols Protocol Runtime.evaluate result exists Sep 21, 2018
@exterkamp exterkamp changed the title core(driver): add check to make sure DevTols Protocol Runtime.evaluate result exists core(driver): add check to make sure Runtime.evaluate result exists Sep 21, 2018
Copy link
Member

@paulirish paulirish left a 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.

return reject(new Error('an unexpected driver error occurred'));
}

// Protocol should always return a 'result' object, but it is sometimes undefined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...undefined. See #6026

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'));
Copy link
Member

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}`

// 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'));
Copy link
Member

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

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!


// 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'));
Copy link
Member

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"?

Copy link
Member Author

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.

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg. 'omitted' sgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants