From 02cba63331b4ba8f62d72ef7222584d003367e94 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 5 Oct 2024 14:51:38 -0400 Subject: [PATCH] Partially revert 4169340 --- src/js/biditrie.js | 2 +- src/js/hntrie.js | 2 +- src/js/static-net-filtering.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/js/biditrie.js b/src/js/biditrie.js index 2fa0495062fc6..560d5918a2276 100644 --- a/src/js/biditrie.js +++ b/src/js/biditrie.js @@ -582,7 +582,7 @@ class BidiTrieContainer { } toSelfie() { - const buf32 = this.buf32.slice(0, this.buf32[CHAR1_SLOT] + 3 >>> 2); + const buf32 = this.buf32.subarray(0, this.buf32[CHAR1_SLOT] + 3 >>> 2); return { buf32, checksum: i32Checksum(buf32) }; } diff --git a/src/js/hntrie.js b/src/js/hntrie.js index 5885e6e21175d..518d0b8ddb19c 100644 --- a/src/js/hntrie.js +++ b/src/js/hntrie.js @@ -452,7 +452,7 @@ class HNTrieContainer { } toSelfie() { - const buf32 = this.buf32.slice(0, this.buf32[CHAR1_SLOT] + 3 >>> 2); + const buf32 = this.buf32.subarray(0, this.buf32[CHAR1_SLOT] + 3 >>> 2); return { buf32, checksum: i32Checksum(buf32) }; } diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index ac4b373df616d..ec62bb945aea7 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -495,7 +495,7 @@ const filterDataReset = ( ) => { filterDataWritePtr = 2; }; const filterDataToSelfie = ( ) => - filterData.slice(0, filterDataWritePtr); + filterData.subarray(0, filterDataWritePtr); const filterDataFromSelfie = selfie => { if ( selfie instanceof Int32Array === false ) { return false; } @@ -3193,7 +3193,7 @@ const urlTokenizer = new (class { } toSelfie() { - return this.knownTokens.slice(); + return this.knownTokens; } fromSelfie(selfie) { @@ -4779,7 +4779,7 @@ StaticNetFilteringEngine.prototype.toSelfie = function() { processedFilterCount: this.processedFilterCount, acceptedCount: this.acceptedCount, discardedCount: this.discardedCount, - bitsToBucket: new Map(this.bitsToBucket), + bitsToBucket: this.bitsToBucket, urlTokenizer: urlTokenizer.toSelfie(), destHNTrieContainer: destHNTrieContainer.toSelfie(), origHNTrieContainer: origHNTrieContainer.toSelfie(),