This commit is contained in:
Raymond Hill 2019-07-05 12:33:14 -04:00
parent f930da7ad6
commit 9693d07a6d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 9 additions and 8 deletions

View File

@ -171,22 +171,23 @@
}; };
})(); })();
const normalizeRawToken = function(raw) { const normalizeRawFilter = function(rawFilter) {
let rawEnd = raw.length; let rawToken = rawFilter.slice(4, -1);
let end = raw.indexOf(','); let rawEnd = rawToken.length;
let end = rawToken.indexOf(',');
if ( end === -1 ) { if ( end === -1 ) {
end = rawEnd; end = rawEnd;
} }
let token = raw.slice(0, end).trim(); let token = rawToken.slice(0, end).trim();
let normalized = token.endsWith('.js') ? token.slice(0, -3) : token; let normalized = token.endsWith('.js') ? token.slice(0, -3) : token;
let beg = end + 1; let beg = end + 1;
while ( beg < rawEnd ) { while ( beg < rawEnd ) {
end = raw.indexOf(',', beg); end = rawToken.indexOf(',', beg);
if ( end === -1 ) { end = rawEnd; } if ( end === -1 ) { end = rawEnd; }
normalized += ', ' + raw.slice(beg, end).trim(); normalized += ', ' + rawToken.slice(beg, end).trim();
beg = end + 1; beg = end + 1;
} }
return normalized; return `+js(${normalized})`;
}; };
const lookupScriptlet = function(rawToken, reng, toInject) { const lookupScriptlet = function(rawToken, reng, toInject) {
@ -270,7 +271,7 @@
writer.select(1001); writer.select(1001);
// Only exception filters are allowed to be global. // Only exception filters are allowed to be global.
const normalized = normalizeRawToken(parsed.suffix); const normalized = normalizeRawFilter(parsed.suffix);
if ( parsed.hostnames.length === 0 ) { if ( parsed.hostnames.length === 0 ) {
if ( parsed.exception ) { if ( parsed.exception ) {