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

Fix _getPermittedAccounts type safety #10819

Merged
merged 1 commit into from
Apr 5, 2021

Conversation

rekmarks
Copy link
Member

@rekmarks rekmarks commented Apr 4, 2021

PermissionsController._getPermittedAccounts could return an array or null, but it was used in removeAllAccountPermissions as though it could only return an array.

I don't believe it would ever return anything other than an array as things stand, but it's not type safe, and we should fix it. Things with getAccounts in the name tend to only return arrays in our codebase, so I made _getPermittedAccounts only return arrays, and updated calls expecting null to expect an empty array instead.

@rekmarks rekmarks requested a review from a team as a code owner April 4, 2021 05:21
@rekmarks rekmarks requested a review from ryanml April 4, 2021 05:21
@metamaskbot
Copy link
Collaborator

Builds ready [ce2f5ad]
Page Load Metrics (601 ± 63 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint45716073
domContentLoaded36885060013263
load36985160113263
domInteractive36785060013263

Copy link
Contributor

@darkwing darkwing left a comment

Choose a reason for hiding this comment

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

I very, very much like this change! LGTM!

@rekmarks rekmarks merged commit e142bf0 into develop Apr 5, 2021
@rekmarks rekmarks deleted the fix-_getPermittedAccounts-type-safety branch April 5, 2021 18:32
@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants