From 62f2a3e68d9b6e53563518403ad1571afcbd88f4 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 14 Aug 2023 13:09:19 -0400 Subject: [PATCH] Fix broken mapping between scriptlet aliases and canonical name Related commit: https://github.com/gorhill/uBlock/commit/bf591d93fbc692b7ccd0dfe630ed1cb0e5a33cfd --- assets/resources/scriptlets.js | 12 ++++++------ src/js/redirect-engine.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index 48c4b9a8f..307e71244 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -1954,13 +1954,13 @@ function noXhrIf( } if ( directive.startsWith('war:') ) { if ( warOrigin === undefined ) { return ''; } - const warName = directive.slice(4); - const fullpath = [ warOrigin, '/', warName ]; - const warSecret = scriptletGlobals.get('warSecret') || ''; - if ( warSecret !== '' ) { - fullpath.push('?secret=', warSecret); - } return new Promise(resolve => { + const warName = directive.slice(4); + const fullpath = [ warOrigin, '/', warName ]; + const warSecret = scriptletGlobals.get('warSecret'); + if ( warSecret !== undefined ) { + fullpath.push('?secret=', warSecret); + } const warXHR = new XMLHttpRequest(); warXHR.responseType = 'text'; warXHR.onloadend = ev => { diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index 5a6e480a2..ef4e77541 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -334,7 +334,7 @@ class RedirectEngine { this.resources.set(details.name, entry); if ( Array.isArray(details.aliases) === false ) { continue; } for ( const alias of details.aliases ) { - this.aliases.set(alias, name); + this.aliases.set(alias, details.name); } } this.modifyTime = Date.now();