Skip to content

Commit

Permalink
Remove unused interestCohort-related code paths
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Jan 31, 2023
1 parent 2f1d8bb commit d2487b6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 55 deletions.
4 changes: 0 additions & 4 deletions src/js/scriptlet-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
28 changes: 0 additions & 28 deletions src/js/static-ext-filtering-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
23 changes: 0 additions & 23 deletions src/js/traffic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 /* '/' */
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d2487b6

Please sign in to comment.