Prevent TWA location permission request callback run more than once
When checking TWA location permission with the client app, if the TWAService did not returns the success message (returns failed), we treat it as "denied" and returns the result via the PermissionResponseCallback. However if the TWAService did handle the extraCommand and later invoked the TWACallback, the PermissionResponseCallback will be called again. This causes the OnceCallback in native been called twice, and crashed. This should happen with a correct TWAService, but it would be nice to prevent that a TWAService handling extraCommand wrongly crashes Chrome. This CL fix it by adding a boolean mCalled in PermissionCheckCallback to mark whether the callback been invoked. so the callback would not be run more than once. Bug: 1105867 Change-Id: Icb5a87b73a5e18a107fed7f83cff8d7e311087bc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300367 Commit-Queue: Ella Ge <eirage@chromium.org> Reviewed-by:Peter Conn <peconn@chromium.org> Cr-Commit-Position: refs/heads/master@{#789495}
Showing
Please register or sign in to comment