alephium/extension-wallet

Issue with IS_PREAUTHORIZED_RES

Closed this issue · 1 comments

Symptom

Sometimes, when refreshing web pages on dApp, users always get disconnected. For Chrome, if you use Chrome Profiles, this only happens in some profiles (a fresh Chrome profile usually do not have this issue).

Cause

The reason for this symptom is that when extension wallet tries to check if the current dApp is pre-authorized, it sends a IS_PREAUTHORIZED message to the service worker and wait for IS_PREAUTHORIZED_RES to be returned from the service worker. Details see here. The problem is even if service worker returns true, the extension wallet frontend always gets false as if the wrong message response is cached.

This doesn't happen to all profiles, but if it happens, for all dApps a page refresh would lose the the wallet connection.

Fixed by #143