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

Prevent error when strict_min_version is not a string value #3913

Merged
merged 1 commit into from Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/utils.js
Expand Up @@ -398,7 +398,8 @@ export function firefoxStrictMinVersion(manifestJson) {
if (
manifestJson.applications &&
manifestJson.applications.gecko &&
manifestJson.applications.gecko.strict_min_version
manifestJson.applications.gecko.strict_min_version &&
typeof manifestJson.applications.gecko.strict_min_version === 'string'
) {
return parseInt(
manifestJson.applications.gecko.strict_min_version.split('.')[0],
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/test.utils.js
Expand Up @@ -512,6 +512,14 @@ describe('firefoxStrictMinVersion', () => {
})
).toEqual(60);
});

it('should return null when value is not a string', () => {
expect(
firefoxStrictMinVersion({
applications: { gecko: { strict_min_version: 12.3 } },
})
).toEqual(null);
});
});

describe('basicCompatVersionComparison', () => {
Expand Down