Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
isPageloadTransaction, // should wait for finish signal if it's a pageload transaction
);

if (isPageloadTransaction) {
if (isPageloadTransaction && WINDOW.document) {
WINDOW.document.addEventListener('readystatechange', () => {
if (['interactive', 'complete'].includes(WINDOW.document.readyState)) {
idleTransaction.sendAutoFinishSignal();
Expand Down Expand Up @@ -295,7 +295,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
options;

let activeSpan: Span | undefined;
let startingUrl: string | undefined = WINDOW.location.href;
let startingUrl: string | undefined = WINDOW.location && WINDOW.location.href;

client.on('startNavigationSpan', (context: StartSpanOptions) => {
if (activeSpan) {
Expand All @@ -321,7 +321,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
});
});

if (options.instrumentPageLoad) {
if (options.instrumentPageLoad && WINDOW.location) {
const context: StartSpanOptions = {
name: WINDOW.location.pathname,
// pageload should always start at timeOrigin (and needs to be in s, not ms)
Expand All @@ -334,7 +334,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
startBrowserTracingPageLoadSpan(client, context);
}

if (options.instrumentNavigation) {
if (options.instrumentNavigation && WINDOW.location) {
addHistoryInstrumentationHandler(({ to, from }) => {
/**
* This early return is there to account for some cases where a navigation transaction starts right after
Expand Down