device-orientation-permisson-ui: Don't emit "granted" event until permissions are actually granted. #5079
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.
Description:
See #5078
Changes proposed:
Code is currently structured as:
This is flawed, because when the
catch
branch is executed, thethen
branch then gets executed immediately as well.The fix is to restructure the code as follows:
I've also made a small UT fix to check for the non-emission of events at this stage in the process. This change made the script fail without the fix, and it succeeds with the fix in place.
UTs for this component could benefit from some significant extensions, but I'm not sure how soon I'd find time for that, and I didn't want to hold up making this fix available. So I've only implemented this minimal update to the UT alongside this change.