@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) 2018-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -699,9 +699,12 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
699
699
|
const includeset = new Set();
|
|
700
700
|
let errorCount = 0;
|
|
701
701
|
|
|
702
|
+
const ifendifSet = new Set();
|
|
703
|
+
let ifendifSetChanged = false;
|
|
704
|
+
|
|
702
705
|
const extractMarkerDetails = (doc, lineHandle) => {
|
|
703
706
|
if ( astParser.isUnsupported() ) {
|
|
704
|
-
return {
|
|
707
|
+
return { lint: 'error', msg: 'Unsupported filter syntax' };
|
|
705
708
|
}
|
|
706
709
|
if ( astParser.hasError() ) {
|
|
707
710
|
let msg = 'Invalid filter';
|
|
@@ -739,7 +742,7 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
739
742
|
}
|
|
740
743
|
break;
|
|
741
744
|
}
|
|
742
|
-
return {
|
|
745
|
+
return { lint: 'error', msg };
|
|
743
746
|
}
|
|
744
747
|
if ( astParser.astType !== sfp.AST_TYPE_COMMENT ) { return; }
|
|
745
748
|
if ( astParser.astTypeFlavor !== sfp.AST_TYPE_COMMENT_PREPARSER ) {
|
|
@@ -747,15 +750,23 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
747
750
|
for ( const include of includeset ) {
|
|
748
751
|
if ( astParser.raw.endsWith(include) === false ) { continue; }
|
|
749
752
|
includeset.delete(include);
|
|
750
|
-
return {
|
|
753
|
+
return { lint: 'include-end' };
|
|
751
754
|
}
|
|
752
755
|
return;
|
|
753
756
|
}
|
|
754
757
|
if ( /^\s*!#if \S+/.test(astParser.raw) ) {
|
|
755
|
-
return {
|
|
758
|
+
return {
|
|
759
|
+
lint: 'if-start',
|
|
760
|
+
data: {
|
|
761
|
+
state: sfp.utils.preparser.evaluateExpr(
|
|
762
|
+
astParser.getTypeString(sfp.NODE_TYPE_PREPARSE_DIRECTIVE_IF_VALUE),
|
|
763
|
+
preparseDirectiveEnv
|
|
764
|
+
) ? 'y' : 'n'
|
|
765
|
+
}
|
|
766
|
+
};
|
|
756
767
|
}
|
|
757
768
|
if ( /^\s*!#endif\b/.test(astParser.raw) ) {
|
|
758
|
-
return {
|
|
769
|
+
return { lint: 'if-end' };
|
|
759
770
|
}
|
|
760
771
|
const match = /^\s*!#include\s*(\S+)/.exec(astParser.raw);
|
|
761
772
|
if ( match === null ) { return; }
|
|
@@ -765,7 +776,7 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
765
776
|
const includeToken = `/${match[1]}`;
|
|
766
777
|
if ( nextLineHandle.text.endsWith(includeToken) === false ) { return; }
|
|
767
778
|
includeset.add(includeToken);
|
|
768
|
-
return {
|
|
779
|
+
return { lint: 'include-start' };
|
|
769
780
|
};
|
|
770
781
|
|
|
771
782
|
const extractMarker = lineHandle => {
|
|
@@ -779,7 +790,7 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
779
790
|
'error': {
|
|
780
791
|
node: null,
|
|
781
792
|
html: [
|
|
782
|
-
'<div class="CodeMirror-lintmarker" data-lint="error"> ',
|
|
793
|
+
'<div class="CodeMirror-lintmarker" data-lint="error" data-error="y"> ',
|
|
783
794
|
'<span class="msg"></span>',
|
|
784
795
|
'</div>',
|
|
785
796
|
],
|
|
@@ -787,10 +798,11 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
787
798
|
'if-start': {
|
|
788
799
|
node: null,
|
|
789
800
|
html: [
|
|
790
|
-
'<div class="CodeMirror-lintmarker" data-lint="if" data-fold="start"> ',
|
|
801
|
+
'<div class="CodeMirror-lintmarker" data-lint="if" data-fold="start" data-state=""> ',
|
|
791
802
|
'<svg viewBox="0 0 100 100">',
|
|
792
803
|
'<polygon points="0,0 100,0 50,100" />',
|
|
793
804
|
'</svg>',
|
|
805
|
+
'<span class="msg">Mismatched if-endif directive</span>',
|
|
794
806
|
'</div>',
|
|
795
807
|
],
|
|
796
808
|
},
|
|
@@ -801,6 +813,7 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
801
813
|
'<svg viewBox="0 0 100 100">',
|
|
802
814
|
'<polygon points="50,0 100,100 0,100" />',
|
|
803
815
|
'</svg>',
|
|
816
|
+
'<span class="msg">Mismatched if-endif directive</span>',
|
|
804
817
|
'</div>',
|
|
805
818
|
],
|
|
806
819
|
},
|
|
@@ -826,41 +839,98 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
826
839
|
},
|
|
827
840
|
};
|
|
828
841
|
|
|
829
|
-
const markerFromTemplate =
|
|
830
|
-
const template = markerTemplates[
|
|
842
|
+
const markerFromTemplate = details => {
|
|
843
|
+
const template = markerTemplates[details.lint];
|
|
831
844
|
if ( template.node === null ) {
|
|
832
845
|
const domParser = new DOMParser();
|
|
833
846
|
const doc = domParser.parseFromString(template.html.join(''), 'text/html');
|
|
834
847
|
template.node = document.adoptNode(qs$(doc, '.CodeMirror-lintmarker'));
|
|
835
848
|
}
|
|
836
|
-
|
|
849
|
+
const node = template.node.cloneNode(true);
|
|
850
|
+
if ( details.data instanceof Object ) {
|
|
851
|
+
for ( const [ k, v ] of Object.entries(details.data) ) {
|
|
852
|
+
node.dataset[k] = `${v}`;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return node;
|
|
837
856
|
};
|
|
838
857
|
|
|
839
858
|
const addMarker = (doc, lineHandle, marker, details) => {
|
|
840
|
-
if ( marker
|
|
859
|
+
if ( marker && marker.dataset.lint !== details.lint ) {
|
|
841
860
|
doc.setGutterMarker(lineHandle, 'CodeMirror-lintgutter', null);
|
|
842
|
-
if ( marker.dataset.
|
|
861
|
+
if ( marker.dataset.error === 'y' ) {
|
|
843
862
|
errorCount -= 1;
|
|
844
863
|
}
|
|
864
|
+
if ( marker.dataset.lint === 'if' ) {
|
|
865
|
+
ifendifSet.delete(lineHandle);
|
|
866
|
+
ifendifSetChanged = true;
|
|
867
|
+
}
|
|
845
868
|
marker = null;
|
|
846
869
|
}
|
|
847
870
|
if ( marker === null ) {
|
|
848
|
-
marker = markerFromTemplate(details
|
|
871
|
+
marker = markerFromTemplate(details);
|
|
849
872
|
doc.setGutterMarker(lineHandle, 'CodeMirror-lintgutter', marker);
|
|
850
|
-
if (
|
|
873
|
+
if ( marker.dataset.error === 'y' ) {
|
|
851
874
|
errorCount += 1;
|
|
852
875
|
}
|
|
876
|
+
if ( marker.dataset.lint === 'if' ) {
|
|
877
|
+
ifendifSet.add(lineHandle);
|
|
878
|
+
ifendifSetChanged = true;
|
|
879
|
+
}
|
|
853
880
|
}
|
|
881
|
+
if ( typeof details.msg !== 'string' || details.msg === '' ) { return; }
|
|
854
882
|
const msgElem = qs$(marker, '.msg');
|
|
855
883
|
if ( msgElem === null ) { return; }
|
|
856
|
-
msgElem.textContent = details.msg
|
|
884
|
+
msgElem.textContent = details.msg;
|
|
857
885
|
};
|
|
858
886
|
|
|
859
887
|
const removeMarker = (doc, lineHandle, marker) => {
|
|
860
888
|
doc.setGutterMarker(lineHandle, 'CodeMirror-lintgutter', null);
|
|
861
|
-
if ( marker.dataset.
|
|
889
|
+
if ( marker.dataset.error === 'y' ) {
|
|
862
890
|
errorCount -= 1;
|
|
863
891
|
}
|
|
892
|
+
if ( marker.dataset.lint === 'if' ) {
|
|
893
|
+
ifendifSet.delete(lineHandle);
|
|
894
|
+
ifendifSetChanged = true;
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// Analyze whether all if-endif are properly paired
|
|
899
|
+
const processIfendifs = ( ) => {
|
|
900
|
+
if ( ifendifSet.size === 0 ) { return; }
|
|
901
|
+
if ( ifendifSetChanged !== true ) { return; }
|
|
902
|
+
const sortFn = (a, b) => a.lineNo() - b.lineNo();
|
|
903
|
+
const sorted = Array.from(ifendifSet).sort(sortFn);
|
|
904
|
+
const bad = [];
|
|
905
|
+
const stack = [];
|
|
906
|
+
for ( const line of sorted ) {
|
|
907
|
+
const marker = extractMarker(line);
|
|
908
|
+
const fold = marker.dataset.fold;
|
|
909
|
+
if ( fold === 'start' ) {
|
|
910
|
+
stack.push(line);
|
|
911
|
+
} else if ( fold === 'end' ) {
|
|
912
|
+
if ( stack.length !== 0 ) {
|
|
913
|
+
if ( marker.dataset.error === 'y' ) {
|
|
914
|
+
marker.dataset.error = '';
|
|
915
|
+
errorCount -= 1;
|
|
916
|
+
}
|
|
917
|
+
const ifstart = extractMarker(stack.pop());
|
|
918
|
+
if ( ifstart.dataset.error === 'y' ) {
|
|
919
|
+
ifstart.dataset.error = '';
|
|
920
|
+
errorCount -= 1;
|
|
921
|
+
}
|
|
922
|
+
} else {
|
|
923
|
+
bad.push(line);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
bad.push(...stack);
|
|
928
|
+
for ( const line of bad ) {
|
|
929
|
+
const marker = extractMarker(line);
|
|
930
|
+
marker.dataset.error = 'y';
|
|
931
|
+
errorCount += 1;
|
|
932
|
+
}
|
|
933
|
+
ifendifSetChanged = false;
|
|
864
934
|
};
|
|
865
935
|
|
|
866
936
|
const processDeletion = (doc, change) => {
|
|
@@ -868,10 +938,12 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
868
938
|
doc.eachLine(from.line, to.line, lineHandle => {
|
|
869
939
|
const marker = extractMarker(lineHandle);
|
|
870
940
|
if ( marker === null ) { return; }
|
|
871
|
-
if ( marker.dataset.
|
|
941
|
+
if ( marker.dataset.error === 'y' ) {
|
|
942
|
+
marker.dataset.error = '';
|
|
872
943
|
errorCount -= 1;
|
|
873
|
-
marker.dataset.lint = 'void';
|
|
874
944
|
}
|
|
945
|
+
ifendifSet.delete(lineHandle);
|
|
946
|
+
ifendifSetChanged = true;
|
|
875
947
|
});
|
|
876
948
|
};
|
|
877
949
|
|
|
@@ -881,10 +953,10 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
881
953
|
astParser.parse(lineHandle.text);
|
|
882
954
|
const markerDetails = extractMarkerDetails(doc, lineHandle);
|
|
883
955
|
const marker = extractMarker(lineHandle);
|
|
884
|
-
if ( markerDetails
|
|
885
|
-
removeMarker(doc, lineHandle, marker);
|
|
886
|
-
} else if ( markerDetails !== undefined ) {
|
|
956
|
+
if ( markerDetails !== undefined ) {
|
|
887
957
|
addMarker(doc, lineHandle, marker, markerDetails);
|
|
958
|
+
} else if ( marker !== null ) {
|
|
959
|
+
removeMarker(doc, lineHandle, marker);
|
|
888
960
|
}
|
|
889
961
|
from += 1;
|
|
890
962
|
if ( (from & 0x0F) !== 0 ) { return; }
|
|
@@ -910,6 +982,7 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
910
982
|
return processChangesetAsync(doc);
|
|
911
983
|
}
|
|
912
984
|
includeset.clear();
|
|
985
|
+
processIfendifs(doc);
|
|
913
986
|
CodeMirror.signal(doc.getEditor(), 'linterDone', { errorCount });
|
|
914
987
|
};
|
|
915
988
|
|
|
@@ -922,13 +995,14 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
|
922
995
|
};
|
|
923
996
|
|
|
924
997
|
const onChanges = (cm, changes) => {
|
|
998
|
+
if ( changes.length === 0 ) { return; }
|
|
925
999
|
const doc = cm.getDoc();
|
|
926
1000
|
for ( const change of changes ) {
|
|
927
1001
|
const from = change.from.line;
|
|
928
1002
|
const to = from + change.text.length;
|
|
929
1003
|
changeset.push({ from, to });
|
|
930
|
-
processChangesetAsync(doc);
|
|
931
1004
|
}
|
|
1005
|
+
processChangesetAsync(doc);
|
|
932
1006
|
};
|
|
933
1007
|
|
|
934
1008
|
const onBeforeChanges = (cm, change) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2017-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2019-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -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
|
|
@@ -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
|
|
@@ -1320,8 +1320,6 @@ vAPI.DOMFilterer = class {
|
|
|
1320
1320
|
vAPI.userStylesheet.apply();
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
|
-
// Library of resources is located at:
|
|
1324
|
-
// https://github.com/gorhill/uBlock/blob/master/assets/ublock/resources.txt
|
|
1325
1323
|
if ( scriptletDetails && typeof self.uBO_scriptletsInjected !== 'string' ) {
|
|
1326
1324
|
self.uBO_scriptletsInjected = scriptletDetails.filters;
|
|
1327
1325
|
if ( scriptletDetails.mainWorld ) {
|
|
@@ -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
|
|
@@ -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
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
/******************************************************************************/
|
|
25
25
|
|
|
26
|
-
import './utils.js';
|
|
27
26
|
import logger from './logger.js';
|
|
28
27
|
import µb from './background.js';
|
|
29
28
|
|
|
29
|
+
import { MRUCache } from './mrucache.js';
|
|
30
30
|
import { StaticExtFilteringHostnameDB } from './static-ext-filtering-db.js';
|
|
31
31
|
|
|
32
32
|
/******************************************************************************/
|
|
@@ -244,13 +244,13 @@ const FilterContainer = function() {
|
|
|
244
244
|
canonical: 'highGenericHideSimple',
|
|
245
245
|
dict: new Set(),
|
|
246
246
|
str: '',
|
|
247
|
-
mru: new
|
|
247
|
+
mru: new MRUCache(16)
|
|
248
248
|
};
|
|
249
249
|
this.highlyGeneric.complex = {
|
|
250
250
|
canonical: 'highGenericHideComplex',
|
|
251
251
|
dict: new Set(),
|
|
252
252
|
str: '',
|
|
253
|
-
mru: new
|
|
253
|
+
mru: new MRUCache(16)
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
// Short-lived: content is valid only during one function call. These
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -134,7 +134,7 @@ dom.on('#console-unfold', 'click', ( ) => {
|
|
|
134
134
|
dom.on('#snfe-dump', 'click', ev => {
|
|
135
135
|
const button = ev.target;
|
|
136
136
|
dom.attr(button, 'disabled', '');
|
|
137
|
-
vAPI.messaging.send('
|
|
137
|
+
vAPI.messaging.send('devTools', {
|
|
138
138
|
what: 'snfeDump',
|
|
139
139
|
}).then(result => {
|
|
140
140
|
log(result);
|
|
@@ -145,7 +145,7 @@ dom.on('#snfe-dump', 'click', ev => {
|
|
|
145
145
|
dom.on('#snfe-todnr', 'click', ev => {
|
|
146
146
|
const button = ev.target;
|
|
147
147
|
dom.attr(button, 'disabled', '');
|
|
148
|
-
vAPI.messaging.send('
|
|
148
|
+
vAPI.messaging.send('devTools', {
|
|
149
149
|
what: 'snfeToDNR',
|
|
150
150
|
}).then(result => {
|
|
151
151
|
log(result);
|
|
@@ -153,6 +153,25 @@ dom.on('#snfe-todnr', 'click', ev => {
|
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
dom.on('#cfe-dump', 'click', ev => {
|
|
157
|
+
const button = ev.target;
|
|
158
|
+
dom.attr(button, 'disabled', '');
|
|
159
|
+
vAPI.messaging.send('devTools', {
|
|
160
|
+
what: 'cfeDump',
|
|
161
|
+
}).then(result => {
|
|
162
|
+
log(result);
|
|
163
|
+
dom.attr(button, 'disabled', null);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
dom.on('#purge-all-caches', 'click', ( ) => {
|
|
168
|
+
vAPI.messaging.send('devTools', {
|
|
169
|
+
what: 'purgeAllCaches'
|
|
170
|
+
}).then(result => {
|
|
171
|
+
log(result);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
156
175
|
vAPI.messaging.send('dashboard', {
|
|
157
176
|
what: 'getAppData',
|
|
158
177
|
}).then(appData => {
|
|
@@ -161,7 +180,7 @@ vAPI.messaging.send('dashboard', {
|
|
|
161
180
|
dom.on('#snfe-benchmark', 'click', ev => {
|
|
162
181
|
const button = ev.target;
|
|
163
182
|
dom.attr(button, 'disabled', '');
|
|
164
|
-
vAPI.messaging.send('
|
|
183
|
+
vAPI.messaging.send('devTools', {
|
|
165
184
|
what: 'snfeBenchmark',
|
|
166
185
|
}).then(result => {
|
|
167
186
|
log(result);
|
|
@@ -170,15 +189,4 @@ vAPI.messaging.send('dashboard', {
|
|
|
170
189
|
});
|
|
171
190
|
});
|
|
172
191
|
|
|
173
|
-
dom.on('#cfe-dump', 'click', ev => {
|
|
174
|
-
const button = ev.target;
|
|
175
|
-
dom.attr(button, 'disabled', '');
|
|
176
|
-
vAPI.messaging.send('dashboard', {
|
|
177
|
-
what: 'cfeDump',
|
|
178
|
-
}).then(result => {
|
|
179
|
-
log(result);
|
|
180
|
-
dom.attr(button, 'disabled', null);
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
192
|
/******************************************************************************/
|
|
@@ -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
|
|
@@ -191,7 +191,7 @@ async function fetchPatchDetailsFromCDNs(assetDetails) {
|
|
|
191
191
|
const patchURL = resolveURL(patchPath, cdnURL);
|
|
192
192
|
if ( patchURL === undefined ) { continue; }
|
|
193
193
|
const response = await fetch(patchURL).catch(reason => {
|
|
194
|
-
console.error(reason);
|
|
194
|
+
console.error(reason, patchURL);
|
|
195
195
|
});
|
|
196
196
|
if ( response === undefined ) { continue; }
|
|
197
197
|
if ( response.status === 404 ) { break; }
|
|
@@ -271,7 +271,7 @@ async function fetchAndApplyAllPatches(assetDetails) {
|
|
|
271
271
|
const bc = new globalThis.BroadcastChannel('diffUpdater');
|
|
272
272
|
|
|
273
273
|
bc.onmessage = ev => {
|
|
274
|
-
const message = ev.data;
|
|
274
|
+
const message = ev.data || {};
|
|
275
275
|
switch ( message.what ) {
|
|
276
276
|
case 'update':
|
|
277
277
|
fetchAndApplyAllPatches(message).then(response => {
|
|
@@ -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
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
|
+
Copyright (C) 2014-present Raymond Hill
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
18
|
+
|
|
19
|
+
Home: https://github.com/gorhill/uBlock
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
'use strict';
|
|
23
|
+
|
|
24
|
+
/******************************************************************************/
|
|
25
|
+
/******************************************************************************/
|
|
26
|
+
|
|
27
|
+
const svgRoot = document.querySelector('svg');
|
|
28
|
+
let inspectorContentPort;
|
|
29
|
+
|
|
30
|
+
const shutdown = ( ) => {
|
|
31
|
+
inspectorContentPort.close();
|
|
32
|
+
inspectorContentPort.onmessage = inspectorContentPort.onmessageerror = null;
|
|
33
|
+
inspectorContentPort = undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const contentInspectorChannel = ev => {
|
|
37
|
+
const msg = ev.data || {};
|
|
38
|
+
switch ( msg.what ) {
|
|
39
|
+
case 'quitInspector': {
|
|
40
|
+
shutdown();
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'svgPaths': {
|
|
44
|
+
const paths = svgRoot.children;
|
|
45
|
+
paths[0].setAttribute('d', msg.paths[0]);
|
|
46
|
+
paths[1].setAttribute('d', msg.paths[1]);
|
|
47
|
+
paths[2].setAttribute('d', msg.paths[2]);
|
|
48
|
+
paths[3].setAttribute('d', msg.paths[3]);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Wait for the content script to establish communication
|
|
57
|
+
globalThis.addEventListener('message', ev => {
|
|
58
|
+
const msg = ev.data || {};
|
|
59
|
+
if ( msg.what !== 'startInspector' ) { return; }
|
|
60
|
+
if ( Array.isArray(ev.ports) === false ) { return; }
|
|
61
|
+
if ( ev.ports.length === 0 ) { return; }
|
|
62
|
+
inspectorContentPort = ev.ports[0];
|
|
63
|
+
inspectorContentPort.onmessage = contentInspectorChannel;
|
|
64
|
+
inspectorContentPort.onmessageerror = shutdown;
|
|
65
|
+
inspectorContentPort.postMessage({ what: 'startInspector' });
|
|
66
|
+
}, { once: true });
|
|
67
|
+
|
|
68
|
+
/******************************************************************************/
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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-2018 Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|