mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix inpage provider behavior on unlock (#12339)
This fixes a bug where we were failing to notify the inpage provider of the user's currently selected account when the extension becomes unlocked.
This commit is contained in:
parent
859b80955b
commit
20b921f520
@ -380,7 +380,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
this.keyringController.memStore.subscribe((state) =>
|
this.keyringController.memStore.subscribe((state) =>
|
||||||
this._onKeyringControllerUpdate(state),
|
this._onKeyringControllerUpdate(state),
|
||||||
);
|
);
|
||||||
this.keyringController.on('unlock', () => this.emit('unlock'));
|
this.keyringController.on('unlock', () => this._onUnlock());
|
||||||
this.keyringController.on('lock', () => this._onLock());
|
this.keyringController.on('lock', () => this._onLock());
|
||||||
|
|
||||||
this.permissionsController = new PermissionsController(
|
this.permissionsController = new PermissionsController(
|
||||||
@ -2626,10 +2626,10 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
? (origin) => payload(origin)
|
? (origin) => payload(origin)
|
||||||
: () => payload;
|
: () => payload;
|
||||||
|
|
||||||
Object.values(this.connections).forEach((origin) => {
|
Object.keys(this.connections).forEach((origin) => {
|
||||||
Object.values(origin).forEach((conn) => {
|
Object.values(this.connections[origin]).forEach(async (conn) => {
|
||||||
if (conn.engine) {
|
if (conn.engine) {
|
||||||
conn.engine.emit('notification', getPayload(origin));
|
conn.engine.emit('notification', await getPayload(origin));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -2664,12 +2664,12 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
* Notifies all connections that the extension is unlocked.
|
* Notifies all connections that the extension is unlocked.
|
||||||
*/
|
*/
|
||||||
_onUnlock() {
|
_onUnlock() {
|
||||||
this.notifyAllConnections((origin) => {
|
this.notifyAllConnections(async (origin) => {
|
||||||
return {
|
return {
|
||||||
method: NOTIFICATION_NAMES.unlockStateChanged,
|
method: NOTIFICATION_NAMES.unlockStateChanged,
|
||||||
params: {
|
params: {
|
||||||
isUnlocked: true,
|
isUnlocked: true,
|
||||||
accounts: this.permissionsController.getAccounts(origin),
|
accounts: await this.permissionsController.getAccounts(origin),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user