@browserless.io/browserless 2.0.0-beta-1
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/CHANGELOG.md +674 -0
- package/LICENSE +6 -0
- package/README.md +132 -0
- package/assets/logo.png +0 -0
- package/bin/browserless.js +227 -0
- package/browser.json +7 -0
- package/build/browserless.d.ts +33 -0
- package/build/browserless.js +146 -0
- package/build/browsers/cdp-chromium.d.ts +41 -0
- package/build/browsers/cdp-chromium.js +287 -0
- package/build/browsers/index.d.ts +26 -0
- package/build/browsers/index.js +183 -0
- package/build/browsers/playwright-chromium.d.ts +34 -0
- package/build/browsers/playwright-chromium.js +106 -0
- package/build/browsers/playwright-firefox.d.ts +34 -0
- package/build/browsers/playwright-firefox.js +101 -0
- package/build/browsers/playwright-webkit.d.ts +34 -0
- package/build/browsers/playwright-webkit.js +101 -0
- package/build/config.d.ts +138 -0
- package/build/config.js +349 -0
- package/build/constants.d.ts +4 -0
- package/build/constants.js +4 -0
- package/build/data/classes.json +1 -0
- package/build/data/selectors.json +1 -0
- package/build/exports.d.ts +20 -0
- package/build/exports.js +22 -0
- package/build/file-system.d.ts +24 -0
- package/build/file-system.js +46 -0
- package/build/hooks.d.ts +5 -0
- package/build/hooks.js +20 -0
- package/build/http.d.ts +175 -0
- package/build/http.js +104 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +39 -0
- package/build/limiter.d.ts +24 -0
- package/build/limiter.js +147 -0
- package/build/limiter.spec.d.ts +1 -0
- package/build/limiter.spec.js +241 -0
- package/build/metrics.d.ts +24 -0
- package/build/metrics.js +86 -0
- package/build/metrics.spec.d.ts +1 -0
- package/build/metrics.spec.js +35 -0
- package/build/mime-types.d.ts +1 -0
- package/build/mime-types.js +328 -0
- package/build/monitoring.d.ts +13 -0
- package/build/monitoring.js +38 -0
- package/build/routes/chromium/http/content-post.body.json +514 -0
- package/build/routes/chromium/http/content-post.d.ts +34 -0
- package/build/routes/chromium/http/content-post.js +109 -0
- package/build/routes/chromium/http/content-post.query.json +183 -0
- package/build/routes/chromium/http/content-post.response.json +5 -0
- package/build/routes/chromium/http/download-post.body.json +32 -0
- package/build/routes/chromium/http/download-post.d.ts +16 -0
- package/build/routes/chromium/http/download-post.js +92 -0
- package/build/routes/chromium/http/download-post.query.json +120 -0
- package/build/routes/chromium/http/download-post.response.json +4 -0
- package/build/routes/chromium/http/function-post.body.json +32 -0
- package/build/routes/chromium/http/function-post.d.ts +18 -0
- package/build/routes/chromium/http/function-post.js +53 -0
- package/build/routes/chromium/http/function-post.query.json +120 -0
- package/build/routes/chromium/http/function-post.response.json +4 -0
- package/build/routes/chromium/http/pdf-post.body.json +654 -0
- package/build/routes/chromium/http/pdf-post.d.ts +35 -0
- package/build/routes/chromium/http/pdf-post.js +107 -0
- package/build/routes/chromium/http/pdf-post.query.json +120 -0
- package/build/routes/chromium/http/pdf-post.response.json +5 -0
- package/build/routes/chromium/http/performance.body.json +26 -0
- package/build/routes/chromium/http/performance.d.ts +17 -0
- package/build/routes/chromium/http/performance.js +30 -0
- package/build/routes/chromium/http/performance.query.json +120 -0
- package/build/routes/chromium/http/performance.response.json +7 -0
- package/build/routes/chromium/http/scrape-post.body.json +561 -0
- package/build/routes/chromium/http/scrape-post.d.ts +106 -0
- package/build/routes/chromium/http/scrape-post.js +205 -0
- package/build/routes/chromium/http/scrape-post.query.json +183 -0
- package/build/routes/chromium/http/scrape-post.response.json +325 -0
- package/build/routes/chromium/http/screenshot-post.body.json +604 -0
- package/build/routes/chromium/http/screenshot-post.d.ts +37 -0
- package/build/routes/chromium/http/screenshot-post.js +124 -0
- package/build/routes/chromium/http/screenshot-post.query.json +120 -0
- package/build/routes/chromium/http/screenshot-post.response.json +5 -0
- package/build/routes/chromium/tests/content.spec.d.ts +1 -0
- package/build/routes/chromium/tests/content.spec.js +285 -0
- package/build/routes/chromium/tests/download.spec.d.ts +1 -0
- package/build/routes/chromium/tests/download.spec.js +67 -0
- package/build/routes/chromium/tests/function.spec.d.ts +1 -0
- package/build/routes/chromium/tests/function.spec.js +245 -0
- package/build/routes/chromium/tests/pdf.spec.d.ts +1 -0
- package/build/routes/chromium/tests/pdf.spec.js +333 -0
- package/build/routes/chromium/tests/performance.spec.d.ts +1 -0
- package/build/routes/chromium/tests/performance.spec.js +124 -0
- package/build/routes/chromium/tests/scrape.spec.d.ts +1 -0
- package/build/routes/chromium/tests/scrape.spec.js +354 -0
- package/build/routes/chromium/tests/screenshot.spec.d.ts +1 -0
- package/build/routes/chromium/tests/screenshot.spec.js +339 -0
- package/build/routes/chromium/tests/websocket.spec.d.ts +1 -0
- package/build/routes/chromium/tests/websocket.spec.js +309 -0
- package/build/routes/chromium/utils/function/client.d.ts +26 -0
- package/build/routes/chromium/utils/function/client.js +66 -0
- package/build/routes/chromium/utils/function/handler.d.ts +18 -0
- package/build/routes/chromium/utils/function/handler.js +95 -0
- package/build/routes/chromium/utils/performance/child.d.ts +1 -0
- package/build/routes/chromium/utils/performance/child.js +29 -0
- package/build/routes/chromium/utils/performance/main.d.ts +3 -0
- package/build/routes/chromium/utils/performance/main.js +65 -0
- package/build/routes/chromium/utils/performance/types.d.ts +21 -0
- package/build/routes/chromium/utils/performance/types.js +1 -0
- package/build/routes/chromium/ws/browser.d.ts +6 -0
- package/build/routes/chromium/ws/browser.js +11 -0
- package/build/routes/chromium/ws/browser.query.json +120 -0
- package/build/routes/chromium/ws/cdp-chromium.d.ts +6 -0
- package/build/routes/chromium/ws/cdp-chromium.js +11 -0
- package/build/routes/chromium/ws/cdp-chromium.query.json +120 -0
- package/build/routes/chromium/ws/page.d.ts +6 -0
- package/build/routes/chromium/ws/page.js +11 -0
- package/build/routes/chromium/ws/page.query.json +120 -0
- package/build/routes/chromium/ws/playwright-chromium.d.ts +6 -0
- package/build/routes/chromium/ws/playwright-chromium.js +19 -0
- package/build/routes/chromium/ws/playwright-chromium.query.json +100 -0
- package/build/routes/firefox/tests/websocket.spec.d.ts +1 -0
- package/build/routes/firefox/tests/websocket.spec.js +104 -0
- package/build/routes/firefox/ws/playwright-firefox.d.ts +6 -0
- package/build/routes/firefox/ws/playwright-firefox.js +19 -0
- package/build/routes/firefox/ws/playwright-firefox.query.json +100 -0
- package/build/routes/management/http/config-get.d.ts +25 -0
- package/build/routes/management/http/config-get.js +43 -0
- package/build/routes/management/http/config-get.response.json +107 -0
- package/build/routes/management/http/metrics-get.d.ts +4 -0
- package/build/routes/management/http/metrics-get.js +24 -0
- package/build/routes/management/http/metrics-get.response.json +94 -0
- package/build/routes/management/http/metrics-total-get.d.ts +4 -0
- package/build/routes/management/http/metrics-total-get.js +60 -0
- package/build/routes/management/http/metrics-total-get.response.json +72 -0
- package/build/routes/management/http/sessions-get.d.ts +4 -0
- package/build/routes/management/http/sessions-get.js +21 -0
- package/build/routes/management/http/sessions-get.response.json +221 -0
- package/build/routes/management/http/static-get.d.ts +3 -0
- package/build/routes/management/http/static-get.js +67 -0
- package/build/routes/management/tests/management.spec.d.ts +1 -0
- package/build/routes/management/tests/management.spec.js +41 -0
- package/build/routes/webkit/tests/websocket.spec.d.ts +1 -0
- package/build/routes/webkit/tests/websocket.spec.js +104 -0
- package/build/routes/webkit/ws/playwright-webkit.d.ts +6 -0
- package/build/routes/webkit/ws/playwright-webkit.js +19 -0
- package/build/routes/webkit/ws/playwright-webkit.query.json +100 -0
- package/build/server.d.ts +38 -0
- package/build/server.js +365 -0
- package/build/shim.d.ts +9 -0
- package/build/shim.js +54 -0
- package/build/shim.spec.d.ts +1 -0
- package/build/shim.spec.js +114 -0
- package/build/types.d.ts +360 -0
- package/build/types.js +6 -0
- package/build/utils.d.ts +111 -0
- package/build/utils.js +570 -0
- package/build/webhooks.d.ts +11 -0
- package/build/webhooks.js +43 -0
- package/docker/base/.dockerignore +16 -0
- package/docker/base/Dockerfile +70 -0
- package/docker/chrome/.dockerignore +16 -0
- package/docker/chrome/Dockerfile +40 -0
- package/docker/firefox/.dockerignore +16 -0
- package/docker/firefox/Dockerfile +39 -0
- package/docker/multi/.dockerignore +16 -0
- package/docker/multi/Dockerfile +37 -0
- package/docker/sdk/.dockerignore +16 -0
- package/docker/sdk/Dockerfile +34 -0
- package/docker/webkit/.dockerignore +16 -0
- package/docker/webkit/Dockerfile +40 -0
- package/extensions/screencast/background.js +143 -0
- package/extensions/screencast/content_script.js +18 -0
- package/extensions/screencast/manifest.json +19 -0
- package/extensions/ublock/1p-filters.html +69 -0
- package/extensions/ublock/3p-filters.html +119 -0
- package/extensions/ublock/LICENSE.txt +674 -0
- package/extensions/ublock/_locales/ar/messages.json +1290 -0
- package/extensions/ublock/_locales/az/messages.json +1290 -0
- package/extensions/ublock/_locales/be/messages.json +1290 -0
- package/extensions/ublock/_locales/bg/messages.json +1290 -0
- package/extensions/ublock/_locales/bn/messages.json +1290 -0
- package/extensions/ublock/_locales/br_FR/messages.json +1290 -0
- package/extensions/ublock/_locales/bs/messages.json +1290 -0
- package/extensions/ublock/_locales/ca/messages.json +1290 -0
- package/extensions/ublock/_locales/cs/messages.json +1290 -0
- package/extensions/ublock/_locales/cv/messages.json +1290 -0
- package/extensions/ublock/_locales/da/messages.json +1290 -0
- package/extensions/ublock/_locales/de/messages.json +1290 -0
- package/extensions/ublock/_locales/el/messages.json +1290 -0
- package/extensions/ublock/_locales/en/messages.json +1292 -0
- package/extensions/ublock/_locales/en_GB/messages.json +1290 -0
- package/extensions/ublock/_locales/eo/messages.json +1290 -0
- package/extensions/ublock/_locales/es/messages.json +1290 -0
- package/extensions/ublock/_locales/et/messages.json +1290 -0
- package/extensions/ublock/_locales/eu/messages.json +1290 -0
- package/extensions/ublock/_locales/fa/messages.json +1290 -0
- package/extensions/ublock/_locales/fi/messages.json +1290 -0
- package/extensions/ublock/_locales/fil/messages.json +1290 -0
- package/extensions/ublock/_locales/fr/messages.json +1290 -0
- package/extensions/ublock/_locales/fy/messages.json +1290 -0
- package/extensions/ublock/_locales/gl/messages.json +1290 -0
- package/extensions/ublock/_locales/gu/messages.json +1290 -0
- package/extensions/ublock/_locales/he/messages.json +1290 -0
- package/extensions/ublock/_locales/hi/messages.json +1290 -0
- package/extensions/ublock/_locales/hr/messages.json +1290 -0
- package/extensions/ublock/_locales/hu/messages.json +1290 -0
- package/extensions/ublock/_locales/hy/messages.json +1290 -0
- package/extensions/ublock/_locales/id/messages.json +1290 -0
- package/extensions/ublock/_locales/it/messages.json +1290 -0
- package/extensions/ublock/_locales/ja/messages.json +1290 -0
- package/extensions/ublock/_locales/ka/messages.json +1290 -0
- package/extensions/ublock/_locales/kk/messages.json +1290 -0
- package/extensions/ublock/_locales/kn/messages.json +1290 -0
- package/extensions/ublock/_locales/ko/messages.json +1290 -0
- package/extensions/ublock/_locales/ku/messages.json +1290 -0
- package/extensions/ublock/_locales/lt/messages.json +1290 -0
- package/extensions/ublock/_locales/lv/messages.json +1290 -0
- package/extensions/ublock/_locales/mk/messages.json +1290 -0
- package/extensions/ublock/_locales/ml/messages.json +1290 -0
- package/extensions/ublock/_locales/mr/messages.json +1290 -0
- package/extensions/ublock/_locales/ms/messages.json +1290 -0
- package/extensions/ublock/_locales/nb/messages.json +1290 -0
- package/extensions/ublock/_locales/nl/messages.json +1290 -0
- package/extensions/ublock/_locales/no/messages.json +1290 -0
- package/extensions/ublock/_locales/oc/messages.json +1290 -0
- package/extensions/ublock/_locales/pa/messages.json +1290 -0
- package/extensions/ublock/_locales/pl/messages.json +1290 -0
- package/extensions/ublock/_locales/pt_BR/messages.json +1290 -0
- package/extensions/ublock/_locales/pt_PT/messages.json +1290 -0
- package/extensions/ublock/_locales/ro/messages.json +1290 -0
- package/extensions/ublock/_locales/ru/messages.json +1290 -0
- package/extensions/ublock/_locales/si/messages.json +1290 -0
- package/extensions/ublock/_locales/sk/messages.json +1290 -0
- package/extensions/ublock/_locales/sl/messages.json +1290 -0
- package/extensions/ublock/_locales/so/messages.json +1290 -0
- package/extensions/ublock/_locales/sq/messages.json +1290 -0
- package/extensions/ublock/_locales/sr/messages.json +1290 -0
- package/extensions/ublock/_locales/sv/messages.json +1290 -0
- package/extensions/ublock/_locales/sw/messages.json +1290 -0
- package/extensions/ublock/_locales/ta/messages.json +1290 -0
- package/extensions/ublock/_locales/te/messages.json +1290 -0
- package/extensions/ublock/_locales/th/messages.json +1290 -0
- package/extensions/ublock/_locales/tr/messages.json +1290 -0
- package/extensions/ublock/_locales/uk/messages.json +1290 -0
- package/extensions/ublock/_locales/ur/messages.json +1290 -0
- package/extensions/ublock/_locales/vi/messages.json +1290 -0
- package/extensions/ublock/_locales/zh_CN/messages.json +1290 -0
- package/extensions/ublock/_locales/zh_TW/messages.json +1290 -0
- package/extensions/ublock/about.html +63 -0
- package/extensions/ublock/advanced-settings.html +42 -0
- package/extensions/ublock/asset-viewer.html +50 -0
- package/extensions/ublock/assets/assets.json +903 -0
- package/extensions/ublock/assets/resources/scriptlets.js +4255 -0
- package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +65576 -0
- package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +33219 -0
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/README.md +29 -0
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +3732 -0
- package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +15431 -0
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/LICENSE.md +42 -0
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +1970 -0
- package/extensions/ublock/assets/ublock/badlists.txt +77 -0
- package/extensions/ublock/assets/ublock/badware.min.txt +3033 -0
- package/extensions/ublock/assets/ublock/filters.min.txt +23419 -0
- package/extensions/ublock/assets/ublock/privacy.min.txt +575 -0
- package/extensions/ublock/assets/ublock/quick-fixes.min.txt +99 -0
- package/extensions/ublock/assets/ublock/unbreak.min.txt +2448 -0
- package/extensions/ublock/background.html +12 -0
- package/extensions/ublock/cloud-ui.html +23 -0
- package/extensions/ublock/code-viewer.html +53 -0
- package/extensions/ublock/css/1p-filters.css +26 -0
- package/extensions/ublock/css/3p-filters.css +250 -0
- package/extensions/ublock/css/about.css +3 -0
- package/extensions/ublock/css/advanced-settings.css +26 -0
- package/extensions/ublock/css/asset-viewer.css +79 -0
- package/extensions/ublock/css/click2load.css +53 -0
- package/extensions/ublock/css/cloud-ui.css +104 -0
- package/extensions/ublock/css/code-viewer.css +67 -0
- package/extensions/ublock/css/codemirror.css +326 -0
- package/extensions/ublock/css/common.css +347 -0
- package/extensions/ublock/css/dashboard-common.css +55 -0
- package/extensions/ublock/css/dashboard.css +115 -0
- package/extensions/ublock/css/devtools.css +22 -0
- package/extensions/ublock/css/document-blocked.css +146 -0
- package/extensions/ublock/css/dyna-rules.css +79 -0
- package/extensions/ublock/css/epicker-ui.css +270 -0
- package/extensions/ublock/css/fa-icons.css +149 -0
- package/extensions/ublock/css/fonts/Inter/Inter-Regular.woff2 +0 -0
- package/extensions/ublock/css/fonts/Inter/Inter-SemiBold.woff2 +0 -0
- package/extensions/ublock/css/fonts/Inter/LICENSE.txt +93 -0
- package/extensions/ublock/css/fonts/Metropolis/Metropolis-Regular.woff2 +0 -0
- package/extensions/ublock/css/fonts/Metropolis/Metropolis-SemiBold.woff2 +0 -0
- package/extensions/ublock/css/fonts/Metropolis/README.md +25 -0
- package/extensions/ublock/css/fonts/Metropolis/UNLICENSE +24 -0
- package/extensions/ublock/css/logger-ui-inspector.css +116 -0
- package/extensions/ublock/css/logger-ui.css +978 -0
- package/extensions/ublock/css/popup-fenix.css +778 -0
- package/extensions/ublock/css/settings.css +74 -0
- package/extensions/ublock/css/support.css +110 -0
- package/extensions/ublock/css/themes/default.css +526 -0
- package/extensions/ublock/css/whitelist.css +22 -0
- package/extensions/ublock/dashboard.html +47 -0
- package/extensions/ublock/devtools.html +58 -0
- package/extensions/ublock/document-blocked.html +64 -0
- package/extensions/ublock/dyna-rules.html +67 -0
- package/extensions/ublock/img/cloud.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/README +9 -0
- package/extensions/ublock/img/flags-of-the-world/ad.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ae.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/af.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ag.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ai.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/al.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/am.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ao.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/aq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ar.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/as.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/at.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/au.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/aw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ax.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/az.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ba.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/be.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/br.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/by.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ca.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ch.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ci.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ck.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/co.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/de.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/do.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ec.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ee.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/eg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/eh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/er.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/es.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/et.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ga.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-eng.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-nir.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-sct.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-wls.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ge.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ht.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/id.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ie.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/il.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/im.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/in.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/io.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/iq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ir.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/is.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/it.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/je.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ke.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ki.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/km.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ky.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/la.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/li.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ls.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ly.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ma.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/md.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/me.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ml.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ms.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/my.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/na.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ne.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ng.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ni.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/no.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/np.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/om.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pe.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ph.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ps.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/py.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/qa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/re.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ro.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/rs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ru.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/rw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/se.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/si.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/so.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ss.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/st.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/td.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/th.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/to.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ua.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ug.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/um.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/us.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/uy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/uz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/va.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ve.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/wf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ws.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/xk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ye.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/yt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/za.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/zm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/zw.png +0 -0
- package/extensions/ublock/img/fontawesome/LICENSE.txt +25 -0
- package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +79 -0
- package/extensions/ublock/img/help16.png +0 -0
- package/extensions/ublock/img/icon_128.png +0 -0
- package/extensions/ublock/img/icon_16-loading.png +0 -0
- package/extensions/ublock/img/icon_16-off.png +0 -0
- package/extensions/ublock/img/icon_16.png +0 -0
- package/extensions/ublock/img/icon_32-loading.png +0 -0
- package/extensions/ublock/img/icon_32-off.png +0 -0
- package/extensions/ublock/img/icon_32.png +0 -0
- package/extensions/ublock/img/icon_64-loading.png +0 -0
- package/extensions/ublock/img/icon_64-off.png +0 -0
- package/extensions/ublock/img/icon_64.png +0 -0
- package/extensions/ublock/img/material-design.svg +16 -0
- package/extensions/ublock/img/photon.svg +16 -0
- package/extensions/ublock/img/ublock-defs.svg +27 -0
- package/extensions/ublock/img/ublock.svg +44 -0
- package/extensions/ublock/is-webrtc-supported.html +9 -0
- package/extensions/ublock/js/1p-filters.js +336 -0
- package/extensions/ublock/js/3p-filters.js +867 -0
- package/extensions/ublock/js/about.js +34 -0
- package/extensions/ublock/js/advanced-settings.js +194 -0
- package/extensions/ublock/js/asset-viewer.js +112 -0
- package/extensions/ublock/js/assets.js +1448 -0
- package/extensions/ublock/js/background.js +404 -0
- package/extensions/ublock/js/base64-custom.js +246 -0
- package/extensions/ublock/js/benchmarks.js +421 -0
- package/extensions/ublock/js/biditrie.js +947 -0
- package/extensions/ublock/js/cachestorage.js +510 -0
- package/extensions/ublock/js/click2load.js +60 -0
- package/extensions/ublock/js/cloud-ui.js +238 -0
- package/extensions/ublock/js/code-viewer.js +311 -0
- package/extensions/ublock/js/codemirror/search-thread.js +199 -0
- package/extensions/ublock/js/codemirror/search.js +504 -0
- package/extensions/ublock/js/codemirror/ubo-dynamic-filtering.js +239 -0
- package/extensions/ublock/js/codemirror/ubo-static-filtering.js +1126 -0
- package/extensions/ublock/js/commands.js +181 -0
- package/extensions/ublock/js/console.js +59 -0
- package/extensions/ublock/js/contentscript-extra.js +662 -0
- package/extensions/ublock/js/contentscript.js +1366 -0
- package/extensions/ublock/js/contextmenu.js +270 -0
- package/extensions/ublock/js/cosmetic-filtering.js +983 -0
- package/extensions/ublock/js/dashboard-common.js +215 -0
- package/extensions/ublock/js/dashboard.js +166 -0
- package/extensions/ublock/js/devtools.js +184 -0
- package/extensions/ublock/js/diff-updater.js +288 -0
- package/extensions/ublock/js/document-blocked.js +230 -0
- package/extensions/ublock/js/dom.js +213 -0
- package/extensions/ublock/js/dyna-rules.js +678 -0
- package/extensions/ublock/js/dynamic-net-filtering.js +488 -0
- package/extensions/ublock/js/epicker-ui.js +924 -0
- package/extensions/ublock/js/fa-icons.js +129 -0
- package/extensions/ublock/js/filtering-context.js +461 -0
- package/extensions/ublock/js/filtering-engines.js +50 -0
- package/extensions/ublock/js/hnswitches.js +289 -0
- package/extensions/ublock/js/hntrie.js +780 -0
- package/extensions/ublock/js/html-filtering.js +465 -0
- package/extensions/ublock/js/httpheader-filtering.js +213 -0
- package/extensions/ublock/js/i18n.js +346 -0
- package/extensions/ublock/js/is-webrtc-supported.js +52 -0
- package/extensions/ublock/js/logger-ui-inspector.js +652 -0
- package/extensions/ublock/js/logger-ui.js +3028 -0
- package/extensions/ublock/js/logger.js +84 -0
- package/extensions/ublock/js/lz4.js +190 -0
- package/extensions/ublock/js/messaging.js +2095 -0
- package/extensions/ublock/js/pagestore.js +1140 -0
- package/extensions/ublock/js/popup-fenix.js +1529 -0
- package/extensions/ublock/js/redirect-engine.js +494 -0
- package/extensions/ublock/js/redirect-resources.js +193 -0
- package/extensions/ublock/js/reverselookup-worker.js +287 -0
- package/extensions/ublock/js/reverselookup.js +223 -0
- package/extensions/ublock/js/scriptlet-filtering.js +556 -0
- package/extensions/ublock/js/scriptlets/cosmetic-logger.js +376 -0
- package/extensions/ublock/js/scriptlets/cosmetic-off.js +48 -0
- package/extensions/ublock/js/scriptlets/cosmetic-on.js +48 -0
- package/extensions/ublock/js/scriptlets/cosmetic-report.js +142 -0
- package/extensions/ublock/js/scriptlets/dom-inspector.js +906 -0
- package/extensions/ublock/js/scriptlets/dom-survey-elements.js +72 -0
- package/extensions/ublock/js/scriptlets/dom-survey-scripts.js +126 -0
- package/extensions/ublock/js/scriptlets/epicker.js +1365 -0
- package/extensions/ublock/js/scriptlets/load-3p-css.js +67 -0
- package/extensions/ublock/js/scriptlets/load-large-media-all.js +62 -0
- package/extensions/ublock/js/scriptlets/load-large-media-interactive.js +299 -0
- package/extensions/ublock/js/scriptlets/noscript-spoof.js +89 -0
- package/extensions/ublock/js/scriptlets/should-inject-contentscript.js +40 -0
- package/extensions/ublock/js/scriptlets/subscriber.js +113 -0
- package/extensions/ublock/js/scriptlets/updater.js +101 -0
- package/extensions/ublock/js/settings.js +317 -0
- package/extensions/ublock/js/start.js +509 -0
- package/extensions/ublock/js/static-dnr-filtering.js +497 -0
- package/extensions/ublock/js/static-ext-filtering-db.js +171 -0
- package/extensions/ublock/js/static-ext-filtering.js +184 -0
- package/extensions/ublock/js/static-filtering-io.js +144 -0
- package/extensions/ublock/js/static-filtering-parser.js +4459 -0
- package/extensions/ublock/js/static-net-filtering.js +5631 -0
- package/extensions/ublock/js/storage.js +1683 -0
- package/extensions/ublock/js/support.js +335 -0
- package/extensions/ublock/js/tab.js +1178 -0
- package/extensions/ublock/js/tasks.js +42 -0
- package/extensions/ublock/js/text-encode.js +275 -0
- package/extensions/ublock/js/text-utils.js +107 -0
- package/extensions/ublock/js/theme.js +151 -0
- package/extensions/ublock/js/traffic.js +1260 -0
- package/extensions/ublock/js/ublock.js +696 -0
- package/extensions/ublock/js/uri-utils.js +175 -0
- package/extensions/ublock/js/url-net-filtering.js +336 -0
- package/extensions/ublock/js/utils.js +208 -0
- package/extensions/ublock/js/vapi-background-ext.js +254 -0
- package/extensions/ublock/js/vapi-background.js +1802 -0
- package/extensions/ublock/js/vapi-client-extra.js +312 -0
- package/extensions/ublock/js/vapi-client.js +280 -0
- package/extensions/ublock/js/vapi-common.js +308 -0
- package/extensions/ublock/js/vapi.js +89 -0
- package/extensions/ublock/js/wasm/README.md +24 -0
- package/extensions/ublock/js/wasm/biditrie.wasm +0 -0
- package/extensions/ublock/js/wasm/biditrie.wat +728 -0
- package/extensions/ublock/js/wasm/hntrie.wasm +0 -0
- package/extensions/ublock/js/wasm/hntrie.wat +724 -0
- package/extensions/ublock/js/webext.js +164 -0
- package/extensions/ublock/js/whitelist.js +258 -0
- package/extensions/ublock/lib/codemirror/LICENSE +21 -0
- package/extensions/ublock/lib/codemirror/README.md +47 -0
- package/extensions/ublock/lib/codemirror/addon/comment/comment.js +211 -0
- package/extensions/ublock/lib/codemirror/addon/display/panel.js +133 -0
- package/extensions/ublock/lib/codemirror/addon/edit/closebrackets.js +201 -0
- package/extensions/ublock/lib/codemirror/addon/edit/matchbrackets.js +160 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldcode.js +157 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldgutter.css +20 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldgutter.js +163 -0
- package/extensions/ublock/lib/codemirror/addon/hint/show-hint.css +36 -0
- package/extensions/ublock/lib/codemirror/addon/hint/show-hint.js +509 -0
- package/extensions/ublock/lib/codemirror/addon/merge/merge.css +119 -0
- package/extensions/ublock/lib/codemirror/addon/merge/merge.js +1006 -0
- package/extensions/ublock/lib/codemirror/addon/scroll/annotatescrollbar.js +128 -0
- package/extensions/ublock/lib/codemirror/addon/search/matchesonscrollbar.css +8 -0
- package/extensions/ublock/lib/codemirror/addon/search/searchcursor.js +296 -0
- package/extensions/ublock/lib/codemirror/addon/selection/active-line.js +72 -0
- package/extensions/ublock/lib/codemirror/lib/codemirror.css +350 -0
- package/extensions/ublock/lib/codemirror/lib/codemirror.js +9800 -0
- package/extensions/ublock/lib/codemirror/mode/css/css.js +864 -0
- package/extensions/ublock/lib/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
- package/extensions/ublock/lib/codemirror/mode/javascript/javascript.js +942 -0
- package/extensions/ublock/lib/codemirror/mode/xml/xml.js +413 -0
- package/extensions/ublock/lib/codemirror/theme/night.css +27 -0
- package/extensions/ublock/lib/csstree/LICENSE +19 -0
- package/extensions/ublock/lib/csstree/css-tree.js +17 -0
- package/extensions/ublock/lib/diff/README.md +34 -0
- package/extensions/ublock/lib/diff/swatinem_diff.js +272 -0
- package/extensions/ublock/lib/hsluv/LICENSE +20 -0
- package/extensions/ublock/lib/hsluv/README +3 -0
- package/extensions/ublock/lib/hsluv/hsluv-0.1.0.min.js +8 -0
- package/extensions/ublock/lib/js-beautify/LICENSE +9 -0
- package/extensions/ublock/lib/js-beautify/README +5 -0
- package/extensions/ublock/lib/js-beautify/beautifier.min.js +2 -0
- package/extensions/ublock/lib/lz4/README.md +52 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-any.js +151 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-js.js +297 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-wasm.js +195 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec.wasm +0 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec.wat +745 -0
- package/extensions/ublock/lib/publicsuffixlist/publicsuffixlist.js +641 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/README.md +29 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/publicsuffixlist.wasm +0 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/publicsuffixlist.wat +322 -0
- package/extensions/ublock/lib/punycode.js +493 -0
- package/extensions/ublock/lib/regexanalyzer/CHANGES.md +15 -0
- package/extensions/ublock/lib/regexanalyzer/README.md +14 -0
- package/extensions/ublock/lib/regexanalyzer/regex.js +2276 -0
- package/extensions/ublock/logger-ui.html +232 -0
- package/extensions/ublock/managed_storage.json +73 -0
- package/extensions/ublock/manifest.json +115 -0
- package/extensions/ublock/no-dashboard.html +27 -0
- package/extensions/ublock/popup-fenix.html +114 -0
- package/extensions/ublock/settings.html +98 -0
- package/extensions/ublock/support.html +131 -0
- package/extensions/ublock/web_accessible_resources/1x1.gif +0 -0
- package/extensions/ublock/web_accessible_resources/2x2.png +0 -0
- package/extensions/ublock/web_accessible_resources/32x32.png +0 -0
- package/extensions/ublock/web_accessible_resources/3x2.png +0 -0
- package/extensions/ublock/web_accessible_resources/README.txt +11 -0
- package/extensions/ublock/web_accessible_resources/addthis_widget.js +39 -0
- package/extensions/ublock/web_accessible_resources/amazon_ads.js +70 -0
- package/extensions/ublock/web_accessible_resources/amazon_apstag.js +62 -0
- package/extensions/ublock/web_accessible_resources/ampproject_v0.js +34 -0
- package/extensions/ublock/web_accessible_resources/chartbeat.js +30 -0
- package/extensions/ublock/web_accessible_resources/click2load.html +28 -0
- package/extensions/ublock/web_accessible_resources/doubleclick_instream_ad_status.js +1 -0
- package/extensions/ublock/web_accessible_resources/empty +0 -0
- package/extensions/ublock/web_accessible_resources/epicker-ui.html +76 -0
- package/extensions/ublock/web_accessible_resources/fingerprint2.js +55 -0
- package/extensions/ublock/web_accessible_resources/fingerprint3.js +45 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_analytics.js +110 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_cx_api.js +36 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_ga.js +130 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_inpage_linkid.js +28 -0
- package/extensions/ublock/web_accessible_resources/google-ima.js +855 -0
- package/extensions/ublock/web_accessible_resources/googlesyndication_adsbygoogle.js +56 -0
- package/extensions/ublock/web_accessible_resources/googletagmanager_gtm.js +43 -0
- package/extensions/ublock/web_accessible_resources/googletagservices_gpt.js +153 -0
- package/extensions/ublock/web_accessible_resources/hd-main.js +46 -0
- package/extensions/ublock/web_accessible_resources/ligatus_angular-tag.js +29 -0
- package/extensions/ublock/web_accessible_resources/monkeybroker.js +43 -0
- package/extensions/ublock/web_accessible_resources/mxpnl_mixpanel.js +51 -0
- package/extensions/ublock/web_accessible_resources/nobab.js +87 -0
- package/extensions/ublock/web_accessible_resources/nobab2.js +42 -0
- package/extensions/ublock/web_accessible_resources/noeval-silent.js +28 -0
- package/extensions/ublock/web_accessible_resources/noeval.js +30 -0
- package/extensions/ublock/web_accessible_resources/nofab.js +67 -0
- package/extensions/ublock/web_accessible_resources/noop-0.1s.mp3 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-0.5s.mp3 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-1s.mp4 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-vmap1.0.xml +1 -0
- package/extensions/ublock/web_accessible_resources/noop.css +1 -0
- package/extensions/ublock/web_accessible_resources/noop.html +5 -0
- package/extensions/ublock/web_accessible_resources/noop.js +3 -0
- package/extensions/ublock/web_accessible_resources/noop.json +1 -0
- package/extensions/ublock/web_accessible_resources/noop.txt +1 -0
- package/extensions/ublock/web_accessible_resources/outbrain-widget.js +72 -0
- package/extensions/ublock/web_accessible_resources/popads-dummy.js +30 -0
- package/extensions/ublock/web_accessible_resources/popads.js +40 -0
- package/extensions/ublock/web_accessible_resources/prebid-ads.js +26 -0
- package/extensions/ublock/web_accessible_resources/scorecardresearch_beacon.js +31 -0
- package/extensions/ublock/whitelist.html +63 -0
- package/external/.gitkeep +0 -0
- package/fonts/Calibri Bold Italic.ttf +0 -0
- package/fonts/Calibri Bold.TTF +0 -0
- package/fonts/Calibri Italic.ttf +0 -0
- package/fonts/Calibri Light Italic.ttf +0 -0
- package/fonts/Calibri Light.ttf +0 -0
- package/fonts/Calibri Regular.ttf +0 -0
- package/fonts/Emoji.ttf +0 -0
- package/fonts/SegoeUI-Bold.ttf +0 -0
- package/fonts/SegoeUI-Light.ttf +0 -0
- package/fonts/SegoeUI-Regular.ttf +0 -0
- package/fonts/SegoeUI-Semibold.ttf +0 -0
- package/fonts/SegoeUI-Semilight.ttf +0 -0
- package/fonts/Tahoma Bold.ttf +0 -0
- package/fonts/Tahoma.ttf +0 -0
- package/fonts/fonts.conf +21 -0
- package/package.json +177 -0
- package/scripts/build-function.js +18 -0
- package/scripts/build-open-api.js +274 -0
- package/scripts/build-schemas.js +86 -0
- package/scripts/build-selectors.js +36 -0
- package/scripts/clean.js +7 -0
- package/scripts/install-adblock.js +45 -0
- package/scripts/install-cdp-json.js +37 -0
- package/scripts/start.sh +30 -0
- package/scripts/test.sh +17 -0
- package/src/browserless.ts +253 -0
- package/src/browsers/cdp-chromium.ts +422 -0
- package/src/browsers/index.ts +296 -0
- package/src/browsers/playwright-chromium.ts +168 -0
- package/src/browsers/playwright-firefox.ts +161 -0
- package/src/browsers/playwright-webkit.ts +161 -0
- package/src/config.ts +426 -0
- package/src/constants.ts +4 -0
- package/src/exports.ts +23 -0
- package/src/file-system.ts +54 -0
- package/src/hooks.ts +37 -0
- package/src/http.ts +157 -0
- package/src/index.ts +41 -0
- package/src/limiter.spec.ts +365 -0
- package/src/limiter.ts +225 -0
- package/src/metrics.spec.ts +49 -0
- package/src/metrics.ts +108 -0
- package/src/mime-types.ts +332 -0
- package/src/monitoring.ts +53 -0
- package/src/routes/chromium/http/content-post.ts +238 -0
- package/src/routes/chromium/http/download-post.ts +162 -0
- package/src/routes/chromium/http/function-post.ts +98 -0
- package/src/routes/chromium/http/pdf-post.ts +234 -0
- package/src/routes/chromium/http/performance.ts +71 -0
- package/src/routes/chromium/http/scrape-post.ts +439 -0
- package/src/routes/chromium/http/screenshot-post.ts +262 -0
- package/src/routes/chromium/tests/content.spec.ts +340 -0
- package/src/routes/chromium/tests/download.spec.ts +77 -0
- package/src/routes/chromium/tests/function.spec.ts +279 -0
- package/src/routes/chromium/tests/pdf.spec.ts +375 -0
- package/src/routes/chromium/tests/performance.spec.ts +155 -0
- package/src/routes/chromium/tests/scrape.spec.ts +414 -0
- package/src/routes/chromium/tests/screenshot.spec.ts +387 -0
- package/src/routes/chromium/tests/websocket.spec.ts +407 -0
- package/src/routes/chromium/utils/function/client.ts +99 -0
- package/src/routes/chromium/utils/function/handler.ts +172 -0
- package/src/routes/chromium/utils/performance/child.ts +38 -0
- package/src/routes/chromium/utils/performance/main.ts +90 -0
- package/src/routes/chromium/utils/performance/types.ts +24 -0
- package/src/routes/chromium/ws/browser.ts +31 -0
- package/src/routes/chromium/ws/cdp-chromium.ts +31 -0
- package/src/routes/chromium/ws/page.ts +31 -0
- package/src/routes/chromium/ws/playwright-chromium.ts +44 -0
- package/src/routes/firefox/tests/websocket.spec.ts +146 -0
- package/src/routes/firefox/ws/playwright-firefox.ts +44 -0
- package/src/routes/management/http/config-get.ts +82 -0
- package/src/routes/management/http/metrics-get.ts +43 -0
- package/src/routes/management/http/metrics-total-get.ts +89 -0
- package/src/routes/management/http/sessions-get.ts +39 -0
- package/src/routes/management/http/static-get.ts +109 -0
- package/src/routes/management/tests/management.spec.ts +71 -0
- package/src/routes/webkit/tests/websocket.spec.ts +146 -0
- package/src/routes/webkit/ws/playwright-webkit.ts +44 -0
- package/src/server.ts +609 -0
- package/src/shim.spec.ts +154 -0
- package/src/shim.ts +78 -0
- package/src/types.ts +470 -0
- package/src/utils.ts +787 -0
- package/src/webhooks.ts +50 -0
- package/static/docs/browserless-logo.png +0 -0
- package/static/docs/docs.js +2 -0
- package/static/docs/index.html +71 -0
- package/static/docs/swagger.json +4232 -0
- package/static/favicon-32x32.png +0 -0
- package/static/function/client.js +31623 -0
- package/static/function/index.html +12 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,1140 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
|
|
3
|
+
uBlock Origin - a browser extension to block requests.
|
|
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
|
+
import contextMenu from './contextmenu.js';
|
|
27
|
+
import logger from './logger.js';
|
|
28
|
+
import staticNetFilteringEngine from './static-net-filtering.js';
|
|
29
|
+
import µb from './background.js';
|
|
30
|
+
import webext from './webext.js';
|
|
31
|
+
import { orphanizeString } from './text-utils.js';
|
|
32
|
+
import { redirectEngine } from './redirect-engine.js';
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
sessionFirewall,
|
|
36
|
+
sessionSwitches,
|
|
37
|
+
sessionURLFiltering,
|
|
38
|
+
} from './filtering-engines.js';
|
|
39
|
+
|
|
40
|
+
import {
|
|
41
|
+
domainFromHostname,
|
|
42
|
+
hostnameFromURI,
|
|
43
|
+
isNetworkURI,
|
|
44
|
+
} from './uri-utils.js';
|
|
45
|
+
|
|
46
|
+
/*******************************************************************************
|
|
47
|
+
|
|
48
|
+
A PageRequestStore object is used to store net requests in two ways:
|
|
49
|
+
|
|
50
|
+
To record distinct net requests
|
|
51
|
+
To create a log of net requests
|
|
52
|
+
|
|
53
|
+
**/
|
|
54
|
+
|
|
55
|
+
/******************************************************************************/
|
|
56
|
+
|
|
57
|
+
const NetFilteringResultCache = class {
|
|
58
|
+
constructor() {
|
|
59
|
+
this.pruneTimer = vAPI.defer.create(( ) => {
|
|
60
|
+
this.prune();
|
|
61
|
+
});
|
|
62
|
+
this.init();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
init() {
|
|
66
|
+
this.blocked = new Map();
|
|
67
|
+
this.results = new Map();
|
|
68
|
+
this.hash = 0;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// https://github.com/gorhill/uBlock/issues/3619
|
|
73
|
+
// Don't collapse redirected resources
|
|
74
|
+
rememberResult(fctxt, result) {
|
|
75
|
+
if ( fctxt.tabId <= 0 ) { return; }
|
|
76
|
+
if ( this.results.size === 0 ) {
|
|
77
|
+
this.pruneAsync();
|
|
78
|
+
}
|
|
79
|
+
const key = `${fctxt.getDocHostname()} ${fctxt.type} ${fctxt.url}`;
|
|
80
|
+
this.results.set(key, {
|
|
81
|
+
result,
|
|
82
|
+
redirectURL: fctxt.redirectURL,
|
|
83
|
+
logData: fctxt.filter,
|
|
84
|
+
tstamp: Date.now()
|
|
85
|
+
});
|
|
86
|
+
if ( result !== 1 || fctxt.redirectURL !== undefined ) { return; }
|
|
87
|
+
const now = Date.now();
|
|
88
|
+
this.blocked.set(key, now);
|
|
89
|
+
this.hash = now;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
rememberBlock(fctxt) {
|
|
93
|
+
if ( fctxt.tabId <= 0 ) { return; }
|
|
94
|
+
if ( this.blocked.size === 0 ) {
|
|
95
|
+
this.pruneAsync();
|
|
96
|
+
}
|
|
97
|
+
if ( fctxt.redirectURL !== undefined ) { return; }
|
|
98
|
+
const now = Date.now();
|
|
99
|
+
this.blocked.set(
|
|
100
|
+
`${fctxt.getDocHostname()} ${fctxt.type} ${fctxt.url}`,
|
|
101
|
+
now
|
|
102
|
+
);
|
|
103
|
+
this.hash = now;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
forgetResult(docHostname, type, url) {
|
|
107
|
+
const key = `${docHostname} ${type} ${url}`;
|
|
108
|
+
this.results.delete(key);
|
|
109
|
+
this.blocked.delete(key);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
empty() {
|
|
113
|
+
this.blocked.clear();
|
|
114
|
+
this.results.clear();
|
|
115
|
+
this.hash = 0;
|
|
116
|
+
this.pruneTimer.off();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
prune() {
|
|
120
|
+
const obsolete = Date.now() - this.shelfLife;
|
|
121
|
+
for ( const entry of this.blocked ) {
|
|
122
|
+
if ( entry[1] <= obsolete ) {
|
|
123
|
+
this.results.delete(entry[0]);
|
|
124
|
+
this.blocked.delete(entry[0]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for ( const entry of this.results ) {
|
|
128
|
+
if ( entry[1].tstamp <= obsolete ) {
|
|
129
|
+
this.results.delete(entry[0]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if ( this.blocked.size !== 0 || this.results.size !== 0 ) {
|
|
133
|
+
this.pruneAsync();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
pruneAsync() {
|
|
138
|
+
this.pruneTimer.on(this.shelfLife);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
lookupResult(fctxt) {
|
|
142
|
+
const entry = this.results.get(
|
|
143
|
+
fctxt.getDocHostname() + ' ' +
|
|
144
|
+
fctxt.type + ' ' +
|
|
145
|
+
fctxt.url
|
|
146
|
+
);
|
|
147
|
+
if ( entry === undefined ) { return; }
|
|
148
|
+
// We need to use a new WAR secret if one is present since WAR secrets
|
|
149
|
+
// can only be used once.
|
|
150
|
+
if (
|
|
151
|
+
entry.redirectURL !== undefined &&
|
|
152
|
+
entry.redirectURL.startsWith(this.extensionOriginURL)
|
|
153
|
+
) {
|
|
154
|
+
const redirectURL = new URL(entry.redirectURL);
|
|
155
|
+
redirectURL.searchParams.set('secret', vAPI.warSecret.short());
|
|
156
|
+
entry.redirectURL = redirectURL.href;
|
|
157
|
+
}
|
|
158
|
+
return entry;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
lookupAllBlocked(hostname) {
|
|
162
|
+
const result = [];
|
|
163
|
+
for ( const entry of this.blocked ) {
|
|
164
|
+
const pos = entry[0].indexOf(' ');
|
|
165
|
+
if ( entry[0].slice(0, pos) === hostname ) {
|
|
166
|
+
result[result.length] = entry[0].slice(pos + 1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static factory() {
|
|
173
|
+
return new NetFilteringResultCache();
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
NetFilteringResultCache.prototype.shelfLife = 15000;
|
|
178
|
+
NetFilteringResultCache.prototype.extensionOriginURL = vAPI.getURL('/');
|
|
179
|
+
|
|
180
|
+
/******************************************************************************/
|
|
181
|
+
|
|
182
|
+
// Frame stores are used solely to associate a URL with a frame id.
|
|
183
|
+
|
|
184
|
+
const FrameStore = class {
|
|
185
|
+
constructor(frameURL, parentId) {
|
|
186
|
+
this.init(frameURL, parentId);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
init(frameURL, parentId) {
|
|
190
|
+
this.t0 = Date.now();
|
|
191
|
+
this.parentId = parentId;
|
|
192
|
+
this.exceptCname = undefined;
|
|
193
|
+
this.clickToLoad = false;
|
|
194
|
+
this.rawURL = frameURL;
|
|
195
|
+
if ( frameURL !== undefined ) {
|
|
196
|
+
this.hostname = hostnameFromURI(frameURL);
|
|
197
|
+
this.domain = domainFromHostname(this.hostname) || this.hostname;
|
|
198
|
+
}
|
|
199
|
+
// Evaluated on-demand
|
|
200
|
+
// - 0b01: specific cosmetic filtering
|
|
201
|
+
// - 0b10: generic cosmetic filtering
|
|
202
|
+
this._cosmeticFilteringBits = undefined;
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
dispose() {
|
|
207
|
+
this.rawURL = this.hostname = this.domain = '';
|
|
208
|
+
if ( FrameStore.junkyard.length < FrameStore.junkyardMax ) {
|
|
209
|
+
FrameStore.junkyard.push(this);
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
updateURL(url) {
|
|
215
|
+
if ( typeof url !== 'string' ) { return; }
|
|
216
|
+
this.rawURL = url;
|
|
217
|
+
this.hostname = hostnameFromURI(url);
|
|
218
|
+
this.domain = domainFromHostname(this.hostname) || this.hostname;
|
|
219
|
+
this._cosmeticFilteringBits = undefined;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
getCosmeticFilteringBits(tabId) {
|
|
223
|
+
if ( this._cosmeticFilteringBits !== undefined ) {
|
|
224
|
+
return this._cosmeticFilteringBits;
|
|
225
|
+
}
|
|
226
|
+
this._cosmeticFilteringBits = 0b11;
|
|
227
|
+
{
|
|
228
|
+
const result = staticNetFilteringEngine.matchRequestReverse(
|
|
229
|
+
'specifichide',
|
|
230
|
+
this.rawURL
|
|
231
|
+
);
|
|
232
|
+
if ( result !== 0 && logger.enabled ) {
|
|
233
|
+
µb.filteringContext
|
|
234
|
+
.duplicate()
|
|
235
|
+
.fromTabId(tabId)
|
|
236
|
+
.setURL(this.rawURL)
|
|
237
|
+
.setDocOriginFromURL(this.rawURL)
|
|
238
|
+
.setRealm('network')
|
|
239
|
+
.setType('specifichide')
|
|
240
|
+
.setFilter(staticNetFilteringEngine.toLogData())
|
|
241
|
+
.toLogger();
|
|
242
|
+
}
|
|
243
|
+
if ( result === 2 ) {
|
|
244
|
+
this._cosmeticFilteringBits &= ~0b01;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
{
|
|
248
|
+
const result = staticNetFilteringEngine.matchRequestReverse(
|
|
249
|
+
'generichide',
|
|
250
|
+
this.rawURL
|
|
251
|
+
);
|
|
252
|
+
if ( result !== 0 && logger.enabled ) {
|
|
253
|
+
µb.filteringContext
|
|
254
|
+
.duplicate()
|
|
255
|
+
.fromTabId(tabId)
|
|
256
|
+
.setURL(this.rawURL)
|
|
257
|
+
.setDocOriginFromURL(this.rawURL)
|
|
258
|
+
.setRealm('network')
|
|
259
|
+
.setType('generichide')
|
|
260
|
+
.setFilter(staticNetFilteringEngine.toLogData())
|
|
261
|
+
.toLogger();
|
|
262
|
+
}
|
|
263
|
+
if ( result === 2 ) {
|
|
264
|
+
this._cosmeticFilteringBits &= ~0b10;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return this._cosmeticFilteringBits;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
shouldApplySpecificCosmeticFilters(tabId) {
|
|
271
|
+
return (this.getCosmeticFilteringBits(tabId) & 0b01) !== 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
shouldApplyGenericCosmeticFilters(tabId) {
|
|
275
|
+
return (this.getCosmeticFilteringBits(tabId) & 0b10) !== 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
static factory(frameURL, parentId = -1) {
|
|
279
|
+
const entry = FrameStore.junkyard.pop();
|
|
280
|
+
if ( entry === undefined ) {
|
|
281
|
+
return new FrameStore(frameURL, parentId);
|
|
282
|
+
}
|
|
283
|
+
return entry.init(frameURL, parentId);
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
// To mitigate memory churning
|
|
288
|
+
FrameStore.junkyard = [];
|
|
289
|
+
FrameStore.junkyardMax = 50;
|
|
290
|
+
|
|
291
|
+
/******************************************************************************/
|
|
292
|
+
|
|
293
|
+
const CountDetails = class {
|
|
294
|
+
constructor() {
|
|
295
|
+
this.allowed = { any: 0, frame: 0, script: 0 };
|
|
296
|
+
this.blocked = { any: 0, frame: 0, script: 0 };
|
|
297
|
+
}
|
|
298
|
+
reset() {
|
|
299
|
+
const { allowed, blocked } = this;
|
|
300
|
+
blocked.any = blocked.frame = blocked.script =
|
|
301
|
+
allowed.any = allowed.frame = allowed.script = 0;
|
|
302
|
+
}
|
|
303
|
+
inc(blocked, type = undefined) {
|
|
304
|
+
const stat = blocked ? this.blocked : this.allowed;
|
|
305
|
+
if ( type !== undefined ) { stat[type] += 1; }
|
|
306
|
+
stat.any += 1;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const HostnameDetails = class {
|
|
311
|
+
constructor(hostname) {
|
|
312
|
+
this.counts = new CountDetails();
|
|
313
|
+
this.init(hostname);
|
|
314
|
+
}
|
|
315
|
+
init(hostname) {
|
|
316
|
+
this.hostname = hostname;
|
|
317
|
+
this.counts.reset();
|
|
318
|
+
}
|
|
319
|
+
dispose() {
|
|
320
|
+
this.hostname = '';
|
|
321
|
+
if ( HostnameDetails.junkyard.length < HostnameDetails.junkyardMax ) {
|
|
322
|
+
HostnameDetails.junkyard.push(this);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
HostnameDetails.junkyard = [];
|
|
328
|
+
HostnameDetails.junkyardMax = 100;
|
|
329
|
+
|
|
330
|
+
const HostnameDetailsMap = class extends Map {
|
|
331
|
+
reset() {
|
|
332
|
+
this.clear();
|
|
333
|
+
}
|
|
334
|
+
dispose() {
|
|
335
|
+
for ( const item of this.values() ) {
|
|
336
|
+
item.dispose();
|
|
337
|
+
}
|
|
338
|
+
this.reset();
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
/******************************************************************************/
|
|
343
|
+
|
|
344
|
+
const PageStore = class {
|
|
345
|
+
constructor(tabId, details) {
|
|
346
|
+
this.extraData = new Map();
|
|
347
|
+
this.journal = [];
|
|
348
|
+
this.journalLastCommitted = this.journalLastUncommitted = -1;
|
|
349
|
+
this.journalLastUncommittedOrigin = undefined;
|
|
350
|
+
this.netFilteringCache = NetFilteringResultCache.factory();
|
|
351
|
+
this.hostnameDetailsMap = new HostnameDetailsMap();
|
|
352
|
+
this.counts = new CountDetails();
|
|
353
|
+
this.journalTimer = vAPI.defer.create(( ) => {
|
|
354
|
+
this.journalProcess();
|
|
355
|
+
});
|
|
356
|
+
this.largeMediaTimer = vAPI.defer.create(( ) => {
|
|
357
|
+
this.injectLargeMediaElementScriptlet();
|
|
358
|
+
});
|
|
359
|
+
this.init(tabId, details);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
static factory(tabId, details) {
|
|
363
|
+
let entry = PageStore.junkyard.pop();
|
|
364
|
+
if ( entry === undefined ) {
|
|
365
|
+
entry = new PageStore(tabId, details);
|
|
366
|
+
} else {
|
|
367
|
+
entry.init(tabId, details);
|
|
368
|
+
}
|
|
369
|
+
return entry;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// https://github.com/gorhill/uBlock/issues/3201
|
|
373
|
+
// The context is used to determine whether we report behavior change
|
|
374
|
+
// to the logger.
|
|
375
|
+
|
|
376
|
+
init(tabId, details) {
|
|
377
|
+
const tabContext = µb.tabContextManager.mustLookup(tabId);
|
|
378
|
+
this.tabId = tabId;
|
|
379
|
+
|
|
380
|
+
// If we are navigating from-to same site, remember whether large
|
|
381
|
+
// media elements were temporarily allowed.
|
|
382
|
+
if (
|
|
383
|
+
typeof this.allowLargeMediaElementsUntil !== 'number' ||
|
|
384
|
+
tabContext.rootHostname !== this.tabHostname
|
|
385
|
+
) {
|
|
386
|
+
this.allowLargeMediaElementsUntil = Date.now();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
this.tabHostname = tabContext.rootHostname;
|
|
390
|
+
this.rawURL = tabContext.rawURL;
|
|
391
|
+
this.hostnameDetailsMap.reset();
|
|
392
|
+
this.contentLastModified = 0;
|
|
393
|
+
this.logData = undefined;
|
|
394
|
+
this.counts.reset();
|
|
395
|
+
this.remoteFontCount = 0;
|
|
396
|
+
this.popupBlockedCount = 0;
|
|
397
|
+
this.largeMediaCount = 0;
|
|
398
|
+
this.allowLargeMediaElementsRegex = undefined;
|
|
399
|
+
this.extraData.clear();
|
|
400
|
+
|
|
401
|
+
this.frameAddCount = 0;
|
|
402
|
+
this.frames = new Map();
|
|
403
|
+
this.setFrameURL({ url: tabContext.rawURL });
|
|
404
|
+
|
|
405
|
+
if ( this.titleFromDetails(details) === false ) {
|
|
406
|
+
this.title = tabContext.rawURL;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Evaluated on-demand
|
|
410
|
+
this._noCosmeticFiltering = undefined;
|
|
411
|
+
|
|
412
|
+
// Remember if the webpage was potentially improperly filtered, for
|
|
413
|
+
// reporting purpose.
|
|
414
|
+
this.hasUnprocessedRequest = vAPI.net.hasUnprocessedRequest(tabId);
|
|
415
|
+
|
|
416
|
+
return this;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
reuse(context, details) {
|
|
420
|
+
// When force refreshing a page, the page store data needs to be reset.
|
|
421
|
+
|
|
422
|
+
// If the hostname changes, we can't merely just update the context.
|
|
423
|
+
const tabContext = µb.tabContextManager.mustLookup(this.tabId);
|
|
424
|
+
if ( tabContext.rootHostname !== this.tabHostname ) {
|
|
425
|
+
context = '';
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// If URL changes without a page reload (more and more common), then
|
|
429
|
+
// we need to keep all that we collected for reuse. In particular,
|
|
430
|
+
// not doing so was causing a problem in `videos.foxnews.com`:
|
|
431
|
+
// clicking a video thumbnail would not work, because the frame
|
|
432
|
+
// hierarchy structure was flushed from memory, while not really being
|
|
433
|
+
// flushed on the page.
|
|
434
|
+
if ( context === 'tabUpdated' ) {
|
|
435
|
+
// As part of https://github.com/chrisaljoudi/uBlock/issues/405
|
|
436
|
+
// URL changed, force a re-evaluation of filtering switch
|
|
437
|
+
this.rawURL = tabContext.rawURL;
|
|
438
|
+
this.setFrameURL({ url: this.rawURL });
|
|
439
|
+
this.titleFromDetails(details);
|
|
440
|
+
return this;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// A new page is completely reloaded from scratch, reset all.
|
|
444
|
+
this.largeMediaTimer.off();
|
|
445
|
+
this.disposeFrameStores();
|
|
446
|
+
this.init(this.tabId, details);
|
|
447
|
+
return this;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
dispose() {
|
|
451
|
+
this.tabHostname = '';
|
|
452
|
+
this.title = '';
|
|
453
|
+
this.rawURL = '';
|
|
454
|
+
this.hostnameDetailsMap.dispose();
|
|
455
|
+
this.netFilteringCache.empty();
|
|
456
|
+
this.allowLargeMediaElementsUntil = Date.now();
|
|
457
|
+
this.allowLargeMediaElementsRegex = undefined;
|
|
458
|
+
this.largeMediaTimer.off();
|
|
459
|
+
this.disposeFrameStores();
|
|
460
|
+
this.journalTimer.off();
|
|
461
|
+
this.journal = [];
|
|
462
|
+
this.journalLastUncommittedOrigin = undefined;
|
|
463
|
+
this.journalLastCommitted = this.journalLastUncommitted = -1;
|
|
464
|
+
if ( PageStore.junkyard.length < PageStore.junkyardMax ) {
|
|
465
|
+
PageStore.junkyard.push(this);
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
titleFromDetails(details) {
|
|
471
|
+
if (
|
|
472
|
+
details instanceof Object === false ||
|
|
473
|
+
details.title === undefined
|
|
474
|
+
) {
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
this.title = orphanizeString(details.title.slice(0, 128));
|
|
478
|
+
return true;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
disposeFrameStores() {
|
|
482
|
+
for ( const frameStore of this.frames.values() ) {
|
|
483
|
+
frameStore.dispose();
|
|
484
|
+
}
|
|
485
|
+
this.frames.clear();
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
getFrameStore(frameId) {
|
|
489
|
+
return this.frames.get(frameId) || null;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/1858
|
|
493
|
+
// Mind that setFrameURL() can be called from navigation event handlers.
|
|
494
|
+
setFrameURL(details) {
|
|
495
|
+
let { frameId, url, parentFrameId } = details;
|
|
496
|
+
if ( frameId === undefined ) { frameId = 0; }
|
|
497
|
+
if ( parentFrameId === undefined ) { parentFrameId = -1; }
|
|
498
|
+
let frameStore = this.frames.get(frameId);
|
|
499
|
+
if ( frameStore !== undefined ) {
|
|
500
|
+
if ( url === frameStore.rawURL ) {
|
|
501
|
+
frameStore.parentId = parentFrameId;
|
|
502
|
+
} else {
|
|
503
|
+
frameStore.init(url, parentFrameId);
|
|
504
|
+
}
|
|
505
|
+
return frameStore;
|
|
506
|
+
}
|
|
507
|
+
frameStore = FrameStore.factory(url, parentFrameId);
|
|
508
|
+
this.frames.set(frameId, frameStore);
|
|
509
|
+
this.frameAddCount += 1;
|
|
510
|
+
if ( url.startsWith('about:') ) {
|
|
511
|
+
frameStore.updateURL(this.getEffectiveFrameURL({ frameId }));
|
|
512
|
+
}
|
|
513
|
+
if ( (this.frameAddCount & 0b111111) === 0 ) {
|
|
514
|
+
this.pruneFrames();
|
|
515
|
+
}
|
|
516
|
+
return frameStore;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
getEffectiveFrameURL(sender) {
|
|
520
|
+
let { frameId } = sender;
|
|
521
|
+
for (;;) {
|
|
522
|
+
const frameStore = this.getFrameStore(frameId);
|
|
523
|
+
if ( frameStore === null ) { break; }
|
|
524
|
+
if ( frameStore.rawURL.startsWith('about:') === false ) {
|
|
525
|
+
return frameStore.rawURL;
|
|
526
|
+
}
|
|
527
|
+
frameId = frameStore.parentId;
|
|
528
|
+
if ( frameId === -1 ) { break; }
|
|
529
|
+
}
|
|
530
|
+
return sender.frameURL;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// There is no event to tell us a specific subframe has been removed from
|
|
534
|
+
// the main document. The code below will remove subframes which are no
|
|
535
|
+
// longer present in the root document. Removing obsolete subframes is
|
|
536
|
+
// not a critical task, so this is executed just once on a while, to avoid
|
|
537
|
+
// bloated dictionary of subframes.
|
|
538
|
+
// A TTL is used to avoid race conditions when new iframes are added
|
|
539
|
+
// through the webRequest API but still not yet visible through the
|
|
540
|
+
// webNavigation API.
|
|
541
|
+
async pruneFrames() {
|
|
542
|
+
let entries;
|
|
543
|
+
try {
|
|
544
|
+
entries = await webext.webNavigation.getAllFrames({
|
|
545
|
+
tabId: this.tabId
|
|
546
|
+
});
|
|
547
|
+
} catch(ex) {
|
|
548
|
+
}
|
|
549
|
+
if ( Array.isArray(entries) === false ) { return; }
|
|
550
|
+
const toKeep = new Set();
|
|
551
|
+
for ( const { frameId } of entries ) {
|
|
552
|
+
toKeep.add(frameId);
|
|
553
|
+
}
|
|
554
|
+
const obsolete = Date.now() - 60000;
|
|
555
|
+
for ( const [ frameId, { t0 } ] of this.frames ) {
|
|
556
|
+
if ( toKeep.has(frameId) || t0 >= obsolete ) { continue; }
|
|
557
|
+
this.frames.delete(frameId);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
getNetFilteringSwitch() {
|
|
562
|
+
return µb.tabContextManager
|
|
563
|
+
.mustLookup(this.tabId)
|
|
564
|
+
.getNetFilteringSwitch();
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
toggleNetFilteringSwitch(url, scope, state) {
|
|
568
|
+
µb.toggleNetFilteringSwitch(url, scope, state);
|
|
569
|
+
this.netFilteringCache.empty();
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
shouldApplyCosmeticFilters(frameId = 0) {
|
|
573
|
+
if ( this._noCosmeticFiltering === undefined ) {
|
|
574
|
+
this._noCosmeticFiltering = this.getNetFilteringSwitch() === false;
|
|
575
|
+
if ( this._noCosmeticFiltering === false ) {
|
|
576
|
+
this._noCosmeticFiltering = sessionSwitches.evaluateZ(
|
|
577
|
+
'no-cosmetic-filtering',
|
|
578
|
+
this.tabHostname
|
|
579
|
+
) === true;
|
|
580
|
+
if ( this._noCosmeticFiltering && logger.enabled ) {
|
|
581
|
+
µb.filteringContext
|
|
582
|
+
.duplicate()
|
|
583
|
+
.fromTabId(this.tabId)
|
|
584
|
+
.setURL(this.rawURL)
|
|
585
|
+
.setRealm('cosmetic')
|
|
586
|
+
.setType('dom')
|
|
587
|
+
.setFilter(sessionSwitches.toLogData())
|
|
588
|
+
.toLogger();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
if ( this._noCosmeticFiltering ) { return false; }
|
|
593
|
+
if ( frameId === -1 ) { return true; }
|
|
594
|
+
// Cosmetic filtering can be effectively disabled when both specific
|
|
595
|
+
// and generic cosmetic filters are disabled.
|
|
596
|
+
return this.shouldApplySpecificCosmeticFilters(frameId) ||
|
|
597
|
+
this.shouldApplyGenericCosmeticFilters(frameId);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
shouldApplySpecificCosmeticFilters(frameId) {
|
|
601
|
+
if ( this.shouldApplyCosmeticFilters(-1) === false ) { return false; }
|
|
602
|
+
const frameStore = this.getFrameStore(frameId);
|
|
603
|
+
if ( frameStore === null ) { return false; }
|
|
604
|
+
return frameStore.shouldApplySpecificCosmeticFilters(this.tabId);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
shouldApplyGenericCosmeticFilters(frameId) {
|
|
608
|
+
if ( this.shouldApplyCosmeticFilters(-1) === false ) { return false; }
|
|
609
|
+
const frameStore = this.getFrameStore(frameId);
|
|
610
|
+
if ( frameStore === null ) { return false; }
|
|
611
|
+
return frameStore.shouldApplyGenericCosmeticFilters(this.tabId);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// https://github.com/gorhill/uBlock/issues/2105
|
|
615
|
+
// Be sure to always include the current page's hostname -- it might not
|
|
616
|
+
// be present when the page itself is pulled from the browser's
|
|
617
|
+
// short-term memory cache.
|
|
618
|
+
getAllHostnameDetails() {
|
|
619
|
+
if (
|
|
620
|
+
this.hostnameDetailsMap.has(this.tabHostname) === false &&
|
|
621
|
+
isNetworkURI(this.rawURL)
|
|
622
|
+
) {
|
|
623
|
+
this.hostnameDetailsMap.set(
|
|
624
|
+
this.tabHostname,
|
|
625
|
+
new HostnameDetails(this.tabHostname)
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
return this.hostnameDetailsMap;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
injectLargeMediaElementScriptlet() {
|
|
632
|
+
vAPI.tabs.executeScript(this.tabId, {
|
|
633
|
+
file: '/js/scriptlets/load-large-media-interactive.js',
|
|
634
|
+
allFrames: true,
|
|
635
|
+
runAt: 'document_idle',
|
|
636
|
+
});
|
|
637
|
+
contextMenu.update(this.tabId);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
temporarilyAllowLargeMediaElements(state) {
|
|
641
|
+
this.largeMediaCount = 0;
|
|
642
|
+
contextMenu.update(this.tabId);
|
|
643
|
+
if ( state ) {
|
|
644
|
+
this.allowLargeMediaElementsUntil = 0;
|
|
645
|
+
this.allowLargeMediaElementsRegex = undefined;
|
|
646
|
+
} else {
|
|
647
|
+
this.allowLargeMediaElementsUntil = Date.now();
|
|
648
|
+
}
|
|
649
|
+
vAPI.tabs.executeScript(this.tabId, {
|
|
650
|
+
file: '/js/scriptlets/load-large-media-all.js',
|
|
651
|
+
allFrames: true,
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// https://github.com/gorhill/uBlock/issues/2053
|
|
656
|
+
// There is no way around using journaling to ensure we deal properly with
|
|
657
|
+
// potentially out of order navigation events vs. network request events.
|
|
658
|
+
journalAddRequest(fctxt, result) {
|
|
659
|
+
const hostname = fctxt.getHostname();
|
|
660
|
+
if ( hostname === '' ) { return; }
|
|
661
|
+
this.journal.push(hostname, result, fctxt.itype);
|
|
662
|
+
this.journalTimer.on(µb.hiddenSettings.requestJournalProcessPeriod);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
journalAddRootFrame(type, url) {
|
|
666
|
+
if ( type === 'committed' ) {
|
|
667
|
+
this.journalLastCommitted = this.journal.length;
|
|
668
|
+
if (
|
|
669
|
+
this.journalLastUncommitted !== -1 &&
|
|
670
|
+
this.journalLastUncommitted < this.journalLastCommitted &&
|
|
671
|
+
this.journalLastUncommittedOrigin === hostnameFromURI(url)
|
|
672
|
+
) {
|
|
673
|
+
this.journalLastCommitted = this.journalLastUncommitted;
|
|
674
|
+
}
|
|
675
|
+
} else if ( type === 'uncommitted' ) {
|
|
676
|
+
const newOrigin = hostnameFromURI(url);
|
|
677
|
+
if (
|
|
678
|
+
this.journalLastUncommitted === -1 ||
|
|
679
|
+
this.journalLastUncommittedOrigin !== newOrigin
|
|
680
|
+
) {
|
|
681
|
+
this.journalLastUncommitted = this.journal.length;
|
|
682
|
+
this.journalLastUncommittedOrigin = newOrigin;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
this.journalTimer.offon(µb.hiddenSettings.requestJournalProcessPeriod);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
journalProcess() {
|
|
689
|
+
this.journalTimer.off();
|
|
690
|
+
|
|
691
|
+
const journal = this.journal;
|
|
692
|
+
const pivot = Math.max(0, this.journalLastCommitted);
|
|
693
|
+
const now = Date.now();
|
|
694
|
+
const { SCRIPT, SUB_FRAME, OBJECT } = µb.FilteringContext;
|
|
695
|
+
let aggregateAllowed = 0;
|
|
696
|
+
let aggregateBlocked = 0;
|
|
697
|
+
|
|
698
|
+
// Everything after pivot originates from current page.
|
|
699
|
+
for ( let i = pivot; i < journal.length; i += 3 ) {
|
|
700
|
+
const hostname = journal[i+0];
|
|
701
|
+
let hnDetails = this.hostnameDetailsMap.get(hostname);
|
|
702
|
+
if ( hnDetails === undefined ) {
|
|
703
|
+
hnDetails = new HostnameDetails(hostname);
|
|
704
|
+
this.hostnameDetailsMap.set(hostname, hnDetails);
|
|
705
|
+
this.contentLastModified = now;
|
|
706
|
+
}
|
|
707
|
+
const blocked = journal[i+1] === 1;
|
|
708
|
+
const itype = journal[i+2];
|
|
709
|
+
if ( itype === SCRIPT ) {
|
|
710
|
+
hnDetails.counts.inc(blocked, 'script');
|
|
711
|
+
this.counts.inc(blocked, 'script');
|
|
712
|
+
} else if ( itype === SUB_FRAME || itype === OBJECT ) {
|
|
713
|
+
hnDetails.counts.inc(blocked, 'frame');
|
|
714
|
+
this.counts.inc(blocked, 'frame');
|
|
715
|
+
} else {
|
|
716
|
+
hnDetails.counts.inc(blocked);
|
|
717
|
+
this.counts.inc(blocked);
|
|
718
|
+
}
|
|
719
|
+
if ( blocked ) {
|
|
720
|
+
aggregateBlocked += 1;
|
|
721
|
+
} else {
|
|
722
|
+
aggregateAllowed += 1;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
this.journalLastUncommitted = this.journalLastCommitted = -1;
|
|
726
|
+
|
|
727
|
+
// https://github.com/chrisaljoudi/uBlock/issues/905#issuecomment-76543649
|
|
728
|
+
// No point updating the badge if it's not being displayed.
|
|
729
|
+
if ( aggregateBlocked !== 0 && µb.userSettings.showIconBadge ) {
|
|
730
|
+
µb.updateToolbarIcon(this.tabId, 0x02);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Everything before pivot does not originate from current page -- we
|
|
734
|
+
// still need to bump global blocked/allowed counts.
|
|
735
|
+
for ( let i = 0; i < pivot; i += 3 ) {
|
|
736
|
+
if ( journal[i+1] === 1 ) {
|
|
737
|
+
aggregateBlocked += 1;
|
|
738
|
+
} else {
|
|
739
|
+
aggregateAllowed += 1;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
if ( aggregateAllowed !== 0 || aggregateBlocked !== 0 ) {
|
|
743
|
+
µb.localSettings.blockedRequestCount += aggregateBlocked;
|
|
744
|
+
µb.localSettings.allowedRequestCount += aggregateAllowed;
|
|
745
|
+
µb.localSettingsLastModified = now;
|
|
746
|
+
}
|
|
747
|
+
journal.length = 0;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
filterRequest(fctxt) {
|
|
751
|
+
fctxt.filter = undefined;
|
|
752
|
+
fctxt.redirectURL = undefined;
|
|
753
|
+
|
|
754
|
+
if ( this.getNetFilteringSwitch(fctxt) === false ) {
|
|
755
|
+
return 0;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
if (
|
|
759
|
+
fctxt.itype === fctxt.CSP_REPORT &&
|
|
760
|
+
this.filterCSPReport(fctxt) === 1
|
|
761
|
+
) {
|
|
762
|
+
return 1;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
if (
|
|
766
|
+
(fctxt.itype & fctxt.FONT_ANY) !== 0 &&
|
|
767
|
+
this.filterFont(fctxt) === 1 )
|
|
768
|
+
{
|
|
769
|
+
return 1;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
if (
|
|
773
|
+
fctxt.itype === fctxt.SCRIPT &&
|
|
774
|
+
this.filterScripting(fctxt, true) === 1
|
|
775
|
+
) {
|
|
776
|
+
return 1;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
const cacheableResult =
|
|
780
|
+
this.cacheableResults.has(fctxt.itype) &&
|
|
781
|
+
fctxt.aliasURL === undefined;
|
|
782
|
+
|
|
783
|
+
if ( cacheableResult ) {
|
|
784
|
+
const entry = this.netFilteringCache.lookupResult(fctxt);
|
|
785
|
+
if ( entry !== undefined ) {
|
|
786
|
+
fctxt.redirectURL = entry.redirectURL;
|
|
787
|
+
fctxt.filter = entry.logData;
|
|
788
|
+
return entry.result;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
const requestType = fctxt.type;
|
|
793
|
+
const loggerEnabled = logger.enabled;
|
|
794
|
+
|
|
795
|
+
// Dynamic URL filtering.
|
|
796
|
+
let result = sessionURLFiltering.evaluateZ(
|
|
797
|
+
fctxt.getTabHostname(),
|
|
798
|
+
fctxt.url,
|
|
799
|
+
requestType
|
|
800
|
+
);
|
|
801
|
+
if ( result !== 0 && loggerEnabled ) {
|
|
802
|
+
fctxt.filter = sessionURLFiltering.toLogData();
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// Dynamic hostname/type filtering.
|
|
806
|
+
if ( result === 0 && µb.userSettings.advancedUserEnabled ) {
|
|
807
|
+
result = sessionFirewall.evaluateCellZY(
|
|
808
|
+
fctxt.getTabHostname(),
|
|
809
|
+
fctxt.getHostname(),
|
|
810
|
+
requestType
|
|
811
|
+
);
|
|
812
|
+
if ( result !== 0 && result !== 3 && loggerEnabled ) {
|
|
813
|
+
fctxt.filter = sessionFirewall.toLogData();
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// Static filtering has lowest precedence.
|
|
818
|
+
const snfe = staticNetFilteringEngine;
|
|
819
|
+
if ( result === 0 || result === 3 ) {
|
|
820
|
+
result = snfe.matchRequest(fctxt);
|
|
821
|
+
if ( result !== 0 ) {
|
|
822
|
+
if ( loggerEnabled ) {
|
|
823
|
+
fctxt.setFilter(snfe.toLogData());
|
|
824
|
+
}
|
|
825
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/943
|
|
826
|
+
// Blanket-except blocked aliased canonical hostnames?
|
|
827
|
+
if (
|
|
828
|
+
result === 1 &&
|
|
829
|
+
fctxt.aliasURL !== undefined &&
|
|
830
|
+
snfe.isBlockImportant() === false &&
|
|
831
|
+
this.shouldExceptCname(fctxt)
|
|
832
|
+
) {
|
|
833
|
+
return 2;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// Click-to-load?
|
|
839
|
+
// When frameId is not -1, the resource is always sub_frame.
|
|
840
|
+
if ( result === 1 && fctxt.frameId !== -1 ) {
|
|
841
|
+
const frameStore = this.getFrameStore(fctxt.frameId);
|
|
842
|
+
if ( frameStore !== null && frameStore.clickToLoad ) {
|
|
843
|
+
result = 2;
|
|
844
|
+
if ( loggerEnabled ) {
|
|
845
|
+
fctxt.pushFilter({
|
|
846
|
+
result,
|
|
847
|
+
source: 'network',
|
|
848
|
+
raw: 'click-to-load',
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// Modifier(s)?
|
|
855
|
+
// A modifier is an action which transform the original network request.
|
|
856
|
+
// https://github.com/gorhill/uBlock/issues/949
|
|
857
|
+
// Redirect blocked request?
|
|
858
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/760
|
|
859
|
+
// Redirect non-blocked request?
|
|
860
|
+
if ( (fctxt.itype & fctxt.INLINE_ANY) === 0 ) {
|
|
861
|
+
if ( result === 1 ) {
|
|
862
|
+
this.redirectBlockedRequest(fctxt);
|
|
863
|
+
} else {
|
|
864
|
+
this.redirectNonBlockedRequest(fctxt);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
if ( cacheableResult ) {
|
|
869
|
+
this.netFilteringCache.rememberResult(fctxt, result);
|
|
870
|
+
} else if ( result === 1 && this.collapsibleResources.has(fctxt.itype) ) {
|
|
871
|
+
this.netFilteringCache.rememberBlock(fctxt);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
return result;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
filterOnHeaders(fctxt, headers) {
|
|
878
|
+
fctxt.filter = undefined;
|
|
879
|
+
|
|
880
|
+
if ( this.getNetFilteringSwitch(fctxt) === false ) { return 0; }
|
|
881
|
+
|
|
882
|
+
let result = staticNetFilteringEngine.matchHeaders(fctxt, headers);
|
|
883
|
+
if ( result === 0 ) { return 0; }
|
|
884
|
+
|
|
885
|
+
const loggerEnabled = logger.enabled;
|
|
886
|
+
if ( loggerEnabled ) {
|
|
887
|
+
fctxt.filter = staticNetFilteringEngine.toLogData();
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// Dynamic filtering allow rules
|
|
891
|
+
// URL filtering
|
|
892
|
+
if (
|
|
893
|
+
result === 1 &&
|
|
894
|
+
sessionURLFiltering.evaluateZ(
|
|
895
|
+
fctxt.getTabHostname(),
|
|
896
|
+
fctxt.url,
|
|
897
|
+
fctxt.type
|
|
898
|
+
) === 2
|
|
899
|
+
) {
|
|
900
|
+
result = 2;
|
|
901
|
+
if ( loggerEnabled ) {
|
|
902
|
+
fctxt.filter = sessionURLFiltering.toLogData();
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
// Hostname filtering
|
|
906
|
+
if (
|
|
907
|
+
result === 1 &&
|
|
908
|
+
µb.userSettings.advancedUserEnabled &&
|
|
909
|
+
sessionFirewall.evaluateCellZY(
|
|
910
|
+
fctxt.getTabHostname(),
|
|
911
|
+
fctxt.getHostname(),
|
|
912
|
+
fctxt.type
|
|
913
|
+
) === 2
|
|
914
|
+
) {
|
|
915
|
+
result = 2;
|
|
916
|
+
if ( loggerEnabled ) {
|
|
917
|
+
fctxt.filter = sessionFirewall.toLogData();
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
return result;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
redirectBlockedRequest(fctxt) {
|
|
925
|
+
const directives = staticNetFilteringEngine.redirectRequest(redirectEngine, fctxt);
|
|
926
|
+
if ( directives === undefined ) { return; }
|
|
927
|
+
if ( logger.enabled !== true ) { return; }
|
|
928
|
+
fctxt.pushFilters(directives.map(a => a.logData()));
|
|
929
|
+
if ( fctxt.redirectURL === undefined ) { return; }
|
|
930
|
+
fctxt.pushFilter({
|
|
931
|
+
source: 'redirect',
|
|
932
|
+
raw: directives[directives.length-1].value
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
redirectNonBlockedRequest(fctxt) {
|
|
937
|
+
const transformDirectives = staticNetFilteringEngine.transformRequest(fctxt);
|
|
938
|
+
const pruneDirectives = fctxt.redirectURL === undefined &&
|
|
939
|
+
staticNetFilteringEngine.hasQuery(fctxt) &&
|
|
940
|
+
staticNetFilteringEngine.filterQuery(fctxt) ||
|
|
941
|
+
undefined;
|
|
942
|
+
if ( transformDirectives === undefined && pruneDirectives === undefined ) { return; }
|
|
943
|
+
if ( logger.enabled !== true ) { return; }
|
|
944
|
+
if ( transformDirectives !== undefined ) {
|
|
945
|
+
fctxt.pushFilters(transformDirectives.map(a => a.logData()));
|
|
946
|
+
}
|
|
947
|
+
if ( pruneDirectives !== undefined ) {
|
|
948
|
+
fctxt.pushFilters(pruneDirectives.map(a => a.logData()));
|
|
949
|
+
}
|
|
950
|
+
if ( fctxt.redirectURL === undefined ) { return; }
|
|
951
|
+
fctxt.pushFilter({
|
|
952
|
+
source: 'redirect',
|
|
953
|
+
raw: fctxt.redirectURL
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
filterCSPReport(fctxt) {
|
|
958
|
+
if (
|
|
959
|
+
sessionSwitches.evaluateZ(
|
|
960
|
+
'no-csp-reports',
|
|
961
|
+
fctxt.getHostname()
|
|
962
|
+
)
|
|
963
|
+
) {
|
|
964
|
+
if ( logger.enabled ) {
|
|
965
|
+
fctxt.filter = sessionSwitches.toLogData();
|
|
966
|
+
}
|
|
967
|
+
return 1;
|
|
968
|
+
}
|
|
969
|
+
return 0;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
filterFont(fctxt) {
|
|
973
|
+
if ( fctxt.itype === fctxt.FONT ) {
|
|
974
|
+
this.remoteFontCount += 1;
|
|
975
|
+
}
|
|
976
|
+
if (
|
|
977
|
+
sessionSwitches.evaluateZ(
|
|
978
|
+
'no-remote-fonts',
|
|
979
|
+
fctxt.getTabHostname()
|
|
980
|
+
) !== false
|
|
981
|
+
) {
|
|
982
|
+
if ( logger.enabled ) {
|
|
983
|
+
fctxt.filter = sessionSwitches.toLogData();
|
|
984
|
+
}
|
|
985
|
+
return 1;
|
|
986
|
+
}
|
|
987
|
+
return 0;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
filterScripting(fctxt, netFiltering) {
|
|
991
|
+
fctxt.filter = undefined;
|
|
992
|
+
if ( netFiltering === undefined ) {
|
|
993
|
+
netFiltering = this.getNetFilteringSwitch(fctxt);
|
|
994
|
+
}
|
|
995
|
+
if (
|
|
996
|
+
netFiltering === false ||
|
|
997
|
+
sessionSwitches.evaluateZ(
|
|
998
|
+
'no-scripting',
|
|
999
|
+
fctxt.getTabHostname()
|
|
1000
|
+
) === false
|
|
1001
|
+
) {
|
|
1002
|
+
return 0;
|
|
1003
|
+
}
|
|
1004
|
+
if ( logger.enabled ) {
|
|
1005
|
+
fctxt.filter = sessionSwitches.toLogData();
|
|
1006
|
+
}
|
|
1007
|
+
return 1;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
// The caller is responsible to check whether filtering is enabled or not.
|
|
1011
|
+
filterLargeMediaElement(fctxt, size) {
|
|
1012
|
+
fctxt.filter = undefined;
|
|
1013
|
+
|
|
1014
|
+
if ( this.allowLargeMediaElementsUntil === 0 ) {
|
|
1015
|
+
return 0;
|
|
1016
|
+
}
|
|
1017
|
+
// Disregard large media elements previously allowed: for example, to
|
|
1018
|
+
// seek inside a previously allowed audio/video.
|
|
1019
|
+
if (
|
|
1020
|
+
this.allowLargeMediaElementsRegex instanceof RegExp &&
|
|
1021
|
+
this.allowLargeMediaElementsRegex.test(fctxt.url)
|
|
1022
|
+
) {
|
|
1023
|
+
return 0;
|
|
1024
|
+
}
|
|
1025
|
+
if ( Date.now() < this.allowLargeMediaElementsUntil ) {
|
|
1026
|
+
const sources = this.allowLargeMediaElementsRegex instanceof RegExp
|
|
1027
|
+
? [ this.allowLargeMediaElementsRegex.source ]
|
|
1028
|
+
: [];
|
|
1029
|
+
sources.push('^' + µb.escapeRegex(fctxt.url));
|
|
1030
|
+
this.allowLargeMediaElementsRegex = new RegExp(sources.join('|'));
|
|
1031
|
+
return 0;
|
|
1032
|
+
}
|
|
1033
|
+
if (
|
|
1034
|
+
sessionSwitches.evaluateZ(
|
|
1035
|
+
'no-large-media',
|
|
1036
|
+
fctxt.getTabHostname()
|
|
1037
|
+
) !== true
|
|
1038
|
+
) {
|
|
1039
|
+
this.allowLargeMediaElementsUntil = 0;
|
|
1040
|
+
return 0;
|
|
1041
|
+
}
|
|
1042
|
+
if ( (size >>> 10) < µb.userSettings.largeMediaSize ) {
|
|
1043
|
+
return 0;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
this.largeMediaCount += 1;
|
|
1047
|
+
this.largeMediaTimer.on(500);
|
|
1048
|
+
|
|
1049
|
+
if ( logger.enabled ) {
|
|
1050
|
+
fctxt.filter = sessionSwitches.toLogData();
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
return 1;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
clickToLoad(frameId, frameURL) {
|
|
1057
|
+
let frameStore = this.getFrameStore(frameId);
|
|
1058
|
+
if ( frameStore === null ) {
|
|
1059
|
+
frameStore = this.setFrameURL({ frameId, url: frameURL });
|
|
1060
|
+
}
|
|
1061
|
+
this.netFilteringCache.forgetResult(
|
|
1062
|
+
this.tabHostname,
|
|
1063
|
+
'sub_frame',
|
|
1064
|
+
frameURL
|
|
1065
|
+
);
|
|
1066
|
+
frameStore.clickToLoad = true;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
shouldExceptCname(fctxt) {
|
|
1070
|
+
let exceptCname;
|
|
1071
|
+
let frameStore;
|
|
1072
|
+
if ( fctxt.docId !== undefined ) {
|
|
1073
|
+
frameStore = this.getFrameStore(fctxt.docId);
|
|
1074
|
+
if ( frameStore instanceof Object ) {
|
|
1075
|
+
exceptCname = frameStore.exceptCname;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
if ( exceptCname === undefined ) {
|
|
1079
|
+
const result = staticNetFilteringEngine.matchRequestReverse(
|
|
1080
|
+
'cname',
|
|
1081
|
+
frameStore instanceof Object
|
|
1082
|
+
? frameStore.rawURL
|
|
1083
|
+
: fctxt.getDocOrigin()
|
|
1084
|
+
);
|
|
1085
|
+
exceptCname = result === 2
|
|
1086
|
+
? staticNetFilteringEngine.toLogData()
|
|
1087
|
+
: false;
|
|
1088
|
+
if ( frameStore instanceof Object ) {
|
|
1089
|
+
frameStore.exceptCname = exceptCname;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
if ( exceptCname === false ) { return false; }
|
|
1093
|
+
if ( exceptCname instanceof Object ) {
|
|
1094
|
+
fctxt.setFilter(exceptCname);
|
|
1095
|
+
}
|
|
1096
|
+
return true;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
getBlockedResources(request, response) {
|
|
1100
|
+
const normalURL = µb.normalizeTabURL(this.tabId, request.frameURL);
|
|
1101
|
+
const resources = request.resources;
|
|
1102
|
+
const fctxt = µb.filteringContext;
|
|
1103
|
+
fctxt.fromTabId(this.tabId)
|
|
1104
|
+
.setDocOriginFromURL(normalURL);
|
|
1105
|
+
// Force some resources to go through the filtering engine in order to
|
|
1106
|
+
// populate the blocked-resources cache. This is required because for
|
|
1107
|
+
// some resources it's not possible to detect whether they were blocked
|
|
1108
|
+
// content script-side (i.e. `iframes` -- unlike `img`).
|
|
1109
|
+
if ( Array.isArray(resources) && resources.length !== 0 ) {
|
|
1110
|
+
for ( const resource of resources ) {
|
|
1111
|
+
this.filterRequest(
|
|
1112
|
+
fctxt.setType(resource.type).setURL(resource.url)
|
|
1113
|
+
);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
if ( this.netFilteringCache.hash === response.hash ) { return; }
|
|
1117
|
+
response.hash = this.netFilteringCache.hash;
|
|
1118
|
+
response.blockedResources =
|
|
1119
|
+
this.netFilteringCache.lookupAllBlocked(fctxt.getDocHostname());
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
PageStore.prototype.cacheableResults = new Set([
|
|
1124
|
+
µb.FilteringContext.SUB_FRAME,
|
|
1125
|
+
]);
|
|
1126
|
+
|
|
1127
|
+
PageStore.prototype.collapsibleResources = new Set([
|
|
1128
|
+
µb.FilteringContext.IMAGE,
|
|
1129
|
+
µb.FilteringContext.MEDIA,
|
|
1130
|
+
µb.FilteringContext.OBJECT,
|
|
1131
|
+
µb.FilteringContext.SUB_FRAME,
|
|
1132
|
+
]);
|
|
1133
|
+
|
|
1134
|
+
// To mitigate memory churning
|
|
1135
|
+
PageStore.junkyard = [];
|
|
1136
|
+
PageStore.junkyardMax = 10;
|
|
1137
|
+
|
|
1138
|
+
/******************************************************************************/
|
|
1139
|
+
|
|
1140
|
+
export { PageStore };
|