@browserless.io/browserless 2.0.0-beta-5 → 2.0.0-beta-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -0
- package/README.md +11 -11
- package/bin/browserless.js +169 -11
- package/bin/scaffold/README.md +415 -0
- package/bin/scaffold/package.json +21 -0
- package/bin/scaffold/src/hello-world.http.ts +27 -0
- package/bin/scaffold/tsconfig.json +4 -0
- package/build/browserless.js +18 -15
- package/build/browsers/index.d.ts +2 -18
- package/build/browsers/index.js +43 -14
- package/build/file-system.d.ts +5 -0
- package/build/file-system.js +20 -5
- package/build/file-system.spec.d.ts +1 -0
- package/build/file-system.spec.js +44 -0
- package/build/http.d.ts +3 -3
- package/build/http.js +3 -3
- package/build/router.js +2 -4
- package/build/routes/chromium/http/content-post.body.json +8 -8
- package/build/routes/chromium/http/content-post.d.ts +15 -3
- package/build/routes/chromium/http/content-post.js +14 -15
- package/build/routes/chromium/http/download-post.d.ts +16 -3
- package/build/routes/chromium/http/download-post.js +17 -22
- package/build/routes/chromium/http/function-post.d.ts +16 -3
- package/build/routes/chromium/http/function-post.js +17 -22
- package/build/routes/chromium/http/pdf-post.body.json +8 -8
- package/build/routes/chromium/http/pdf-post.d.ts +15 -3
- package/build/routes/chromium/http/pdf-post.js +19 -15
- package/build/routes/chromium/http/performance.d.ts +15 -3
- package/build/routes/chromium/http/performance.js +15 -23
- package/build/routes/chromium/http/scrape-post.body.json +8 -8
- package/build/routes/chromium/http/scrape-post.d.ts +15 -3
- package/build/routes/chromium/http/scrape-post.js +15 -16
- package/build/routes/chromium/http/screenshot-post.body.json +8 -8
- package/build/routes/chromium/http/screenshot-post.d.ts +15 -3
- package/build/routes/chromium/http/screenshot-post.js +18 -15
- package/build/routes/chromium/tests/websocket.spec.js +20 -1
- package/build/routes/chromium/utils/function/handler.js +2 -2
- package/build/routes/chromium/ws/browser.d.ts +13 -3
- package/build/routes/chromium/ws/browser.js +10 -11
- package/build/routes/chromium/ws/cdp-chromium.d.ts +13 -3
- package/build/routes/chromium/ws/cdp-chromium.js +10 -11
- package/build/routes/chromium/ws/page.d.ts +13 -3
- package/build/routes/chromium/ws/page.js +10 -11
- package/build/routes/chromium/ws/playwright-chromium.d.ts +13 -3
- package/build/routes/chromium/ws/playwright-chromium.js +11 -12
- package/build/routes/firefox/ws/playwright-firefox.d.ts +13 -3
- package/build/routes/firefox/ws/playwright-firefox.js +11 -12
- package/build/routes/management/http/config-get.d.ts +15 -3
- package/build/routes/management/http/config-get.js +15 -20
- package/build/routes/management/http/metrics-get.d.ts +15 -3
- package/build/routes/management/http/metrics-get.js +16 -21
- package/build/routes/management/http/metrics-total-get.d.ts +15 -3
- package/build/routes/management/http/metrics-total-get.js +16 -21
- package/build/routes/management/http/sessions-get.d.ts +15 -3
- package/build/routes/management/http/sessions-get.js +16 -20
- package/build/routes/management/http/static-get.d.ts +15 -3
- package/build/routes/management/http/static-get.js +15 -20
- package/build/routes/webkit/ws/playwright-webkit.d.ts +13 -3
- package/build/routes/webkit/ws/playwright-webkit.js +11 -12
- package/build/server.js +0 -1
- package/build/types.d.ts +48 -38
- package/build/types.js +135 -0
- package/extensions/ublock/1p-filters.html +0 -1
- package/extensions/ublock/3p-filters.html +0 -2
- package/extensions/ublock/_locales/bg/messages.json +6 -6
- package/extensions/ublock/_locales/br_FR/messages.json +14 -14
- package/extensions/ublock/_locales/bs/messages.json +8 -8
- package/extensions/ublock/_locales/ca/messages.json +1 -1
- package/extensions/ublock/_locales/da/messages.json +5 -5
- package/extensions/ublock/_locales/fa/messages.json +1 -1
- package/extensions/ublock/_locales/fi/messages.json +6 -6
- package/extensions/ublock/_locales/hr/messages.json +4 -4
- package/extensions/ublock/_locales/nb/messages.json +1 -1
- package/extensions/ublock/_locales/no/messages.json +1 -1
- package/extensions/ublock/_locales/ro/messages.json +2 -2
- package/extensions/ublock/_locales/ru/messages.json +1 -1
- package/extensions/ublock/_locales/sk/messages.json +1 -1
- package/extensions/ublock/_locales/sv/messages.json +2 -2
- package/extensions/ublock/_locales/te/messages.json +17 -17
- package/extensions/ublock/_locales/vi/messages.json +12 -12
- package/extensions/ublock/_locales/zh_TW/messages.json +13 -13
- package/extensions/ublock/assets/assets.json +3 -3
- package/extensions/ublock/assets/resources/scriptlets.js +218 -97
- package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +3010 -2056
- package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +624 -433
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +93 -24
- package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +7 -15
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +795 -777
- package/extensions/ublock/assets/ublock/badware.min.txt +138 -72
- package/extensions/ublock/assets/ublock/filters.min.txt +1929 -2735
- package/extensions/ublock/assets/ublock/privacy.min.txt +57 -26
- package/extensions/ublock/assets/ublock/quick-fixes.min.txt +125 -74
- package/extensions/ublock/assets/ublock/unbreak.min.txt +46 -53
- package/extensions/ublock/css/codemirror.css +8 -7
- package/extensions/ublock/css/dom-inspector.css +40 -0
- package/extensions/ublock/css/logger-ui-inspector.css +7 -1
- package/extensions/ublock/css/logger-ui.css +12 -5
- package/extensions/ublock/css/popup-fenix.css +1 -1
- package/extensions/ublock/devtools.html +1 -0
- package/extensions/ublock/js/1p-filters.js +4 -3
- package/extensions/ublock/js/3p-filters.js +25 -31
- package/extensions/ublock/js/about.js +1 -1
- package/extensions/ublock/js/advanced-settings.js +1 -1
- package/extensions/ublock/js/asset-viewer.js +1 -1
- package/extensions/ublock/js/assets.js +74 -44
- package/extensions/ublock/js/background.js +9 -3
- package/extensions/ublock/js/base64-custom.js +1 -1
- package/extensions/ublock/js/benchmarks.js +1 -1
- package/extensions/ublock/js/biditrie.js +1 -1
- package/extensions/ublock/js/broadcast.js +75 -0
- package/extensions/ublock/js/cachestorage.js +68 -45
- package/extensions/ublock/js/click2load.js +1 -1
- package/extensions/ublock/js/cloud-ui.js +1 -1
- package/extensions/ublock/js/code-viewer.js +1 -1
- package/extensions/ublock/js/codemirror/search-thread.js +1 -1
- package/extensions/ublock/js/codemirror/search.js +1 -1
- package/extensions/ublock/js/codemirror/ubo-dynamic-filtering.js +1 -1
- package/extensions/ublock/js/codemirror/ubo-static-filtering.js +98 -24
- package/extensions/ublock/js/commands.js +1 -1
- package/extensions/ublock/js/console.js +1 -1
- package/extensions/ublock/js/contentscript-extra.js +1 -1
- package/extensions/ublock/js/contentscript.js +1 -3
- package/extensions/ublock/js/contextmenu.js +1 -1
- package/extensions/ublock/js/cosmetic-filtering.js +4 -4
- package/extensions/ublock/js/dashboard-common.js +1 -1
- package/extensions/ublock/js/dashboard.js +1 -1
- package/extensions/ublock/js/devtools.js +23 -15
- package/extensions/ublock/js/diff-updater.js +3 -3
- package/extensions/ublock/js/document-blocked.js +1 -1
- package/extensions/ublock/js/dom-inspector.js +68 -0
- package/extensions/ublock/js/dom.js +1 -1
- package/extensions/ublock/js/dyna-rules.js +1 -1
- package/extensions/ublock/js/dynamic-net-filtering.js +1 -1
- package/extensions/ublock/js/epicker-ui.js +35 -59
- package/extensions/ublock/js/fa-icons.js +1 -1
- package/extensions/ublock/js/filtering-context.js +1 -1
- package/extensions/ublock/js/filtering-engines.js +1 -1
- package/extensions/ublock/js/hnswitches.js +1 -1
- package/extensions/ublock/js/hntrie.js +1 -1
- package/extensions/ublock/js/html-filtering.js +1 -1
- package/extensions/ublock/js/httpheader-filtering.js +1 -1
- package/extensions/ublock/js/i18n.js +1 -1
- package/extensions/ublock/js/is-webrtc-supported.js +1 -1
- package/extensions/ublock/js/logger-ui-inspector.js +203 -145
- package/extensions/ublock/js/logger-ui.js +21 -5
- package/extensions/ublock/js/logger.js +6 -2
- package/extensions/ublock/js/lz4.js +2 -2
- package/extensions/ublock/js/messaging.js +266 -166
- package/extensions/ublock/js/mrucache.js +58 -0
- package/extensions/ublock/js/pagestore.js +1 -1
- package/extensions/ublock/js/popup-fenix.js +2 -1
- package/extensions/ublock/js/redirect-engine.js +1 -1
- package/extensions/ublock/js/redirect-resources.js +1 -12
- package/extensions/ublock/js/reverselookup-worker.js +1 -1
- package/extensions/ublock/js/reverselookup.js +1 -1
- package/extensions/ublock/js/scriptlet-filtering-core.js +300 -0
- package/extensions/ublock/js/scriptlet-filtering.js +122 -350
- package/extensions/ublock/js/scriptlets/cosmetic-logger.js +36 -47
- package/extensions/ublock/js/scriptlets/cosmetic-off.js +1 -1
- package/extensions/ublock/js/scriptlets/cosmetic-on.js +1 -1
- package/extensions/ublock/js/scriptlets/cosmetic-report.js +1 -1
- package/extensions/ublock/js/scriptlets/dom-inspector.js +341 -323
- package/extensions/ublock/js/scriptlets/dom-survey-elements.js +1 -1
- package/extensions/ublock/js/scriptlets/dom-survey-scripts.js +1 -1
- package/extensions/ublock/js/scriptlets/epicker.js +80 -89
- package/extensions/ublock/js/scriptlets/load-3p-css.js +1 -1
- package/extensions/ublock/js/scriptlets/load-large-media-all.js +1 -1
- package/extensions/ublock/js/scriptlets/load-large-media-interactive.js +1 -1
- package/extensions/ublock/js/scriptlets/noscript-spoof.js +1 -1
- package/extensions/ublock/js/scriptlets/should-inject-contentscript.js +1 -1
- package/extensions/ublock/js/scriptlets/subscriber.js +1 -1
- package/extensions/ublock/js/scriptlets/updater.js +20 -3
- package/extensions/ublock/js/settings.js +1 -1
- package/extensions/ublock/js/start.js +19 -20
- package/extensions/ublock/js/static-dnr-filtering.js +1 -1
- package/extensions/ublock/js/static-ext-filtering-db.js +1 -1
- package/extensions/ublock/js/static-ext-filtering.js +1 -1
- package/extensions/ublock/js/static-filtering-io.js +1 -1
- package/extensions/ublock/js/static-filtering-parser.js +5 -3
- package/extensions/ublock/js/static-net-filtering.js +57 -37
- package/extensions/ublock/js/storage.js +49 -29
- package/extensions/ublock/js/support.js +4 -4
- package/extensions/ublock/js/tab.js +1 -1
- package/extensions/ublock/js/tasks.js +1 -1
- package/extensions/ublock/js/text-encode.js +1 -1
- package/extensions/ublock/js/text-utils.js +1 -1
- package/extensions/ublock/js/theme.js +1 -1
- package/extensions/ublock/js/traffic.js +2 -1
- package/extensions/ublock/js/ublock.js +15 -11
- package/extensions/ublock/js/uri-utils.js +1 -1
- package/extensions/ublock/js/url-net-filtering.js +1 -1
- package/extensions/ublock/js/utils.js +1 -73
- package/extensions/ublock/js/vapi-background-ext.js +1 -1
- package/extensions/ublock/js/vapi-background.js +92 -83
- package/extensions/ublock/js/vapi-client.js +4 -33
- package/extensions/ublock/js/vapi-common.js +16 -30
- package/extensions/ublock/js/vapi.js +1 -1
- package/extensions/ublock/js/wasm/biditrie.wat +1 -1
- package/extensions/ublock/js/wasm/hntrie.wat +1 -1
- package/extensions/ublock/js/webext.js +1 -1
- package/extensions/ublock/js/whitelist.js +1 -1
- package/extensions/ublock/logger-ui.html +2 -2
- package/extensions/ublock/manifest.json +1 -1
- package/extensions/ublock/support.html +0 -1
- package/extensions/ublock/web_accessible_resources/dom-inspector.html +25 -0
- package/extensions/ublock/web_accessible_resources/epicker-ui.html +0 -1
- package/extensions/ublock/web_accessible_resources/googletagservices_gpt.js +1 -0
- package/package.json +7 -19
- package/scripts/build-open-api.js +7 -4
- package/src/browserless.ts +42 -18
- package/src/browsers/index.ts +48 -20
- package/src/file-system.spec.ts +58 -0
- package/src/file-system.ts +36 -8
- package/src/http.ts +3 -3
- package/src/router.ts +2 -6
- package/src/routes/chromium/http/content-post.ts +13 -16
- package/src/routes/chromium/http/download-post.ts +16 -27
- package/src/routes/chromium/http/function-post.ts +16 -25
- package/src/routes/chromium/http/pdf-post.ts +19 -15
- package/src/routes/chromium/http/performance.ts +14 -26
- package/src/routes/chromium/http/scrape-post.ts +14 -16
- package/src/routes/chromium/http/screenshot-post.ts +18 -15
- package/src/routes/chromium/tests/websocket.spec.ts +28 -1
- package/src/routes/chromium/utils/function/handler.ts +2 -1
- package/src/routes/chromium/ws/browser.ts +10 -12
- package/src/routes/chromium/ws/cdp-chromium.ts +10 -12
- package/src/routes/chromium/ws/page.ts +10 -12
- package/src/routes/chromium/ws/playwright-chromium.ts +10 -12
- package/src/routes/firefox/ws/playwright-firefox.ts +10 -12
- package/src/routes/management/http/config-get.ts +14 -23
- package/src/routes/management/http/metrics-get.ts +15 -24
- package/src/routes/management/http/metrics-total-get.ts +15 -26
- package/src/routes/management/http/sessions-get.ts +15 -23
- package/src/routes/management/http/static-get.ts +14 -22
- package/src/routes/webkit/ws/playwright-webkit.ts +10 -12
- package/src/server.ts +0 -1
- package/src/types.ts +59 -45
- package/static/docs/browserless-logo-inline.svg +1 -0
- package/static/docs/index.html +27 -0
- package/static/docs/swagger.json +33 -33
- package/static/function/client.js +626 -78
- package/extensions/ublock/js/vapi-client-extra.js +0 -312
- package/extensions/ublock/web_accessible_resources/addthis_widget.js +0 -39
- package/extensions/ublock/web_accessible_resources/ligatus_angular-tag.js +0 -29
- package/extensions/ublock/web_accessible_resources/monkeybroker.js +0 -43
- package/extensions/ublock/web_accessible_resources/mxpnl_mixpanel.js +0 -51
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2015-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -671,7 +671,7 @@ const viewPort = (( ) => {
|
|
|
671
671
|
` width: calc(calc(100% - ${reservedWidth}px) * ${cellWidths[COLUMN_FILTER]});`,
|
|
672
672
|
'}',
|
|
673
673
|
`#vwContent .logEntry > div.messageRealm > span:nth-of-type(${COLUMN_MESSAGE+1}) {`,
|
|
674
|
-
` width: calc(100% - ${cellWidths[
|
|
674
|
+
` width: calc(100% - ${cellWidths[COLUMN_TIMESTAMP]}px);`,
|
|
675
675
|
'}',
|
|
676
676
|
`#vwContent .logEntry > div > span:nth-of-type(${COLUMN_RESULT+1}) {`,
|
|
677
677
|
` width: ${cellWidths[COLUMN_RESULT]}px;`,
|
|
@@ -972,7 +972,7 @@ const viewPort = (( ) => {
|
|
|
972
972
|
const updateCurrentTabTitle = (( ) => {
|
|
973
973
|
const i18nCurrentTab = i18n$('loggerCurrentTab');
|
|
974
974
|
|
|
975
|
-
return
|
|
975
|
+
return ( ) => {
|
|
976
976
|
const select = qs$('#pageSelector');
|
|
977
977
|
if ( select.value !== '_' || activeTabId === 0 ) { return; }
|
|
978
978
|
const opt0 = qs$(select, '[value="_"]');
|
|
@@ -1033,8 +1033,7 @@ const synchronizeTabIds = function(newTabIds) {
|
|
|
1033
1033
|
return newTabIds.get(a).localeCompare(newTabIds.get(b));
|
|
1034
1034
|
});
|
|
1035
1035
|
let j = 3;
|
|
1036
|
-
for (
|
|
1037
|
-
const tabId = tabIds[i];
|
|
1036
|
+
for ( const tabId of tabIds ) {
|
|
1038
1037
|
if ( tabId <= 0 ) { continue; }
|
|
1039
1038
|
if ( j === select.options.length ) {
|
|
1040
1039
|
select.appendChild(document.createElement('option'));
|
|
@@ -2252,6 +2251,23 @@ const rowFilterer = (( ) => {
|
|
|
2252
2251
|
dom.cl.toggle(ev.target, 'on');
|
|
2253
2252
|
builtinFilterExpression();
|
|
2254
2253
|
});
|
|
2254
|
+
dom.on('#filterInput > input', 'drop', ev => {
|
|
2255
|
+
const dropItem = item => {
|
|
2256
|
+
if ( item.kind !== 'string' ) { return false; }
|
|
2257
|
+
if ( item.type !== 'text/plain' ) { return false; }
|
|
2258
|
+
item.getAsString(s => {
|
|
2259
|
+
qs$('#filterInput > input').value = s;
|
|
2260
|
+
parseInput();
|
|
2261
|
+
filterAll();
|
|
2262
|
+
});
|
|
2263
|
+
return true;
|
|
2264
|
+
};
|
|
2265
|
+
for ( const item of ev.dataTransfer.items ) {
|
|
2266
|
+
if ( dropItem(item) === false ) { continue; }
|
|
2267
|
+
ev.preventDefault();
|
|
2268
|
+
break;
|
|
2269
|
+
}
|
|
2270
|
+
});
|
|
2255
2271
|
|
|
2256
2272
|
// https://github.com/gorhill/uBlock/issues/404
|
|
2257
2273
|
// Ensure page state is in sync with the state of its various widgets.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2015-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
/******************************************************************************/
|
|
25
25
|
|
|
26
|
+
import { broadcastToAll } from './broadcast.js';
|
|
27
|
+
|
|
28
|
+
/******************************************************************************/
|
|
29
|
+
|
|
26
30
|
let buffer = null;
|
|
27
31
|
let lastReadTime = 0;
|
|
28
32
|
let writePtr = 0;
|
|
@@ -40,7 +44,7 @@ const janitorTimer = vAPI.defer.create(( ) => {
|
|
|
40
44
|
buffer = null;
|
|
41
45
|
writePtr = 0;
|
|
42
46
|
logger.ownerId = undefined;
|
|
43
|
-
|
|
47
|
+
broadcastToAll({ what: 'loggerDisabled' });
|
|
44
48
|
});
|
|
45
49
|
|
|
46
50
|
const boxEntry = function(details) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2018-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -44,7 +44,7 @@ let ttlCount = 0;
|
|
|
44
44
|
let ttlDelay = 60000;
|
|
45
45
|
|
|
46
46
|
const init = function() {
|
|
47
|
-
ttlDelay = µb.hiddenSettings.autoUpdateAssetFetchPeriod *
|
|
47
|
+
ttlDelay = µb.hiddenSettings.autoUpdateAssetFetchPeriod * 2 * 1000;
|
|
48
48
|
if ( promisedInstance === undefined ) {
|
|
49
49
|
let flavor;
|
|
50
50
|
if ( µb.hiddenSettings.disableWebAssembly === true ) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2014-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
import publicSuffixList from '../lib/publicsuffixlist/publicsuffixlist.js';
|
|
29
29
|
import punycode from '../lib/punycode.js';
|
|
30
30
|
|
|
31
|
+
import { filteringBehaviorChanged } from './broadcast.js';
|
|
31
32
|
import cacheStorage from './cachestorage.js';
|
|
32
33
|
import cosmeticFilteringEngine from './cosmetic-filtering.js';
|
|
33
34
|
import htmlFilteringEngine from './html-filtering.js';
|
|
@@ -141,120 +142,6 @@ const onMessage = function(request, sender, callback) {
|
|
|
141
142
|
});
|
|
142
143
|
return;
|
|
143
144
|
|
|
144
|
-
case 'snfeBenchmark':
|
|
145
|
-
µb.benchmarkStaticNetFiltering({ redirectEngine }).then(result => {
|
|
146
|
-
callback(result);
|
|
147
|
-
});
|
|
148
|
-
return;
|
|
149
|
-
|
|
150
|
-
case 'snfeToDNR': {
|
|
151
|
-
const listPromises = [];
|
|
152
|
-
const listNames = [];
|
|
153
|
-
for ( const assetKey of µb.selectedFilterLists ) {
|
|
154
|
-
listPromises.push(
|
|
155
|
-
io.get(assetKey, { dontCache: true }).then(details => {
|
|
156
|
-
listNames.push(assetKey);
|
|
157
|
-
return { name: assetKey, text: details.content };
|
|
158
|
-
})
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
const options = {
|
|
162
|
-
extensionPaths: redirectEngine.getResourceDetails(),
|
|
163
|
-
env: vAPI.webextFlavor.env,
|
|
164
|
-
};
|
|
165
|
-
const t0 = Date.now();
|
|
166
|
-
dnrRulesetFromRawLists(listPromises, options).then(result => {
|
|
167
|
-
const { network } = result;
|
|
168
|
-
const replacer = (k, v) => {
|
|
169
|
-
if ( k.startsWith('__') ) { return; }
|
|
170
|
-
if ( Array.isArray(v) ) {
|
|
171
|
-
return v.sort();
|
|
172
|
-
}
|
|
173
|
-
if ( v instanceof Object ) {
|
|
174
|
-
const sorted = {};
|
|
175
|
-
for ( const kk of Object.keys(v).sort() ) {
|
|
176
|
-
sorted[kk] = v[kk];
|
|
177
|
-
}
|
|
178
|
-
return sorted;
|
|
179
|
-
}
|
|
180
|
-
return v;
|
|
181
|
-
};
|
|
182
|
-
const isUnsupported = rule =>
|
|
183
|
-
rule._error !== undefined;
|
|
184
|
-
const isRegex = rule =>
|
|
185
|
-
rule.condition !== undefined &&
|
|
186
|
-
rule.condition.regexFilter !== undefined;
|
|
187
|
-
const isRedirect = rule =>
|
|
188
|
-
rule.action !== undefined &&
|
|
189
|
-
rule.action.type === 'redirect' &&
|
|
190
|
-
rule.action.redirect.extensionPath !== undefined;
|
|
191
|
-
const isCsp = rule =>
|
|
192
|
-
rule.action !== undefined &&
|
|
193
|
-
rule.action.type === 'modifyHeaders';
|
|
194
|
-
const isRemoveparam = rule =>
|
|
195
|
-
rule.action !== undefined &&
|
|
196
|
-
rule.action.type === 'redirect' &&
|
|
197
|
-
rule.action.redirect.transform !== undefined;
|
|
198
|
-
const runtime = Date.now() - t0;
|
|
199
|
-
const { ruleset } = network;
|
|
200
|
-
const good = ruleset.filter(rule =>
|
|
201
|
-
isUnsupported(rule) === false &&
|
|
202
|
-
isRegex(rule) === false &&
|
|
203
|
-
isRedirect(rule) === false &&
|
|
204
|
-
isCsp(rule) === false &&
|
|
205
|
-
isRemoveparam(rule) === false
|
|
206
|
-
);
|
|
207
|
-
const unsupported = ruleset.filter(rule =>
|
|
208
|
-
isUnsupported(rule)
|
|
209
|
-
);
|
|
210
|
-
const regexes = ruleset.filter(rule =>
|
|
211
|
-
isUnsupported(rule) === false &&
|
|
212
|
-
isRegex(rule) &&
|
|
213
|
-
isRedirect(rule) === false &&
|
|
214
|
-
isCsp(rule) === false &&
|
|
215
|
-
isRemoveparam(rule) === false
|
|
216
|
-
);
|
|
217
|
-
const redirects = ruleset.filter(rule =>
|
|
218
|
-
isUnsupported(rule) === false &&
|
|
219
|
-
isRedirect(rule)
|
|
220
|
-
);
|
|
221
|
-
const headers = ruleset.filter(rule =>
|
|
222
|
-
isUnsupported(rule) === false &&
|
|
223
|
-
isCsp(rule)
|
|
224
|
-
);
|
|
225
|
-
const removeparams = ruleset.filter(rule =>
|
|
226
|
-
isUnsupported(rule) === false &&
|
|
227
|
-
isRemoveparam(rule)
|
|
228
|
-
);
|
|
229
|
-
const out = [
|
|
230
|
-
`dnrRulesetFromRawLists(${JSON.stringify(listNames, null, 2)})`,
|
|
231
|
-
`Run time: ${runtime} ms`,
|
|
232
|
-
`Filters count: ${network.filterCount}`,
|
|
233
|
-
`Accepted filter count: ${network.acceptedFilterCount}`,
|
|
234
|
-
`Rejected filter count: ${network.rejectedFilterCount}`,
|
|
235
|
-
`Un-DNR-able filter count: ${unsupported.length}`,
|
|
236
|
-
`Resulting DNR rule count: ${ruleset.length}`,
|
|
237
|
-
];
|
|
238
|
-
out.push(`+ Good filters (${good.length}): ${JSON.stringify(good, replacer, 2)}`);
|
|
239
|
-
out.push(`+ Regex-based filters (${regexes.length}): ${JSON.stringify(regexes, replacer, 2)}`);
|
|
240
|
-
out.push(`+ 'redirect=' filters (${redirects.length}): ${JSON.stringify(redirects, replacer, 2)}`);
|
|
241
|
-
out.push(`+ 'csp=' filters (${headers.length}): ${JSON.stringify(headers, replacer, 2)}`);
|
|
242
|
-
out.push(`+ 'removeparam=' filters (${removeparams.length}): ${JSON.stringify(removeparams, replacer, 2)}`);
|
|
243
|
-
out.push(`+ Unsupported filters (${unsupported.length}): ${JSON.stringify(unsupported, replacer, 2)}`);
|
|
244
|
-
out.push(`+ generichide exclusions (${network.generichideExclusions.length}): ${JSON.stringify(network.generichideExclusions, replacer, 2)}`);
|
|
245
|
-
if ( result.specificCosmetic ) {
|
|
246
|
-
out.push(`+ Cosmetic filters: ${result.specificCosmetic.size}`);
|
|
247
|
-
for ( const details of result.specificCosmetic ) {
|
|
248
|
-
out.push(` ${JSON.stringify(details)}`);
|
|
249
|
-
}
|
|
250
|
-
} else {
|
|
251
|
-
out.push(' Cosmetic filters: 0');
|
|
252
|
-
}
|
|
253
|
-
callback(out.join('\n'));
|
|
254
|
-
});
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
145
|
default:
|
|
259
146
|
break;
|
|
260
147
|
}
|
|
@@ -275,13 +162,6 @@ const onMessage = function(request, sender, callback) {
|
|
|
275
162
|
µb.createUserFilters(request);
|
|
276
163
|
break;
|
|
277
164
|
|
|
278
|
-
case 'forceUpdateAssets':
|
|
279
|
-
µb.scheduleAssetUpdater(0);
|
|
280
|
-
io.updateStart({
|
|
281
|
-
delay: µb.hiddenSettings.manualUpdateAssetFetchPeriod
|
|
282
|
-
});
|
|
283
|
-
break;
|
|
284
|
-
|
|
285
165
|
case 'getAppData':
|
|
286
166
|
response = {
|
|
287
167
|
name: browser.runtime.getManifest().name,
|
|
@@ -346,7 +226,7 @@ const onMessage = function(request, sender, callback) {
|
|
|
346
226
|
case 'setWhitelist':
|
|
347
227
|
µb.netWhitelist = µb.whitelistFromString(request.whitelist);
|
|
348
228
|
µb.saveWhitelist();
|
|
349
|
-
|
|
229
|
+
filteringBehaviorChanged();
|
|
350
230
|
break;
|
|
351
231
|
|
|
352
232
|
case 'toggleHostnameSwitch':
|
|
@@ -378,14 +258,6 @@ const onMessage = function(request, sender, callback) {
|
|
|
378
258
|
}
|
|
379
259
|
break;
|
|
380
260
|
|
|
381
|
-
case 'snfeDump':
|
|
382
|
-
response = staticNetFilteringEngine.dump();
|
|
383
|
-
break;
|
|
384
|
-
|
|
385
|
-
case 'cfeDump':
|
|
386
|
-
response = cosmeticFilteringEngine.dump();
|
|
387
|
-
break;
|
|
388
|
-
|
|
389
261
|
default:
|
|
390
262
|
return vAPI.messaging.UNHANDLED;
|
|
391
263
|
}
|
|
@@ -846,13 +718,7 @@ const retrieveContentScriptParameters = async function(sender, request) {
|
|
|
846
718
|
if ( logger.enabled || request.needScriptlets ) {
|
|
847
719
|
const scriptletDetails = scriptletFilteringEngine.injectNow(request);
|
|
848
720
|
if ( scriptletDetails !== undefined ) {
|
|
849
|
-
|
|
850
|
-
scriptletFilteringEngine.logFilters(
|
|
851
|
-
tabId,
|
|
852
|
-
request.url,
|
|
853
|
-
scriptletDetails.filters
|
|
854
|
-
);
|
|
855
|
-
}
|
|
721
|
+
scriptletFilteringEngine.toLogger(request, scriptletDetails);
|
|
856
722
|
if ( request.needScriptlets ) {
|
|
857
723
|
response.scriptletDetails = scriptletDetails;
|
|
858
724
|
}
|
|
@@ -1442,7 +1308,9 @@ const getSupportData = async function() {
|
|
|
1442
1308
|
|
|
1443
1309
|
const now = Date.now();
|
|
1444
1310
|
|
|
1445
|
-
const formatDelayFromNow =
|
|
1311
|
+
const formatDelayFromNow = list => {
|
|
1312
|
+
const time = list.writeTime;
|
|
1313
|
+
if ( typeof time !== 'number' || time === 0 ) { return 'never'; }
|
|
1446
1314
|
if ( (time || 0) === 0 ) { return '?'; }
|
|
1447
1315
|
const delayInSec = (now - time) / 1000;
|
|
1448
1316
|
const days = (delayInSec / 86400) | 0;
|
|
@@ -1453,7 +1321,9 @@ const getSupportData = async function() {
|
|
|
1453
1321
|
if ( hours > 0 ) { parts.push(`${hours}h`); }
|
|
1454
1322
|
if ( minutes > 0 ) { parts.push(`${minutes}m`); }
|
|
1455
1323
|
if ( parts.length === 0 ) { parts.push('now'); }
|
|
1456
|
-
|
|
1324
|
+
const out = parts.join('.');
|
|
1325
|
+
if ( list.diffUpdated ) { return `${out} Δ`; }
|
|
1326
|
+
return out;
|
|
1457
1327
|
};
|
|
1458
1328
|
|
|
1459
1329
|
const lists = µb.availableFilterLists;
|
|
@@ -1470,11 +1340,7 @@ const getSupportData = async function() {
|
|
|
1470
1340
|
if ( typeof list.entryCount === 'number' ) {
|
|
1471
1341
|
listDetails.push(`${list.entryCount}-${list.entryCount-list.entryUsedCount}`);
|
|
1472
1342
|
}
|
|
1473
|
-
|
|
1474
|
-
listDetails.push('never');
|
|
1475
|
-
} else {
|
|
1476
|
-
listDetails.push(formatDelayFromNow(list.writeTime));
|
|
1477
|
-
}
|
|
1343
|
+
listDetails.push(formatDelayFromNow(list));
|
|
1478
1344
|
}
|
|
1479
1345
|
if ( list.isDefault || listKey === µb.userFiltersPath ) {
|
|
1480
1346
|
if ( used ) {
|
|
@@ -1560,7 +1426,9 @@ const onMessage = function(request, sender, callback) {
|
|
|
1560
1426
|
});
|
|
1561
1427
|
|
|
1562
1428
|
case 'getLists':
|
|
1563
|
-
return
|
|
1429
|
+
return µb.isReadyPromise.then(( ) => {
|
|
1430
|
+
getLists(callback);
|
|
1431
|
+
});
|
|
1564
1432
|
|
|
1565
1433
|
case 'getLocalData':
|
|
1566
1434
|
return getLocalData().then(localData => {
|
|
@@ -1623,19 +1491,25 @@ const onMessage = function(request, sender, callback) {
|
|
|
1623
1491
|
response = getRules();
|
|
1624
1492
|
break;
|
|
1625
1493
|
|
|
1626
|
-
case '
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
io.purge(
|
|
1494
|
+
case 'supportUpdateNow': {
|
|
1495
|
+
const { assetKeys } = request;
|
|
1496
|
+
if ( assetKeys.length === 0 ) { return; }
|
|
1497
|
+
for ( const assetKey of assetKeys ) {
|
|
1498
|
+
io.purge(assetKey);
|
|
1631
1499
|
}
|
|
1500
|
+
µb.scheduleAssetUpdater({ now: true, fetchDelay: 100 });
|
|
1632
1501
|
break;
|
|
1502
|
+
}
|
|
1633
1503
|
|
|
1634
|
-
case '
|
|
1635
|
-
|
|
1504
|
+
case 'listsUpdateNow': {
|
|
1505
|
+
const { assetKeys, preferOrigin = false } = request;
|
|
1506
|
+
if ( assetKeys.length === 0 ) { return; }
|
|
1507
|
+
for ( const assetKey of assetKeys ) {
|
|
1636
1508
|
io.purge(assetKey);
|
|
1637
1509
|
}
|
|
1510
|
+
µb.scheduleAssetUpdater({ now: true, fetchDelay: 100, auto: preferOrigin !== true });
|
|
1638
1511
|
break;
|
|
1512
|
+
}
|
|
1639
1513
|
|
|
1640
1514
|
case 'readHiddenSettings':
|
|
1641
1515
|
response = {
|
|
@@ -1653,6 +1527,10 @@ const onMessage = function(request, sender, callback) {
|
|
|
1653
1527
|
resetUserData();
|
|
1654
1528
|
break;
|
|
1655
1529
|
|
|
1530
|
+
case 'updateNow':
|
|
1531
|
+
µb.scheduleAssetUpdater({ now: true, fetchDelay: 100, auto: true });
|
|
1532
|
+
break;
|
|
1533
|
+
|
|
1656
1534
|
case 'writeHiddenSettings':
|
|
1657
1535
|
µb.changeHiddenSettings(µb.hiddenSettingsFromString(request.content));
|
|
1658
1536
|
break;
|
|
@@ -1695,17 +1573,14 @@ const getLoggerData = async function(details, activeTabId, callback) {
|
|
|
1695
1573
|
tooltips: µb.userSettings.tooltipsDisabled === false
|
|
1696
1574
|
};
|
|
1697
1575
|
if ( µb.pageStoresToken !== details.tabIdsToken ) {
|
|
1698
|
-
|
|
1576
|
+
response.tabIds = [];
|
|
1699
1577
|
for ( const [ tabId, pageStore ] of µb.pageStores ) {
|
|
1700
|
-
const { rawURL } = pageStore;
|
|
1701
|
-
if (
|
|
1702
|
-
rawURL.startsWith(
|
|
1703
|
-
rawURL.startsWith(documentBlockedURL)
|
|
1704
|
-
) {
|
|
1705
|
-
tabIds.set(tabId, pageStore.title);
|
|
1578
|
+
const { rawURL, title } = pageStore;
|
|
1579
|
+
if ( rawURL.startsWith(extensionOriginURL) ) {
|
|
1580
|
+
if ( rawURL.startsWith(documentBlockedURL) === false ) { continue; }
|
|
1706
1581
|
}
|
|
1582
|
+
response.tabIds.push([ tabId, title ]);
|
|
1707
1583
|
}
|
|
1708
|
-
response.tabIds = Array.from(tabIds);
|
|
1709
1584
|
}
|
|
1710
1585
|
if ( activeTabId ) {
|
|
1711
1586
|
const pageStore = µb.pageStoreFromTabId(activeTabId);
|
|
@@ -1845,6 +1720,54 @@ vAPI.messaging.listen({
|
|
|
1845
1720
|
/******************************************************************************/
|
|
1846
1721
|
/******************************************************************************/
|
|
1847
1722
|
|
|
1723
|
+
// Channel:
|
|
1724
|
+
// domInspectorContent
|
|
1725
|
+
// unprivileged
|
|
1726
|
+
|
|
1727
|
+
{
|
|
1728
|
+
// >>>>> start of local scope
|
|
1729
|
+
|
|
1730
|
+
const onMessage = (request, sender, callback) => {
|
|
1731
|
+
// Async
|
|
1732
|
+
switch ( request.what ) {
|
|
1733
|
+
default:
|
|
1734
|
+
break;
|
|
1735
|
+
}
|
|
1736
|
+
// Sync
|
|
1737
|
+
let response;
|
|
1738
|
+
switch ( request.what ) {
|
|
1739
|
+
case 'getInspectorArgs':
|
|
1740
|
+
const bc = new globalThis.BroadcastChannel('contentInspectorChannel');
|
|
1741
|
+
bc.postMessage({
|
|
1742
|
+
what: 'contentInspectorChannel',
|
|
1743
|
+
tabId: sender.tabId || 0,
|
|
1744
|
+
frameId: sender.frameId || 0,
|
|
1745
|
+
});
|
|
1746
|
+
response = {
|
|
1747
|
+
inspectorURL: vAPI.getURL(
|
|
1748
|
+
`/web_accessible_resources/dom-inspector.html?secret=${vAPI.warSecret.short()}`
|
|
1749
|
+
),
|
|
1750
|
+
};
|
|
1751
|
+
break;
|
|
1752
|
+
default:
|
|
1753
|
+
return vAPI.messaging.UNHANDLED;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
callback(response);
|
|
1757
|
+
};
|
|
1758
|
+
|
|
1759
|
+
vAPI.messaging.listen({
|
|
1760
|
+
name: 'domInspectorContent',
|
|
1761
|
+
listener: onMessage,
|
|
1762
|
+
privileged: false,
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
// <<<<< end of local scope
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/******************************************************************************/
|
|
1769
|
+
/******************************************************************************/
|
|
1770
|
+
|
|
1848
1771
|
// Channel:
|
|
1849
1772
|
// documentBlocked
|
|
1850
1773
|
// privileged
|
|
@@ -1892,6 +1815,181 @@ vAPI.messaging.listen({
|
|
|
1892
1815
|
/******************************************************************************/
|
|
1893
1816
|
/******************************************************************************/
|
|
1894
1817
|
|
|
1818
|
+
// Channel:
|
|
1819
|
+
// devTools
|
|
1820
|
+
// privileged
|
|
1821
|
+
|
|
1822
|
+
{
|
|
1823
|
+
// >>>>> start of local scope
|
|
1824
|
+
|
|
1825
|
+
const onMessage = function(request, sender, callback) {
|
|
1826
|
+
// Async
|
|
1827
|
+
switch ( request.what ) {
|
|
1828
|
+
case 'purgeAllCaches':
|
|
1829
|
+
µb.getBytesInUse().then(bytesInUseBefore =>
|
|
1830
|
+
io.remove(/./).then(( ) =>
|
|
1831
|
+
µb.getBytesInUse().then(bytesInUseAfter => {
|
|
1832
|
+
callback([
|
|
1833
|
+
`Storage used before: ${µb.formatCount(bytesInUseBefore)}B`,
|
|
1834
|
+
`Storage used after: ${µb.formatCount(bytesInUseAfter)}B`,
|
|
1835
|
+
].join('\n'));
|
|
1836
|
+
})
|
|
1837
|
+
)
|
|
1838
|
+
);
|
|
1839
|
+
return;
|
|
1840
|
+
|
|
1841
|
+
case 'snfeBenchmark':
|
|
1842
|
+
µb.benchmarkStaticNetFiltering({ redirectEngine }).then(result => {
|
|
1843
|
+
callback(result);
|
|
1844
|
+
});
|
|
1845
|
+
return;
|
|
1846
|
+
|
|
1847
|
+
case 'snfeToDNR': {
|
|
1848
|
+
const listPromises = [];
|
|
1849
|
+
const listNames = [];
|
|
1850
|
+
for ( const assetKey of µb.selectedFilterLists ) {
|
|
1851
|
+
listPromises.push(
|
|
1852
|
+
io.get(assetKey, { dontCache: true }).then(details => {
|
|
1853
|
+
listNames.push(assetKey);
|
|
1854
|
+
return { name: assetKey, text: details.content };
|
|
1855
|
+
})
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
const options = {
|
|
1859
|
+
extensionPaths: redirectEngine.getResourceDetails().filter(e =>
|
|
1860
|
+
typeof e[1].extensionPath === 'string' && e[1].extensionPath !== ''
|
|
1861
|
+
).map(e =>
|
|
1862
|
+
[ e[0], e[1].extensionPath ]
|
|
1863
|
+
),
|
|
1864
|
+
env: vAPI.webextFlavor.env,
|
|
1865
|
+
};
|
|
1866
|
+
const t0 = Date.now();
|
|
1867
|
+
dnrRulesetFromRawLists(listPromises, options).then(result => {
|
|
1868
|
+
const { network } = result;
|
|
1869
|
+
const replacer = (k, v) => {
|
|
1870
|
+
if ( k.startsWith('__') ) { return; }
|
|
1871
|
+
if ( Array.isArray(v) ) {
|
|
1872
|
+
return v.sort();
|
|
1873
|
+
}
|
|
1874
|
+
if ( v instanceof Object ) {
|
|
1875
|
+
const sorted = {};
|
|
1876
|
+
for ( const kk of Object.keys(v).sort() ) {
|
|
1877
|
+
sorted[kk] = v[kk];
|
|
1878
|
+
}
|
|
1879
|
+
return sorted;
|
|
1880
|
+
}
|
|
1881
|
+
return v;
|
|
1882
|
+
};
|
|
1883
|
+
const isUnsupported = rule =>
|
|
1884
|
+
rule._error !== undefined;
|
|
1885
|
+
const isRegex = rule =>
|
|
1886
|
+
rule.condition !== undefined &&
|
|
1887
|
+
rule.condition.regexFilter !== undefined;
|
|
1888
|
+
const isRedirect = rule =>
|
|
1889
|
+
rule.action !== undefined &&
|
|
1890
|
+
rule.action.type === 'redirect' &&
|
|
1891
|
+
rule.action.redirect.extensionPath !== undefined;
|
|
1892
|
+
const isCsp = rule =>
|
|
1893
|
+
rule.action !== undefined &&
|
|
1894
|
+
rule.action.type === 'modifyHeaders';
|
|
1895
|
+
const isRemoveparam = rule =>
|
|
1896
|
+
rule.action !== undefined &&
|
|
1897
|
+
rule.action.type === 'redirect' &&
|
|
1898
|
+
rule.action.redirect.transform !== undefined;
|
|
1899
|
+
const runtime = Date.now() - t0;
|
|
1900
|
+
const { ruleset } = network;
|
|
1901
|
+
const good = ruleset.filter(rule =>
|
|
1902
|
+
isUnsupported(rule) === false &&
|
|
1903
|
+
isRegex(rule) === false &&
|
|
1904
|
+
isRedirect(rule) === false &&
|
|
1905
|
+
isCsp(rule) === false &&
|
|
1906
|
+
isRemoveparam(rule) === false
|
|
1907
|
+
);
|
|
1908
|
+
const unsupported = ruleset.filter(rule =>
|
|
1909
|
+
isUnsupported(rule)
|
|
1910
|
+
);
|
|
1911
|
+
const regexes = ruleset.filter(rule =>
|
|
1912
|
+
isUnsupported(rule) === false &&
|
|
1913
|
+
isRegex(rule) &&
|
|
1914
|
+
isRedirect(rule) === false &&
|
|
1915
|
+
isCsp(rule) === false &&
|
|
1916
|
+
isRemoveparam(rule) === false
|
|
1917
|
+
);
|
|
1918
|
+
const redirects = ruleset.filter(rule =>
|
|
1919
|
+
isUnsupported(rule) === false &&
|
|
1920
|
+
isRedirect(rule)
|
|
1921
|
+
);
|
|
1922
|
+
const headers = ruleset.filter(rule =>
|
|
1923
|
+
isUnsupported(rule) === false &&
|
|
1924
|
+
isCsp(rule)
|
|
1925
|
+
);
|
|
1926
|
+
const removeparams = ruleset.filter(rule =>
|
|
1927
|
+
isUnsupported(rule) === false &&
|
|
1928
|
+
isRemoveparam(rule)
|
|
1929
|
+
);
|
|
1930
|
+
const out = [
|
|
1931
|
+
`dnrRulesetFromRawLists(${JSON.stringify(listNames, null, 2)})`,
|
|
1932
|
+
`Run time: ${runtime} ms`,
|
|
1933
|
+
`Filters count: ${network.filterCount}`,
|
|
1934
|
+
`Accepted filter count: ${network.acceptedFilterCount}`,
|
|
1935
|
+
`Rejected filter count: ${network.rejectedFilterCount}`,
|
|
1936
|
+
`Un-DNR-able filter count: ${unsupported.length}`,
|
|
1937
|
+
`Resulting DNR rule count: ${ruleset.length}`,
|
|
1938
|
+
];
|
|
1939
|
+
out.push(`+ Good filters (${good.length}): ${JSON.stringify(good, replacer, 2)}`);
|
|
1940
|
+
out.push(`+ Regex-based filters (${regexes.length}): ${JSON.stringify(regexes, replacer, 2)}`);
|
|
1941
|
+
out.push(`+ 'redirect=' filters (${redirects.length}): ${JSON.stringify(redirects, replacer, 2)}`);
|
|
1942
|
+
out.push(`+ 'csp=' filters (${headers.length}): ${JSON.stringify(headers, replacer, 2)}`);
|
|
1943
|
+
out.push(`+ 'removeparam=' filters (${removeparams.length}): ${JSON.stringify(removeparams, replacer, 2)}`);
|
|
1944
|
+
out.push(`+ Unsupported filters (${unsupported.length}): ${JSON.stringify(unsupported, replacer, 2)}`);
|
|
1945
|
+
out.push(`+ generichide exclusions (${network.generichideExclusions.length}): ${JSON.stringify(network.generichideExclusions, replacer, 2)}`);
|
|
1946
|
+
if ( result.specificCosmetic ) {
|
|
1947
|
+
out.push(`+ Cosmetic filters: ${result.specificCosmetic.size}`);
|
|
1948
|
+
for ( const details of result.specificCosmetic ) {
|
|
1949
|
+
out.push(` ${JSON.stringify(details)}`);
|
|
1950
|
+
}
|
|
1951
|
+
} else {
|
|
1952
|
+
out.push(' Cosmetic filters: 0');
|
|
1953
|
+
}
|
|
1954
|
+
callback(out.join('\n'));
|
|
1955
|
+
});
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
default:
|
|
1959
|
+
break;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
// Sync
|
|
1963
|
+
let response;
|
|
1964
|
+
|
|
1965
|
+
switch ( request.what ) {
|
|
1966
|
+
case 'snfeDump':
|
|
1967
|
+
response = staticNetFilteringEngine.dump();
|
|
1968
|
+
break;
|
|
1969
|
+
|
|
1970
|
+
case 'cfeDump':
|
|
1971
|
+
response = cosmeticFilteringEngine.dump();
|
|
1972
|
+
break;
|
|
1973
|
+
|
|
1974
|
+
default:
|
|
1975
|
+
return vAPI.messaging.UNHANDLED;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
callback(response);
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
vAPI.messaging.listen({
|
|
1982
|
+
name: 'devTools',
|
|
1983
|
+
listener: onMessage,
|
|
1984
|
+
privileged: true,
|
|
1985
|
+
});
|
|
1986
|
+
|
|
1987
|
+
// <<<<< end of local scope
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
/******************************************************************************/
|
|
1991
|
+
/******************************************************************************/
|
|
1992
|
+
|
|
1895
1993
|
// Channel:
|
|
1896
1994
|
// scriptlets
|
|
1897
1995
|
// unprivileged
|
|
@@ -2063,16 +2161,18 @@ const onMessage = function(request, sender, callback) {
|
|
|
2063
2161
|
case 'updateLists':
|
|
2064
2162
|
const listkeys = request.listkeys.split(',').filter(s => s !== '');
|
|
2065
2163
|
if ( listkeys.length === 0 ) { return; }
|
|
2066
|
-
|
|
2067
|
-
io.purge(
|
|
2068
|
-
|
|
2164
|
+
if ( listkeys.includes('all') ) {
|
|
2165
|
+
io.purge(/./, 'public_suffix_list.dat');
|
|
2166
|
+
} else {
|
|
2167
|
+
for ( const listkey of listkeys ) {
|
|
2168
|
+
io.purge(listkey);
|
|
2169
|
+
}
|
|
2069
2170
|
}
|
|
2070
|
-
µb.scheduleAssetUpdater(0);
|
|
2071
2171
|
µb.openNewTab({
|
|
2072
2172
|
url: 'dashboard.html#3p-filters.html',
|
|
2073
2173
|
select: true,
|
|
2074
2174
|
});
|
|
2075
|
-
|
|
2175
|
+
µb.scheduleAssetUpdater({ now: true, fetchDelay: 100, auto: request.auto });
|
|
2076
2176
|
break;
|
|
2077
2177
|
|
|
2078
2178
|
default:
|