From 3463a60e6bed747ccac10b9220e3d08c07536732 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 21 Nov 2019 12:04:19 -0500 Subject: [PATCH] Fix incorrect resolved value in promise This fixes the ability to block when a hostname had to be cname-resolved the first time it was encountered. The result being cached allowed the subsequent requests to be correctly blockable. --- platform/firefox/vapi-webrequest.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/platform/firefox/vapi-webrequest.js b/platform/firefox/vapi-webrequest.js index d0c95b9ec..6c82c3fa0 100644 --- a/platform/firefox/vapi-webrequest.js +++ b/platform/firefox/vapi-webrequest.js @@ -197,14 +197,16 @@ this.cnames.set(hn, ''); return; } - return browser.dns.resolve(hn, [ 'canonical_name' ]).then(rec => { - const cname = this.recordCanonicalName(hn, rec); - if ( cname === '' ) { return; } - return this.processCanonicalName(cname, details); - }).catch(( ) => { - this.cnames.set(hn, ''); - }).then(( ) => { - }); + return browser.dns.resolve(hn, [ 'canonical_name' ]).then( + rec => { + const cname = this.recordCanonicalName(hn, rec); + if ( cname === '' ) { return; } + return this.processCanonicalName(cname, details); + }, + ( ) => { + this.cnames.set(hn, ''); + } + ); } suspendOneRequest(details) { const pending = {