-
-
Notifications
You must be signed in to change notification settings - Fork 368
IGNORE: cursed iframe test #416
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
Conversation
There was a problem hiding this 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
Lines 1 to 29 in 752eaec
| 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', | |
| }); |
| }); | ||
|
|
||
| window.dispatchEvent(new Event('eip6963:requestProvider')); | ||
| window.parent.dispatchEvent(new Event('eip6963:requestProvider')); |
There was a problem hiding this comment.
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)
| } catch (error) { | ||
| currentNetworkName.textContent = error.message; | ||
| } | ||
| }, 5000); |
There was a problem hiding this comment.
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.
No description provided.