@whotracksme/reporting 5.1.17
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/.editorconfig +12 -0
- package/.eslintignore +3 -0
- package/.eslintrc +16 -0
- package/.github/workflows/release.yml +34 -0
- package/.github/workflows/tests.yml +20 -0
- package/.prettierrc +9 -0
- package/.tool-versions +1 -0
- package/CHANGELOG.md +795 -0
- package/LICENSE +373 -0
- package/README.md +1 -0
- package/communication/README.md +11 -0
- package/communication/example/index.js +43 -0
- package/communication/example/manifest.json +16 -0
- package/communication/karma.conf.cjs +19 -0
- package/communication/package.json +52 -0
- package/communication/rollup.common-config.cjs +17 -0
- package/communication/rollup.config.cjs +10 -0
- package/communication/src/encoding.js +54 -0
- package/communication/src/errors.js +84 -0
- package/communication/src/index.js +76 -0
- package/communication/src/logger.js +41 -0
- package/communication/src/padding.js +60 -0
- package/communication/src/proxied-http.js +231 -0
- package/communication/src/server-public-key-accessor.js +123 -0
- package/communication/src/timestamps.js +37 -0
- package/communication/src/trusted-clock.js +58 -0
- package/communication/src/utils.js +28 -0
- package/communication/src/zlib.js +17 -0
- package/communication/test/helpers/in-memory-database.js +43 -0
- package/communication/test/server-public-key-accessor.spec.js +135 -0
- package/communication/test/utils.spec.js +43 -0
- package/package.json +50 -0
- package/reporting/TODO.md +2 -0
- package/reporting/assets/request/bloom_filter.dat +0 -0
- package/reporting/assets/request/update.json +1 -0
- package/reporting/example/content.js +11 -0
- package/reporting/example/index.js +132 -0
- package/reporting/example/inspector/index.html +17 -0
- package/reporting/example/inspector/index.js +27 -0
- package/reporting/example/manifests/chromium.json +37 -0
- package/reporting/example/manifests/firefox.json +35 -0
- package/reporting/example/rules.json +62 -0
- package/reporting/example/setup.js +1 -0
- package/reporting/example/tests/test1.html +10 -0
- package/reporting/karma.conf.cjs +22 -0
- package/reporting/package.json +63 -0
- package/reporting/rollup.common-config.cjs +19 -0
- package/reporting/rollup.config.cjs +20 -0
- package/reporting/src/LRU.js +149 -0
- package/reporting/src/activity-estimator.js +298 -0
- package/reporting/src/alive-check.js +139 -0
- package/reporting/src/alive-message-generator.js +142 -0
- package/reporting/src/bloom-filters.js +345 -0
- package/reporting/src/country-provider.js +295 -0
- package/reporting/src/cyrb53.js +32 -0
- package/reporting/src/digest.js +33 -0
- package/reporting/src/doublefetch-page-handler.js +548 -0
- package/reporting/src/duplicate-detector.js +233 -0
- package/reporting/src/errors.js +84 -0
- package/reporting/src/event-listener-queue.js +121 -0
- package/reporting/src/fixed-size-cache.js +63 -0
- package/reporting/src/hash-detector.js +1526 -0
- package/reporting/src/html-parser.js +17 -0
- package/reporting/src/http.js +265 -0
- package/reporting/src/index.js +14 -0
- package/reporting/src/job-scheduler.js +912 -0
- package/reporting/src/logger.js +121 -0
- package/reporting/src/md5.js +334 -0
- package/reporting/src/message-sender.js +51 -0
- package/reporting/src/network.js +140 -0
- package/reporting/src/new-page-approver.js +119 -0
- package/reporting/src/page-aggregator.js +185 -0
- package/reporting/src/page-quorum-check-handler.js +200 -0
- package/reporting/src/page-structure.js +136 -0
- package/reporting/src/pagedb.js +671 -0
- package/reporting/src/pages.js +1798 -0
- package/reporting/src/patterns-updater.js +310 -0
- package/reporting/src/patterns.js +416 -0
- package/reporting/src/persisted-bitarray.js +265 -0
- package/reporting/src/persisted-hashes.js +189 -0
- package/reporting/src/quorum-checker.js +327 -0
- package/reporting/src/random.js +39 -0
- package/reporting/src/reporting.js +290 -0
- package/reporting/src/request/config.js +116 -0
- package/reporting/src/request/content-script.js +77 -0
- package/reporting/src/request/database.js +147 -0
- package/reporting/src/request/dnt.js +24 -0
- package/reporting/src/request/hash.js +101 -0
- package/reporting/src/request/index.js +874 -0
- package/reporting/src/request/page-telemetry.js +42 -0
- package/reporting/src/request/qs-whitelist2.js +247 -0
- package/reporting/src/request/resources/prob.js +601 -0
- package/reporting/src/request/steps/block-rules.js +40 -0
- package/reporting/src/request/steps/check-context.js +37 -0
- package/reporting/src/request/steps/cookie-context.js +209 -0
- package/reporting/src/request/steps/oauth-detector.js +101 -0
- package/reporting/src/request/steps/page-logger.js +177 -0
- package/reporting/src/request/steps/redirect-tagger.js +75 -0
- package/reporting/src/request/steps/subdomain-check.js +34 -0
- package/reporting/src/request/steps/token-checker/index.js +189 -0
- package/reporting/src/request/steps/token-checker/token-domain.js +129 -0
- package/reporting/src/request/steps/token-examiner.js +182 -0
- package/reporting/src/request/steps/token-telemetry/cached-entry-pipeline.js +210 -0
- package/reporting/src/request/steps/token-telemetry/index.js +234 -0
- package/reporting/src/request/steps/token-telemetry/key-pipeline.js +109 -0
- package/reporting/src/request/steps/token-telemetry/token-pipeline.js +105 -0
- package/reporting/src/request/time.js +73 -0
- package/reporting/src/request/utils/bloom-filter-packed.js +107 -0
- package/reporting/src/request/utils/chrome-storage-map.js +282 -0
- package/reporting/src/request/utils/subject.js +37 -0
- package/reporting/src/request/utils/temp-set.js +56 -0
- package/reporting/src/request/utils/tlds.js +55 -0
- package/reporting/src/request/utils.js +41 -0
- package/reporting/src/request-reporter.js +111 -0
- package/reporting/src/sanitizer.js +519 -0
- package/reporting/src/search-extractor.js +338 -0
- package/reporting/src/self-check.js +105 -0
- package/reporting/src/seq-executor.js +43 -0
- package/reporting/src/session-storage.js +399 -0
- package/reporting/src/url-analyzer.js +161 -0
- package/reporting/src/url-cleaner.js +60 -0
- package/reporting/src/utils/pacemaker.js +279 -0
- package/reporting/src/utils/url.js +114 -0
- package/reporting/src/utils.js +345 -0
- package/reporting/src/webrequest-pipeline/cname-uncloak.js +110 -0
- package/reporting/src/webrequest-pipeline/index.js +287 -0
- package/reporting/src/webrequest-pipeline/logger.js +14 -0
- package/reporting/src/webrequest-pipeline/page-store.js +282 -0
- package/reporting/src/webrequest-pipeline/page.js +140 -0
- package/reporting/src/webrequest-pipeline/pipeline.js +249 -0
- package/reporting/src/webrequest-pipeline/utils/webrequest.js +113 -0
- package/reporting/src/webrequest-pipeline/webrequest-context.js +153 -0
- package/reporting/test/README.md +2 -0
- package/reporting/test/activity-estimator.spec.js +356 -0
- package/reporting/test/alive-check.spec.js +156 -0
- package/reporting/test/alive-message-generator.spec.js +186 -0
- package/reporting/test/country-provider.spec.js +263 -0
- package/reporting/test/doublefetch-page-handler.spec.js +818 -0
- package/reporting/test/duplicate-detector.spec.js +689 -0
- package/reporting/test/helpers/dom-parsers.js +41 -0
- package/reporting/test/helpers/fake-session-storage.js +69 -0
- package/reporting/test/helpers/fast-check-utils.js +28 -0
- package/reporting/test/helpers/fetch-mock.js +57 -0
- package/reporting/test/helpers/in-memory-database.js +14 -0
- package/reporting/test/helpers/memory-map.js +72 -0
- package/reporting/test/helpers/pagedb-mocks.js +41 -0
- package/reporting/test/index.js +47 -0
- package/reporting/test/job-scheduler.spec.js +691 -0
- package/reporting/test/network.spec.js +72 -0
- package/reporting/test/page-aggregator.spec.js +104 -0
- package/reporting/test/page-quorum-check-handler.spec.js +86 -0
- package/reporting/test/pagedb.spec.js +250 -0
- package/reporting/test/pages.spec.js +693 -0
- package/reporting/test/patterns-updater.spec.js +446 -0
- package/reporting/test/patterns.spec.js +751 -0
- package/reporting/test/persisted-hashes.spec.js +169 -0
- package/reporting/test/reporting.spec.js +205 -0
- package/reporting/test/request/database.spec.js +59 -0
- package/reporting/test/request/hash.spec.js +108 -0
- package/reporting/test/request/index.spec.js +378 -0
- package/reporting/test/request/qs-whitelist2.spec.js +189 -0
- package/reporting/test/request/steps/check-context.spec.js +51 -0
- package/reporting/test/request/steps/oauth-detector.spec.js +339 -0
- package/reporting/test/request/test-pages.js +1246 -0
- package/reporting/test/request/utils/bloom-filter-packed.spec.js +37 -0
- package/reporting/test/request/utils/chrome-storage-map.spec.js +28 -0
- package/reporting/test/request/utils/tldts.spec.js +62 -0
- package/reporting/test/request/utils.spec.js +168 -0
- package/reporting/test/sanitizer.spec.js +1087 -0
- package/reporting/test/search-extractor.spec.js +590 -0
- package/reporting/test/seq-executor.spec.js +158 -0
- package/reporting/test/session-storage.spec.js +400 -0
- package/reporting/test/setup.js +24 -0
- package/reporting/test/url-analyzer.spec.js +451 -0
- package/reporting/test/url-cleaner.spec.js +102 -0
- package/reporting/test/utils/pacemaker.spec.js +222 -0
- package/reporting/test/utils/url.spec.js +660 -0
- package/reporting/test/utils.spec.js +299 -0
- package/reporting/test/webrequest-pipeline/pipeline.spec.js +251 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WhoTracks.Me
|
|
3
|
+
* https://whotracks.me/
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2017-present Ghostery GmbH. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
8
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
9
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { DOMParser } from 'linkedom/cached';
|
|
13
|
+
|
|
14
|
+
export default function parseHtml(html) {
|
|
15
|
+
const domParser = new DOMParser();
|
|
16
|
+
return domParser.parseFromString(html, 'text/html');
|
|
17
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WhoTracks.Me
|
|
3
|
+
* https://whotracks.me/
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2017-present Ghostery GmbH. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
8
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
9
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import logger from './logger';
|
|
13
|
+
import {
|
|
14
|
+
TemporarilyUnableToFetchUrlError,
|
|
15
|
+
PermanentlyUnableToFetchUrlError,
|
|
16
|
+
RateLimitedByServerError,
|
|
17
|
+
UnableToOverrideHeadersError,
|
|
18
|
+
} from './errors';
|
|
19
|
+
import { split0 } from './utils';
|
|
20
|
+
|
|
21
|
+
const SECOND = 1000;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Note: 429 (too many requests) is intentionally not included in the list.
|
|
25
|
+
* Even though it is by definition a temporary error, it depends on the context
|
|
26
|
+
* whether it should be retried. To reflect that, it is a special case
|
|
27
|
+
* with its own exception class (RateLimitedByServerError) and a flag
|
|
28
|
+
* to "anonymousHttpGet" to override whether it should be retried or not
|
|
29
|
+
* ("treat429AsPermanentError").
|
|
30
|
+
*/
|
|
31
|
+
const httpStatusCodesThatShouldBeRetried = [
|
|
32
|
+
500, // Internal Server Error
|
|
33
|
+
502, // Bad Gateway
|
|
34
|
+
503, // Service Unavailable
|
|
35
|
+
504, // Gateway Timeout
|
|
36
|
+
599, // Network Connect Timeout Error
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Performs a HTTP Get. Given the constraints, it tries to include
|
|
41
|
+
* as few information as possible (e.g. credentials from cookies will
|
|
42
|
+
* be omitted).
|
|
43
|
+
*
|
|
44
|
+
* Optional:
|
|
45
|
+
* - headers: allows to overwrite headers
|
|
46
|
+
* - redirect: 'follow' (or by default, it will fail with a permanent error)
|
|
47
|
+
* - shouldFollowRedirect:
|
|
48
|
+
* If redirect is set 'follow', this callback decides whether the final
|
|
49
|
+
* redirect location should be followed. By default, all redirects are
|
|
50
|
+
* accepted. Expects a function of type (finalUrl) => true|false
|
|
51
|
+
* - treat429AsPermanentError:
|
|
52
|
+
* By default, HTTP 429 (too many requests) will result in a
|
|
53
|
+
* recoverable error (RateLimitedByServerError). For many use cases,
|
|
54
|
+
* that is reasonable; but for double-fetch requests, repeating may
|
|
55
|
+
* degrade user experience. Setting this flag will instead raise a
|
|
56
|
+
* PermanentlyUnableToFetchUrlError instead.
|
|
57
|
+
* - downloadLimit:
|
|
58
|
+
* A best-effort attempt to define an upper bound for the number of
|
|
59
|
+
* bytes downloaded. Note that there are no guarantees that it will
|
|
60
|
+
* be able to stop bigger downloads. Also, it is based on the data
|
|
61
|
+
* that comes over the wire; in other words, *after* compression.
|
|
62
|
+
* - allowedContentTypes (optional):
|
|
63
|
+
* An optional list of supported Content-Types (e.g. "text/html").
|
|
64
|
+
* If given and the HTTP "Content-Type" header does not match, the
|
|
65
|
+
* function will fail with a permanent error.
|
|
66
|
+
*
|
|
67
|
+
* TODO: For pages like YouTube, double-fetch fails because of consent
|
|
68
|
+
* pages. In the YouTube example, the following cookie could be set:
|
|
69
|
+
* "SOCS=CAESEwgDEgk0ODE3Nzk3MjQaAmVuIAEaBgiA_LyaBg"
|
|
70
|
+
* (Maybe there is a way to generalize?)
|
|
71
|
+
*/
|
|
72
|
+
export async function anonymousHttpGet(url, params = {}) {
|
|
73
|
+
const {
|
|
74
|
+
headers = null,
|
|
75
|
+
redirect = 'manual',
|
|
76
|
+
shouldFollowRedirect = () => true,
|
|
77
|
+
timeout = 15 * SECOND,
|
|
78
|
+
treat429AsPermanentError = false,
|
|
79
|
+
downloadLimit = 10 * 1024 * 1024, // 10 MB
|
|
80
|
+
allowedContentTypes = null,
|
|
81
|
+
} = params;
|
|
82
|
+
|
|
83
|
+
if (redirect !== 'follow' && params.shouldFollowRedirect) {
|
|
84
|
+
logger.warn(
|
|
85
|
+
'shouldFollowRedirect ignored because redirects will be automatically resolved',
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const controller = new AbortController();
|
|
90
|
+
const options = {
|
|
91
|
+
credentials: 'omit',
|
|
92
|
+
mode: 'no-cors',
|
|
93
|
+
redirect,
|
|
94
|
+
signal: controller.signal,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
let timeoutTimer;
|
|
98
|
+
let timeoutTriggered = false;
|
|
99
|
+
if (timeout && timeout > 0) {
|
|
100
|
+
timeoutTimer = setTimeout(() => {
|
|
101
|
+
const msg = `Request to ${url} timed out (limit: ${timeout} ms)`;
|
|
102
|
+
controller.abort(new TemporarilyUnableToFetchUrlError(msg));
|
|
103
|
+
logger.warn(msg);
|
|
104
|
+
timeoutTimer = null;
|
|
105
|
+
timeoutTriggered = true;
|
|
106
|
+
}, timeout);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
// The following code overwrite the headers of the request.
|
|
111
|
+
// Note that "fetch" allows to overwrite headers in a simple declarative way,
|
|
112
|
+
// but unfortunately it is limited. For example, it is not possible to
|
|
113
|
+
// overwrite the cookie headers. The following code will work for all
|
|
114
|
+
// type of headers.
|
|
115
|
+
//
|
|
116
|
+
// The matching logic is not perfect but should be fairly accurate.
|
|
117
|
+
// Ideally, we would want to run the handler only for the request that we
|
|
118
|
+
// are about to trigger, but not for any other requests to avoid unintended
|
|
119
|
+
// side-effects. To mitigate the risk, uninstall the handler at the first
|
|
120
|
+
// opportunity: either if it is called or if the request finished
|
|
121
|
+
// (and we know the handle will never be called).
|
|
122
|
+
let webRequestHandler;
|
|
123
|
+
const uninstallHandler = () => {
|
|
124
|
+
if (webRequestHandler) {
|
|
125
|
+
chrome.webRequest.onBeforeSendHeaders.removeListener(webRequestHandler);
|
|
126
|
+
webRequestHandler = null;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const headerNames = Object.keys(headers || {});
|
|
130
|
+
if (headerNames.length > 0) {
|
|
131
|
+
if (
|
|
132
|
+
!chrome.webRequest ||
|
|
133
|
+
!chrome.webRequest.onBeforeSendHeaders ||
|
|
134
|
+
!chrome.runtime.getManifest().permissions.includes('webRequestBlocking')
|
|
135
|
+
) {
|
|
136
|
+
throw new UnableToOverrideHeadersError();
|
|
137
|
+
}
|
|
138
|
+
webRequestHandler = (details) => {
|
|
139
|
+
if (
|
|
140
|
+
details.url !== url ||
|
|
141
|
+
details.type !== 'xmlhttprequest' ||
|
|
142
|
+
details.method !== 'GET'
|
|
143
|
+
) {
|
|
144
|
+
// does that match the request that we intended to trigger
|
|
145
|
+
return {};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// match: now we can already deregister the listener
|
|
149
|
+
// (it should not be executed multiple times)
|
|
150
|
+
uninstallHandler();
|
|
151
|
+
const normalizedHeaders = headerNames.map((x) => x.toLowerCase());
|
|
152
|
+
|
|
153
|
+
/* eslint-disable no-param-reassign */
|
|
154
|
+
details.requestHeaders = details.requestHeaders.filter(
|
|
155
|
+
(header) => !normalizedHeaders.includes(header.name.toLowerCase()),
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
headerNames.forEach((name) => {
|
|
159
|
+
details.requestHeaders.push({
|
|
160
|
+
name,
|
|
161
|
+
value: headers[name],
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
requestHeaders: details.requestHeaders,
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
chrome.webRequest.onBeforeSendHeaders.addListener(
|
|
171
|
+
webRequestHandler,
|
|
172
|
+
{
|
|
173
|
+
urls: [url],
|
|
174
|
+
},
|
|
175
|
+
['blocking', 'requestHeaders'],
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
let response;
|
|
180
|
+
try {
|
|
181
|
+
response = await fetch(url, options);
|
|
182
|
+
} catch (e) {
|
|
183
|
+
throw new TemporarilyUnableToFetchUrlError(`Failed to fetch url ${url}`, {
|
|
184
|
+
cause: e,
|
|
185
|
+
});
|
|
186
|
+
} finally {
|
|
187
|
+
uninstallHandler();
|
|
188
|
+
}
|
|
189
|
+
if (
|
|
190
|
+
response.status === 0 &&
|
|
191
|
+
(response.type == 'opaqueredirect' || response.type == 'opaque')
|
|
192
|
+
) {
|
|
193
|
+
throw new PermanentlyUnableToFetchUrlError(
|
|
194
|
+
`Failed to fetch url ${url}: not allowed to follow redirects (response.type=${response.type})`,
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
if (response.url !== url && !shouldFollowRedirect(response.url)) {
|
|
198
|
+
throw new PermanentlyUnableToFetchUrlError(
|
|
199
|
+
`Failed to fetch url ${url}: detected forbidden redirect to ${response.url}`,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (!response.ok) {
|
|
204
|
+
const msg = `Failed to fetch url ${url}: ${response.statusText}`;
|
|
205
|
+
if (response.status === 429) {
|
|
206
|
+
if (treat429AsPermanentError) {
|
|
207
|
+
throw new PermanentlyUnableToFetchUrlError(msg);
|
|
208
|
+
}
|
|
209
|
+
throw new RateLimitedByServerError(msg);
|
|
210
|
+
}
|
|
211
|
+
if (httpStatusCodesThatShouldBeRetried.includes(response.status)) {
|
|
212
|
+
throw new TemporarilyUnableToFetchUrlError(msg);
|
|
213
|
+
}
|
|
214
|
+
throw new PermanentlyUnableToFetchUrlError(msg);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (downloadLimit && downloadLimit > 0) {
|
|
218
|
+
const contentLength = response.headers.get('content-length');
|
|
219
|
+
if (contentLength && contentLength > downloadLimit) {
|
|
220
|
+
const err = new PermanentlyUnableToFetchUrlError(
|
|
221
|
+
`Exceeded size limit when fetching url ${url} (${contentLength} > ${downloadLimit})`,
|
|
222
|
+
);
|
|
223
|
+
controller.abort(err);
|
|
224
|
+
throw err;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (allowedContentTypes) {
|
|
229
|
+
const value = response.headers.get('content-type');
|
|
230
|
+
if (value) {
|
|
231
|
+
const contentType = split0(value, ';').trim().toLowerCase();
|
|
232
|
+
if (!allowedContentTypes.includes(contentType)) {
|
|
233
|
+
const err = new PermanentlyUnableToFetchUrlError(
|
|
234
|
+
`Unexpected "Content-Type" <${contentType}> (<${value}> not in {${allowedContentTypes}})`,
|
|
235
|
+
);
|
|
236
|
+
controller.abort(err);
|
|
237
|
+
throw err;
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
logger.warn(
|
|
241
|
+
'The URL',
|
|
242
|
+
url,
|
|
243
|
+
'did not return a "Content-Type" HTTP header.',
|
|
244
|
+
'Continue and assume the types are matching...',
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
return await response.text();
|
|
251
|
+
} catch (e) {
|
|
252
|
+
if (timeoutTriggered) {
|
|
253
|
+
throw new TemporarilyUnableToFetchUrlError(
|
|
254
|
+
`Failed to fetch url ${url} because the request timed out.`,
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
throw new TemporarilyUnableToFetchUrlError(
|
|
258
|
+
`Failed to fetch url ${url} (${e.message})`,
|
|
259
|
+
{ cause: e },
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
} finally {
|
|
263
|
+
clearTimeout(timeoutTimer);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WhoTracks.Me
|
|
3
|
+
* https://whotracks.me/
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2017-present Ghostery GmbH. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
8
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
9
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
|
+
*/
|
|
11
|
+
export { default as UrlReporter } from './reporting';
|
|
12
|
+
export { default as RequestReporter } from './request-reporter';
|
|
13
|
+
export { default as WebRequestPipeline } from './webrequest-pipeline';
|
|
14
|
+
export { setLogLevel, describeLoggers } from './logger';
|