From c23a9ada334f411cf2f515e33a082112f46f0595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Fri, 14 Jul 2023 18:19:30 +0000 Subject: [PATCH] Fix typos --- assets/resources/scriptlets.js | 2 +- platform/chromium/is-webrtc-supported.js | 2 +- src/js/contentscript.js | 8 +-- src/js/filtering-context.js | 4 +- src/js/messaging.js | 6 +-- src/js/popup-fenix.js | 2 +- src/js/scriptlets/epicker.js | 4 +- .../scriptlets/should-inject-contentscript.js | 2 +- src/js/static-net-filtering.js | 52 +++++++++---------- src/lib/lz4/README.md | 6 +-- src/lib/lz4/lz4-block-codec-any.js | 2 +- src/lib/lz4/lz4-block-codec.wat | 6 +-- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index a844fb2de..788ba24c4 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -2585,7 +2585,7 @@ function m3uPrune( * ``` * * - `selector`: required, CSS selector, specifies `a` elements for which the - * `href` attribute must be overriden. + * `href` attribute must be overridden. * - `source`: optional, default to `text`, specifies from where to get the * value which will override the `href` attribute. * - `text`: the value will be the first valid URL found in the text diff --git a/platform/chromium/is-webrtc-supported.js b/platform/chromium/is-webrtc-supported.js index 5a3eea1e7..132228cfa 100644 --- a/platform/chromium/is-webrtc-supported.js +++ b/platform/chromium/is-webrtc-supported.js @@ -21,7 +21,7 @@ // https://github.com/gorhill/uBlock/issues/533#issuecomment-164292868 // If WebRTC is supported, there won't be an exception if we -// try to instanciate a peer connection object. +// try to instantiate a peer connection object. // https://github.com/gorhill/uBlock/issues/533#issuecomment-168097594 // Because Chromium leaks WebRTC connections after they have been closed diff --git a/src/js/contentscript.js b/src/js/contentscript.js index ffc6bedef..ff828f5d8 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -707,7 +707,7 @@ vAPI.DOMFilterer = class { object: 'object', video: 'media', }; - let resquestIdGenerator = 1, + let requestIdGenerator = 1, processTimer, cachedBlockedSet, cachedBlockedSetHash, @@ -801,10 +801,10 @@ vAPI.DOMFilterer = class { const send = function() { processTimer = undefined; - toCollapse.set(resquestIdGenerator, toProcess); + toCollapse.set(requestIdGenerator, toProcess); messaging.send('contentscript', { what: 'getCollapsibleBlockedRequests', - id: resquestIdGenerator, + id: requestIdGenerator, frameURL: window.location.href, resources: toFilter, hash: cachedBlockedSetHash, @@ -813,7 +813,7 @@ vAPI.DOMFilterer = class { }); toProcess = []; toFilter = []; - resquestIdGenerator += 1; + requestIdGenerator += 1; }; const process = function(delay) { diff --git a/src/js/filtering-context.js b/src/js/filtering-context.js index bb3b7215d..4169ffd23 100644 --- a/src/js/filtering-context.js +++ b/src/js/filtering-context.js @@ -296,7 +296,7 @@ const FilteringContext = class { return this; } - // The idea is to minimize the amout of work done to figure out whether + // The idea is to minimize the amount of work done to figure out whether // the resource is 3rd-party to the document. is3rdPartyToDoc() { let docDomain = this.getDocDomain(); @@ -359,7 +359,7 @@ const FilteringContext = class { return this; } - // The idea is to minimize the amout of work done to figure out whether + // The idea is to minimize the amount of work done to figure out whether // the resource is 3rd-party to the top document. is3rdPartyToTab() { let tabDomain = this.getTabDomain(); diff --git a/src/js/messaging.js b/src/js/messaging.js index 5df6cd95a..4ba80a24e 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -599,11 +599,11 @@ const launchReporter = async function(request) { const entries = await io.getUpdateAges({ filters: µb.selectedFilterLists.slice() }); - let shoudUpdateLists = false; + let shouldUpdateLists = false; for ( const entry of entries ) { if ( entry.age < (2 * 60 * 60 * 1000) ) { continue; } io.purge(entry.assetKey); - shoudUpdateLists = true; + shouldUpdateLists = true; } // https://github.com/gorhill/uBlock/commit/6efd8eb#commitcomment-107523558 @@ -631,7 +631,7 @@ const launchReporter = async function(request) { const supportURL = new URL(vAPI.getURL('support.html')); supportURL.searchParams.set('pageURL', request.pageURL); supportURL.searchParams.set('popupPanel', JSON.stringify(request.popupPanel)); - if ( shoudUpdateLists ) { + if ( shouldUpdateLists ) { supportURL.searchParams.set('shouldUpdate', 1); } return supportURL.href; diff --git a/src/js/popup-fenix.js b/src/js/popup-fenix.js index 019c49ddb..3342792e3 100644 --- a/src/js/popup-fenix.js +++ b/src/js/popup-fenix.js @@ -1152,7 +1152,7 @@ const setFirewallRuleHandler = function(ev) { /******************************************************************************/ const reloadTab = function(bypassCache = false) { - // Premptively clear the unprocessed-requests status since we know for sure + // Preemptively clear the unprocessed-requests status since we know for sure // the page is being reloaded in this code path. if ( popupData.hasUnprocessedRequest === true ) { messaging.send('popupPanel', { diff --git a/src/js/scriptlets/epicker.js b/src/js/scriptlets/epicker.js index e4588c9a5..a1db985f2 100644 --- a/src/js/scriptlets/epicker.js +++ b/src/js/scriptlets/epicker.js @@ -877,7 +877,7 @@ const filterToDOMInterface = (( ) => { /******************************************************************************/ -const onOptmizeCandidates = function(details) { +const onOptimizeCandidates = function(details) { const { candidates } = details; const results = []; for ( const paths of candidates ) { @@ -1165,7 +1165,7 @@ const onDialogMessage = function(msg) { } break; case 'optimizeCandidates': - onOptmizeCandidates(msg); + onOptimizeCandidates(msg); break; case 'dialogCreate': filterToDOMInterface.queryAll(msg); diff --git a/src/js/scriptlets/should-inject-contentscript.js b/src/js/scriptlets/should-inject-contentscript.js index b7458ad04..d721293fc 100644 --- a/src/js/scriptlets/should-inject-contentscript.js +++ b/src/js/scriptlets/should-inject-contentscript.js @@ -25,7 +25,7 @@ // to "should inject content scripts?" // // https://github.com/uBlockOrigin/uBlock-issues/issues/403 -// If the content script was not boostrapped, give it another try. +// If the content script was not bootstrapped, give it another try. (( ) => { try { diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 245c41e4e..ab14f3829 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -103,9 +103,9 @@ const typeNameToTypeValue = { 'beacon': 10 << TypeBitsOffset, 'ping': 10 << TypeBitsOffset, 'other': 11 << TypeBitsOffset, - 'popup': 12 << TypeBitsOffset, // start of behavorial filtering + 'popup': 12 << TypeBitsOffset, // start of behavioral filtering 'popunder': 13 << TypeBitsOffset, - 'main_frame': 14 << TypeBitsOffset, // start of 1p behavorial filtering + 'main_frame': 14 << TypeBitsOffset, // start of 1p behavioral filtering 'generichide': 15 << TypeBitsOffset, 'specifichide': 16 << TypeBitsOffset, 'inline-font': 17 << TypeBitsOffset, @@ -2715,20 +2715,20 @@ class FilterBucket extends FilterCollection { const isrccollection = filterData[idata+1]; const candidates = []; this.forEach(idata, iunit => { - if ( fc.canCoallesce(iunit) === false ) { return; } + if ( fc.canCoalesce(iunit) === false ) { return; } candidates.push(iunit); }); if ( candidates.length < min ) { return 0; } const idesbucket = FilterBucket.create(); const idescollection = filterData[idesbucket+1]; - let coallesced; + let coalesced; let isrcseq = filterData[isrccollection+1]; let iprev = 0; for (;;) { const iunit = filterData[isrcseq+0]; const inext = filterData[isrcseq+1]; if ( candidates.includes(iunit) ) { - coallesced = fc.coallesce(iunit, coallesced); + coalesced = fc.coalesce(iunit, coalesced); // move the sequence slot to new bucket filterData[isrcseq+1] = filterData[idescollection+1]; filterData[idescollection+1] = isrcseq; @@ -2745,7 +2745,7 @@ class FilterBucket extends FilterCollection { if ( inext === 0 ) { break; } isrcseq = inext; } - return fc.create(coallesced, idesbucket); + return fc.create(coalesced, idesbucket); } static dumpInfo(idata) { @@ -2802,28 +2802,28 @@ class FilterBucketIfOriginHits extends FilterBucketIf { return filterMatch(filterData[idata+2]); } - static canCoallesce(iunit) { + static canCoalesce(iunit) { return filterHasOriginHit(iunit); } - static coallesce(iunit, coallesced) { - if ( coallesced === undefined ) { - coallesced = new Set(); + static coalesce(iunit, coalesced) { + if ( coalesced === undefined ) { + coalesced = new Set(); } const domainOpt = filterGetDomainOpt(iunit); if ( domainOpt.includes('|') ) { for ( const hn of domainOptIterator.reset(domainOpt) ) { - coallesced.add(hn); + coalesced.add(hn); } } else { - coallesced.add(domainOpt); + coalesced.add(domainOpt); } - return coallesced; + return coalesced; } - static create(coallesced, ibucket) { + static create(coalesced, ibucket) { const units = []; - compileFromDomainOpt(coallesced, false, units); + compileFromDomainOpt(coalesced, false, units); const ihittest = filterFromCompiled(units[0]); const ipretest = super.create( FilterBucketIfOriginHits.fid, @@ -2843,23 +2843,23 @@ class FilterBucketIfRegexHits extends FilterBucketIf { return filterRefs[filterData[idata+2]].test($requestURLRaw); } - static canCoallesce(iunit) { + static canCoalesce(iunit) { const fc = filterGetClass(iunit); if ( fc.hasRegexPattern === undefined ) { return false; } if ( fc.hasRegexPattern(iunit) !== true ) { return false; } return true; } - static coallesce(iunit, coallesced) { - if ( coallesced === undefined ) { - coallesced = new Set(); + static coalesce(iunit, coalesced) { + if ( coalesced === undefined ) { + coalesced = new Set(); } - coallesced.add(filterGetRegexPattern(iunit)); - return coallesced; + coalesced.add(filterGetRegexPattern(iunit)); + return coalesced; } - static create(coallesced, ibucket) { - const reString = Array.from(coallesced).join('|'); + static create(coalesced, ibucket) { + const reString = Array.from(coalesced).join('|'); return super.create( FilterBucketIfRegexHits.fid, ibucket, @@ -2877,7 +2877,7 @@ registerFilterClass(FilterBucketIfRegexHits); /******************************************************************************/ class FilterStrictParty { - // TODO: diregard `www.`? + // TODO: disregard `www.`? static match(idata) { return ($requestHostname === $docHostname) === (filterData[idata+1] === 0); } @@ -5026,7 +5026,7 @@ FilterContainer.prototype.matchAndFetchModifiers = function( } if ( toAddImportant.size === 0 && toAdd.size === 0 ) { return; } - // Remove entries overriden by important block filters. + // Remove entries overridden by important block filters. if ( toAddImportant.size !== 0 ) { for ( const key of toAddImportant.keys() ) { toAdd.delete(key); @@ -5260,7 +5260,7 @@ FilterContainer.prototype.matchRequestReverse = function(type, url) { * Bit 1: lookup allow realm regardless of whether there was a match in * block realm. * - * @returns {integer} 0=no match, 1=block, 2=allow (exeption) + * @returns {integer} 0=no match, 1=block, 2=allow (exception) */ FilterContainer.prototype.matchRequest = function(fctxt, modifiers = 0) { let typeBits = typeNameToTypeValue[fctxt.type]; diff --git a/src/lib/lz4/README.md b/src/lib/lz4/README.md index 8061e80e4..6fcf4f82b 100644 --- a/src/lib/lz4/README.md +++ b/src/lib/lz4/README.md @@ -13,7 +13,7 @@ https://github.com/gorhill/lz4-wasm ### `lz4-block-codec-any.js` -The purpose is to instanciate a WebAssembly- or pure javascript-based +The purpose is to instantiate a WebAssembly- or pure javascript-based LZ4 block codec. If the chosen implementation is not specified, there will be an attempt to @@ -26,13 +26,13 @@ used. ### `lz4-block-codec-wasm.js` -This contains the code to instanciate WebAssembly-based LZ4 block codec. Note +This contains the code to instantiate WebAssembly-based LZ4 block codec. Note that the WebAssembly module is loaded using a `same-origin` fetch, hence ensuring that no code outside the package is loaded. ### `lz4-block-codec-js.js` -This contains the code to instanciate pure javascript-based LZ4 block codec. +This contains the code to instantiate pure javascript-based LZ4 block codec. This is used as a fallback implementation should WebAssembly not be available for whatever reason. diff --git a/src/lib/lz4/lz4-block-codec-any.js b/src/lib/lz4/lz4-block-codec-any.js index f76e5b0d3..daf141b1b 100644 --- a/src/lib/lz4/lz4-block-codec-any.js +++ b/src/lib/lz4/lz4-block-codec-any.js @@ -1,7 +1,7 @@ /******************************************************************************* lz4-block-codec-any.js - A wrapper to instanciate a wasm- and/or js-based LZ4 block + A wrapper to instantiate a wasm- and/or js-based LZ4 block encoder/decoder. Copyright (C) 2018 Raymond Hill diff --git a/src/lib/lz4/lz4-block-codec.wat b/src/lib/lz4/lz4-block-codec.wat index 1181379ad..4d9cf4226 100644 --- a/src/lib/lz4/lz4-block-codec.wat +++ b/src/lib/lz4/lz4-block-codec.wat @@ -95,7 +95,7 @@ ;; ;; The implementation below is modified from the reference one. ;; -;; - There is no skip adjustement for repeated failure to find a match. +;; - There is no skip adjustment for repeated failure to find a match. ;; ;; - All configurable values are hard-coded to match the generic version ;; of the compressor. @@ -462,7 +462,7 @@ i32.eq br_if 0 end end - local.get $outPtr ;; copy literals to ouput buffer + local.get $outPtr ;; copy literals to output buffer local.get $inPtr local.get $clen call $copy @@ -523,7 +523,7 @@ i32.eq br_if 0 end end - local.get $outPtr ;; copy match to ouput buffer + local.get $outPtr ;; copy match to output buffer local.get $matchPtr local.get $clen call $copy