1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

fix regression reported in dec0b80a72 (commitcomment-26435928) by partially reverting changes from 4a09c9f866

This commit is contained in:
Raymond Hill 2017-12-22 11:45:07 -05:00
parent dfcfa5ab9e
commit b446f9f8bd
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 9 additions and 21 deletions

View File

@ -120,7 +120,7 @@ var µBlock = (function() { // jshint ignore:line
// read-only // read-only
systemSettings: { systemSettings: {
compiledMagic: 'pxpclstriajk', compiledMagic: 'vrgorlgelgws',
selfieMagic: 'pxpclstriajk' selfieMagic: 'pxpclstriajk'
}, },

View File

@ -1266,13 +1266,7 @@ FilterContainer.prototype.compileGenericUnhideSelector = function(parsed, writer
// script:contains(...) // script:contains(...)
// script:inject(...) // script:inject(...)
if ( this.reScriptSelector.test(selector) ) { if ( this.reScriptSelector.test(selector) ) {
compiled = [ 6 /* js */, 0, '!', '', '' ]; compiled = [ 6 /* js */, '!', '', selector ];
if ( selector.startsWith('script:inject') ) {
compiled[4] = selector.slice(14, -1).trim();
} else {
compiled[1] = 1;
compiled[4] = selector.slice(16, -1).trim();
}
writer.push(compiled); writer.push(compiled);
return; return;
} }
@ -1314,13 +1308,7 @@ FilterContainer.prototype.compileHostnameSelector = function(hostname, parsed, w
if ( unhide ) { if ( unhide ) {
hash = '!' + hash; hash = '!' + hash;
} }
compiled = [ 6 /* js */, 0, hash, hostname, '' ]; compiled = [ 6 /* js */, hash, hostname, selector ];
if ( selector.startsWith('script:inject') ) {
compiled[4] = selector.slice(14, -1).trim();
} else {
compiled[1] = 1;
compiled[4] = selector.slice(16, -1).trim();
}
writer.push(compiled); writer.push(compiled);
return; return;
} }
@ -1545,10 +1533,10 @@ FilterContainer.prototype.skipCompiledContent = function(reader) {
/******************************************************************************/ /******************************************************************************/
FilterContainer.prototype.createScriptFilter = function(args) { FilterContainer.prototype.createScriptFilter = function(args) {
if ( args[1] === 0 ) { if ( args[3].startsWith('script:inject') ) {
return this.createUserScriptRule(args); return this.createUserScriptRule(args);
} }
if ( args[1] === 1 ) { if ( args[3].startsWith('script:contains') ) {
return this.createScriptTagFilter(args); return this.createScriptTagFilter(args);
} }
}; };
@ -1561,8 +1549,8 @@ FilterContainer.prototype.createScriptFilter = function(args) {
// 16 -1 // 16 -1
FilterContainer.prototype.createScriptTagFilter = function(args) { FilterContainer.prototype.createScriptTagFilter = function(args) {
var hostname = args[3], var hostname = args[2],
token = args[4]; token = args[3].slice(16, -1);
token = token.startsWith('/') && token.endsWith('/') token = token.startsWith('/') && token.endsWith('/')
? token.slice(1, -1) ? token.slice(1, -1)
: token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); : token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
@ -1623,8 +1611,8 @@ FilterContainer.prototype.retrieveScriptTagRegex = function(domain, hostname) {
// userScripts{hash} => FilterHostname | FilterBucket // userScripts{hash} => FilterHostname | FilterBucket
FilterContainer.prototype.createUserScriptRule = function(args) { FilterContainer.prototype.createUserScriptRule = function(args) {
var hash = args[2], var hash = args[1],
filter = new FilterHostname(args[4], args[3]); filter = new FilterHostname(args[3].slice(14, -1), args[2]);
var bucket = this.userScripts.get(hash); var bucket = this.userScripts.get(hash);
if ( bucket === undefined ) { if ( bucket === undefined ) {
this.userScripts.set(hash, filter); this.userScripts.set(hash, filter);