@cloudcare/browser-rum 3.3.11 → 3.3.13
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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/recorderApi.js +22 -2
- package/cjs/boot/recorderApi.js.map +1 -1
- package/cjs/boot/startRecording.js +52 -2
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/domain/assembly.js +15 -2
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/canvasContinuousScheduler.js +1 -1
- package/cjs/domain/replay/record/canvasContinuousScheduler.js.map +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/replay/record/canvasObserver.js +1 -1
- package/cjs/domain/replay/record/canvasObserver.js.map +1 -1
- package/cjs/domain/replay/record/mutationObserver.js +16 -6
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
- package/cjs/domain/replay/record/observers.js +45 -13
- package/cjs/domain/replay/record/observers.js.map +1 -1
- package/cjs/domain/replay/record/record.js +104 -15
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/replay/record/serializationUtils.js +1 -1
- package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +45 -17
- package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/cjs/domain/replay/timeAnchor.js +27 -0
- package/cjs/domain/replay/timeAnchor.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackViews.js +31 -4
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +1 -1
- package/cjs/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/recorderApi.js +23 -3
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/startRecording.js +52 -2
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/assembly.js +16 -3
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/replay/record/canvasContinuousScheduler.js +1 -1
- package/esm/domain/replay/record/canvasContinuousScheduler.js.map +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/replay/record/canvasObserver.js +1 -1
- package/esm/domain/replay/record/canvasObserver.js.map +1 -1
- package/esm/domain/replay/record/mutationObserver.js +16 -6
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/observers.js +45 -13
- package/esm/domain/replay/record/observers.js.map +1 -1
- package/esm/domain/replay/record/record.js +89 -17
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +1 -1
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js +45 -17
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/esm/domain/replay/timeAnchor.js +20 -0
- package/esm/domain/replay/timeAnchor.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackViews.js +31 -4
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.js +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/package.json +4 -4
- package/src/boot/recorderApi.js +25 -3
- package/src/boot/startRecording.js +53 -2
- package/src/domain/assembly.js +18 -4
- package/src/domain/replay/record/canvasContinuousScheduler.js +1 -2
- package/src/domain/replay/record/canvasObserver.js +1 -1
- package/src/domain/replay/record/mutationObserver.js +21 -11
- package/src/domain/replay/record/observers.js +65 -33
- package/src/domain/replay/record/record.js +169 -33
- package/src/domain/replay/record/serializationUtils.js +2 -2
- package/src/domain/replay/segmentCollection/segmentCollection.js +83 -18
- package/src/domain/replay/timeAnchor.js +33 -0
- package/src/domain/rumEventsCollection/view/trackViews.js +52 -8
- package/src/domain/rumEventsCollection/view/viewCollection.js +2 -1
|
@@ -44,6 +44,12 @@ var MOUSE_MOVE_OBSERVER_THRESHOLD = 50
|
|
|
44
44
|
var SCROLL_OBSERVER_THRESHOLD = 100
|
|
45
45
|
var VISUAL_VIEWPORT_OBSERVER_THRESHOLD = 200
|
|
46
46
|
var MAX_TRACKED_RADIO_GROUPS = 256
|
|
47
|
+
var MAX_INPUT_SETTER_PROTOTYPES = 36
|
|
48
|
+
var INPUT_TAG_NAMES = {
|
|
49
|
+
INPUT: true,
|
|
50
|
+
TEXTAREA: true,
|
|
51
|
+
SELECT: true
|
|
52
|
+
}
|
|
47
53
|
|
|
48
54
|
var recordIds = new WeakMap()
|
|
49
55
|
let nextId = 1
|
|
@@ -110,14 +116,16 @@ export function initObservers(o) {
|
|
|
110
116
|
cleanupTasks.push(
|
|
111
117
|
initViewportResizeObserver(o.viewportResizeCb, o.configuration)
|
|
112
118
|
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
if (!o.inputObserver) {
|
|
120
|
+
cleanupTasks.push(
|
|
121
|
+
initInputObserver(
|
|
122
|
+
o.inputCb,
|
|
123
|
+
o.configuration,
|
|
124
|
+
undefined,
|
|
125
|
+
isNodeIgnoredForStateObserver
|
|
126
|
+
)
|
|
119
127
|
)
|
|
120
|
-
|
|
128
|
+
}
|
|
121
129
|
cleanupTasks.push(
|
|
122
130
|
initMediaInteractionObserver(
|
|
123
131
|
o.mediaInteractionCb,
|
|
@@ -464,6 +472,9 @@ export function initInputObserver(
|
|
|
464
472
|
var lastInputStateMap = new WeakMap()
|
|
465
473
|
var radioGroupStateByRoot = new WeakMap()
|
|
466
474
|
var isShadowRoot = target !== document
|
|
475
|
+
var setterInstrumentationStoppers = []
|
|
476
|
+
var instrumentedInputPrototypes = new WeakSet()
|
|
477
|
+
var instrumentedInputPrototypeCount = 0
|
|
467
478
|
|
|
468
479
|
var _addEventListeners = addEventListeners(
|
|
469
480
|
target,
|
|
@@ -473,11 +484,7 @@ export function initInputObserver(
|
|
|
473
484
|
isShadowRoot ? [DOM_EVENT.CHANGE] : [DOM_EVENT.INPUT, DOM_EVENT.CHANGE],
|
|
474
485
|
function (event) {
|
|
475
486
|
var target = getEventTarget(event)
|
|
476
|
-
if (
|
|
477
|
-
target instanceof HTMLInputElement ||
|
|
478
|
-
target instanceof HTMLTextAreaElement ||
|
|
479
|
-
target instanceof HTMLSelectElement
|
|
480
|
-
) {
|
|
487
|
+
if (isInputElement(target)) {
|
|
481
488
|
onElementChange(target)
|
|
482
489
|
}
|
|
483
490
|
},
|
|
@@ -487,32 +494,53 @@ export function initInputObserver(
|
|
|
487
494
|
}
|
|
488
495
|
)
|
|
489
496
|
var stopEventListeners = _addEventListeners.stop
|
|
490
|
-
var stopPropertySetterInstrumentation
|
|
491
497
|
if (!isShadowRoot) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
instrumentSetter(HTMLSelectElement.prototype, 'value', onElementChange),
|
|
496
|
-
instrumentSetter(HTMLTextAreaElement.prototype, 'value', onElementChange),
|
|
497
|
-
instrumentSetter(
|
|
498
|
-
HTMLSelectElement.prototype,
|
|
499
|
-
'selectedIndex',
|
|
500
|
-
onElementChange
|
|
501
|
-
)
|
|
502
|
-
]
|
|
503
|
-
stopPropertySetterInstrumentation = function () {
|
|
504
|
-
instrumentationStoppers.forEach(function (stopper) {
|
|
505
|
-
return stopper.stop()
|
|
506
|
-
})
|
|
507
|
-
}
|
|
508
|
-
} else {
|
|
509
|
-
stopPropertySetterInstrumentation = noop
|
|
498
|
+
observeInputNode(document.createElement('input'))
|
|
499
|
+
observeInputNode(document.createElement('textarea'))
|
|
500
|
+
observeInputNode(document.createElement('select'))
|
|
510
501
|
}
|
|
511
502
|
|
|
512
|
-
|
|
513
|
-
|
|
503
|
+
var stop = function () {
|
|
504
|
+
setterInstrumentationStoppers.forEach(function (stopper) {
|
|
505
|
+
stopper()
|
|
506
|
+
})
|
|
514
507
|
stopEventListeners()
|
|
515
508
|
}
|
|
509
|
+
stop.observeInputNode = isShadowRoot ? noop : observeInputNode
|
|
510
|
+
return stop
|
|
511
|
+
|
|
512
|
+
function observeInputNode(node) {
|
|
513
|
+
if (!isInputElement(node)) {
|
|
514
|
+
return
|
|
515
|
+
}
|
|
516
|
+
var prototype
|
|
517
|
+
try {
|
|
518
|
+
prototype = Object.getPrototypeOf(node)
|
|
519
|
+
} catch (_) {
|
|
520
|
+
return
|
|
521
|
+
}
|
|
522
|
+
if (
|
|
523
|
+
!prototype ||
|
|
524
|
+
instrumentedInputPrototypes.has(prototype) ||
|
|
525
|
+
instrumentedInputPrototypeCount >= MAX_INPUT_SETTER_PROTOTYPES
|
|
526
|
+
) {
|
|
527
|
+
return
|
|
528
|
+
}
|
|
529
|
+
instrumentedInputPrototypes.add(prototype)
|
|
530
|
+
instrumentedInputPrototypeCount += 1
|
|
531
|
+
var properties =
|
|
532
|
+
node.tagName === 'TEXTAREA'
|
|
533
|
+
? ['value']
|
|
534
|
+
: [
|
|
535
|
+
'value',
|
|
536
|
+
node.tagName === 'INPUT' ? 'checked' : 'selectedIndex'
|
|
537
|
+
]
|
|
538
|
+
properties.forEach(function (property) {
|
|
539
|
+
setterInstrumentationStoppers.push(
|
|
540
|
+
instrumentSetter(prototype, property, onElementChange).stop
|
|
541
|
+
)
|
|
542
|
+
})
|
|
543
|
+
}
|
|
516
544
|
|
|
517
545
|
function onElementChange(target) {
|
|
518
546
|
if (isNodeIgnored(target)) {
|
|
@@ -683,6 +711,10 @@ export function initInputObserver(
|
|
|
683
711
|
}
|
|
684
712
|
}
|
|
685
713
|
|
|
714
|
+
function isInputElement(target) {
|
|
715
|
+
return !!target && INPUT_TAG_NAMES[target.tagName]
|
|
716
|
+
}
|
|
717
|
+
|
|
686
718
|
export function initStyleSheetObserver(
|
|
687
719
|
cb,
|
|
688
720
|
configuration,
|
|
@@ -4,9 +4,22 @@ import {
|
|
|
4
4
|
getScrollY,
|
|
5
5
|
assign,
|
|
6
6
|
addTelemetryDebug,
|
|
7
|
-
getParentNode
|
|
7
|
+
getParentNode,
|
|
8
|
+
setInterval,
|
|
9
|
+
clearInterval
|
|
8
10
|
} from '@cloudcare/browser-core'
|
|
9
11
|
import { getViewportDimension } from '../../initViewportObservable'
|
|
12
|
+
import {
|
|
13
|
+
SESSION_REPLAY_TIME_ANCHOR_INTERVAL,
|
|
14
|
+
SESSION_REPLAY_TIME_ANCHOR_RECORD_TYPE,
|
|
15
|
+
SESSION_REPLAY_TIME_ANCHOR_TAG
|
|
16
|
+
} from '../timeAnchor'
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
SESSION_REPLAY_TIME_ANCHOR_INTERVAL,
|
|
20
|
+
SESSION_REPLAY_TIME_ANCHOR_RECORD_TYPE,
|
|
21
|
+
SESSION_REPLAY_TIME_ANCHOR_TAG
|
|
22
|
+
} from '../timeAnchor'
|
|
10
23
|
|
|
11
24
|
import { RecordType, IncrementalSource } from '../../../types'
|
|
12
25
|
import { NodePrivacyLevel } from '../../../constants'
|
|
@@ -17,7 +30,7 @@ import {
|
|
|
17
30
|
SERIALIZATION_MAX_NODE_COUNT,
|
|
18
31
|
SERIALIZATION_MAX_APPROX_BYTES,
|
|
19
32
|
} from './serialize'
|
|
20
|
-
import { initObservers } from './observers'
|
|
33
|
+
import { initInputObserver, initObservers } from './observers'
|
|
21
34
|
|
|
22
35
|
import { getVisualViewport } from './viewports'
|
|
23
36
|
import { assembleIncrementalSnapshot } from './utils'
|
|
@@ -78,6 +91,8 @@ var FULL_SNAPSHOT_MAX_RESTART_COUNT = 3
|
|
|
78
91
|
var FULL_SNAPSHOT_MAX_TOTAL_DURATION_MS = 1000
|
|
79
92
|
var FULL_SNAPSHOT_MAX_WALL_DURATION_MS = 30000
|
|
80
93
|
var FULL_SNAPSHOT_MUTATION_QUIET_DELAY_MS = 250
|
|
94
|
+
var REPLAY_MEMORY_BUDGET_BYTES = 48 * 1024 * 1024
|
|
95
|
+
var REPLAY_MEMORY_HIGH_WATERMARK_BYTES = 32 * 1024 * 1024
|
|
81
96
|
export var MAX_FULL_SNAPSHOT_CANVAS_BASELINE_COUNT = 64
|
|
82
97
|
var FULL_SNAPSHOT_CANVAS_BASELINE_TOTAL_TIMEOUT_MS = 2000
|
|
83
98
|
var FULL_SNAPSHOT_CANVAS_BASELINE_ITEM_TIMEOUT_MS = 1000
|
|
@@ -508,6 +523,65 @@ export function record(options) {
|
|
|
508
523
|
var pendingFullSnapshotBaselineRecords
|
|
509
524
|
var pendingFullSnapshotBaselineMutationVersion
|
|
510
525
|
var fullSnapshotWasPublished = false
|
|
526
|
+
var replayMemoryBudget = options.$rMemoryBudget
|
|
527
|
+
if (replayMemoryBudget) {
|
|
528
|
+
replayMemoryBudget.$rRecord = function () {
|
|
529
|
+
return pendingMutationAdmissionApproxBytes
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
var lastReplayTimeAnchorTimestamp
|
|
534
|
+
function emitReplayTimeAnchor() {
|
|
535
|
+
if (
|
|
536
|
+
!fullSnapshotWasPublished ||
|
|
537
|
+
recordStopping ||
|
|
538
|
+
recordStopped ||
|
|
539
|
+
(options.$rShouldEmitTimeAnchor &&
|
|
540
|
+
!options.$rShouldEmitTimeAnchor())
|
|
541
|
+
) {
|
|
542
|
+
return
|
|
543
|
+
}
|
|
544
|
+
// A time anchor carries no replay state and is safe to drop. Do not put it
|
|
545
|
+
// on the shared deferred queue: `true` must mean that the segment layer
|
|
546
|
+
// actually admitted it, especially for the final stop boundary.
|
|
547
|
+
if (
|
|
548
|
+
suppressRecordsUntilFullSnapshot ||
|
|
549
|
+
mutationPublicationBarrier ||
|
|
550
|
+
deferredRecords.length ||
|
|
551
|
+
deferredRecordAdmissionTimeout !== undefined ||
|
|
552
|
+
pendingMutationPayload ||
|
|
553
|
+
pendingMutationAdmissionQueue.length ||
|
|
554
|
+
mutationAdmissionEmitInProgress ||
|
|
555
|
+
mutationSourceFlushInProgress
|
|
556
|
+
) {
|
|
557
|
+
return false
|
|
558
|
+
}
|
|
559
|
+
var timestamp = timeStampNow()
|
|
560
|
+
if (timestamp === lastReplayTimeAnchorTimestamp) {
|
|
561
|
+
return true
|
|
562
|
+
}
|
|
563
|
+
lastEmitWasLocallyBackpressured = false
|
|
564
|
+
var accepted = rawEmit({
|
|
565
|
+
type: SESSION_REPLAY_TIME_ANCHOR_RECORD_TYPE,
|
|
566
|
+
timestamp: timestamp,
|
|
567
|
+
data: {
|
|
568
|
+
tag: SESSION_REPLAY_TIME_ANCHOR_TAG,
|
|
569
|
+
payload: {}
|
|
570
|
+
}
|
|
571
|
+
})
|
|
572
|
+
if (accepted === false) {
|
|
573
|
+
return false
|
|
574
|
+
}
|
|
575
|
+
lastReplayTimeAnchorTimestamp = timestamp
|
|
576
|
+
return true
|
|
577
|
+
}
|
|
578
|
+
var replayTimeAnchorIntervalId = setInterval(
|
|
579
|
+
emitReplayTimeAnchor,
|
|
580
|
+
SESSION_REPLAY_TIME_ANCHOR_INTERVAL
|
|
581
|
+
)
|
|
582
|
+
registerInitializationCleanup(function () {
|
|
583
|
+
clearInterval(replayTimeAnchorIntervalId)
|
|
584
|
+
})
|
|
511
585
|
var domMutationVersion = 0
|
|
512
586
|
var mutationActivityTargets = new Set()
|
|
513
587
|
var mutationActivityFlushScheduled = false
|
|
@@ -519,6 +593,7 @@ export function record(options) {
|
|
|
519
593
|
var refreshAndFlushPendingRootForNode = function () {}
|
|
520
594
|
var currentFullSnapshotPublicationToken = createPublicationToken()
|
|
521
595
|
var previousPublishedReplayTree
|
|
596
|
+
var inputObserver
|
|
522
597
|
|
|
523
598
|
function getPublishedReplayTree() {
|
|
524
599
|
return {
|
|
@@ -570,6 +645,7 @@ export function record(options) {
|
|
|
570
645
|
) {
|
|
571
646
|
publishedNodeParentByNode.set(node, parentNode)
|
|
572
647
|
publicationTokenByNode.set(node, publicationToken)
|
|
648
|
+
observeInputNode(node)
|
|
573
649
|
}
|
|
574
650
|
|
|
575
651
|
function stageMutationNodePublication(
|
|
@@ -587,10 +663,10 @@ export function record(options) {
|
|
|
587
663
|
}
|
|
588
664
|
pendingNodeParentByNode.set(node, parentNode)
|
|
589
665
|
pendingPublicationTokenByNode.set(node, publicationToken)
|
|
666
|
+
observeInputNode(node)
|
|
590
667
|
if (
|
|
591
668
|
publicationToken &&
|
|
592
|
-
|
|
593
|
-
node instanceof HTMLCanvasElement
|
|
669
|
+
node.tagName === 'CANVAS'
|
|
594
670
|
) {
|
|
595
671
|
if (!publicationToken.$rCanvasNodes) {
|
|
596
672
|
publicationToken.$rCanvasNodes = new Set()
|
|
@@ -599,6 +675,12 @@ export function record(options) {
|
|
|
599
675
|
}
|
|
600
676
|
}
|
|
601
677
|
|
|
678
|
+
function observeInputNode(node) {
|
|
679
|
+
if (inputObserver && inputObserver.observeInputNode) {
|
|
680
|
+
inputObserver.observeInputNode(node)
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
602
684
|
function isNodePublished(node) {
|
|
603
685
|
if (!node) {
|
|
604
686
|
return false
|
|
@@ -642,9 +724,14 @@ export function record(options) {
|
|
|
642
724
|
) {
|
|
643
725
|
return true
|
|
644
726
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
727
|
+
// Serializing a newly added ancestor can stage an already-published
|
|
728
|
+
// descendant before the paired remove is normalized. This is the
|
|
729
|
+
// common DOM shape used by Cocos Creator when it inserts a wrapper and
|
|
730
|
+
// moves its existing GameCanvas into it. Until the destination add is
|
|
731
|
+
// queued, the node still belongs to the previously published replay
|
|
732
|
+
// tree and must remain eligible for the atomic remove + add transition.
|
|
733
|
+
// A genuinely new node has no previous publication token and therefore
|
|
734
|
+
// still falls through to false below.
|
|
648
735
|
}
|
|
649
736
|
var publicationToken = publicationTokenByNode.get(node)
|
|
650
737
|
return Boolean(
|
|
@@ -1117,7 +1204,10 @@ export function record(options) {
|
|
|
1117
1204
|
)
|
|
1118
1205
|
}
|
|
1119
1206
|
|
|
1120
|
-
function tryMergePendingPureAddMutationAdmission(
|
|
1207
|
+
function tryMergePendingPureAddMutationAdmission(
|
|
1208
|
+
entry,
|
|
1209
|
+
admissionBytesLimit
|
|
1210
|
+
) {
|
|
1121
1211
|
var previousEntry =
|
|
1122
1212
|
pendingMutationAdmissionQueue[
|
|
1123
1213
|
pendingMutationAdmissionQueue.length - 1
|
|
@@ -1131,7 +1221,7 @@ export function record(options) {
|
|
|
1131
1221
|
!isPureAddMutationPayload(mutationPayload) ||
|
|
1132
1222
|
previousEntry[1] + entry[1] > MAX_MUTATION_EMIT_APPROX_BYTES ||
|
|
1133
1223
|
pendingMutationAdmissionApproxBytes + entry[1] >
|
|
1134
|
-
|
|
1224
|
+
admissionBytesLimit
|
|
1135
1225
|
) {
|
|
1136
1226
|
return false
|
|
1137
1227
|
}
|
|
@@ -1163,16 +1253,27 @@ export function record(options) {
|
|
|
1163
1253
|
})
|
|
1164
1254
|
return
|
|
1165
1255
|
}
|
|
1256
|
+
var admissionBytesLimit = replayMemoryBudget
|
|
1257
|
+
? Math.min(
|
|
1258
|
+
MAX_PENDING_MUTATION_ADMISSION_APPROX_BYTES,
|
|
1259
|
+
REPLAY_MEMORY_BUDGET_BYTES - replayMemoryBudget.$rSegment()
|
|
1260
|
+
)
|
|
1261
|
+
: MAX_PENDING_MUTATION_ADMISSION_APPROX_BYTES
|
|
1166
1262
|
for (var entryIndex = 0; entryIndex < mutationEntries.length; entryIndex += 1) {
|
|
1167
1263
|
var entry = mutationEntries[entryIndex]
|
|
1168
|
-
if (
|
|
1264
|
+
if (
|
|
1265
|
+
tryMergePendingPureAddMutationAdmission(
|
|
1266
|
+
entry,
|
|
1267
|
+
admissionBytesLimit
|
|
1268
|
+
)
|
|
1269
|
+
) {
|
|
1169
1270
|
continue
|
|
1170
1271
|
}
|
|
1171
1272
|
if (
|
|
1172
1273
|
pendingMutationAdmissionQueue.length + 1 >
|
|
1173
1274
|
MAX_PENDING_MUTATION_ADMISSION_PAYLOADS ||
|
|
1174
1275
|
pendingMutationAdmissionApproxBytes + entry[1] >
|
|
1175
|
-
|
|
1276
|
+
admissionBytesLimit
|
|
1176
1277
|
) {
|
|
1177
1278
|
var rejectedTail = mutationEntries.slice(entryIndex)
|
|
1178
1279
|
rejectedTail.forEach(function (rejectedEntry) {
|
|
@@ -1365,6 +1466,21 @@ export function record(options) {
|
|
|
1365
1466
|
emit(assembleIncrementalSnapshot(IncrementalSource.Input, s))
|
|
1366
1467
|
}
|
|
1367
1468
|
|
|
1469
|
+
try {
|
|
1470
|
+
inputObserver = initInputObserver(
|
|
1471
|
+
inputCb,
|
|
1472
|
+
configuration,
|
|
1473
|
+
undefined,
|
|
1474
|
+
isNodeIgnoredForObserver
|
|
1475
|
+
)
|
|
1476
|
+
} catch (error) {
|
|
1477
|
+
return abortRecorderInitialization(
|
|
1478
|
+
'recorder_initialization_error',
|
|
1479
|
+
error
|
|
1480
|
+
)
|
|
1481
|
+
}
|
|
1482
|
+
registerInitializationCleanup(inputObserver)
|
|
1483
|
+
|
|
1368
1484
|
var mutationResourceBudget = createMutationResourceBudget()
|
|
1369
1485
|
var shadowRootsController
|
|
1370
1486
|
try {
|
|
@@ -1608,31 +1724,30 @@ export function record(options) {
|
|
|
1608
1724
|
: startContinuousCanvasSnapshotLoop
|
|
1609
1725
|
var canvasSnapshotLoop
|
|
1610
1726
|
try {
|
|
1611
|
-
canvasSnapshotLoop =
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
function (canvas) {
|
|
1621
|
-
return !isDrawDrivenWebGLCanvas(canvas)
|
|
1622
|
-
}
|
|
1727
|
+
canvasSnapshotLoop = startCanvasSnapshotLoop({
|
|
1728
|
+
configuration: configuration,
|
|
1729
|
+
getCanvases: function (maxScanCount) {
|
|
1730
|
+
return getActiveSerializedCanvases(maxScanCount).filter(
|
|
1731
|
+
function (canvas) {
|
|
1732
|
+
return (
|
|
1733
|
+
!isDrawDrivenWebGLCanvas(canvas) &&
|
|
1734
|
+
(!shouldUseCanvasCommandCapture ||
|
|
1735
|
+
!(canvas instanceof HTMLCanvasElement))
|
|
1623
1736
|
)
|
|
1624
|
-
},
|
|
1625
|
-
getSerializedNodeId: function (canvas) {
|
|
1626
|
-
return getActiveSerializedNodeId(canvas)
|
|
1627
|
-
},
|
|
1628
|
-
onDebug: handleAutoCanvasSnapshotDebug,
|
|
1629
|
-
snapshotCanvas: function (canvas) {
|
|
1630
|
-
return snapshotCanvasIfActive(canvas, {
|
|
1631
|
-
trigger: 'auto',
|
|
1632
|
-
scheduler: 'continuous_snapshot'
|
|
1633
|
-
})
|
|
1634
1737
|
}
|
|
1738
|
+
)
|
|
1739
|
+
},
|
|
1740
|
+
getSerializedNodeId: function (canvas) {
|
|
1741
|
+
return getActiveSerializedNodeId(canvas)
|
|
1742
|
+
},
|
|
1743
|
+
onDebug: handleAutoCanvasSnapshotDebug,
|
|
1744
|
+
snapshotCanvas: function (canvas) {
|
|
1745
|
+
return snapshotCanvasIfActive(canvas, {
|
|
1746
|
+
trigger: 'auto',
|
|
1747
|
+
scheduler: 'continuous_snapshot'
|
|
1635
1748
|
})
|
|
1749
|
+
}
|
|
1750
|
+
})
|
|
1636
1751
|
} catch (error) {
|
|
1637
1752
|
return abortRecorderInitialization(
|
|
1638
1753
|
'recorder_initialization_error',
|
|
@@ -1721,6 +1836,20 @@ export function record(options) {
|
|
|
1721
1836
|
}
|
|
1722
1837
|
|
|
1723
1838
|
function snapshotCanvasIfActive(canvas, snapshotOptions) {
|
|
1839
|
+
if (
|
|
1840
|
+
replayMemoryBudget &&
|
|
1841
|
+
pendingMutationAdmissionApproxBytes +
|
|
1842
|
+
replayMemoryBudget.$rSegment() >=
|
|
1843
|
+
REPLAY_MEMORY_HIGH_WATERMARK_BYTES &&
|
|
1844
|
+
snapshotOptions &&
|
|
1845
|
+
(snapshotOptions.scheduler === 'continuous_snapshot' ||
|
|
1846
|
+
snapshotOptions.scheduler === 'webgl_snapshot')
|
|
1847
|
+
) {
|
|
1848
|
+
return Promise.resolve({
|
|
1849
|
+
ok: false,
|
|
1850
|
+
reason: 'memory_pressure'
|
|
1851
|
+
})
|
|
1852
|
+
}
|
|
1724
1853
|
if (isNodeIgnored(canvas)) {
|
|
1725
1854
|
return Promise.resolve({
|
|
1726
1855
|
ok: false,
|
|
@@ -2158,6 +2287,7 @@ export function record(options) {
|
|
|
2158
2287
|
mutationActivityCb: trackDomMutationActivity,
|
|
2159
2288
|
mutationNodeSerializationCb: stageMutationNodePublication,
|
|
2160
2289
|
mutationResourceBudget: mutationResourceBudget,
|
|
2290
|
+
inputObserver: inputObserver,
|
|
2161
2291
|
isNodeIgnored: isNodeIgnoredForObserver,
|
|
2162
2292
|
isNodeIgnoredForStatelessObserver:
|
|
2163
2293
|
isNodeIgnoredForStatelessObserver,
|
|
@@ -3500,6 +3630,9 @@ export function record(options) {
|
|
|
3500
3630
|
}
|
|
3501
3631
|
recordStopped = true
|
|
3502
3632
|
;[
|
|
3633
|
+
function () {
|
|
3634
|
+
clearInterval(replayTimeAnchorIntervalId)
|
|
3635
|
+
},
|
|
3503
3636
|
discardPendingMutationAdmissions,
|
|
3504
3637
|
cancelMutationSourceFlushContinuation,
|
|
3505
3638
|
cancelScheduledFullSnapshot,
|
|
@@ -3519,6 +3652,7 @@ export function record(options) {
|
|
|
3519
3652
|
stopCanvasSnapshots(canvasSnapshotLoop)
|
|
3520
3653
|
},
|
|
3521
3654
|
stopObservers,
|
|
3655
|
+
inputObserver,
|
|
3522
3656
|
stopSerializedCanvasTracking
|
|
3523
3657
|
].forEach(function (cleanupTask) {
|
|
3524
3658
|
try {
|
|
@@ -3539,6 +3673,7 @@ export function record(options) {
|
|
|
3539
3673
|
|
|
3540
3674
|
var recorder = {
|
|
3541
3675
|
stop: stopRecording,
|
|
3676
|
+
$rEmitTimeAnchor: emitReplayTimeAnchor,
|
|
3542
3677
|
$rFlushCanvasCommands: function () {
|
|
3543
3678
|
// A previous boundary pass may have preserved the exact Canvas record
|
|
3544
3679
|
// after transient segment/encoder backpressure. Retry that object before
|
|
@@ -3605,6 +3740,7 @@ function createInactiveRecorder() {
|
|
|
3605
3740
|
var noop = function () {}
|
|
3606
3741
|
var recorder = {
|
|
3607
3742
|
stop: noop,
|
|
3743
|
+
$rEmitTimeAnchor: noop,
|
|
3608
3744
|
$rFlushCanvasCommands: noop,
|
|
3609
3745
|
snapshotCanvas: noop,
|
|
3610
3746
|
getSerializedNodeIdForDebug: noop,
|
|
@@ -68,8 +68,8 @@ export function getSerializedNodeId(node) {
|
|
|
68
68
|
export function setSerializedNodeId(node, serializeNodeId) {
|
|
69
69
|
serializedNodeIds.set(node, serializeNodeId)
|
|
70
70
|
if (
|
|
71
|
-
serializedCanvasTrackingCount
|
|
72
|
-
node
|
|
71
|
+
serializedCanvasTrackingCount &&
|
|
72
|
+
node.tagName === 'CANVAS'
|
|
73
73
|
) {
|
|
74
74
|
registerSerializedCanvasNode(node)
|
|
75
75
|
}
|