@sentry/browser 6.13.1 → 6.14.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/build/bundle.es6.js +453 -340
- package/build/bundle.es6.js.map +1 -1
- package/build/bundle.es6.min.js +2 -2
- package/build/bundle.es6.min.js.map +1 -1
- package/build/bundle.js +454 -342
- package/build/bundle.js.map +1 -1
- package/build/bundle.min.js +2 -2
- package/build/bundle.min.js.map +1 -1
- package/dist/eventbuilder.d.ts.map +1 -1
- package/dist/eventbuilder.js +1 -4
- package/dist/eventbuilder.js.map +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +6 -2
- package/dist/helpers.js.map +1 -1
- package/dist/integrations/trycatch.js +1 -1
- package/dist/integrations/trycatch.js.map +1 -1
- package/dist/transports/base.d.ts.map +1 -1
- package/dist/transports/base.js +12 -9
- package/dist/transports/base.js.map +1 -1
- package/dist/transports/fetch.d.ts +1 -2
- package/dist/transports/fetch.d.ts.map +1 -1
- package/dist/transports/fetch.js +2 -67
- package/dist/transports/fetch.js.map +1 -1
- package/dist/transports/utils.d.ts +48 -0
- package/dist/transports/utils.d.ts.map +1 -0
- package/dist/transports/utils.js +99 -0
- package/dist/transports/utils.js.map +1 -0
- package/dist/transports/xhr.js +1 -1
- package/dist/transports/xhr.js.map +1 -1
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +1 -4
- package/esm/eventbuilder.js.map +1 -1
- package/esm/helpers.d.ts.map +1 -1
- package/esm/helpers.js +7 -3
- package/esm/helpers.js.map +1 -1
- package/esm/integrations/trycatch.js +1 -1
- package/esm/integrations/trycatch.js.map +1 -1
- package/esm/transports/base.d.ts.map +1 -1
- package/esm/transports/base.js +14 -11
- package/esm/transports/base.js.map +1 -1
- package/esm/transports/fetch.d.ts +1 -2
- package/esm/transports/fetch.d.ts.map +1 -1
- package/esm/transports/fetch.js +2 -67
- package/esm/transports/fetch.js.map +1 -1
- package/esm/transports/utils.d.ts +48 -0
- package/esm/transports/utils.d.ts.map +1 -0
- package/esm/transports/utils.js +96 -0
- package/esm/transports/utils.js.map +1 -0
- package/esm/transports/xhr.js +1 -1
- package/esm/transports/xhr.js.map +1 -1
- package/package.json +23 -23
package/esm/transports/fetch.js
CHANGED
|
@@ -1,74 +1,9 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';
|
|
3
3
|
import { Outcome } from '@sentry/types';
|
|
4
|
-
import {
|
|
4
|
+
import { SentryError, supportsReferrerPolicy, SyncPromise } from '@sentry/utils';
|
|
5
5
|
import { BaseTransport } from './base';
|
|
6
|
-
|
|
7
|
-
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
|
|
8
|
-
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
|
|
9
|
-
* this chain becomes orphaned and there is no possible way to capture it's rejections
|
|
10
|
-
* other than allowing it bubble up to this very handler. eg.
|
|
11
|
-
*
|
|
12
|
-
* const f = window.fetch;
|
|
13
|
-
* window.fetch = function () {
|
|
14
|
-
* const p = f.apply(this, arguments);
|
|
15
|
-
*
|
|
16
|
-
* p.then(function() {
|
|
17
|
-
* console.log('hi.');
|
|
18
|
-
* });
|
|
19
|
-
*
|
|
20
|
-
* return p;
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* `p.then(function () { ... })` is producing a completely separate promise chain,
|
|
24
|
-
* however, what's returned is `p` - the result of original `fetch` call.
|
|
25
|
-
*
|
|
26
|
-
* This mean, that whenever we use the Fetch API to send our own requests, _and_
|
|
27
|
-
* some ad-blocker blocks it, this orphaned chain will _always_ reject,
|
|
28
|
-
* effectively causing another event to be captured.
|
|
29
|
-
* This makes a whole process become an infinite loop, which we need to somehow
|
|
30
|
-
* deal with, and break it in one way or another.
|
|
31
|
-
*
|
|
32
|
-
* To deal with this issue, we are making sure that we _always_ use the real
|
|
33
|
-
* browser Fetch API, instead of relying on what `window.fetch` exposes.
|
|
34
|
-
* The only downside to this would be missing our own requests as breadcrumbs,
|
|
35
|
-
* but because we are already not doing this, it should be just fine.
|
|
36
|
-
*
|
|
37
|
-
* Possible failed fetch error messages per-browser:
|
|
38
|
-
*
|
|
39
|
-
* Chrome: Failed to fetch
|
|
40
|
-
* Edge: Failed to Fetch
|
|
41
|
-
* Firefox: NetworkError when attempting to fetch resource
|
|
42
|
-
* Safari: resource blocked by content blocker
|
|
43
|
-
*/
|
|
44
|
-
function getNativeFetchImplementation() {
|
|
45
|
-
/* eslint-disable @typescript-eslint/unbound-method */
|
|
46
|
-
var _a, _b;
|
|
47
|
-
// Fast path to avoid DOM I/O
|
|
48
|
-
var global = getGlobalObject();
|
|
49
|
-
if (isNativeFetch(global.fetch)) {
|
|
50
|
-
return global.fetch.bind(global);
|
|
51
|
-
}
|
|
52
|
-
var document = global.document;
|
|
53
|
-
var fetchImpl = global.fetch;
|
|
54
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
55
|
-
if (typeof ((_a = document) === null || _a === void 0 ? void 0 : _a.createElement) === "function") {
|
|
56
|
-
try {
|
|
57
|
-
var sandbox = document.createElement('iframe');
|
|
58
|
-
sandbox.hidden = true;
|
|
59
|
-
document.head.appendChild(sandbox);
|
|
60
|
-
if ((_b = sandbox.contentWindow) === null || _b === void 0 ? void 0 : _b.fetch) {
|
|
61
|
-
fetchImpl = sandbox.contentWindow.fetch;
|
|
62
|
-
}
|
|
63
|
-
document.head.removeChild(sandbox);
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return fetchImpl.bind(global);
|
|
70
|
-
/* eslint-enable @typescript-eslint/unbound-method */
|
|
71
|
-
}
|
|
6
|
+
import { getNativeFetchImplementation } from './utils';
|
|
72
7
|
/** `fetch` based transport */
|
|
73
8
|
var FetchTransport = /** @class */ (function (_super) {
|
|
74
9
|
__extends(FetchTransport, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/transports/fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAS,OAAO,EAAsD,MAAM,eAAe,CAAC;AACnG,OAAO,
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/transports/fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAS,OAAO,EAAsD,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAa,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAElE,8BAA8B;AAC9B;IAAoC,kCAAa;IAM/C,wBAAmB,OAAyB,EAAE,SAAqD;QAArD,0BAAA,EAAA,YAAuB,4BAA4B,EAAE;QAAnG,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,MAAM,GAAG,SAAS,CAAC;;IAC1B,CAAC;IAED;;OAEG;IACI,kCAAS,GAAhB,UAAiB,KAAY;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACI,oCAAW,GAAlB,UAAmB,OAAgB;QACjC,OAAO,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;IAED;;;OAGG;IACK,qCAAY,GAApB,UAAqB,aAA4B,EAAE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CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;wBACpE,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;qBACnD,CAAC;oBACF,KAAI,CAAC,eAAe,CAAC;wBACnB,WAAW,EAAE,aAAa,CAAC,IAAI;wBAC/B,QAAQ,UAAA;wBACR,OAAO,SAAA;wBACP,OAAO,SAAA;wBACP,MAAM,QAAA;qBACP,CAAC,CAAC;gBACL,CAAC,CAAC;qBACD,KAAK,CAAC,MAAM,CAAC,CAAC;YACnB,CAAC,CAAC;QAhBF,CAgBE,CACL;aACA,IAAI,CAAC,SAAS,EAAE,UAAA,MAAM;YACrB,gGAAgG;YAChG,IAAI,MAAM,YAAY,WAAW,EAAE;gBACjC,KAAI,CAAC,eAAe,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aACjE;iBAAM;gBACL,KAAI,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAChE;YACD,MAAM,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IACH,qBAAC;AAAD,CAAC,AA1FD,CAAoC,aAAa,GA0FhD","sourcesContent":["import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Outcome, Response, SentryRequest, Session, TransportOptions } from '@sentry/types';\nimport { SentryError, supportsReferrerPolicy, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\nimport { FetchImpl, getNativeFetchImplementation } from './utils';\n\n/** `fetch` based transport */\nexport class FetchTransport extends BaseTransport {\n /**\n * Fetch API reference which always points to native browser implementation.\n */\n private _fetch: typeof fetch;\n\n public constructor(options: TransportOptions, fetchImpl: FetchImpl = getNativeFetchImplementation()) {\n super(options);\n this._fetch = fetchImpl;\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<Response> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<Response> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n if (this._isRateLimited(sentryRequest.type)) {\n this.recordLostEvent(Outcome.RateLimitBackoff, sentryRequest.type);\n\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n reason: `Transport for ${sentryRequest.type} requests locked till ${this._disabledUntil(\n sentryRequest.type,\n )} due to too many requests.`,\n status: 429,\n });\n }\n\n const options: RequestInit = {\n body: sentryRequest.body,\n method: 'POST',\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n referrerPolicy: (supportsReferrerPolicy() ? 'origin' : '') as ReferrerPolicy,\n };\n if (this.options.fetchParameters !== undefined) {\n Object.assign(options, this.options.fetchParameters);\n }\n if (this.options.headers !== undefined) {\n options.headers = this.options.headers;\n }\n\n return this._buffer\n .add(\n () =>\n new SyncPromise<Response>((resolve, reject) => {\n void this._fetch(sentryRequest.url, options)\n .then(response => {\n const headers = {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n };\n this._handleResponse({\n requestType: sentryRequest.type,\n response,\n headers,\n resolve,\n reject,\n });\n })\n .catch(reject);\n }),\n )\n .then(undefined, reason => {\n // It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.\n if (reason instanceof SentryError) {\n this.recordLostEvent(Outcome.QueueOverflow, sentryRequest.type);\n } else {\n this.recordLostEvent(Outcome.NetworkError, sentryRequest.type);\n }\n throw reason;\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare type FetchImpl = typeof fetch;
|
|
2
|
+
/**
|
|
3
|
+
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
|
|
4
|
+
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
|
|
5
|
+
* this chain becomes orphaned and there is no possible way to capture it's rejections
|
|
6
|
+
* other than allowing it bubble up to this very handler. eg.
|
|
7
|
+
*
|
|
8
|
+
* const f = window.fetch;
|
|
9
|
+
* window.fetch = function () {
|
|
10
|
+
* const p = f.apply(this, arguments);
|
|
11
|
+
*
|
|
12
|
+
* p.then(function() {
|
|
13
|
+
* console.log('hi.');
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* return p;
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* `p.then(function () { ... })` is producing a completely separate promise chain,
|
|
20
|
+
* however, what's returned is `p` - the result of original `fetch` call.
|
|
21
|
+
*
|
|
22
|
+
* This mean, that whenever we use the Fetch API to send our own requests, _and_
|
|
23
|
+
* some ad-blocker blocks it, this orphaned chain will _always_ reject,
|
|
24
|
+
* effectively causing another event to be captured.
|
|
25
|
+
* This makes a whole process become an infinite loop, which we need to somehow
|
|
26
|
+
* deal with, and break it in one way or another.
|
|
27
|
+
*
|
|
28
|
+
* To deal with this issue, we are making sure that we _always_ use the real
|
|
29
|
+
* browser Fetch API, instead of relying on what `window.fetch` exposes.
|
|
30
|
+
* The only downside to this would be missing our own requests as breadcrumbs,
|
|
31
|
+
* but because we are already not doing this, it should be just fine.
|
|
32
|
+
*
|
|
33
|
+
* Possible failed fetch error messages per-browser:
|
|
34
|
+
*
|
|
35
|
+
* Chrome: Failed to fetch
|
|
36
|
+
* Edge: Failed to Fetch
|
|
37
|
+
* Firefox: NetworkError when attempting to fetch resource
|
|
38
|
+
* Safari: resource blocked by content blocker
|
|
39
|
+
*/
|
|
40
|
+
export declare function getNativeFetchImplementation(): FetchImpl;
|
|
41
|
+
/**
|
|
42
|
+
* Sends sdk client report using sendBeacon or fetch as a fallback if available
|
|
43
|
+
*
|
|
44
|
+
* @param url report endpoint
|
|
45
|
+
* @param body report payload
|
|
46
|
+
*/
|
|
47
|
+
export declare function sendReport(url: string, body: string): void;
|
|
48
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/transports/utils.ts"],"names":[],"mappings":"AAKA,oBAAY,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,4BAA4B,IAAI,SAAS,CA+BxD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAqB1D"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { forget, getGlobalObject, isNativeFetch, logger, supportsFetch } from '@sentry/utils';
|
|
2
|
+
var global = getGlobalObject();
|
|
3
|
+
var cachedFetchImpl;
|
|
4
|
+
/**
|
|
5
|
+
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
|
|
6
|
+
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
|
|
7
|
+
* this chain becomes orphaned and there is no possible way to capture it's rejections
|
|
8
|
+
* other than allowing it bubble up to this very handler. eg.
|
|
9
|
+
*
|
|
10
|
+
* const f = window.fetch;
|
|
11
|
+
* window.fetch = function () {
|
|
12
|
+
* const p = f.apply(this, arguments);
|
|
13
|
+
*
|
|
14
|
+
* p.then(function() {
|
|
15
|
+
* console.log('hi.');
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* return p;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* `p.then(function () { ... })` is producing a completely separate promise chain,
|
|
22
|
+
* however, what's returned is `p` - the result of original `fetch` call.
|
|
23
|
+
*
|
|
24
|
+
* This mean, that whenever we use the Fetch API to send our own requests, _and_
|
|
25
|
+
* some ad-blocker blocks it, this orphaned chain will _always_ reject,
|
|
26
|
+
* effectively causing another event to be captured.
|
|
27
|
+
* This makes a whole process become an infinite loop, which we need to somehow
|
|
28
|
+
* deal with, and break it in one way or another.
|
|
29
|
+
*
|
|
30
|
+
* To deal with this issue, we are making sure that we _always_ use the real
|
|
31
|
+
* browser Fetch API, instead of relying on what `window.fetch` exposes.
|
|
32
|
+
* The only downside to this would be missing our own requests as breadcrumbs,
|
|
33
|
+
* but because we are already not doing this, it should be just fine.
|
|
34
|
+
*
|
|
35
|
+
* Possible failed fetch error messages per-browser:
|
|
36
|
+
*
|
|
37
|
+
* Chrome: Failed to fetch
|
|
38
|
+
* Edge: Failed to Fetch
|
|
39
|
+
* Firefox: NetworkError when attempting to fetch resource
|
|
40
|
+
* Safari: resource blocked by content blocker
|
|
41
|
+
*/
|
|
42
|
+
export function getNativeFetchImplementation() {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if (cachedFetchImpl) {
|
|
45
|
+
return cachedFetchImpl;
|
|
46
|
+
}
|
|
47
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
48
|
+
// Fast path to avoid DOM I/O
|
|
49
|
+
if (isNativeFetch(global.fetch)) {
|
|
50
|
+
return (cachedFetchImpl = global.fetch.bind(global));
|
|
51
|
+
}
|
|
52
|
+
var document = global.document;
|
|
53
|
+
var fetchImpl = global.fetch;
|
|
54
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
55
|
+
if (typeof ((_a = document) === null || _a === void 0 ? void 0 : _a.createElement) === "function") {
|
|
56
|
+
try {
|
|
57
|
+
var sandbox = document.createElement('iframe');
|
|
58
|
+
sandbox.hidden = true;
|
|
59
|
+
document.head.appendChild(sandbox);
|
|
60
|
+
if ((_b = sandbox.contentWindow) === null || _b === void 0 ? void 0 : _b.fetch) {
|
|
61
|
+
fetchImpl = sandbox.contentWindow.fetch;
|
|
62
|
+
}
|
|
63
|
+
document.head.removeChild(sandbox);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return (cachedFetchImpl = fetchImpl.bind(global));
|
|
70
|
+
/* eslint-enable @typescript-eslint/unbound-method */
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Sends sdk client report using sendBeacon or fetch as a fallback if available
|
|
74
|
+
*
|
|
75
|
+
* @param url report endpoint
|
|
76
|
+
* @param body report payload
|
|
77
|
+
*/
|
|
78
|
+
export function sendReport(url, body) {
|
|
79
|
+
var isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]';
|
|
80
|
+
var hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function';
|
|
81
|
+
if (hasSendBeacon) {
|
|
82
|
+
// Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
|
|
83
|
+
var sendBeacon = global.navigator.sendBeacon.bind(global.navigator);
|
|
84
|
+
return sendBeacon(url, body);
|
|
85
|
+
}
|
|
86
|
+
if (supportsFetch()) {
|
|
87
|
+
var fetch_1 = getNativeFetchImplementation();
|
|
88
|
+
return forget(fetch_1(url, {
|
|
89
|
+
body: body,
|
|
90
|
+
method: 'POST',
|
|
91
|
+
credentials: 'omit',
|
|
92
|
+
keepalive: true,
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/transports/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9F,IAAM,MAAM,GAAG,eAAe,EAAU,CAAC;AACzC,IAAI,eAA0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AAC,KAAK,oBAAoB,CAAC;IAC5G,IAAM,aAAa,GAAG,eAAe,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE3F,IAAI,aAAa,EAAE;QACjB,wHAAwH;QACxH,IAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAC9B;IAED,IAAI,aAAa,EAAE,EAAE;QACnB,IAAM,OAAK,GAAG,4BAA4B,EAAE,CAAC;QAC7C,OAAO,MAAM,CACX,OAAK,CAAC,GAAG,EAAE;YACT,IAAI,MAAA;YACJ,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC;KACH;AACH,CAAC","sourcesContent":["import { forget, getGlobalObject, isNativeFetch, logger, supportsFetch } from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\nlet cachedFetchImpl: FetchImpl;\n\nexport type FetchImpl = typeof fetch;\n\n/**\n * A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.\n * Whenever someone wraps the Fetch API and returns the wrong promise chain,\n * this chain becomes orphaned and there is no possible way to capture it's rejections\n * other than allowing it bubble up to this very handler. eg.\n *\n * const f = window.fetch;\n * window.fetch = function () {\n * const p = f.apply(this, arguments);\n *\n * p.then(function() {\n * console.log('hi.');\n * });\n *\n * return p;\n * }\n *\n * `p.then(function () { ... })` is producing a completely separate promise chain,\n * however, what's returned is `p` - the result of original `fetch` call.\n *\n * This mean, that whenever we use the Fetch API to send our own requests, _and_\n * some ad-blocker blocks it, this orphaned chain will _always_ reject,\n * effectively causing another event to be captured.\n * This makes a whole process become an infinite loop, which we need to somehow\n * deal with, and break it in one way or another.\n *\n * To deal with this issue, we are making sure that we _always_ use the real\n * browser Fetch API, instead of relying on what `window.fetch` exposes.\n * The only downside to this would be missing our own requests as breadcrumbs,\n * but because we are already not doing this, it should be just fine.\n *\n * Possible failed fetch error messages per-browser:\n *\n * Chrome: Failed to fetch\n * Edge: Failed to Fetch\n * Firefox: NetworkError when attempting to fetch resource\n * Safari: resource blocked by content blocker\n */\nexport function getNativeFetchImplementation(): FetchImpl {\n if (cachedFetchImpl) {\n return cachedFetchImpl;\n }\n\n /* eslint-disable @typescript-eslint/unbound-method */\n\n // Fast path to avoid DOM I/O\n if (isNativeFetch(global.fetch)) {\n return (cachedFetchImpl = global.fetch.bind(global));\n }\n\n const document = global.document;\n let fetchImpl = global.fetch;\n // eslint-disable-next-line deprecation/deprecation\n if (typeof document?.createElement === `function`) {\n try {\n const sandbox = document.createElement('iframe');\n sandbox.hidden = true;\n document.head.appendChild(sandbox);\n if (sandbox.contentWindow?.fetch) {\n fetchImpl = sandbox.contentWindow.fetch;\n }\n document.head.removeChild(sandbox);\n } catch (e) {\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);\n }\n }\n\n return (cachedFetchImpl = fetchImpl.bind(global));\n /* eslint-enable @typescript-eslint/unbound-method */\n}\n\n/**\n * Sends sdk client report using sendBeacon or fetch as a fallback if available\n *\n * @param url report endpoint\n * @param body report payload\n */\nexport function sendReport(url: string, body: string): void {\n const isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]';\n const hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function';\n\n if (hasSendBeacon) {\n // Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch\n const sendBeacon = global.navigator.sendBeacon.bind(global.navigator);\n return sendBeacon(url, body);\n }\n\n if (supportsFetch()) {\n const fetch = getNativeFetchImplementation();\n return forget(\n fetch(url, {\n body,\n method: 'POST',\n credentials: 'omit',\n keepalive: true,\n }),\n );\n }\n}\n"]}
|
package/esm/transports/xhr.js
CHANGED
|
@@ -51,7 +51,7 @@ var XHRTransport = /** @class */ (function (_super) {
|
|
|
51
51
|
};
|
|
52
52
|
request.open('POST', sentryRequest.url);
|
|
53
53
|
for (var header in _this.options.headers) {
|
|
54
|
-
if (_this.options.headers
|
|
54
|
+
if (Object.prototype.hasOwnProperty.call(_this.options.headers, header)) {
|
|
55
55
|
request.setRequestHeader(header, _this.options.headers[header]);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../src/transports/xhr.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAS,OAAO,EAAoC,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,4BAA4B;AAC5B;IAAkC,gCAAa;IAA/C;;IAoEA,CAAC;IAnEC;;OAEG;IACI,gCAAS,GAAhB,UAAiB,KAAY;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACI,kCAAW,GAAlB,UAAmB,OAAgB;QACjC,OAAO,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;IAED;;;OAGG;IACK,mCAAY,GAApB,UAAqB,aAA4B,EAAE,eAAgC;QAAnF,iBAgDC;QA/CC,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;YAC3C,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;YAEnE,OAAO,OAAO,CAAC,MAAM,CAA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AAsB,CAAC;4BACzE,aAAa,EAAE,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC;yBACxD,CAAC;wBACF,KAAI,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,SAAA,EAAE,OAAO,SAAA,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;qBACxG;gBACH,CAAC,CAAC;gBAEF,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;gBACxC,KAAK,IAAM,MAAM,IAAI,KAAI,CAAC,OAAO,CAAC,OAAO,EAAE;oBACzC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;wBACtE,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;qBAChE;iBACF;gBACD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC,CAAC;QApBF,CAoBE,CACL;aACA,IAAI,CAAC,SAAS,EAAE,UAAA,MAAM;YACrB,gGAAgG;YAChG,IAAI,MAAM,YAAY,WAAW,EAAE;gBACjC,KAAI,CAAC,eAAe,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aACjE;iBAAM;gBACL,KAAI,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAChE;YACD,MAAM,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IACH,mBAAC;AAAD,CAAC,AApED,CAAkC,aAAa,GAoE9C","sourcesContent":["import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Outcome, Response, SentryRequest, Session } from '@sentry/types';\nimport { SentryError, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<Response> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<Response> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n if (this._isRateLimited(sentryRequest.type)) {\n this.recordLostEvent(Outcome.RateLimitBackoff, sentryRequest.type);\n\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n reason: `Transport for ${sentryRequest.type} requests locked till ${this._disabledUntil(\n sentryRequest.type,\n )} due to too many requests.`,\n status: 429,\n });\n }\n\n return this._buffer\n .add(\n () =>\n new SyncPromise<Response>((resolve, reject) => {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = (): void => {\n if (request.readyState === 4) {\n const headers = {\n 'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': request.getResponseHeader('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response: request, headers, resolve, reject });\n }\n };\n\n request.open('POST', sentryRequest.url);\n for (const header in this.options.headers) {\n if (Object.prototype.hasOwnProperty.call(this.options.headers, header)) {\n request.setRequestHeader(header, this.options.headers[header]);\n }\n }\n request.send(sentryRequest.body);\n }),\n )\n .then(undefined, reason => {\n // It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.\n if (reason instanceof SentryError) {\n this.recordLostEvent(Outcome.QueueOverflow, sentryRequest.type);\n } else {\n this.recordLostEvent(Outcome.NetworkError, sentryRequest.type);\n }\n throw reason;\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.14.1",
|
|
4
4
|
"description": "Official Sentry SDK for browsers",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@sentry/core": "6.
|
|
20
|
-
"@sentry/types": "6.
|
|
21
|
-
"@sentry/utils": "6.
|
|
19
|
+
"@sentry/core": "6.14.1",
|
|
20
|
+
"@sentry/types": "6.14.1",
|
|
21
|
+
"@sentry/utils": "6.14.1",
|
|
22
22
|
"tslib": "^1.9.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@sentry-internal/eslint-config-sdk": "6.
|
|
25
|
+
"@sentry-internal/eslint-config-sdk": "6.14.1",
|
|
26
26
|
"@types/eslint": "^7.2.0",
|
|
27
27
|
"@types/md5": "2.1.33",
|
|
28
28
|
"btoa": "^1.2.1",
|
|
@@ -54,36 +54,36 @@
|
|
|
54
54
|
"webpack": "^4.30.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
|
-
"build": "run-s build:
|
|
57
|
+
"build": "run-s build:es5 build:esm build:bundle",
|
|
58
58
|
"build:bundle": "rollup --config",
|
|
59
|
-
"build:
|
|
60
|
-
"build:
|
|
61
|
-
"build:dist:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
|
|
62
|
-
"build:es5": "run-s build:dist",
|
|
63
|
-
"build:es5:watch": "run-s build:dist:watch",
|
|
59
|
+
"build:dev": "run-s build:es5 build:esm",
|
|
60
|
+
"build:es5": "tsc -p tsconfig.build.json",
|
|
64
61
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
62
|
+
"build:watch": "run-p build:es5:watch build:esm:watch build:bundle:watch",
|
|
63
|
+
"build:bundle:watch": "rollup --config --watch",
|
|
64
|
+
"build:dev:watch": "run-p build:es5:watch build:esm:watch",
|
|
65
|
+
"build:es5:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
|
|
65
66
|
"build:esm:watch": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
|
|
66
|
-
"
|
|
67
|
+
"circularDepCheck": "madge --circular src/index.ts",
|
|
67
68
|
"clean": "rimraf dist esm build coverage .rpt2_cache",
|
|
69
|
+
"fix": "run-s fix:eslint fix:prettier",
|
|
70
|
+
"fix:eslint": "eslint . --format stylish --fix",
|
|
71
|
+
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
|
|
68
72
|
"link:yarn": "yarn link",
|
|
69
73
|
"lint": "run-s lint:prettier lint:eslint",
|
|
70
|
-
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
|
|
71
74
|
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
+
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
|
|
76
|
+
"pack": "npm pack",
|
|
77
|
+
"size:check": "run-p size:check:es5 size:check:es6",
|
|
78
|
+
"size:check:es5": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES5: \",$1,\"kB\";}'",
|
|
79
|
+
"size:check:es6": "cat build/bundle.es6.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES6: \",$1,\"kB\";}'",
|
|
75
80
|
"test": "run-s test:unit",
|
|
76
81
|
"test:unit": "jest --config test/unit/jest.config.js",
|
|
77
|
-
"test:unit:watch": "jest --config test/unit/jest.config.js --watch",
|
|
78
82
|
"test:integration": "test/integration/run.js",
|
|
79
|
-
"test:integration:watch": "test/integration/run.js --watch",
|
|
80
83
|
"test:integration:checkbrowsers": "node scripts/checkbrowsers.js",
|
|
81
84
|
"test:package": "node test/package/npm-build.js && rm test/package/tmp.js",
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"size:check:es6": "cat build/bundle.es6.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES6: \",$1,\"kB\";}'",
|
|
85
|
-
"pack": "npm pack",
|
|
86
|
-
"circularDepCheck": "madge --circular src/index.ts"
|
|
85
|
+
"test:unit:watch": "jest --config test/unit/jest.config.js --watch",
|
|
86
|
+
"test:integration:watch": "test/integration/run.js --watch"
|
|
87
87
|
},
|
|
88
88
|
"volta": {
|
|
89
89
|
"extends": "../../package.json"
|