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

Opening .eth creates 2 tabs #873

Closed
abueide opened this issue May 3, 2020 · 3 comments · Fixed by #876
Closed

Opening .eth creates 2 tabs #873

abueide opened this issue May 3, 2020 · 3 comments · Fixed by #876
Labels
area/eth.link Issues related to ENS over eth.link DNS service effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up status/ready Ready to be worked

Comments

@abueide
Copy link
Contributor

abueide commented May 3, 2020

Describe the bug
A clear and concise description of what the bug is.

when I click on this link: http://ipfs.eth I end up with two tabs: www.ipfs.eth (doesn't load, says it could not connect), and another new tab gets opened to ipfs.eth.link which loads properly. Why is it loading in a new tab instead of redirecting in the old tab? I don't want two tabs every time I click/type in a .eth link. It happens on http://almonit.eth too. Happens in firefox/chrome.

To Reproduce
Steps to reproduce the behavior:
Click on this link with ipfs companion installed in firefox: http://ipfs.eth

Expected behavior
A single tab redirecting to ipfs.eth.link, or at least an option to disable ens name resolution.

Screenshots
If applicable, add screenshots to help explain your problem.
image

@abueide abueide added the need/triage Needs initial labeling and prioritization label May 3, 2020
@lidel lidel added area/eth.link Issues related to ENS over eth.link DNS service exp/novice Someone with a little familiarity can pick up effort/hours Estimated to take one or several hours kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up status/ready Ready to be worked labels May 4, 2020
@lidel
Copy link
Member

lidel commented May 4, 2020

Original tab fails because browser is unable to connect to the server (.eth is not a real TLD).

By default IPFS Companion tries to recover from various HTTP failures by checking for DNSLink record and recovering in a new tab, and that is what you observe here.

That being said, I agree .eth is a special case and instead of opening a new tab, we could improve UX by updating URL of original one.

I suspect the fix is to change this line:

      // Check if error can be recovered via EthDNS
      if (isRecoverableViaEthDNS(request, state)) {
        const url = new URL(request.url)
        url.hostname = `${url.hostname}.link`
        const redirectUrl = url.toString()
        log(`onErrorOccurred: attempting to recover from DNS error (${request.error}) using EthDNS for ${request.url} → ${redirectUrl}`, request)
-        // TODO: update existing tab
-        return createTabWithURL(request, redirectUrl, browser, recoveredTabs)
+        browser.tabs.update({ url: fixedUrl })
+        return
      }

@abueide is this something you would be interested in submitting PR for?

@lidel lidel added exp/beginner Can be confidently tackled by newcomers and removed need/triage Needs initial labeling and prioritization exp/novice Someone with a little familiarity can pick up labels May 4, 2020
@abueide
Copy link
Contributor Author

abueide commented May 4, 2020

@lidel sure, I tested it and its working now. Should I replace the ones in the isRecoverable and isRecoverableViaDNSLink functions for the PR as well?

@lidel
Copy link
Member

lidel commented May 5, 2020

@abueide yes, I believe it will be less confusing than having two tabs for now.

Instead of changing this everywhere please:

  1. rename createTabWithURL to updateTabWithURL and switch its internals to browser.tabs.update
  2. recoveredTabs cache can be removed - afaik no longer needed (we used it to fix some Chromium quirks)

Thanks!

abueide pushed a commit to abueide/ipfs-companion that referenced this issue May 6, 2020
abueide pushed a commit to abueide/ipfs-companion that referenced this issue May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/eth.link Issues related to ENS over eth.link DNS service effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up status/ready Ready to be worked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants