@browserless.io/browserless 2.0.0-beta-5 → 2.0.0-beta-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -0
- package/README.md +11 -11
- package/bin/browserless.js +169 -11
- package/bin/scaffold/README.md +415 -0
- package/bin/scaffold/package.json +21 -0
- package/bin/scaffold/src/hello-world.http.ts +27 -0
- package/bin/scaffold/tsconfig.json +4 -0
- package/build/browserless.js +18 -15
- package/build/browsers/index.d.ts +2 -18
- package/build/browsers/index.js +43 -14
- package/build/file-system.d.ts +5 -0
- package/build/file-system.js +20 -5
- package/build/file-system.spec.d.ts +1 -0
- package/build/file-system.spec.js +44 -0
- package/build/http.d.ts +3 -3
- package/build/http.js +3 -3
- package/build/router.js +2 -4
- package/build/routes/chromium/http/content-post.body.json +8 -8
- package/build/routes/chromium/http/content-post.d.ts +15 -3
- package/build/routes/chromium/http/content-post.js +14 -15
- package/build/routes/chromium/http/download-post.d.ts +16 -3
- package/build/routes/chromium/http/download-post.js +17 -22
- package/build/routes/chromium/http/function-post.d.ts +16 -3
- package/build/routes/chromium/http/function-post.js +17 -22
- package/build/routes/chromium/http/pdf-post.body.json +8 -8
- package/build/routes/chromium/http/pdf-post.d.ts +15 -3
- package/build/routes/chromium/http/pdf-post.js +19 -15
- package/build/routes/chromium/http/performance.d.ts +15 -3
- package/build/routes/chromium/http/performance.js +15 -23
- package/build/routes/chromium/http/scrape-post.body.json +8 -8
- package/build/routes/chromium/http/scrape-post.d.ts +15 -3
- package/build/routes/chromium/http/scrape-post.js +15 -16
- package/build/routes/chromium/http/screenshot-post.body.json +8 -8
- package/build/routes/chromium/http/screenshot-post.d.ts +15 -3
- package/build/routes/chromium/http/screenshot-post.js +18 -15
- package/build/routes/chromium/tests/websocket.spec.js +20 -1
- package/build/routes/chromium/utils/function/handler.js +2 -2
- package/build/routes/chromium/ws/browser.d.ts +13 -3
- package/build/routes/chromium/ws/browser.js +10 -11
- package/build/routes/chromium/ws/cdp-chromium.d.ts +13 -3
- package/build/routes/chromium/ws/cdp-chromium.js +10 -11
- package/build/routes/chromium/ws/page.d.ts +13 -3
- package/build/routes/chromium/ws/page.js +10 -11
- package/build/routes/chromium/ws/playwright-chromium.d.ts +13 -3
- package/build/routes/chromium/ws/playwright-chromium.js +11 -12
- package/build/routes/firefox/ws/playwright-firefox.d.ts +13 -3
- package/build/routes/firefox/ws/playwright-firefox.js +11 -12
- package/build/routes/management/http/config-get.d.ts +15 -3
- package/build/routes/management/http/config-get.js +15 -20
- package/build/routes/management/http/metrics-get.d.ts +15 -3
- package/build/routes/management/http/metrics-get.js +16 -21
- package/build/routes/management/http/metrics-total-get.d.ts +15 -3
- package/build/routes/management/http/metrics-total-get.js +16 -21
- package/build/routes/management/http/sessions-get.d.ts +15 -3
- package/build/routes/management/http/sessions-get.js +16 -20
- package/build/routes/management/http/static-get.d.ts +15 -3
- package/build/routes/management/http/static-get.js +15 -20
- package/build/routes/webkit/ws/playwright-webkit.d.ts +13 -3
- package/build/routes/webkit/ws/playwright-webkit.js +11 -12
- package/build/server.js +0 -1
- package/build/types.d.ts +48 -38
- package/build/types.js +135 -0
- package/extensions/ublock/1p-filters.html +0 -1
- package/extensions/ublock/3p-filters.html +0 -2
- package/extensions/ublock/_locales/bg/messages.json +6 -6
- package/extensions/ublock/_locales/br_FR/messages.json +14 -14
- package/extensions/ublock/_locales/bs/messages.json +8 -8
- package/extensions/ublock/_locales/ca/messages.json +1 -1
- package/extensions/ublock/_locales/da/messages.json +5 -5
- package/extensions/ublock/_locales/fa/messages.json +1 -1
- package/extensions/ublock/_locales/fi/messages.json +6 -6
- package/extensions/ublock/_locales/hr/messages.json +4 -4
- package/extensions/ublock/_locales/nb/messages.json +1 -1
- package/extensions/ublock/_locales/no/messages.json +1 -1
- package/extensions/ublock/_locales/ro/messages.json +2 -2
- package/extensions/ublock/_locales/ru/messages.json +1 -1
- package/extensions/ublock/_locales/sk/messages.json +1 -1
- package/extensions/ublock/_locales/sv/messages.json +2 -2
- package/extensions/ublock/_locales/te/messages.json +17 -17
- package/extensions/ublock/_locales/vi/messages.json +12 -12
- package/extensions/ublock/_locales/zh_TW/messages.json +13 -13
- package/extensions/ublock/assets/assets.json +3 -3
- package/extensions/ublock/assets/resources/scriptlets.js +218 -97
- package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +3010 -2056
- package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +624 -433
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +93 -24
- package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +7 -15
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +795 -777
- package/extensions/ublock/assets/ublock/badware.min.txt +138 -72
- package/extensions/ublock/assets/ublock/filters.min.txt +1929 -2735
- package/extensions/ublock/assets/ublock/privacy.min.txt +57 -26
- package/extensions/ublock/assets/ublock/quick-fixes.min.txt +125 -74
- package/extensions/ublock/assets/ublock/unbreak.min.txt +46 -53
- package/extensions/ublock/css/codemirror.css +8 -7
- package/extensions/ublock/css/dom-inspector.css +40 -0
- package/extensions/ublock/css/logger-ui-inspector.css +7 -1
- package/extensions/ublock/css/logger-ui.css +12 -5
- package/extensions/ublock/css/popup-fenix.css +1 -1
- package/extensions/ublock/devtools.html +1 -0
- package/extensions/ublock/js/1p-filters.js +4 -3
- package/extensions/ublock/js/3p-filters.js +25 -31
- package/extensions/ublock/js/about.js +1 -1
- package/extensions/ublock/js/advanced-settings.js +1 -1
- package/extensions/ublock/js/asset-viewer.js +1 -1
- package/extensions/ublock/js/assets.js +74 -44
- package/extensions/ublock/js/background.js +9 -3
- package/extensions/ublock/js/base64-custom.js +1 -1
- package/extensions/ublock/js/benchmarks.js +1 -1
- package/extensions/ublock/js/biditrie.js +1 -1
- package/extensions/ublock/js/broadcast.js +75 -0
- package/extensions/ublock/js/cachestorage.js +68 -45
- package/extensions/ublock/js/click2load.js +1 -1
- package/extensions/ublock/js/cloud-ui.js +1 -1
- package/extensions/ublock/js/code-viewer.js +1 -1
- package/extensions/ublock/js/codemirror/search-thread.js +1 -1
- package/extensions/ublock/js/codemirror/search.js +1 -1
- package/extensions/ublock/js/codemirror/ubo-dynamic-filtering.js +1 -1
- package/extensions/ublock/js/codemirror/ubo-static-filtering.js +98 -24
- package/extensions/ublock/js/commands.js +1 -1
- package/extensions/ublock/js/console.js +1 -1
- package/extensions/ublock/js/contentscript-extra.js +1 -1
- package/extensions/ublock/js/contentscript.js +1 -3
- package/extensions/ublock/js/contextmenu.js +1 -1
- package/extensions/ublock/js/cosmetic-filtering.js +4 -4
- package/extensions/ublock/js/dashboard-common.js +1 -1
- package/extensions/ublock/js/dashboard.js +1 -1
- package/extensions/ublock/js/devtools.js +23 -15
- package/extensions/ublock/js/diff-updater.js +3 -3
- package/extensions/ublock/js/document-blocked.js +1 -1
- package/extensions/ublock/js/dom-inspector.js +68 -0
- package/extensions/ublock/js/dom.js +1 -1
- package/extensions/ublock/js/dyna-rules.js +1 -1
- package/extensions/ublock/js/dynamic-net-filtering.js +1 -1
- package/extensions/ublock/js/epicker-ui.js +35 -59
- package/extensions/ublock/js/fa-icons.js +1 -1
- package/extensions/ublock/js/filtering-context.js +1 -1
- package/extensions/ublock/js/filtering-engines.js +1 -1
- package/extensions/ublock/js/hnswitches.js +1 -1
- package/extensions/ublock/js/hntrie.js +1 -1
- package/extensions/ublock/js/html-filtering.js +1 -1
- package/extensions/ublock/js/httpheader-filtering.js +1 -1
- package/extensions/ublock/js/i18n.js +1 -1
- package/extensions/ublock/js/is-webrtc-supported.js +1 -1
- package/extensions/ublock/js/logger-ui-inspector.js +203 -145
- package/extensions/ublock/js/logger-ui.js +21 -5
- package/extensions/ublock/js/logger.js +6 -2
- package/extensions/ublock/js/lz4.js +2 -2
- package/extensions/ublock/js/messaging.js +266 -166
- package/extensions/ublock/js/mrucache.js +58 -0
- package/extensions/ublock/js/pagestore.js +1 -1
- package/extensions/ublock/js/popup-fenix.js +2 -1
- package/extensions/ublock/js/redirect-engine.js +1 -1
- package/extensions/ublock/js/redirect-resources.js +1 -12
- package/extensions/ublock/js/reverselookup-worker.js +1 -1
- package/extensions/ublock/js/reverselookup.js +1 -1
- package/extensions/ublock/js/scriptlet-filtering-core.js +300 -0
- package/extensions/ublock/js/scriptlet-filtering.js +122 -350
- package/extensions/ublock/js/scriptlets/cosmetic-logger.js +36 -47
- package/extensions/ublock/js/scriptlets/cosmetic-off.js +1 -1
- package/extensions/ublock/js/scriptlets/cosmetic-on.js +1 -1
- package/extensions/ublock/js/scriptlets/cosmetic-report.js +1 -1
- package/extensions/ublock/js/scriptlets/dom-inspector.js +341 -323
- package/extensions/ublock/js/scriptlets/dom-survey-elements.js +1 -1
- package/extensions/ublock/js/scriptlets/dom-survey-scripts.js +1 -1
- package/extensions/ublock/js/scriptlets/epicker.js +80 -89
- package/extensions/ublock/js/scriptlets/load-3p-css.js +1 -1
- package/extensions/ublock/js/scriptlets/load-large-media-all.js +1 -1
- package/extensions/ublock/js/scriptlets/load-large-media-interactive.js +1 -1
- package/extensions/ublock/js/scriptlets/noscript-spoof.js +1 -1
- package/extensions/ublock/js/scriptlets/should-inject-contentscript.js +1 -1
- package/extensions/ublock/js/scriptlets/subscriber.js +1 -1
- package/extensions/ublock/js/scriptlets/updater.js +20 -3
- package/extensions/ublock/js/settings.js +1 -1
- package/extensions/ublock/js/start.js +19 -20
- package/extensions/ublock/js/static-dnr-filtering.js +1 -1
- package/extensions/ublock/js/static-ext-filtering-db.js +1 -1
- package/extensions/ublock/js/static-ext-filtering.js +1 -1
- package/extensions/ublock/js/static-filtering-io.js +1 -1
- package/extensions/ublock/js/static-filtering-parser.js +5 -3
- package/extensions/ublock/js/static-net-filtering.js +57 -37
- package/extensions/ublock/js/storage.js +49 -29
- package/extensions/ublock/js/support.js +4 -4
- package/extensions/ublock/js/tab.js +1 -1
- package/extensions/ublock/js/tasks.js +1 -1
- package/extensions/ublock/js/text-encode.js +1 -1
- package/extensions/ublock/js/text-utils.js +1 -1
- package/extensions/ublock/js/theme.js +1 -1
- package/extensions/ublock/js/traffic.js +2 -1
- package/extensions/ublock/js/ublock.js +15 -11
- package/extensions/ublock/js/uri-utils.js +1 -1
- package/extensions/ublock/js/url-net-filtering.js +1 -1
- package/extensions/ublock/js/utils.js +1 -73
- package/extensions/ublock/js/vapi-background-ext.js +1 -1
- package/extensions/ublock/js/vapi-background.js +92 -83
- package/extensions/ublock/js/vapi-client.js +4 -33
- package/extensions/ublock/js/vapi-common.js +16 -30
- package/extensions/ublock/js/vapi.js +1 -1
- package/extensions/ublock/js/wasm/biditrie.wat +1 -1
- package/extensions/ublock/js/wasm/hntrie.wat +1 -1
- package/extensions/ublock/js/webext.js +1 -1
- package/extensions/ublock/js/whitelist.js +1 -1
- package/extensions/ublock/logger-ui.html +2 -2
- package/extensions/ublock/manifest.json +1 -1
- package/extensions/ublock/support.html +0 -1
- package/extensions/ublock/web_accessible_resources/dom-inspector.html +25 -0
- package/extensions/ublock/web_accessible_resources/epicker-ui.html +0 -1
- package/extensions/ublock/web_accessible_resources/googletagservices_gpt.js +1 -0
- package/package.json +7 -19
- package/scripts/build-open-api.js +7 -4
- package/src/browserless.ts +42 -18
- package/src/browsers/index.ts +48 -20
- package/src/file-system.spec.ts +58 -0
- package/src/file-system.ts +36 -8
- package/src/http.ts +3 -3
- package/src/router.ts +2 -6
- package/src/routes/chromium/http/content-post.ts +13 -16
- package/src/routes/chromium/http/download-post.ts +16 -27
- package/src/routes/chromium/http/function-post.ts +16 -25
- package/src/routes/chromium/http/pdf-post.ts +19 -15
- package/src/routes/chromium/http/performance.ts +14 -26
- package/src/routes/chromium/http/scrape-post.ts +14 -16
- package/src/routes/chromium/http/screenshot-post.ts +18 -15
- package/src/routes/chromium/tests/websocket.spec.ts +28 -1
- package/src/routes/chromium/utils/function/handler.ts +2 -1
- package/src/routes/chromium/ws/browser.ts +10 -12
- package/src/routes/chromium/ws/cdp-chromium.ts +10 -12
- package/src/routes/chromium/ws/page.ts +10 -12
- package/src/routes/chromium/ws/playwright-chromium.ts +10 -12
- package/src/routes/firefox/ws/playwright-firefox.ts +10 -12
- package/src/routes/management/http/config-get.ts +14 -23
- package/src/routes/management/http/metrics-get.ts +15 -24
- package/src/routes/management/http/metrics-total-get.ts +15 -26
- package/src/routes/management/http/sessions-get.ts +15 -23
- package/src/routes/management/http/static-get.ts +14 -22
- package/src/routes/webkit/ws/playwright-webkit.ts +10 -12
- package/src/server.ts +0 -1
- package/src/types.ts +59 -45
- package/static/docs/browserless-logo-inline.svg +1 -0
- package/static/docs/index.html +27 -0
- package/static/docs/swagger.json +33 -33
- package/static/function/client.js +626 -78
- package/extensions/ublock/js/vapi-client-extra.js +0 -312
- package/extensions/ublock/web_accessible_resources/addthis_widget.js +0 -39
- package/extensions/ublock/web_accessible_resources/ligatus_angular-tag.js +0 -29
- package/extensions/ublock/web_accessible_resources/monkeybroker.js +0 -43
- package/extensions/ublock/web_accessible_resources/mxpnl_mixpanel.js +0 -51
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2014-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -84,48 +84,6 @@ import µb from './background.js';
|
|
|
84
84
|
|
|
85
85
|
/******************************************************************************/
|
|
86
86
|
|
|
87
|
-
µb.MRUCache = class {
|
|
88
|
-
constructor(size) {
|
|
89
|
-
this.size = size;
|
|
90
|
-
this.array = [];
|
|
91
|
-
this.map = new Map();
|
|
92
|
-
this.resetTime = Date.now();
|
|
93
|
-
}
|
|
94
|
-
add(key, value) {
|
|
95
|
-
const found = this.map.has(key);
|
|
96
|
-
this.map.set(key, value);
|
|
97
|
-
if ( !found ) {
|
|
98
|
-
if ( this.array.length === this.size ) {
|
|
99
|
-
this.map.delete(this.array.pop());
|
|
100
|
-
}
|
|
101
|
-
this.array.unshift(key);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
remove(key) {
|
|
105
|
-
if ( this.map.has(key) ) {
|
|
106
|
-
this.array.splice(this.array.indexOf(key), 1);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
lookup(key) {
|
|
110
|
-
const value = this.map.get(key);
|
|
111
|
-
if ( value !== undefined && this.array[0] !== key ) {
|
|
112
|
-
let i = this.array.indexOf(key);
|
|
113
|
-
do {
|
|
114
|
-
this.array[i] = this.array[i-1];
|
|
115
|
-
} while ( --i );
|
|
116
|
-
this.array[0] = key;
|
|
117
|
-
}
|
|
118
|
-
return value;
|
|
119
|
-
}
|
|
120
|
-
reset() {
|
|
121
|
-
this.array = [];
|
|
122
|
-
this.map.clear();
|
|
123
|
-
this.resetTime = Date.now();
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
/******************************************************************************/
|
|
128
|
-
|
|
129
87
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
|
|
130
88
|
|
|
131
89
|
µb.escapeRegex = function(s) {
|
|
@@ -134,36 +92,6 @@ import µb from './background.js';
|
|
|
134
92
|
|
|
135
93
|
/******************************************************************************/
|
|
136
94
|
|
|
137
|
-
µb.fireEvent = function(name, details = undefined) {
|
|
138
|
-
if (
|
|
139
|
-
self instanceof Object &&
|
|
140
|
-
self.dispatchEvent instanceof Function &&
|
|
141
|
-
self.CustomEvent instanceof Function
|
|
142
|
-
) {
|
|
143
|
-
self.dispatchEvent(new CustomEvent(name, { detail: details }));
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
µb.onEvent = function(name, fn) {
|
|
148
|
-
if (
|
|
149
|
-
self instanceof Object &&
|
|
150
|
-
self.addEventListener instanceof Function
|
|
151
|
-
) {
|
|
152
|
-
self.addEventListener(name, fn);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/******************************************************************************/
|
|
157
|
-
|
|
158
|
-
µb.filteringBehaviorChanged = function(details = {}) {
|
|
159
|
-
if ( typeof details.direction !== 'number' || details.direction >= 0 ) {
|
|
160
|
-
vAPI.net.handlerBehaviorChanged();
|
|
161
|
-
}
|
|
162
|
-
this.fireEvent('filteringBehaviorChanged', details);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
/******************************************************************************/
|
|
166
|
-
|
|
167
95
|
// TODO: properly compare arrays
|
|
168
96
|
|
|
169
97
|
µb.getModifiedSettings = function(edit, orig = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2017-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2014-2015 The uBlock Origin authors
|
|
5
5
|
Copyright (C) 2014-present Raymond Hill
|
|
6
6
|
|
|
@@ -87,26 +87,83 @@ vAPI.app = {
|
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
/*******************************************************************************
|
|
91
|
+
*
|
|
92
|
+
* https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/storage/session
|
|
93
|
+
*
|
|
94
|
+
* Session (in-memory) storage is promise-based in all browsers, no need for
|
|
95
|
+
* a webext polyfill. However, not all browsers supports it in MV2.
|
|
96
|
+
*
|
|
97
|
+
* */
|
|
98
|
+
|
|
99
|
+
vAPI.sessionStorage = {
|
|
100
|
+
get() {
|
|
101
|
+
return Promise.resolve({});
|
|
102
|
+
},
|
|
103
|
+
set() {
|
|
104
|
+
return Promise.resolve();
|
|
105
|
+
},
|
|
106
|
+
remove() {
|
|
107
|
+
return Promise.resolve();
|
|
108
|
+
},
|
|
109
|
+
clear() {
|
|
110
|
+
return Promise.resolve();
|
|
111
|
+
},
|
|
112
|
+
implemented: false,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/*******************************************************************************
|
|
116
|
+
*
|
|
117
|
+
* Data written to and read from storage.local will be mirrored to in-memory
|
|
118
|
+
* storage.session.
|
|
119
|
+
*
|
|
120
|
+
* Data read from storage.local will be first fetched from storage.session,
|
|
121
|
+
* then if not available, read from storage.local.
|
|
122
|
+
*
|
|
123
|
+
* */
|
|
92
124
|
|
|
93
125
|
vAPI.storage = {
|
|
94
|
-
get(...args) {
|
|
95
|
-
|
|
96
|
-
|
|
126
|
+
get(key, ...args) {
|
|
127
|
+
if ( vAPI.sessionStorage.implemented !== true ) {
|
|
128
|
+
return webext.storage.local.get(key, ...args).catch(reason => {
|
|
129
|
+
console.log(reason);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return vAPI.sessionStorage.get(key, ...args).then(bin => {
|
|
133
|
+
const size = Object.keys(bin).length;
|
|
134
|
+
if ( size === 1 && typeof key === 'string' && bin[key] === null ) {
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
if ( size !== 0 ) { return bin; }
|
|
138
|
+
return webext.storage.local.get(key, ...args).then(bin => {
|
|
139
|
+
if ( bin instanceof Object === false ) { return bin; }
|
|
140
|
+
// Mirror empty result as null value in order to prevent
|
|
141
|
+
// from falling back to storage.local when there is no need.
|
|
142
|
+
const tomirror = Object.assign({}, bin);
|
|
143
|
+
if ( typeof key === 'string' && Object.keys(bin).length === 0 ) {
|
|
144
|
+
Object.assign(tomirror, { [key]: null });
|
|
145
|
+
}
|
|
146
|
+
vAPI.sessionStorage.set(tomirror);
|
|
147
|
+
return bin;
|
|
148
|
+
}).catch(reason => {
|
|
149
|
+
console.log(reason);
|
|
150
|
+
});
|
|
97
151
|
});
|
|
98
152
|
},
|
|
99
153
|
set(...args) {
|
|
154
|
+
vAPI.sessionStorage.set(...args);
|
|
100
155
|
return webext.storage.local.set(...args).catch(reason => {
|
|
101
156
|
console.log(reason);
|
|
102
157
|
});
|
|
103
158
|
},
|
|
104
159
|
remove(...args) {
|
|
160
|
+
vAPI.sessionStorage.remove(...args);
|
|
105
161
|
return webext.storage.local.remove(...args).catch(reason => {
|
|
106
162
|
console.log(reason);
|
|
107
163
|
});
|
|
108
164
|
},
|
|
109
165
|
clear(...args) {
|
|
166
|
+
vAPI.sessionStorage.clear(...args);
|
|
110
167
|
return webext.storage.local.clear(...args).catch(reason => {
|
|
111
168
|
console.log(reason);
|
|
112
169
|
});
|
|
@@ -967,71 +1024,11 @@ vAPI.messaging = {
|
|
|
967
1024
|
}
|
|
968
1025
|
},
|
|
969
1026
|
|
|
970
|
-
broadcast: function(message) {
|
|
971
|
-
const messageWrapper = { broadcast: true, msg: message };
|
|
972
|
-
for ( const { port } of this.ports.values() ) {
|
|
973
|
-
try {
|
|
974
|
-
port.postMessage(messageWrapper);
|
|
975
|
-
} catch(ex) {
|
|
976
|
-
this.onPortDisconnect(port);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
if ( this.defaultHandler ) {
|
|
980
|
-
this.defaultHandler(message, null, ( ) => { });
|
|
981
|
-
}
|
|
982
|
-
},
|
|
983
|
-
|
|
984
1027
|
onFrameworkMessage: function(request, port, callback) {
|
|
985
1028
|
const portDetails = this.ports.get(port.name) || {};
|
|
986
1029
|
const tabId = portDetails.tabId;
|
|
987
1030
|
const msg = request.msg;
|
|
988
1031
|
switch ( msg.what ) {
|
|
989
|
-
case 'connectionAccepted':
|
|
990
|
-
case 'connectionRefused': {
|
|
991
|
-
const toPort = this.ports.get(msg.fromToken);
|
|
992
|
-
if ( toPort !== undefined ) {
|
|
993
|
-
msg.tabId = tabId;
|
|
994
|
-
toPort.port.postMessage(request);
|
|
995
|
-
} else {
|
|
996
|
-
msg.what = 'connectionBroken';
|
|
997
|
-
port.postMessage(request);
|
|
998
|
-
}
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
case 'connectionRequested':
|
|
1002
|
-
msg.tabId = tabId;
|
|
1003
|
-
for ( const { port: toPort } of this.ports.values() ) {
|
|
1004
|
-
if ( toPort === port ) { continue; }
|
|
1005
|
-
try {
|
|
1006
|
-
toPort.postMessage(request);
|
|
1007
|
-
} catch (ex) {
|
|
1008
|
-
this.onPortDisconnect(toPort);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
break;
|
|
1012
|
-
case 'connectionBroken':
|
|
1013
|
-
case 'connectionCheck':
|
|
1014
|
-
case 'connectionMessage': {
|
|
1015
|
-
const toPort = this.ports.get(
|
|
1016
|
-
port.name === msg.fromToken ? msg.toToken : msg.fromToken
|
|
1017
|
-
);
|
|
1018
|
-
if ( toPort !== undefined ) {
|
|
1019
|
-
msg.tabId = tabId;
|
|
1020
|
-
toPort.port.postMessage(request);
|
|
1021
|
-
} else {
|
|
1022
|
-
msg.what = 'connectionBroken';
|
|
1023
|
-
port.postMessage(request);
|
|
1024
|
-
}
|
|
1025
|
-
break;
|
|
1026
|
-
}
|
|
1027
|
-
case 'extendClient':
|
|
1028
|
-
vAPI.tabs.executeScript(tabId, {
|
|
1029
|
-
file: '/js/vapi-client-extra.js',
|
|
1030
|
-
frameId: portDetails.frameId,
|
|
1031
|
-
}).then(( ) => {
|
|
1032
|
-
callback();
|
|
1033
|
-
});
|
|
1034
|
-
break;
|
|
1035
1032
|
case 'localStorage': {
|
|
1036
1033
|
if ( portDetails.privileged !== true ) { break; }
|
|
1037
1034
|
const args = msg.args || [];
|
|
@@ -1178,16 +1175,15 @@ vAPI.messaging = {
|
|
|
1178
1175
|
const shortSecrets = [];
|
|
1179
1176
|
let lastShortSecretTime = 0;
|
|
1180
1177
|
|
|
1181
|
-
// Long secrets are
|
|
1182
|
-
//
|
|
1183
|
-
const longSecrets =
|
|
1184
|
-
let lastLongSecretTimeSlice = 0;
|
|
1178
|
+
// Long secrets are valid until revoked or uBO restarts. The realm is one
|
|
1179
|
+
// value out of 36^18 = over 10^28 values.
|
|
1180
|
+
const longSecrets = new Set();
|
|
1185
1181
|
|
|
1186
1182
|
const guard = details => {
|
|
1187
1183
|
const match = reSecret.exec(details.url);
|
|
1188
1184
|
if ( match === null ) { return { cancel: true }; }
|
|
1189
1185
|
const secret = match[1];
|
|
1190
|
-
if ( longSecrets.
|
|
1186
|
+
if ( longSecrets.has(secret) ) { return; }
|
|
1191
1187
|
const pos = shortSecrets.indexOf(secret);
|
|
1192
1188
|
if ( pos === -1 ) { return { cancel: true }; }
|
|
1193
1189
|
shortSecrets.splice(pos, 1);
|
|
@@ -1215,14 +1211,13 @@ vAPI.messaging = {
|
|
|
1215
1211
|
shortSecrets.push(secret);
|
|
1216
1212
|
return secret;
|
|
1217
1213
|
},
|
|
1218
|
-
long:
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
longSecrets[1] = longSecrets[0];
|
|
1222
|
-
longSecrets[0] = `${generateSecret()}${generateSecret()}${generateSecret()}`;
|
|
1223
|
-
lastLongSecretTimeSlice = timeSlice;
|
|
1214
|
+
long: previous => {
|
|
1215
|
+
if ( previous !== undefined ) {
|
|
1216
|
+
longSecrets.delete(previous);
|
|
1224
1217
|
}
|
|
1225
|
-
|
|
1218
|
+
const secret = `${generateSecret()}${generateSecret()}${generateSecret()}`;
|
|
1219
|
+
longSecrets.add(secret);
|
|
1220
|
+
return secret;
|
|
1226
1221
|
},
|
|
1227
1222
|
};
|
|
1228
1223
|
}
|
|
@@ -1482,14 +1477,14 @@ vAPI.adminStorage = (( ) => {
|
|
|
1482
1477
|
store = await webext.storage.managed.get();
|
|
1483
1478
|
} catch(ex) {
|
|
1484
1479
|
}
|
|
1485
|
-
|
|
1480
|
+
vAPI.storage.set({ cachedManagedStorage: store || {} });
|
|
1486
1481
|
};
|
|
1487
1482
|
|
|
1488
1483
|
return {
|
|
1489
1484
|
get: async function(key) {
|
|
1490
1485
|
let bin;
|
|
1491
1486
|
try {
|
|
1492
|
-
bin = await
|
|
1487
|
+
bin = await vAPI.storage.get('cachedManagedStorage') || {};
|
|
1493
1488
|
if ( Object.keys(bin).length === 0 ) {
|
|
1494
1489
|
bin = await webext.storage.managed.get() || {};
|
|
1495
1490
|
} else {
|
|
@@ -1537,7 +1532,7 @@ vAPI.localStorage = {
|
|
|
1537
1532
|
start: async function() {
|
|
1538
1533
|
if ( this.cache instanceof Promise ) { return this.cache; }
|
|
1539
1534
|
if ( this.cache instanceof Object ) { return this.cache; }
|
|
1540
|
-
this.cache =
|
|
1535
|
+
this.cache = vAPI.storage.get('localStorage').then(bin => {
|
|
1541
1536
|
this.cache = bin instanceof Object &&
|
|
1542
1537
|
bin.localStorage instanceof Object
|
|
1543
1538
|
? bin.localStorage
|
|
@@ -1547,7 +1542,7 @@ vAPI.localStorage = {
|
|
|
1547
1542
|
},
|
|
1548
1543
|
clear: function() {
|
|
1549
1544
|
this.cache = {};
|
|
1550
|
-
return
|
|
1545
|
+
return vAPI.storage.set({ localStorage: this.cache });
|
|
1551
1546
|
},
|
|
1552
1547
|
getItem: function(key) {
|
|
1553
1548
|
if ( this.cache instanceof Object === false ) {
|
|
@@ -1569,7 +1564,7 @@ vAPI.localStorage = {
|
|
|
1569
1564
|
await this.start();
|
|
1570
1565
|
if ( value === this.cache[key] ) { return; }
|
|
1571
1566
|
this.cache[key] = value;
|
|
1572
|
-
return
|
|
1567
|
+
return vAPI.storage.set({ localStorage: this.cache });
|
|
1573
1568
|
},
|
|
1574
1569
|
cache: undefined,
|
|
1575
1570
|
};
|
|
@@ -1800,3 +1795,17 @@ vAPI.cloud = (( ) => {
|
|
|
1800
1795
|
})();
|
|
1801
1796
|
|
|
1802
1797
|
/******************************************************************************/
|
|
1798
|
+
/******************************************************************************/
|
|
1799
|
+
|
|
1800
|
+
vAPI.alarms = browser.alarms || {
|
|
1801
|
+
create() {
|
|
1802
|
+
},
|
|
1803
|
+
clear() {
|
|
1804
|
+
},
|
|
1805
|
+
onAlarm: {
|
|
1806
|
+
addListener() {
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1811
|
+
/******************************************************************************/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2014-2015 The uBlock Origin authors
|
|
5
5
|
Copyright (C) 2014-present Raymond Hill
|
|
6
6
|
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
|
|
23
23
|
// For non-background page
|
|
24
24
|
|
|
25
|
+
/* globals browser */
|
|
26
|
+
|
|
25
27
|
'use strict';
|
|
26
28
|
|
|
27
29
|
/******************************************************************************/
|
|
@@ -81,8 +83,6 @@ vAPI.messaging = {
|
|
|
81
83
|
port: null,
|
|
82
84
|
portTimer: null,
|
|
83
85
|
portTimerDelay: 10000,
|
|
84
|
-
extended: undefined,
|
|
85
|
-
extensions: [],
|
|
86
86
|
msgIdGenerator: 1,
|
|
87
87
|
pending: new Map(),
|
|
88
88
|
shuttingDown: false,
|
|
@@ -125,23 +125,11 @@ vAPI.messaging = {
|
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
// Unhandled messages
|
|
130
|
-
this.extensions.every(ext => ext.canProcessMessage(details) !== true);
|
|
131
128
|
},
|
|
132
129
|
messageListenerBound: null,
|
|
133
130
|
|
|
134
131
|
canDestroyPort: function() {
|
|
135
|
-
return this.pending.size === 0
|
|
136
|
-
this.extensions.length === 0 ||
|
|
137
|
-
this.extensions.every(e => e.canDestroyPort())
|
|
138
|
-
);
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
mustDestroyPort: function() {
|
|
142
|
-
if ( this.extensions.length === 0 ) { return; }
|
|
143
|
-
this.extensions.forEach(e => e.mustDestroyPort());
|
|
144
|
-
this.extensions.length = 0;
|
|
132
|
+
return this.pending.size === 0;
|
|
145
133
|
},
|
|
146
134
|
|
|
147
135
|
portPoller: function() {
|
|
@@ -166,7 +154,6 @@ vAPI.messaging = {
|
|
|
166
154
|
port.onDisconnect.removeListener(this.disconnectListenerBound);
|
|
167
155
|
this.port = null;
|
|
168
156
|
}
|
|
169
|
-
this.mustDestroyPort();
|
|
170
157
|
// service pending callbacks
|
|
171
158
|
if ( this.pending.size !== 0 ) {
|
|
172
159
|
const pending = this.pending;
|
|
@@ -230,22 +217,6 @@ vAPI.messaging = {
|
|
|
230
217
|
port.postMessage({ channel, msgId, msg });
|
|
231
218
|
return promise;
|
|
232
219
|
},
|
|
233
|
-
|
|
234
|
-
// Dynamically extend capabilities.
|
|
235
|
-
//
|
|
236
|
-
// https://github.com/uBlockOrigin/uBlock-issues/issues/1571
|
|
237
|
-
// Don't use `self` to access `vAPI`.
|
|
238
|
-
extend: function() {
|
|
239
|
-
if ( this.extended === undefined ) {
|
|
240
|
-
this.extended = vAPI.messaging.send('vapi', {
|
|
241
|
-
what: 'extendClient'
|
|
242
|
-
}).then(( ) =>
|
|
243
|
-
typeof vAPI === 'object' && this.extensions.length !== 0
|
|
244
|
-
).catch(( ) => {
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
return this.extended;
|
|
248
|
-
},
|
|
249
220
|
};
|
|
250
221
|
|
|
251
222
|
vAPI.shutdown.add(( ) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2014-2015 The uBlock Origin authors
|
|
5
5
|
Copyright (C) 2014-present Raymond Hill
|
|
6
6
|
|
|
@@ -178,38 +178,24 @@ vAPI.webextFlavor = {
|
|
|
178
178
|
soup.add('mobile');
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
browser instanceof Object &&
|
|
184
|
-
typeof browser.runtime.getBrowserInfo === 'function'
|
|
185
|
-
) {
|
|
186
|
-
browser.runtime.getBrowserInfo().then(info => {
|
|
187
|
-
flavor.major = parseInt(info.version, 10) || flavor.major;
|
|
188
|
-
soup.add(info.vendor.toLowerCase())
|
|
189
|
-
.add(info.name.toLowerCase());
|
|
190
|
-
if ( flavor.major >= 121 && soup.has('mobile') === false ) {
|
|
191
|
-
soup.add('native_css_has');
|
|
192
|
-
}
|
|
193
|
-
dispatch();
|
|
194
|
-
});
|
|
195
|
-
if ( browser.runtime.getURL('').startsWith('moz-extension://') ) {
|
|
196
|
-
soup.add('firefox')
|
|
197
|
-
.add('user_stylesheet')
|
|
198
|
-
.add('html_filtering');
|
|
199
|
-
flavor.major = 115;
|
|
200
|
-
}
|
|
201
|
-
return;
|
|
181
|
+
if ( CSS.supports('selector(a:has(b))') ) {
|
|
182
|
+
soup.add('native_css_has');
|
|
202
183
|
}
|
|
203
184
|
|
|
204
|
-
//
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
.add('
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
185
|
+
// Order of tests is important
|
|
186
|
+
if ( browser.runtime.getURL('').startsWith('moz-extension://') ) {
|
|
187
|
+
soup.add('firefox')
|
|
188
|
+
.add('user_stylesheet')
|
|
189
|
+
.add('html_filtering');
|
|
190
|
+
const match = /Firefox\/(\d+)/.exec(ua);
|
|
191
|
+
flavor.major = match && parseInt(match[1], 10) || 115;
|
|
192
|
+
} else {
|
|
193
|
+
const match = /\bChrom(?:e|ium)\/(\d+)/.exec(ua);
|
|
194
|
+
if ( match !== null ) {
|
|
195
|
+
soup.add('chromium')
|
|
196
|
+
.add('user_stylesheet');
|
|
212
197
|
}
|
|
198
|
+
flavor.major = match && parseInt(match[1], 10) || 120;
|
|
213
199
|
}
|
|
214
200
|
|
|
215
201
|
// Don't starve potential listeners
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2017-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2019-present Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*******************************************************************************
|
|
2
2
|
|
|
3
|
-
uBlock Origin - a
|
|
3
|
+
uBlock Origin - a comprehensive, efficient content blocker
|
|
4
4
|
Copyright (C) 2014-2018 Raymond Hill
|
|
5
5
|
|
|
6
6
|
This program is free software: you can redistribute it and/or modify
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
<div id="domInspector" class="inspector hCompact">
|
|
35
35
|
<div class="permatoolbar">
|
|
36
36
|
<div>
|
|
37
|
+
<button class="iconified notext vExpandToggler"><span class="fa-icon">double-angle-up</span><span class="hover"></span></button>
|
|
37
38
|
<button class="iconified notext vCompactToggler"><span class="fa-icon">double-angle-up</span><span class="hover"></span></button>
|
|
38
39
|
<button class="iconified notext hCompactToggler"><span class="fa-icon">double-angle-left</span><span class="hover"></span></button>
|
|
39
40
|
<button class="iconified notext revert disabled"><span class="fa-icon">eraser</span><span class="hover"></span></button>
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
<span id="filterExprGroup">
|
|
55
56
|
<button id="filterButton" class="iconified notext" data-i18n-title="loggerRowFiltererButtonTip"><span class="fa-icon">filter</span><span class="hover"></span></button>
|
|
56
57
|
<span id="filterInput">
|
|
57
|
-
<input type="search" placeholder="logFilterPrompt">
|
|
58
|
+
<input type="search" placeholder="logFilterPrompt" spellcheck="false">
|
|
58
59
|
<span id="filterExprButton" class="button fa-icon expanded" data-i18n-title="loggerRowFiltererBuiltinTip">angle-up</span>
|
|
59
60
|
<div id="filterExprPicker">
|
|
60
61
|
<div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot"></span><span data-filtex="\t--\t|\t<<\t|\t##" data-i18n="loggerRowFiltererBuiltinBlocked"></span><span data-filtex="\t\+\+\t|\t\*\*\t|\t#@#" data-i18n="loggerRowFiltererBuiltinAllowed"></span><span data-filtex="[$,](?:csp|permissions|removeparam|redirect-rule|replace|urltransform)=|\t\<\<\t" data-i18n="loggerRowFiltererBuiltinModified"></span></div>
|
|
@@ -222,7 +223,6 @@
|
|
|
222
223
|
<script src="js/vapi.js"></script>
|
|
223
224
|
<script src="js/vapi-common.js"></script>
|
|
224
225
|
<script src="js/vapi-client.js"></script>
|
|
225
|
-
<script src="js/vapi-client-extra.js"></script>
|
|
226
226
|
<script src="js/theme.js" type="module"></script>
|
|
227
227
|
<script src="js/i18n.js" type="module"></script>
|
|
228
228
|
<script src="js/logger-ui.js" type="module"></script>
|
|
@@ -121,7 +121,6 @@
|
|
|
121
121
|
<script src="js/vapi.js"></script>
|
|
122
122
|
<script src="js/vapi-common.js"></script>
|
|
123
123
|
<script src="js/vapi-client.js"></script>
|
|
124
|
-
<script src="js/vapi-client-extra.js"></script>
|
|
125
124
|
<script src="js/theme.js" type="module"></script>
|
|
126
125
|
<script src="js/i18n.js" type="module"></script>
|
|
127
126
|
<script src="js/dashboard-common.js" type="module"></script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html id="ublock0-inspector">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="color-scheme" content="light dark">
|
|
7
|
+
<title>uBlock Origin Inspector</title>
|
|
8
|
+
<link rel="stylesheet" href="../css/dom-inspector.css">
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<svg>
|
|
13
|
+
<path d></path>
|
|
14
|
+
<path d></path>
|
|
15
|
+
<path d></path>
|
|
16
|
+
<path d></path>
|
|
17
|
+
</svg>
|
|
18
|
+
|
|
19
|
+
<script src="../js/vapi.js"></script>
|
|
20
|
+
<script src="../js/vapi-common.js"></script>
|
|
21
|
+
<script src="../js/vapi-client.js"></script>
|
|
22
|
+
<script src="../js/dom-inspector.js" type="module"></script>
|
|
23
|
+
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
<script src="../js/vapi.js"></script>
|
|
68
68
|
<script src="../js/vapi-common.js"></script>
|
|
69
69
|
<script src="../js/vapi-client.js"></script>
|
|
70
|
-
<script src="../js/vapi-client-extra.js"></script>
|
|
71
70
|
<script src="../js/theme.js" type="module"></script>
|
|
72
71
|
<script src="../js/i18n.js" type="module"></script>
|
|
73
72
|
<script src="../js/epicker-ui.js" type="module"></script>
|