Skip to content

Commit 395c009

Browse files
chore: Add warning if fix_stylesheet is off (#1421)
Co-authored-by: Jordan Porter <insomniacrampage@hotmail.com>
1 parent 7c02a02 commit 395c009

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/warning-codes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,6 @@
9292
### 45
9393
`An internal agent process failed to execute.`
9494
### 46
95-
`A reserved eventType was provided to recordCustomEvent(...) -- The event was not recorded.`
95+
`A reserved eventType was provided to recordCustomEvent(...) -- The event was not recorded.`
96+
### 47
97+
`We tried to access a stylesheet's contents but failed due to browser security. For best results, ensure that cross-domain CSS assets are decorated with "crossorigin='anonymous'" attribution or are otherwise publicly accessible.`

src/features/session_replay/shared/recorder.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { FEATURE_NAMES } from '../../../loaders/features/features'
1414
import { buildNRMetaNode, customMasker } from './utils'
1515
import { IDEAL_PAYLOAD_SIZE } from '../../../common/constants/agent-constants'
1616
import { AggregateBase } from '../../utils/aggregate-base'
17+
import { warn } from '../../../common/util/console'
18+
import { single } from '../../../common/util/invoke'
1719

1820
export class Recorder {
1921
/** Each page mutation or event will be stored (raw) in this array. This array will be cleared on each harvest */
@@ -25,6 +27,8 @@ export class Recorder {
2527
/** flag that if true, blocks events from being "stored". Only set to true when a full snapshot has incomplete nodes (only stylesheets ATM) */
2628
#fixing = false
2729

30+
#warnCSSOnce = single(() => warn(47)) // notifies user of potential replayer issue if fix_stylesheets is off
31+
2832
constructor (parent) {
2933
this.#events = new RecorderEvents()
3034
this.#backloggedEvents = new RecorderEvents()
@@ -120,6 +124,7 @@ export class Recorder {
120124
if (!this.shouldFix) {
121125
if (incompletes > 0) {
122126
this.currentBufferTarget.inlinedAllStylesheets = false
127+
this.#warnCSSOnce()
123128
handle(SUPPORTABILITY_METRIC_CHANNEL, [missingInlineSMTag + 'Skipped', incompletes], undefined, FEATURE_NAMES.metrics, this.parent.ee)
124129
}
125130
return this.store(event, isCheckout)

0 commit comments

Comments
 (0)