1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-02 00:42:45 +01:00

Remove unused interestCohort-related code paths

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1553
This commit is contained in:
Raymond Hill 2023-01-31 09:51:43 -05:00
parent 2f1d8bb733
commit d2487b6a6d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 0 additions and 55 deletions

View File

@ -369,10 +369,6 @@ scriptletFilteringEngine.retrieve = function(request, options = {}) {
return out.join('\n');
};
scriptletFilteringEngine.hasScriptlet = function(hostname, exceptionBit, scriptlet) {
return scriptletDB.hasStr(hostname, exceptionBit, scriptlet);
};
scriptletFilteringEngine.injectNow = function(details) {
if ( typeof details.frameId !== 'number' ) { return; }
const request = {

View File

@ -122,34 +122,6 @@ const StaticExtFilteringHostnameDB = class {
}
}
hasStr(hostname, exceptionBit, value) {
let found = false;
for (;;) {
let iHn = this.hostnameToSlotIdMap.get(hostname);
if ( iHn !== undefined ) {
do {
const strId = this.hostnameSlots[iHn+0];
const str = this.strSlots[strId >>> this.nBits];
if ( (strId & exceptionBit) !== 0 ) {
if ( str === value || str === '' ) { return false; }
}
if ( str === value ) { found = true; }
iHn = this.hostnameSlots[iHn+1];
} while ( iHn !== 0 );
}
if ( hostname === '' ) { break; }
const pos = hostname.indexOf('.');
if ( pos !== -1 ) {
hostname = hostname.slice(pos + 1);
} else if ( hostname !== '*' ) {
hostname = '*';
} else {
hostname = '';
}
}
return found;
}
toSelfie() {
return {
hostnameToSlotIdMap: Array.from(this.hostnameToSlotIdMap),

View File

@ -61,9 +61,6 @@ window.addEventListener('webextFlavor', function() {
vAPI.webextFlavor.soup.has('firefox');
}, { once: true });
// https://github.com/uBlockOrigin/uBlock-issues/issues/1553
const supportsFloc = document.interestCohort instanceof Function;
/******************************************************************************/
const patchLocalRedirectURL = url => url.charCodeAt(0) === 0x2F /* '/' */
@ -562,9 +559,6 @@ const onHeadersReceived = function(details) {
if ( injectCSP(fctxt, pageStore, responseHeaders) === true ) {
modifiedHeaders = true;
}
if ( supportsFloc && foilFloc(fctxt, responseHeaders) ) {
modifiedHeaders = true;
}
// https://bugzilla.mozilla.org/show_bug.cgi?id=1376932
// Prevent document from being cached by the browser if we modified it,
@ -1012,23 +1006,6 @@ const injectCSP = function(fctxt, pageStore, responseHeaders) {
/******************************************************************************/
// https://github.com/uBlockOrigin/uBlock-issues/issues/1553
// https://github.com/WICG/floc#opting-out-of-computation
const foilFloc = function(fctxt, responseHeaders) {
const hn = fctxt.getHostname();
if ( scriptletFilteringEngine.hasScriptlet(hn, 1, 'no-floc') === false ) {
return false;
}
responseHeaders.push({
name: 'Permissions-Policy',
value: 'interest-cohort=()' }
);
return true;
};
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/1163
// "Block elements by size".
// https://github.com/gorhill/uBlock/issues/1390#issuecomment-187310719