mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
bidiTrie is hardcoded
Thus no need to threat it as if it was a changing parameter.
This commit is contained in:
parent
7dba69dc48
commit
5b81369fc2
1 changed files with 7 additions and 7 deletions
|
|
@ -3130,9 +3130,9 @@ const urlTokenizer = new (class {
|
|||
}
|
||||
|
||||
// Tokenize on demand.
|
||||
getTokens(encodeInto) {
|
||||
getTokens() {
|
||||
if ( this._tokenized ) { return this._tokens; }
|
||||
let i = this._tokenize(encodeInto);
|
||||
let i = this._tokenize();
|
||||
this._tokens[i+0] = ANY_TOKEN_HASH;
|
||||
this._tokens[i+1] = 0;
|
||||
i += 2;
|
||||
|
|
@ -3189,17 +3189,17 @@ const urlTokenizer = new (class {
|
|||
// https://github.com/chrisaljoudi/uBlock/issues/1118
|
||||
// We limit to a maximum number of tokens.
|
||||
|
||||
_tokenize(encodeInto) {
|
||||
_tokenize() {
|
||||
const tokens = this._tokens;
|
||||
const url = this._urlOut;
|
||||
const l = encodeInto.setHaystackLen(url.length);
|
||||
const l = bidiTrie.setHaystackLen(url.length);
|
||||
if ( l === 0 ) { return 0; }
|
||||
let j = 0;
|
||||
let hasq = -1;
|
||||
mainLoop: {
|
||||
const knownTokens = this.knownTokens;
|
||||
const vtc = this._validTokenChars;
|
||||
const charCodes = encodeInto.haystack;
|
||||
const charCodes = bidiTrie.haystack;
|
||||
let i = 0, n = 0, ti = 0, th = 0;
|
||||
for (;;) {
|
||||
for (;;) {
|
||||
|
|
@ -4968,7 +4968,7 @@ StaticNetFilteringEngine.prototype.matchAndFetchModifiers = function(
|
|||
results,
|
||||
};
|
||||
|
||||
const tokenHashes = urlTokenizer.getTokens(bidiTrie);
|
||||
const tokenHashes = urlTokenizer.getTokens();
|
||||
let i = 0;
|
||||
let th = 0, iunit = 0;
|
||||
for (;;) {
|
||||
|
|
@ -5158,7 +5158,7 @@ StaticNetFilteringEngine.prototype.realmMatchString = function(
|
|||
}
|
||||
// Pattern-based filters
|
||||
else {
|
||||
const tokenHashes = urlTokenizer.getTokens(bidiTrie);
|
||||
const tokenHashes = urlTokenizer.getTokens();
|
||||
let i = 0;
|
||||
for (;;) {
|
||||
tokenHash = tokenHashes[i];
|
||||
|
|
|
|||
Loading…
Reference in a new issue