Skip to content

Commit

Permalink
fixing merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mneunomne committed Nov 7, 2021
1 parent 3dd3a4f commit 102f3d4
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 156 deletions.
78 changes: 17 additions & 61 deletions src/background.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,22 @@
<title>AdNauseam</title>
</head>
<body>
<script src="lib/lz4/lz4-block-codec-any.js"></script>
<<<<<<< HEAD
<script src="lib/punycode.js"></script>
<script src="lib/publicsuffixlist/publicsuffixlist.js"></script>
<script src="lib/jszip.min.js"></script>
<script src="lib/yamd5.js"></script>
<script src="lib/regexanalyzer/regex.js"></script>
<script src="js/webext.js"></script>
<script src="js/vapi.js"></script>
<script src="js/vapi-common.js"></script>
<script src="js/vapi-background.js"></script>
<script src="js/vapi-background-ext.js"></script><!-- platform-specific to extend common code paths -->
<script src="js/background.js"></script>
<script src="js/traffic.js"></script>
<script src="js/hntrie.js"></script>
<script src="js/strie.js"></script>
<script src="js/utils.js"></script>
<script src="js/uritools.js"></script>
<script src="js/lz4.js"></script>
<script src="js/cachestorage.js"></script>
<script src="js/assets.js"></script>
<script src="js/filtering-context.js"></script>
<script src="js/redirect-engine.js"></script>
<script src="js/dynamic-net-filtering.js"></script>
<script src="js/url-net-filtering.js"></script>
<script src="js/static-filtering-parser.js"></script>
<script src="js/static-net-filtering.js"></script>
<script src="js/static-ext-filtering.js"></script>
<script src="js/cosmetic-filtering.js"></script>
<script src="js/scriptlet-filtering.js"></script>
<script src="js/html-filtering.js"></script>
<script src="js/httpheader-filtering.js"></script>
<script src="js/hnswitches.js"></script>
<script src="js/ublock.js"></script>
<script src="js/storage.js"></script>
<script src="js/logger.js"></script>
<script src="js/pagestore.js"></script>
<script src="js/tab.js"></script>
<script src="js/messaging.js"></script>
<script src="js/text-encode.js"></script>
<script src="js/contextmenu.js"></script>
<script src="js/reverselookup.js"></script>
<script src="js/adn/shared.js"></script>
<script src="js/adn/core.js"></script>
<script src="js/adn/dnt.js"></script>
<script src="js/start.js"></script>
<script src="js/commands.js"></script>
=======
<script src="js/webext.js"></script>
<script src="js/vapi.js"></script>
<script src="js/vapi-common.js"></script>
<script src="js/vapi-background.js" type="module"></script>
<script src="js/vapi-background-ext.js" type="module"></script><!-- platform-specific to extend common code paths -->
<script src="js/utils.js" type="module"></script>
<script src="js/ublock.js" type="module"></script>
<script src="js/storage.js" type="module"></script>
<script src="js/tab.js" type="module"></script>
<script src="js/messaging.js" type="module"></script>
<script src="js/start.js" type="module"></script>
<script src="js/commands.js" type="module"></script>
>>>>>>> upstream1.38.0
<script src="lib/lz4/lz4-block-codec-any.js"></script>
<script src="js/webext.js"></script>
<script src="js/vapi.js"></script>
<script src="js/vapi-common.js"></script>
<script src="js/vapi-background.js" type="module"></script>
<script src="js/vapi-background-ext.js" type="module"></script><!-- platform-specific to extend common code paths -->
<!-- ADN -->
<script src="js/adn/shared.js"></script>
<script src="js/adn/core.js" type="module"></script>
<script src="js/adn/dnt.js" type="module"></script>
<script src="js/utils.js" type="module"></script>
<script src="js/ublock.js" type="module"></script>
<script src="js/storage.js" type="module"></script>
<script src="js/tab.js" type="module"></script>
<script src="js/messaging.js" type="module"></script>
<script src="js/start.js" type="module"></script>
<script src="js/commands.js" type="module"></script>
</body>
</html>
24 changes: 17 additions & 7 deletions src/js/adn/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@

/* global vAPI, µBlock */

'use strict';

import µb from '../background.js';
import staticFilteringReverseLookup from '../reverselookup.js';

const µBlock = µb

µBlock.adnauseam = (function () {
'use strict';

Expand Down Expand Up @@ -1562,7 +1569,7 @@
exports.onListsLoaded = async function (firstRun) {

listEntries = {};
const entries = await µb.staticFilteringReverseLookup.initWorker();
const entries = await staticFilteringReverseLookup.initWorker();
entries.forEach((value, key) => listEntries[key] = value);

devbuild = vAPI.webextFlavor.soup.has('devbuild');
Expand All @@ -1572,7 +1579,7 @@
verifySettings();
verifyLists();

µb.adnauseam.dnt.updateFilters();
adnauseam.dnt.updateFilters();

if (firstRun) {

Expand Down Expand Up @@ -1689,7 +1696,7 @@

ad.id = ++idgen; // gets an id only if its not a duplicate

if (µb.adnauseam.dnt.mustNotVisit(ad)) { // see #1168
if (adnauseam.dnt.mustNotVisit(ad)) { // see #1168
ad.noVisit = true;
ad.dntAllowed = true;
}
Expand Down Expand Up @@ -2063,7 +2070,7 @@
//console.log('clicking: ', state, µb.userSettings.clickingAds || µb.userSettings.clickingAds);
const off = !(µb.userSettings.clickingAds || µb.userSettings.hidingAds);
// µb.selectFilterLists({ location: µb.adnauseam.dnt.effList, off: off })
// µb.selectFilterLists({ location: adnauseam.dnt.effList, off: off })
}*/

sendNotifications(notifications);
Expand Down Expand Up @@ -2297,11 +2304,11 @@
pageStore = µb.pageStoreFromTabId(tabId);
}

if (typeof µb.adnauseam[request.what] === 'function') {
if (typeof adnauseam[request.what] === 'function') {

request.url && (request.url = trimChar(request.url, '/')); // no trailing slash
callback(µb.adnauseam[request.what](request, pageStore, tabId, frameId));
µb.adnauseam.markUserAction(); // assume user-initiated and thus no longer 'idle'
callback(adnauseam[request.what](request, pageStore, tabId, frameId));
adnauseam.markUserAction(); // assume user-initiated and thus no longer 'idle'

} else {

Expand All @@ -2317,4 +2324,7 @@

})();

const adnauseam = µBlock.adnauseam
export default adnauseam

/*************************************************************************/
20 changes: 14 additions & 6 deletions src/js/adn/dnt.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
µBlock.adnauseam.dnt = (function () {
'use strict';

import µb from '../background.js';
import adnauseam from './core.js';
import DynamicHostRuleFiltering from '../dynamic-net-filtering.js';

const dnt = (function () {

'use strict';

const µb = µBlock, adn = µb.adnauseam, log = adn.log;
log = adnauseam.log;
//const effList = 'eff-dnt-whitelist';

let exports = {};

const firewall = exports.firewall = new µb.Firewall();
const firewall = exports.firewall = new DynamicHostRuleFiltering();

exports.shutdown = function () {

Expand Down Expand Up @@ -105,7 +111,7 @@
const updateFilters = exports.updateFilters = function () {

const ruleCount = Object.keys(firewall.rules).length;
const enabled = µb.adnauseam.dnt.enabled();
const enabled = dnt.enabled();
const dnts = µb.userSettings.dntDomains;

// Only clear and possibly update if we actually find a change
Expand Down Expand Up @@ -146,13 +152,13 @@

if (context.tabHostname !== requestDomain) {

µb.adnauseam.logNetEvent('[DNT*3P] (Allow) ', [ context.tabHostname + ' => ' +
adnauseam.logNetEvent('[DNT*3P] (Allow) ', [ context.tabHostname + ' => ' +
requestDomain + ' ' + context.url ]); // suspicious: may want to check
}

if (context.type === 'inline-script') { // #1271

µb.adnauseam.logNetEvent('[DNT] (Allow)', [ context.tabHostname + ' => ' +
adnauseam.logNetEvent('[DNT] (Allow)', [ context.tabHostname + ' => ' +
context.hostname + ' ' + context.url ]);
}
}
Expand All @@ -163,3 +169,5 @@
return exports;

})();

export default dnt
13 changes: 7 additions & 6 deletions src/js/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import cacheStorage from './cachestorage.js';
import logger from './logger.js';
import µb from './background.js';

import adnauseam from './adn/core.js'
import dnt from './adn/dnt.js'
/******************************************************************************/

const reIsExternalPath = /^(?:[a-z-]+):\/\//;
Expand Down Expand Up @@ -112,8 +113,8 @@ assets.fetch = function(url, options = {}) {
}
details.content = this.response;
// ADN: If we've loaded a DNT list, we need to parse it
if (µBlock.adnauseam.dnt.isDoNotTrackUrl(url)) {
µBlock.adnauseam.dnt.processEntries(this.response);
if (dnt.isDoNotTrackUrl(url)) {
dnt.processEntries(this.response);
}
resolve(details);
};
Expand Down Expand Up @@ -859,8 +860,8 @@ const getRemote = async function(assetKey) {
{ content: result.content, url: contentURL }
);
// ADN: If we've loaded a DNT list, we need to parse it
if (µBlock.adnauseam.dnt.isDoNotTrackUrl(assetKey)) {
µBlock.adnauseam.dnt.processEntries(result.content);
if (dnt.isDoNotTrackUrl(assetKey)) {
dnt.processEntries(result.content);
}
registerAssetSource(assetKey, { error: undefined });
return reportBack(result.content);
Expand Down Expand Up @@ -1060,7 +1061,7 @@ assets.forceUpdate = async function(which) { // ADN
updaterStatus = undefined;
updaterAssetDelay = updaterAssetDelayDefault;
fireNotification('after-assets-updated', { assetKeys: assetKeys });
µBlock.applyCompiledFilters(details.assetKey, details.content);
µb.applyCompiledFilters(details.assetKey, details.content);
};

const updatedOne = function(details) {
Expand Down
5 changes: 3 additions & 2 deletions src/js/cosmetic-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import logger from './logger.js';
import µb from './background.js';
import adnauseam from './adn/core.js'

import {
StaticExtFilteringHostnameDB,
Expand Down Expand Up @@ -939,7 +940,7 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
if (
request.tabId !== undefined &&
request.frameId !== undefined &&
!µb.adnauseam.contentPrefs(request.hostname).hidingDisabled // ADN Don't inject user stylesheets if hiding is disabled
!adnauseam.contentPrefs(request.hostname).hidingDisabled // ADN Don't inject user stylesheets if hiding is disabled
) {
//Adn
out.injectedCSS = `${injected.join(',\n')}\n{display:none!important;}`;
Expand Down Expand Up @@ -1139,7 +1140,7 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
// ADN Don't inject user stylesheets if hiding is disabled
// Inject all declarative-based filters as a single stylesheet.
if (
!µb.adnauseam.contentPrefs(request.hostname).hidingDisabled &&
!adnauseam.contentPrefs(request.hostname).hidingDisabled &&
injectedHideFilters.length !== 0
) {
out.injectedCSS = injectedCSS.join('\n\n');
Expand Down
8 changes: 1 addition & 7 deletions src/js/dynamic-net-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,19 +514,13 @@ class DynamicHostRuleFiltering {
}
};

Matrix.prototype.intToActionMap = new Map([
DynamicHostRuleFiltering.prototype.intToActionMap = new Map([
[ 1, 'block' ],
[ 2, 'allow' ],
[ 3, 'noop' ],
[ 4, 'strictBlock' ] // ADN
]);

Matrix.prototype.magicId = 1;

/******************************************************************************/

µBlock.Firewall = Matrix;

DynamicHostRuleFiltering.prototype.magicId = 1;

/******************************************************************************/
Expand Down
22 changes: 8 additions & 14 deletions src/js/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ import {

import './benchmarks.js';

import dnt from './adn/dnt.js'

/******************************************************************************/

// https://github.com/uBlockOrigin/uBlock-issues/issues/710
Expand All @@ -71,8 +73,6 @@ import './benchmarks.js';
/******************************************************************************/
/******************************************************************************/

var µb = µBlock;

{
// >>>>> start of local scope

Expand Down Expand Up @@ -158,7 +158,7 @@ const onMessage = function(request, sender, callback) {
break;

/*case 'domainIsDNT':
response = µb.adnauseam.dnt.isDoNotTrackRule(request.rule);
response = adnauseam.dnt.isDoNotTrackRule(request.rule);
break;*/

case 'isDNTVisible':
Expand Down Expand Up @@ -195,7 +195,7 @@ const onMessage = function(request, sender, callback) {

case 'getWhitelist':
response = {
dntEnabled: µb.adnauseam.dnt.enabled(),
dntEnabled: dnt.enabled(),
whitelist: µb.arrayFromWhitelist(µb.netWhitelist),
reBadHostname: µb.reWhitelistBadHostname.source,
reHostnameExtractor: µb.reWhitelistHostnameExtractor.source
Expand Down Expand Up @@ -253,7 +253,7 @@ const onMessage = function(request, sender, callback) {
vAPI.browserSettings.canLeakLocalIPAddresses === true;
}
if (typeof response === 'undefined') { // ADN return notifications either way
response = { notifications: makeCloneable(µb.adnauseam.getNotifications()) }; // #1163
response = { notifications: makeCloneable(adnauseam.getNotifications()) }; // #1163
}
break;

Expand Down Expand Up @@ -627,7 +627,7 @@ const retrieveContentScriptParameters = async function(sender, request) {
request.hostname = hostnameFromURI(request.url);
request.domain = domainFromHostname(request.hostname);
request.entity = entityFromDomain(request.domain);
response.prefs = µb.adnauseam.contentPrefs(pageStore.tabHostname); // ADN
response.prefs = adnauseam.contentPrefs(pageStore.tabHostname); // ADN

response.specificCosmeticFilters =
cosmeticFilteringEngine.retrieveSpecificSelectors(request, response);
Expand Down Expand Up @@ -770,8 +770,6 @@ vAPI.messaging.listen({
{
// >>>>> start of local scope

var µb = µBlock;

/******************************************************************************/

const onMessage = function(request, sender, callback) {
Expand Down Expand Up @@ -939,8 +937,6 @@ vAPI.messaging.listen({
{
// >>>>> start of local scope

var µb = µBlock;

// Settings
const getLocalData = async function() {
const data = Object.assign({}, µb.restoreBackupSettings);
Expand Down Expand Up @@ -1109,13 +1105,13 @@ const getLists = async function(callback) {
const appendNotifications = function(r) { // ADN

var listKeys = Object.keys(r.available),
notes = µb.adnauseam.getNotifications();
notes = adnauseam.getNotifications();

// check each list for an associated notification
listKeys.forEach(function(url) {
for (var i = 0; i < Notifications.length; i++) {
if (Notifications[i].listUrl === url) {
µb.adnauseam.verifySetting(Notifications[i], r.available[url].off);
adnauseam.verifySetting(Notifications[i], r.available[url].off);
}
}
});
Expand Down Expand Up @@ -1378,8 +1374,6 @@ vAPI.messaging.listen({
{
// >>>>> start of local scope

var µb = µBlock

const extensionOriginURL = vAPI.getURL('');
const documentBlockedURL = vAPI.getURL('document-blocked.html');

Expand Down
Loading

0 comments on commit 102f3d4

Please sign in to comment.