@@ -5,7 +5,7 @@ import { logger } from '@sentry/utils/logger';
55import { getEventDescription , getGlobalObject , parseUrl } from '@sentry/utils/misc' ;
66import { deserialize , fill , safeNormalize } from '@sentry/utils/object' ;
77import { includes , safeJoin } from '@sentry/utils/string' ;
8- import { supportsBeacon , supportsHistory , supportsNativeFetch } from '@sentry/utils/supports' ;
8+ import { supportsHistory , supportsNativeFetch } from '@sentry/utils/supports' ;
99import { BrowserClient } from '../client' ;
1010import { breadcrumbEventHandler , keypressEventHandler , wrap } from './helpers' ;
1111
@@ -24,7 +24,6 @@ export interface SentryWrappedXMLHttpRequest extends XMLHttpRequest {
2424
2525/** JSDoc */
2626interface BreadcrumbIntegrations {
27- beacon ?: boolean ;
2827 console ?: boolean ;
2928 dom ?: boolean ;
3029 fetch ?: boolean ;
@@ -53,7 +52,6 @@ export class Breadcrumbs implements Integration {
5352 */
5453 public constructor ( options ?: BreadcrumbIntegrations ) {
5554 this . options = {
56- beacon : true ,
5755 console : true ,
5856 dom : true ,
5957 fetch : true ,
@@ -64,56 +62,6 @@ export class Breadcrumbs implements Integration {
6462 } ;
6563 }
6664
67- /** JSDoc */
68- private instrumentBeacon ( ) : void {
69- if ( ! supportsBeacon ( ) ) {
70- return ;
71- }
72-
73- /** JSDoc */
74- function beaconReplacementFunction ( originalBeaconFunction : ( ) => void ) : ( ) => void {
75- return function ( this : History , ...args : any [ ] ) : void {
76- const url = args [ 0 ] ;
77- const data = args [ 1 ] ;
78- // If the browser successfully queues the request for delivery, the method returns "true" and returns "false" otherwise.
79- // https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API/Using_the_Beacon_API
80- const result = originalBeaconFunction . apply ( this , args ) ;
81-
82- const client = getCurrentHub ( ) . getClient ( ) as BrowserClient ;
83- const dsn = client && client . getDsn ( ) ;
84- if ( dsn ) {
85- const filterUrl = new API ( dsn ) . getStoreEndpoint ( ) ;
86- // if Sentry key appears in URL, don't capture it as a request
87- // but rather as our own 'sentry' type breadcrumb
88- if ( filterUrl && includes ( url , filterUrl ) ) {
89- addSentryBreadcrumb ( data ) ;
90- return result ;
91- }
92- }
93-
94- // What is wrong with you TypeScript...
95- const breadcrumbData = ( {
96- category : 'beacon' ,
97- data,
98- type : 'http' ,
99- } as any ) as { [ key : string ] : any } ;
100-
101- if ( ! result ) {
102- breadcrumbData . level = Severity . Error ;
103- }
104-
105- Breadcrumbs . addBreadcrumb ( breadcrumbData , {
106- input : args ,
107- result,
108- } ) ;
109-
110- return result ;
111- } ;
112- }
113-
114- fill ( global . navigator , 'sendBeacon' , beaconReplacementFunction ) ;
115- }
116-
11765 /** JSDoc */
11866 private instrumentConsole ( ) : void {
11967 if ( ! ( 'console' in global ) ) {
@@ -481,9 +429,6 @@ export class Breadcrumbs implements Integration {
481429 if ( this . options . fetch ) {
482430 this . instrumentFetch ( ) ;
483431 }
484- if ( this . options . beacon ) {
485- this . instrumentBeacon ( ) ;
486- }
487432 if ( this . options . history ) {
488433 this . instrumentHistory ( ) ;
489434 }
0 commit comments