Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-pick: remove methods from array used to determine which requests should be enqueued because they can be safely passed through (#27315) #27373

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ import {
AuthenticationController,
UserStorageController,
} from '@metamask/profile-sync-controller';
import {
methodsRequiringNetworkSwitch,
methodsWithConfirmation,
} from '../../shared/constants/methods-tags';
import { methodsRequiringNetworkSwitch } from '../../shared/constants/methods-tags';

///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
Expand Down Expand Up @@ -5369,16 +5366,7 @@ export default class MetamaskController extends EventEmitter {
this.preferencesController,
),
shouldEnqueueRequest: (request) => {
if (
request.method === 'eth_requestAccounts' &&
this.permissionController.hasPermission(
request.origin,
PermissionNames.eth_accounts,
)
) {
return false;
}
return methodsWithConfirmation.includes(request.method);
return methodsRequiringNetworkSwitch.includes(request.method);
},
});
engine.push(requestQueueMiddleware);
Expand Down
15 changes: 0 additions & 15 deletions shared/constants/methods-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,9 @@ export const methodsRequiringNetworkSwitch = [
'eth_sendTransaction',
'eth_sendRawTransaction',
'wallet_switchEthereumChain',
'wallet_addEthereumChain',
'wallet_watchAsset',
'eth_signTypedData',
'eth_signTypedData_v3',
'eth_signTypedData_v4',
'personal_sign',
] as const;

/**
* This is a list of methods that can cause a confirmation to be
* presented to the user. Note that some of these methods may
* only sometimes cause a confirmation to appear.
*/
export const methodsWithConfirmation = [
...methodsRequiringNetworkSwitch,
'wallet_requestPermissions',
'wallet_requestSnaps',
'eth_decrypt',
'eth_requestAccounts',
'eth_getEncryptionPublicKey',
];
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,21 @@ describe('Request Queuing Dapp 1 Send Tx -> Dapp 2 Request Accounts Tx', functio

// Dapp Send Button
await driver.clickElement('#sendButton');
await driver.delay(regularDelayMs);
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);

// Leave the confirmation pending
await driver.waitForSelector({
text: 'Reject',
tag: 'button',
});

await driver.delay(regularDelayMs);

await driver.switchToWindowWithTitle(
WINDOW_TITLES.ExtensionInFullScreenView,
);

// Leave the confirmation pending
await openDapp(driver, undefined, DAPP_ONE_URL);

const accountsOnload = await (
Expand Down
Loading