From b54522caa1dccc130931d728260841ab4c1ad97f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 9 Jul 2019 11:36:42 -0400 Subject: [PATCH] [scriptlet engine] Mind old scriptlet names not using `.js` Related commit: - https://github.com/gorhill/uBlock/commit/5552d6717dbe8d617523fff9037004be9cb7c581 --- src/js/scriptlet-filtering.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/js/scriptlet-filtering.js b/src/js/scriptlet-filtering.js index efbdf0913..cde4b93a6 100644 --- a/src/js/scriptlet-filtering.js +++ b/src/js/scriptlet-filtering.js @@ -205,8 +205,15 @@ token = rawToken.slice(0, pos).trim(); args = rawToken.slice(pos + 1).trim(); } + // TODO: The alias lookup can be removed once scriptlet resources + // with obsolete name are converted to their new name. + if ( reng.aliases.has(token) ) { + token = reng.aliases.get(token); + } else { + token = `${token}.js`; + } content = reng.resourceContentFromName( - `${token}.js`, + token, 'application/javascript' ); if ( !content ) { return; }