From 543207b5af63424c1510438af356906696f5eb66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Antu=C3=B1a=20D=C3=ADez?= Date: Thu, 9 Aug 2018 12:14:09 +0200 Subject: [PATCH 1/2] Fixed ENS to IPFS functionality in Firefox `tabs.getSelected` is deprecated and it doesn't work in firefox replaced by `tabs.query({active: true}` --- app/scripts/lib/ipfsContent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js index 5222151ea..9e401ebcd 100644 --- a/app/scripts/lib/ipfsContent.js +++ b/app/scripts/lib/ipfsContent.js @@ -5,7 +5,7 @@ module.exports = function (provider) { function ipfsContent (details) { const name = details.url.substring(7, details.url.length - 1) let clearTime = null - extension.tabs.getSelected(null, tab => { + extension.tabs.query({active: true}, tab => { extension.tabs.update(tab.id, { url: 'loading.html' }) clearTime = setTimeout(() => { From a2082bae5c535f6f92d7b4124785e562815d840f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Antu=C3=B1a=20D=C3=ADez?= Date: Thu, 9 Aug 2018 12:20:51 +0200 Subject: [PATCH 2/2] Avoid overwriting a domain that can be resolved by DNS According to the current implementation any domain ending in .eth or .test will try to resolve through ENS even if the DNS is able to resolve it. changing `onBeforeRequest` to `onErrorOccurred` will only resolve those .eth or .test domains that the DNS is not able to resolve. --- app/scripts/lib/ipfsContent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js index 9e401ebcd..5db63f47d 100644 --- a/app/scripts/lib/ipfsContent.js +++ b/app/scripts/lib/ipfsContent.js @@ -34,11 +34,11 @@ module.exports = function (provider) { return { cancel: true } } - extension.webRequest.onBeforeRequest.addListener(ipfsContent, {urls: ['*://*.eth/', '*://*.test/']}) + extension.webRequest.onErrorOccurred.addListener(ipfsContent, {urls: ['*://*.eth/', '*://*.test/']}) return { remove () { - extension.webRequest.onBeforeRequest.removeListener(ipfsContent) + extension.webRequest.onErrorOccurred.removeListener(ipfsContent) }, } }