mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Prevent showing connected accounts without origin (#8891)
There was a case where the `activeTab.origin` was not set, yet the user could still navigate to the "Connected accounts" modal, which assumes that `activeTab.origin` is set. This would happen in Firefox when the user opened the popup on a page internal to Firefox (e.g. `about:blank`). The connected status indicator would still be shown, but the UI would crash when it was clicked. The connected status indicator is now hidden whenever `activeTab.origin` is falsy. The 'Unconnected account' alert has also been made impossible to trigger in that circumstance.
This commit is contained in:
parent
a294ca7125
commit
d9a27fcf52
@ -26,7 +26,7 @@ export default function MenuBar () {
|
||||
const [accountOptionsMenuOpen, setAccountOptionsMenuOpen] = useState(false)
|
||||
const origin = useSelector(getOriginOfCurrentTab)
|
||||
|
||||
const showStatus = getEnvironmentType() === ENVIRONMENT_TYPE_POPUP && origin !== extension.runtime.id
|
||||
const showStatus = getEnvironmentType() === ENVIRONMENT_TYPE_POPUP && origin && origin !== extension.runtime.id
|
||||
|
||||
return (
|
||||
<div className="menu-bar">
|
||||
|
@ -1191,8 +1191,8 @@ export function showAccountDetail (address) {
|
||||
const activeTabOrigin = state.activeTab.origin
|
||||
const selectedAddress = getSelectedAddress(state)
|
||||
const permittedAccountsForCurrentTab = getPermittedAccountsForCurrentTab(state)
|
||||
const currentTabIsConnectedToPreviousAddress = permittedAccountsForCurrentTab.includes(selectedAddress)
|
||||
const currentTabIsConnectedToNextAddress = permittedAccountsForCurrentTab.includes(address)
|
||||
const currentTabIsConnectedToPreviousAddress = Boolean(activeTabOrigin) && permittedAccountsForCurrentTab.includes(selectedAddress)
|
||||
const currentTabIsConnectedToNextAddress = Boolean(activeTabOrigin) && permittedAccountsForCurrentTab.includes(address)
|
||||
const switchingToUnconnectedAddress = currentTabIsConnectedToPreviousAddress && !currentTabIsConnectedToNextAddress
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user