Bug 2059390: fix crash in SitePermissionsFragment.onDismiss - #321
Closed
pollym wants to merge 1 commit into
Closed
Conversation
If a fragment is detached, it is no longer safe to call `requireComponents`, because this method throws if the `context` is null. In this case, `BaseBrowserFragment` is not attached and returning true from `shouldHide` will stop us from showing the permission prompt, rather than crashing. Also checked `hidePermissionsPrompt` which will be called if `shouldHide` is true. This allows for the case of the fragment not being attached by using an optional and a let, so should be safe to call in this detached fragment case.
Contributor
|
View this pull request in Lando to land it once approved. |
Contributor
Author
|
i couldn't think of an easy way to write a unit test around this, but if anyone has an idea lmk |
segunfamisa
approved these changes
Jul 30, 2026
segunfamisa
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this patch!
lando-worker Bot
pushed a commit
that referenced
this pull request
Jul 31, 2026
…misa If a fragment is detached, it is no longer safe to call `requireComponents`, because this method throws if the `context` is null. In this case, `BaseBrowserFragment` is not attached and returning true from `shouldHide` will stop us from showing the permission prompt, rather than crashing. Also checked `hidePermissionsPrompt` which will be called if `shouldHide` is true. This allows for the case of the fragment not being attached by using an optional and a let, so should be safe to call in this detached fragment case. [try is running here](https://treeherder.mozilla.org/jobs?repo=try&revision=8dbfc878c87991d2da9167e8ad5daed2bb54579a) Pull request: #321
|
Pull request closed by commit 4dbfb9d |
lando-worker Bot
pushed a commit
that referenced
this pull request
Aug 11, 2026
If a fragment is detached, it is no longer safe to call `requireComponents`, because this method throws if the `context` is null. In this case, `BaseBrowserFragment` is not attached and returning true from `shouldHide` will stop us from showing the permission prompt, rather than crashing. Also checked `hidePermissionsPrompt` which will be called if `shouldHide` is true. This allows for the case of the fragment not being attached by using an optional and a let, so should be safe to call in this detached fragment case. [try is running here](https://treeherder.mozilla.org/jobs?repo=try&revision=8dbfc878c87991d2da9167e8ad5daed2bb54579a) Pull request: #321 Differential Revision: https://phabricator.services.mozilla.com/D317829
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a fragment is detached, it is no longer safe to call
requireComponents, because this method throws if thecontextis null. In this case,BaseBrowserFragmentis not attached and returning true fromshouldHidewill stop us from showing the permission prompt, rather than crashing. Also checkedhidePermissionsPromptwhich will be called ifshouldHideis true. This allows for the case of the fragment not being attached by using an optional and a let, so should be safe to call in this detached fragment case.try is running here