Skip to content

Conversation

@jiexi
Copy link
Contributor

@jiexi jiexi commented Sep 16, 2025

No description provided.

@jiexi jiexi changed the title idk IGNORE: cursed iframe test Sep 16, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Removed SDK Import Causes Function Errors

The MetaMaskSDK import and sdk variable initialization were removed, but the handleSdkConnect function still attempts to use the sdk variable (e.g., sdk.connect(), sdk.terminate()). This causes a ReferenceError when handleSdkConnect is called.

src/connections.js#L1-L29

import globalContext, {
handleNewAccounts,
handleNewProviderDetail,
removeProviderDetail,
setActiveProviderDetail,
updateFormElements,
updateSdkConnectionState,
updateWalletConnectState,
} from '.';
const dappMetadata = {
name: 'E2e Test Dapp',
description: 'This is the E2e Test Dapp',
url: 'https://metamask.github.io/test-dapp/',
};
// eslint-disable-next-line require-unicode-regexp
const isAndroid = /Android/i.test(navigator.userAgent);
export const initializeWeb3Modal = () => {
if (!isAndroid) {
try {
// eslint-disable-next-line node/global-require
const { createWeb3Modal, defaultConfig } = require('@web3modal/ethers5');
const web3Modal = createWeb3Modal({
ethersConfig: defaultConfig({ metadata: dappMetadata }),
projectId: 'e6360eaee594162688065f1c70c863b7',
});

Fix in Cursor Fix in Web


});

window.dispatchEvent(new Event('eip6963:requestProvider'));
window.parent.dispatchEvent(new Event('eip6963:requestProvider'));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Iframe Detection Alters UI and EIP-6963 Behavior

Debugging code was accidentally committed, adding "IsIabIframe:" text and dynamic iframe detection results to the UI's accounts section. This also modifies the detectEip6963 function to perform iframe testing and eth_requestAccounts calls on window.parent.ethereum, changing its intended EIP-6963 detection behavior.

Additional Locations (1)

Fix in Cursor Fix in Web

} catch (error) {
currentNetworkName.textContent = error.message;
}
}, 5000);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Inconsistent Error Handling in Ethereum Access

Directly accessing window.parent.ethereum lacks error handling, which can lead to issues like cross-origin errors in iframes or if window.parent.ethereum is undefined. This is inconsistent with the try-catch block used in the subsequent setTimeout call.

Fix in Cursor Fix in Web

@jiexi jiexi closed this Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants