File tree Expand file tree Collapse file tree 3 files changed +9
-25
lines changed Expand file tree Collapse file tree 3 files changed +9
-25
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 16
16
*
17
17
*/
18
18
19
- import './check-browser'
20
19
import './polyfill-safari10'
21
20
import { registerInstrumentations } from '@opentelemetry/instrumentation'
22
21
import {
@@ -288,6 +287,13 @@ export const SplunkRum: SplunkOtelWebType = {
288
287
289
288
init : function ( options ) {
290
289
userTrackingMode = options . user ?. trackingMode ?? 'noTracking'
290
+
291
+ if ( typeof window !== 'object' ) {
292
+ throw Error (
293
+ 'SplunkRum Error: This library is intended to run in a browser environment. Please ensure the code is evaluated within a browser context.' ,
294
+ )
295
+ }
296
+
291
297
// "env" based config still a bad idea for web
292
298
if ( ! ( 'OTEL_TRACES_EXPORTER' in _globalThis ) ) {
293
299
_globalThis . OTEL_TRACES_EXPORTER = 'none'
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import { isIframe } from '../utils'
20
20
import { throttle } from '../utils/throttle'
21
21
import { Store } from './store'
22
22
23
- const isSafari = / ^ ( (? ! c h r o m e | a n d r o i d ) .) * s a f a r i / i. test ( navigator . userAgent )
23
+ const isSafari = ( ) => / ^ ( (? ! c h r o m e | a n d r o i d ) .) * s a f a r i / i. test ( navigator . userAgent )
24
24
25
25
export class CookieStore < T > implements Store < T > {
26
26
private cachedValue : T | undefined
@@ -92,7 +92,7 @@ export class CookieStore<T> implements Store<T> {
92
92
if ( isIframe ( ) ) {
93
93
// Safari does not set cookie when the SameSite attribute is set to None and Secure is set to true in an iframe
94
94
// It fails also in our unit tests since they are running in iframe and on localhost.
95
- if ( [ 'localhost' , '127.0.0.1' ] . includes ( window . location . hostname ) && isSafari ) {
95
+ if ( [ 'localhost' , '127.0.0.1' ] . includes ( window . location . hostname ) && isSafari ( ) ) {
96
96
rawCookie += ';SameSite=None'
97
97
} else {
98
98
rawCookie += ';SameSite=None; Secure'
You can’t perform that action at this time.
0 commit comments