From 24755d4300f9e8f5c32a3c965c98de13ab26a6f4 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Dec 2020 10:34:33 -0500 Subject: [PATCH] Fix broken alias `nostif` Related feedback: - https://github.com/gorhill/uBlock/commit/ba11a700139bbc648e4ae5b2bc7af90ef03db5df#r45030152 Regression from: - https://github.com/gorhill/uBlock/commit/ba11a700139bbc648e4ae5b2bc7af90ef03db5df --- src/js/redirect-engine.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index bd1147fd3..20c59cb57 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -375,11 +375,11 @@ RedirectEngine.prototype.resourcesFromString = function(text) { if ( line.startsWith('/// ') ) { if ( details === undefined ) { - details = {}; + details = []; } const [ prop, value ] = line.slice(4).trim().split(/\s+/); if ( value !== undefined ) { - details[prop] = value; + details.push({ prop, value }); } continue; } @@ -401,8 +401,11 @@ RedirectEngine.prototype.resourcesFromString = function(text) { RedirectEntry.fromContent(mime, content) ); - if ( details instanceof Object && details.alias ) { - this.aliases.set(details.alias, name); + if ( Array.isArray(details) ) { + for ( const { prop, value } of details ) { + if ( prop !== 'alias' ) { continue; } + this.aliases.set(value, name); + } } fields = undefined;