Skip to content

core(source-maps): throw explicit error when map is missing required fields #14060

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

Merged
merged 2 commits into from
May 31, 2022

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented May 26, 2022

Found another one from sentry. (btw it looks like theres only 3 actual JS errors in there. and this is 2 out of 3)

lighthouse https://video.ebscohost.com/results?q=climate%20change -GA

That page loads this JS file which references this map, which is just a {}. It is missing 3 field required by the spec.

But we werent validating these fields are present, leading to a Cannot read properties of undefined (reading 'length') on here:

for (let i = 0; i < sourceMap.map.sources.length; i++) {

image

This change adds the basic validation in the gatherer. As a result, we don't hit the exception. And the user gets the errorMessage in the UI:

image

The audit is still passing cuz it "Only fails if missingMapsForLargeFirstPartyFile is true. All other errors are diagnostical."

@paulirish paulirish requested a review from a team as a code owner May 26, 2022 18:30
@paulirish paulirish requested review from brendankenny and removed request for a team May 26, 2022 18:30
@connorjclark connorjclark changed the title core(sourcemap): flag sourcemaps that are just an object core(source-maps): throw explicit error when map is missing required fields May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants