diff --git a/app/scripts/lib/ens-ipfs/setup.js b/app/scripts/lib/ens-ipfs/setup.js index 2ff08ef80d66..be997cdf1e98 100644 --- a/app/scripts/lib/ens-ipfs/setup.js +++ b/app/scripts/lib/ens-ipfs/setup.js @@ -60,8 +60,7 @@ export default function setupEnsIpfsResolver({ const ensSiteUrl = `https://app.ens.domains/name/${name}`; - // This is the only case where we can show the loading indicator - // https://github.com/MetaMask/metamask-extension/issues/20910#issuecomment-1723962822 + // We cannot show this if useAddressBarEnsResolution is off... if (useAddressBarEnsResolution && ipfsGateway) { browser.tabs.update(tabId, { url: 'loading.html' }); } @@ -71,7 +70,9 @@ export default function setupEnsIpfsResolver({ // If we're testing ENS domain resolution support, // we assume the ENS domains URL if (process.env.IN_TEST) { - browser.tabs.update(tabId, { url }); + if (useAddressBarEnsResolution || ipfsGateway) { + browser.tabs.update(tabId, { url }); + } return; } @@ -129,6 +130,8 @@ export default function setupEnsIpfsResolver({ } catch (err) { console.warn(err); } finally { + // Only forward to destination URL if a URL exists and + // useAddressBarEnsResolution is properly if ( url && (useAddressBarEnsResolution || diff --git a/test/e2e/tests/ipfs-ens-resolution.spec.js b/test/e2e/tests/ipfs-ens-resolution.spec.js index 73b2f70d66b8..ba7a1357d283 100644 --- a/test/e2e/tests/ipfs-ens-resolution.spec.js +++ b/test/e2e/tests/ipfs-ens-resolution.spec.js @@ -31,7 +31,7 @@ describe('Settings', function () { await driver.quit(); }); - it('Does not lookup IPFS data for ENS Domain when switched off', async function () { + it('Does not fetch ENS data for ENS Domain when ENS and IPFS switched off', async function () { let server; await withFixtures( @@ -54,7 +54,10 @@ describe('Settings', function () { await driver.clickElement({ text: 'Settings', tag: 'div' }); await driver.clickElement({ text: 'Security & privacy', tag: 'div' }); - // turns off IPFS domain resolution + // turns off IPFS setting + await driver.clickElement('[data-testid="ipfsToggle"] .toggle-button'); + + // turns off ENS domain resolution await driver.clickElement( '[data-testid="ipfs-gateway-resolution-container"] .toggle-button', );