@cloudcare/browser-rum 3.3.23 → 3.3.25

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.
Files changed (364) hide show
  1. package/README.md +33 -0
  2. package/README.zh.md +30 -0
  3. package/bundle/dataflux-rum.js +1 -1
  4. package/cjs/boot/buildEnv.js +1 -1
  5. package/cjs/boot/disabledRumPublicApi.js +5 -0
  6. package/cjs/boot/disabledRumPublicApi.js.map +1 -1
  7. package/cjs/boot/initCallbacks.js +25 -0
  8. package/cjs/boot/initCallbacks.js.map +1 -0
  9. package/cjs/boot/perStartRum.js +99 -50
  10. package/cjs/boot/perStartRum.js.map +1 -1
  11. package/cjs/boot/rum.js +7 -4
  12. package/cjs/boot/rum.js.map +1 -1
  13. package/cjs/boot/rumPublicApi.js +6 -7
  14. package/cjs/boot/rumPublicApi.js.map +1 -1
  15. package/cjs/boot/startRecording.js +2 -0
  16. package/cjs/boot/startRecording.js.map +1 -1
  17. package/cjs/domain/configuration.js +15 -2
  18. package/cjs/domain/configuration.js.map +1 -1
  19. package/cjs/domain/contexts/urlContexts.js +32 -21
  20. package/cjs/domain/contexts/urlContexts.js.map +1 -1
  21. package/cjs/domain/contexts/viewContexts.js +1 -1
  22. package/cjs/domain/contexts/viewContexts.js.map +1 -1
  23. package/cjs/domain/deflate/deflateWorker.js +39 -27
  24. package/cjs/domain/deflate/deflateWorker.js.map +1 -1
  25. package/cjs/domain/privacy.js +9 -6
  26. package/cjs/domain/privacy.js.map +1 -1
  27. package/cjs/domain/replay/record/canvasCommandCapture.js +91 -179
  28. package/cjs/domain/replay/record/canvasCommandCapture.js.map +1 -1
  29. package/cjs/domain/replay/record/canvasCommandObserverStub.js +24 -0
  30. package/cjs/domain/replay/record/canvasCommandObserverStub.js.map +1 -0
  31. package/cjs/domain/replay/record/canvasCommandSerializeArgs.js +3 -2
  32. package/cjs/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -1
  33. package/cjs/domain/replay/record/canvasContext.js +25 -0
  34. package/cjs/domain/replay/record/canvasContext.js.map +1 -1
  35. package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
  36. package/cjs/domain/replay/record/canvasObserver.js +3 -0
  37. package/cjs/domain/replay/record/canvasObserver.js.map +1 -1
  38. package/cjs/domain/replay/record/mutationObserver.js +3 -12
  39. package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
  40. package/cjs/domain/replay/record/record.js +1 -1
  41. package/cjs/domain/replay/record/record.js.map +1 -1
  42. package/cjs/domain/replay/record/serialize.js +15 -13
  43. package/cjs/domain/replay/record/serialize.js.map +1 -1
  44. package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +21 -6
  45. package/cjs/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
  46. package/cjs/domain/replay/segmentCollection/segmentCollection.js +91 -143
  47. package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  48. package/cjs/domain/replayCanvasSupported.js +8 -0
  49. package/cjs/domain/replayCanvasSupported.js.map +1 -0
  50. package/cjs/domain/requestCollection.js +38 -39
  51. package/cjs/domain/requestCollection.js.map +1 -1
  52. package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js +1 -1
  53. package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
  54. package/cjs/domain/rumEventsCollection/resource/fetchTimingRegistry.js +143 -0
  55. package/cjs/domain/rumEventsCollection/resource/fetchTimingRegistry.js.map +1 -0
  56. package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +2 -2
  57. package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
  58. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +77 -45
  59. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
  60. package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js +11 -9
  61. package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -1
  62. package/cjs/domain/rumEventsCollection/resource/resourceUtils.js +30 -40
  63. package/cjs/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
  64. package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +7 -1
  65. package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
  66. package/cjs/domain/rumEventsCollection/view/trackViews.js +3 -0
  67. package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
  68. package/cjs/domain/tracing/skywalkingTracer.js +4 -50
  69. package/cjs/domain/tracing/skywalkingTracer.js.map +1 -1
  70. package/cjs/domain/tracing/tracer.js +26 -3
  71. package/cjs/domain/tracing/tracer.js.map +1 -1
  72. package/esm/boot/buildEnv.js +2 -5
  73. package/esm/boot/buildEnv.js.map +1 -1
  74. package/esm/boot/disabledRumPublicApi.js +2 -35
  75. package/esm/boot/disabledRumPublicApi.js.map +1 -1
  76. package/esm/boot/initCallbacks.js +2 -0
  77. package/esm/boot/initCallbacks.js.map +1 -0
  78. package/esm/boot/perStartRum.js +2 -260
  79. package/esm/boot/perStartRum.js.map +1 -1
  80. package/esm/boot/recorderApi.js +2 -338
  81. package/esm/boot/recorderApi.js.map +1 -1
  82. package/esm/boot/recorderApiStub.js +2 -21
  83. package/esm/boot/recorderApiStub.js.map +1 -1
  84. package/esm/boot/rum.entry.js +2 -13
  85. package/esm/boot/rum.entry.js.map +1 -1
  86. package/esm/boot/rum.js +2 -184
  87. package/esm/boot/rum.js.map +1 -1
  88. package/esm/boot/rum.slim.entry.js +2 -7
  89. package/esm/boot/rum.slim.entry.js.map +1 -1
  90. package/esm/boot/rumEntryFactory.js +2 -18
  91. package/esm/boot/rumEntryFactory.js.map +1 -1
  92. package/esm/boot/rumPublicApi.js +2 -344
  93. package/esm/boot/rumPublicApi.js.map +1 -1
  94. package/esm/boot/rumRecorderApiStub.js +2 -13
  95. package/esm/boot/rumRecorderApiStub.js.map +1 -1
  96. package/esm/boot/rumSlimConfiguration.js +2 -10
  97. package/esm/boot/rumSlimConfiguration.js.map +1 -1
  98. package/esm/boot/sessionReplayPublicApi.js +2 -43
  99. package/esm/boot/sessionReplayPublicApi.js.map +1 -1
  100. package/esm/boot/startRecording.js +2 -444
  101. package/esm/boot/startRecording.js.map +1 -1
  102. package/esm/constants.js +2 -28
  103. package/esm/constants.js.map +1 -1
  104. package/esm/domain/assembly.js +2 -213
  105. package/esm/domain/assembly.js.map +1 -1
  106. package/esm/domain/configuration.js +2 -323
  107. package/esm/domain/configuration.js.map +1 -1
  108. package/esm/domain/contexts/commonContext.js +2 -8
  109. package/esm/domain/contexts/commonContext.js.map +1 -1
  110. package/esm/domain/contexts/displayContext.js +2 -16
  111. package/esm/domain/contexts/displayContext.js.map +1 -1
  112. package/esm/domain/contexts/foregroundContexts.js +2 -103
  113. package/esm/domain/contexts/foregroundContexts.js.map +1 -1
  114. package/esm/domain/contexts/internalContext.js +2 -41
  115. package/esm/domain/contexts/internalContext.js.map +1 -1
  116. package/esm/domain/contexts/pageStateHistory.js +2 -104
  117. package/esm/domain/contexts/pageStateHistory.js.map +1 -1
  118. package/esm/domain/contexts/urlContexts.js +2 -85
  119. package/esm/domain/contexts/urlContexts.js.map +1 -1
  120. package/esm/domain/contexts/viewContexts.js +2 -45
  121. package/esm/domain/contexts/viewContexts.js.map +1 -1
  122. package/esm/domain/deflate/deflateEncoder.js +2 -592
  123. package/esm/domain/deflate/deflateEncoder.js.map +1 -1
  124. package/esm/domain/deflate/deflateWorker.js +2 -225
  125. package/esm/domain/deflate/deflateWorker.js.map +1 -1
  126. package/esm/domain/deflate/index.js +2 -3
  127. package/esm/domain/deflate/index.js.map +1 -1
  128. package/esm/domain/domMutationObservable.js +2 -62
  129. package/esm/domain/domMutationObservable.js.map +1 -1
  130. package/esm/domain/encoderStreamId.js +2 -6
  131. package/esm/domain/encoderStreamId.js.map +1 -1
  132. package/esm/domain/firstInputPolyfill.js +2 -77
  133. package/esm/domain/firstInputPolyfill.js.map +1 -1
  134. package/esm/domain/initViewportObservable.js +2 -36
  135. package/esm/domain/initViewportObservable.js.map +1 -1
  136. package/esm/domain/locationChangeObservable.js +2 -65
  137. package/esm/domain/locationChangeObservable.js.map +1 -1
  138. package/esm/domain/performanceObservable.js +2 -116
  139. package/esm/domain/performanceObservable.js.map +1 -1
  140. package/esm/domain/performanceUtils.js +2 -45
  141. package/esm/domain/performanceUtils.js.map +1 -1
  142. package/esm/domain/plugins.js +2 -59
  143. package/esm/domain/plugins.js.map +1 -1
  144. package/esm/domain/privacy.js +2 -266
  145. package/esm/domain/privacy.js.map +1 -1
  146. package/esm/domain/replay/record/canvasAutoSnapshot.js +2 -9
  147. package/esm/domain/replay/record/canvasAutoSnapshot.js.map +1 -1
  148. package/esm/domain/replay/record/canvasCommandCapture.js +2 -1275
  149. package/esm/domain/replay/record/canvasCommandCapture.js.map +1 -1
  150. package/esm/domain/replay/record/canvasCommandObserver.js +2 -1207
  151. package/esm/domain/replay/record/canvasCommandObserver.js.map +1 -1
  152. package/esm/domain/replay/record/canvasCommandObserverStub.js +2 -0
  153. package/esm/domain/replay/record/canvasCommandObserverStub.js.map +1 -0
  154. package/esm/domain/replay/record/canvasCommandSerializeArgs.js +2 -111
  155. package/esm/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -1
  156. package/esm/domain/replay/record/canvasContext.js +2 -50
  157. package/esm/domain/replay/record/canvasContext.js.map +1 -1
  158. package/esm/domain/replay/record/canvasContinuousScheduler.js +2 -378
  159. package/esm/domain/replay/record/canvasContinuousScheduler.js.map +1 -1
  160. package/esm/domain/replay/record/canvasEncodeBridge.js +2 -692
  161. package/esm/domain/replay/record/canvasEncodeBridge.js.map +1 -1
  162. package/esm/domain/replay/record/canvasEncodeWorker.js +2 -164
  163. package/esm/domain/replay/record/canvasEncodeWorker.js.map +1 -1
  164. package/esm/domain/replay/record/canvasFrameSignature.js +2 -75
  165. package/esm/domain/replay/record/canvasFrameSignature.js.map +1 -1
  166. package/esm/domain/replay/record/canvasMutationRecord.js +2 -26
  167. package/esm/domain/replay/record/canvasMutationRecord.js.map +1 -1
  168. package/esm/domain/replay/record/canvasObserver.js +2 -420
  169. package/esm/domain/replay/record/canvasObserver.js.map +1 -1
  170. package/esm/domain/replay/record/canvasSerializeArgs.js +2 -101
  171. package/esm/domain/replay/record/canvasSerializeArgs.js.map +1 -1
  172. package/esm/domain/replay/record/canvasWebGLPluginHost.js +2 -26
  173. package/esm/domain/replay/record/canvasWebGLPluginHost.js.map +1 -1
  174. package/esm/domain/replay/record/elementsScrollPositions.js +2 -23
  175. package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -1
  176. package/esm/domain/replay/record/index.js +2 -4
  177. package/esm/domain/replay/record/index.js.map +1 -1
  178. package/esm/domain/replay/record/mutationBatch.js +2 -562
  179. package/esm/domain/replay/record/mutationBatch.js.map +1 -1
  180. package/esm/domain/replay/record/mutationObserver.js +2 -2332
  181. package/esm/domain/replay/record/mutationObserver.js.map +1 -1
  182. package/esm/domain/replay/record/mutationResourceBudget.js +2 -137
  183. package/esm/domain/replay/record/mutationResourceBudget.js.map +1 -1
  184. package/esm/domain/replay/record/observers.js +2 -624
  185. package/esm/domain/replay/record/observers.js.map +1 -1
  186. package/esm/domain/replay/record/privacy.js +2 -1
  187. package/esm/domain/replay/record/privacy.js.map +1 -1
  188. package/esm/domain/replay/record/record.js +2 -3511
  189. package/esm/domain/replay/record/record.js.map +1 -1
  190. package/esm/domain/replay/record/serializationUtils.js +2 -677
  191. package/esm/domain/replay/record/serializationUtils.js.map +1 -1
  192. package/esm/domain/replay/record/serialize.js +2 -735
  193. package/esm/domain/replay/record/serialize.js.map +1 -1
  194. package/esm/domain/replay/record/shadowRootsController.js +2 -902
  195. package/esm/domain/replay/record/shadowRootsController.js.map +1 -1
  196. package/esm/domain/replay/record/utils.js +2 -36
  197. package/esm/domain/replay/record/utils.js.map +1 -1
  198. package/esm/domain/replay/record/viewports.js +2 -58
  199. package/esm/domain/replay/record/viewports.js.map +1 -1
  200. package/esm/domain/replay/replayStats.js +2 -59
  201. package/esm/domain/replay/replayStats.js.map +1 -1
  202. package/esm/domain/replay/segmentCollection/buildReplayPayload.js +2 -31
  203. package/esm/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
  204. package/esm/domain/replay/segmentCollection/index.js +2 -3
  205. package/esm/domain/replay/segmentCollection/index.js.map +1 -1
  206. package/esm/domain/replay/segmentCollection/segment.js +2 -415
  207. package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
  208. package/esm/domain/replay/segmentCollection/segmentCollection.js +2 -1114
  209. package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  210. package/esm/domain/replay/startRecordBridge.js +2 -13
  211. package/esm/domain/replay/startRecordBridge.js.map +1 -1
  212. package/esm/domain/replay/timeAnchor.js +2 -20
  213. package/esm/domain/replay/timeAnchor.js.map +1 -1
  214. package/esm/domain/replayCanvasSupported.js +2 -0
  215. package/esm/domain/replayCanvasSupported.js.map +1 -0
  216. package/esm/domain/requestCollection.js +2 -121
  217. package/esm/domain/requestCollection.js.map +1 -1
  218. package/esm/domain/rumEventsCollection/actions/actionCollection.js +2 -83
  219. package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
  220. package/esm/domain/rumEventsCollection/actions/clickChain.js +2 -62
  221. package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
  222. package/esm/domain/rumEventsCollection/actions/computeFrustration.js +2 -67
  223. package/esm/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -1
  224. package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +2 -279
  225. package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
  226. package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +2 -233
  227. package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
  228. package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -21
  229. package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
  230. package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +2 -67
  231. package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
  232. package/esm/domain/rumEventsCollection/actions/trackClickActions.js +2 -263
  233. package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
  234. package/esm/domain/rumEventsCollection/error/errorCollection.js +2 -93
  235. package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
  236. package/esm/domain/rumEventsCollection/error/trackConsoleError.js +2 -12
  237. package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
  238. package/esm/domain/rumEventsCollection/error/trackReportError.js +2 -19
  239. package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
  240. package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +2 -55
  241. package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
  242. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -38
  243. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
  244. package/esm/domain/rumEventsCollection/resource/fetchTimingRegistry.js +2 -0
  245. package/esm/domain/rumEventsCollection/resource/fetchTimingRegistry.js.map +1 -0
  246. package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +2 -69
  247. package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
  248. package/esm/domain/rumEventsCollection/resource/resourceCollection.js +2 -294
  249. package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
  250. package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js +2 -232
  251. package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -1
  252. package/esm/domain/rumEventsCollection/resource/resourceUtils.js +2 -218
  253. package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
  254. package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +2 -19
  255. package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
  256. package/esm/domain/rumEventsCollection/resource/webSocketCollection.js +2 -191
  257. package/esm/domain/rumEventsCollection/resource/webSocketCollection.js.map +1 -1
  258. package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js +2 -47
  259. package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -1
  260. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +2 -42
  261. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
  262. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +2 -117
  263. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
  264. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +2 -20
  265. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
  266. package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +2 -49
  267. package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
  268. package/esm/domain/rumEventsCollection/view/trackFirstInput.js +2 -41
  269. package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
  270. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +2 -44
  271. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
  272. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +2 -153
  273. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
  274. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +2 -54
  275. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
  276. package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +2 -50
  277. package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
  278. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +2 -73
  279. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
  280. package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +2 -84
  281. package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
  282. package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js +2 -38
  283. package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js.map +1 -1
  284. package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +2 -15
  285. package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
  286. package/esm/domain/rumEventsCollection/view/trackViews.js +2 -418
  287. package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
  288. package/esm/domain/rumEventsCollection/view/viewCollection.js +2 -127
  289. package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
  290. package/esm/domain/rumSessionManager.js +2 -208
  291. package/esm/domain/rumSessionManager.js.map +1 -1
  292. package/esm/domain/tracing/ddtraceTracer.js +2 -40
  293. package/esm/domain/tracing/ddtraceTracer.js.map +1 -1
  294. package/esm/domain/tracing/getDocumentTraceId.js +2 -69
  295. package/esm/domain/tracing/getDocumentTraceId.js.map +1 -1
  296. package/esm/domain/tracing/jaegerTracer.js +2 -42
  297. package/esm/domain/tracing/jaegerTracer.js.map +1 -1
  298. package/esm/domain/tracing/sampler.js +2 -61
  299. package/esm/domain/tracing/sampler.js.map +1 -1
  300. package/esm/domain/tracing/skywalkingTracer.js +2 -90
  301. package/esm/domain/tracing/skywalkingTracer.js.map +1 -1
  302. package/esm/domain/tracing/traceIdentifier.js +2 -57
  303. package/esm/domain/tracing/traceIdentifier.js.map +1 -1
  304. package/esm/domain/tracing/tracer.js +2 -128
  305. package/esm/domain/tracing/tracer.js.map +1 -1
  306. package/esm/domain/tracing/w3cTraceParentTracer.js +2 -69
  307. package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -1
  308. package/esm/domain/tracing/zipkinMultiTracer.js +2 -42
  309. package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
  310. package/esm/domain/tracing/zipkinSingleTracer.js +2 -41
  311. package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
  312. package/esm/domain/trackEventCounts.js +2 -49
  313. package/esm/domain/trackEventCounts.js.map +1 -1
  314. package/esm/domain/usr/index.js +2 -38
  315. package/esm/domain/usr/index.js.map +1 -1
  316. package/esm/domain/visitorId/index.js +2 -406
  317. package/esm/domain/visitorId/index.js.map +1 -1
  318. package/esm/domain/waitPageActivityEnd.js +2 -142
  319. package/esm/domain/waitPageActivityEnd.js.map +1 -1
  320. package/esm/index.js +2 -4
  321. package/esm/index.js.map +1 -1
  322. package/esm/transport/startRumBatch.js +2 -74
  323. package/esm/transport/startRumBatch.js.map +1 -1
  324. package/esm/transport/startRumEventBridge.js +2 -9
  325. package/esm/transport/startRumEventBridge.js.map +1 -1
  326. package/esm/types/index.js +2 -1
  327. package/esm/types/index.js.map +1 -1
  328. package/esm/types/sessionReplayConstants.js +2 -46
  329. package/esm/types/sessionReplayConstants.js.map +1 -1
  330. package/package.json +8 -8
  331. package/src/boot/disabledRumPublicApi.js +5 -0
  332. package/src/boot/initCallbacks.js +16 -0
  333. package/src/boot/perStartRum.js +102 -59
  334. package/src/boot/rum.js +7 -4
  335. package/src/boot/rumPublicApi.js +6 -8
  336. package/src/boot/startRecording.js +2 -0
  337. package/src/domain/configuration.js +13 -2
  338. package/src/domain/contexts/urlContexts.js +34 -27
  339. package/src/domain/contexts/viewContexts.js +2 -2
  340. package/src/domain/deflate/deflateWorker.js +35 -21
  341. package/src/domain/privacy.js +13 -13
  342. package/src/domain/replay/record/canvasCommandCapture.js +105 -239
  343. package/src/domain/replay/record/canvasCommandObserverStub.js +11 -0
  344. package/src/domain/replay/record/canvasCommandSerializeArgs.js +2 -2
  345. package/src/domain/replay/record/canvasContext.js +32 -0
  346. package/src/domain/replay/record/canvasObserver.js +5 -1
  347. package/src/domain/replay/record/mutationObserver.js +6 -22
  348. package/src/domain/replay/record/record.js +1 -1
  349. package/src/domain/replay/record/serialize.js +24 -11
  350. package/src/domain/replay/segmentCollection/buildReplayPayload.js +24 -14
  351. package/src/domain/replay/segmentCollection/segmentCollection.js +97 -227
  352. package/src/domain/replayCanvasSupported.js +1 -0
  353. package/src/domain/requestCollection.js +39 -51
  354. package/src/domain/rumEventsCollection/actions/listenActionEvents.js +8 -2
  355. package/src/domain/rumEventsCollection/resource/fetchTimingRegistry.js +138 -0
  356. package/src/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +2 -2
  357. package/src/domain/rumEventsCollection/resource/resourceCollection.js +87 -64
  358. package/src/domain/rumEventsCollection/resource/resourceTrackerManager.js +10 -10
  359. package/src/domain/rumEventsCollection/resource/resourceUtils.js +36 -59
  360. package/src/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +8 -2
  361. package/src/domain/rumEventsCollection/view/trackViews.js +3 -0
  362. package/src/domain/tracing/skywalkingTracer.js +14 -91
  363. package/src/domain/tracing/tracer.js +28 -4
  364. package/types/index.d.ts +9 -0
@@ -1,5 +1,6 @@
1
- import { SDKMap } from '@cloudcare/browser-core'
2
- import { createCanvasCommandObjectRefRegistry } from './canvasCommandSerializeArgs'
1
+ import { isCanvasHidden } from './canvasContext'
2
+ import { noop, SDKMap } from '@cloudcare/browser-core'
3
+ import { createCanvasCommandObjectRefRegistry, isSerializedTypedArray } from './canvasCommandSerializeArgs'
3
4
  import { createCanvasMutationRecord } from './canvasMutationRecord'
4
5
 
5
6
  var CANVAS_2D_CAPTURED_METHODS = [
@@ -69,7 +70,8 @@ var CANVAS_2D_CAPTURED_PROPERTIES = [
69
70
  'filter'
70
71
  ]
71
72
 
72
- var CANVAS_2D_NON_MUTATING_METHODS = {
73
+ // Known API members are handled separately from unknown canvas mutations.
74
+ var knownCanvasMembers = {
73
75
  createImageData: true,
74
76
  getContextAttributes: true,
75
77
  getImageData: true,
@@ -80,13 +82,8 @@ var CANVAS_2D_NON_MUTATING_METHODS = {
80
82
  isPointInStroke: true,
81
83
  measureText: true
82
84
  }
83
- var CANVAS_2D_CAPTURED_METHOD_NAMES = {}
84
- var CANVAS_2D_CAPTURED_PROPERTY_NAMES = {}
85
- CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
86
- CANVAS_2D_CAPTURED_METHOD_NAMES[methodName] = true
87
- })
88
- CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
89
- CANVAS_2D_CAPTURED_PROPERTY_NAMES[propertyName] = true
85
+ CANVAS_2D_CAPTURED_METHODS.concat(CANVAS_2D_CAPTURED_PROPERTIES).forEach(function (name) {
86
+ knownCanvasMembers[name] = true
90
87
  })
91
88
 
92
89
  var UNSUPPORTED_REPLAY_OBJECT_NAMES = {
@@ -243,20 +240,6 @@ function getTypedArrayElementApproxBytes(value) {
243
240
  return 25
244
241
  }
245
242
 
246
- function isSerializedTypedArray(value) {
247
- return (
248
- value instanceof Float32Array ||
249
- value instanceof Float64Array ||
250
- value instanceof Int32Array ||
251
- value instanceof Uint32Array ||
252
- value instanceof Uint8Array ||
253
- value instanceof Uint16Array ||
254
- value instanceof Int16Array ||
255
- value instanceof Int8Array ||
256
- value instanceof Uint8ClampedArray
257
- )
258
- }
259
-
260
243
  function addTypedArrayApproxBytes(state, value) {
261
244
  var elementCount = value.length
262
245
  var perElementBytes = getTypedArrayElementApproxBytes(value)
@@ -481,7 +464,7 @@ function isUnsupportedDrawImageSource(value) {
481
464
 
482
465
  export function createCanvas2DCommandRecorder(options) {
483
466
  options = options || {}
484
- var emit = options.emit || function () {}
467
+ var emit = options.emit || noop
485
468
  var now = __BUILD_ENV__REPLAY_DEBUG_ENABLED__
486
469
  ? options.now || Date.now
487
470
  : Date.now
@@ -517,8 +500,6 @@ export function createCanvas2DCommandRecorder(options) {
517
500
  var snapshotFallbackPatchTargets = new WeakSet()
518
501
  var pendingCommandsByContext = new SDKMap()
519
502
  var pendingCommandApproxBytes = 0
520
- var fallbackModeContexts = new WeakSet()
521
- var persistentFallbackModeContexts = new WeakSet()
522
503
  var fallbackReasonByContext = new WeakMap()
523
504
  var persistentFallbackReasonByContext = new WeakMap()
524
505
  var expiredUnpublishedContexts = new WeakSet()
@@ -547,7 +528,7 @@ export function createCanvas2DCommandRecorder(options) {
547
528
  (__BUILD_ENV__REPLAY_DEBUG_ENABLED__ && options.objectRefRegistry) ||
548
529
  createCanvasCommandObjectRefRegistry()
549
530
  var onCommandOverflow = __BUILD_ENV__REPLAY_DEBUG_ENABLED__
550
- ? options.onCommandOverflow || function () {}
531
+ ? options.onCommandOverflow || noop
551
532
  : undefined
552
533
  var getCanvasId =
553
534
  options.getCanvasId ||
@@ -560,11 +541,11 @@ export function createCanvas2DCommandRecorder(options) {
560
541
  return '2D'
561
542
  }
562
543
  var requestSnapshotFallback =
563
- options.requestSnapshotFallback || function () {}
544
+ options.requestSnapshotFallback || noop
564
545
  var onContextDiscovered =
565
- options.onContextDiscovered || function () {}
546
+ options.onContextDiscovered || noop
566
547
  var onContextMutation =
567
- options.onContextMutation || function () {}
548
+ options.onContextMutation || noop
568
549
  var shouldRecordContext =
569
550
  options.shouldRecordContext ||
570
551
  function () {
@@ -616,8 +597,8 @@ export function createCanvas2DCommandRecorder(options) {
616
597
 
617
598
  function isSnapshotFallbackContext(context) {
618
599
  return (
619
- fallbackModeContexts.has(context) ||
620
- persistentFallbackModeContexts.has(context)
600
+ fallbackReasonByContext.has(context) ||
601
+ persistentFallbackReasonByContext.has(context)
621
602
  )
622
603
  }
623
604
 
@@ -656,7 +637,6 @@ export function createCanvas2DCommandRecorder(options) {
656
637
 
657
638
  function expireUnpublishedBatch(context) {
658
639
  deletePendingBatch(context)
659
- persistentFallbackModeContexts.add(context)
660
640
  expiredUnpublishedContexts.add(context)
661
641
  if (!persistentFallbackReasonByContext.has(context)) {
662
642
  persistentFallbackReasonByContext.set(
@@ -922,6 +902,10 @@ export function createCanvas2DCommandRecorder(options) {
922
902
  if (!batch) {
923
903
  return
924
904
  }
905
+ if (isCanvasHidden(context.canvas)) {
906
+ markPersistentSnapshotFallback(context, 'canvas_state_reset')
907
+ return
908
+ }
925
909
  if (isSnapshotFallbackContext(context)) {
926
910
  if (batch.fallbackDirty && !batch.fallbackSnapshotRequested) {
927
911
  requestSnapshotFallback(
@@ -1034,6 +1018,14 @@ export function createCanvas2DCommandRecorder(options) {
1034
1018
  if (!trackedContextSet.has(context)) {
1035
1019
  return false
1036
1020
  }
1021
+ if (isCanvasHidden(context.canvas)) {
1022
+ // Drawing will still change the live context while its commands are private.
1023
+ // Resume with pixels once visible, as the previous command state is stale.
1024
+ if (!persistentFallbackReasonByContext.has(context)) {
1025
+ markPersistentSnapshotFallback(context, 'canvas_state_reset')
1026
+ }
1027
+ return false
1028
+ }
1037
1029
  if (captureGenerationByContext.get(context) !== captureGeneration) {
1038
1030
  captureGenerationByContext.set(context, captureGeneration)
1039
1031
  // reset() accompanies a new replay/full-snapshot canvas baseline, but
@@ -1049,6 +1041,14 @@ export function createCanvas2DCommandRecorder(options) {
1049
1041
  return true
1050
1042
  }
1051
1043
 
1044
+ function clearContext(context) {
1045
+ trackedContextSet.delete(context)
1046
+ deletePendingBatch(context)
1047
+ expiredUnpublishedContexts.delete(context)
1048
+ fallbackReasonByContext.delete(context)
1049
+ persistentFallbackReasonByContext.delete(context)
1050
+ }
1051
+
1052
1052
  function registerTrackedContext(context, restoreFns) {
1053
1053
  if (!context || trackedContextSet.has(context)) {
1054
1054
  return false
@@ -1067,13 +1067,7 @@ export function createCanvas2DCommandRecorder(options) {
1067
1067
  trackedContexts.push({
1068
1068
  context: context,
1069
1069
  restore: function () {
1070
- trackedContextSet.delete(context)
1071
- deletePendingBatch(context)
1072
- expiredUnpublishedContexts.delete(context)
1073
- fallbackModeContexts.delete(context)
1074
- persistentFallbackModeContexts.delete(context)
1075
- fallbackReasonByContext.delete(context)
1076
- persistentFallbackReasonByContext.delete(context)
1070
+ clearContext(context)
1077
1071
  while (restoreFns.length) {
1078
1072
  restoreFns.pop()()
1079
1073
  }
@@ -1096,7 +1090,7 @@ export function createCanvas2DCommandRecorder(options) {
1096
1090
  return false
1097
1091
  }
1098
1092
  if (shouldRecordContext(context) === false) {
1099
- rejectedContextSet.add(context)
1093
+ rejectContext(context)
1100
1094
  return false
1101
1095
  }
1102
1096
  if (!registerTrackedContext(context, [])) {
@@ -1138,14 +1132,13 @@ export function createCanvas2DCommandRecorder(options) {
1138
1132
  if (!context) {
1139
1133
  return
1140
1134
  }
1135
+ // A hidden region can become visible while the same context stays alive.
1136
+ if (isCanvasHidden(context.canvas)) {
1137
+ markPersistentSnapshotFallback(context, 'canvas_state_reset')
1138
+ return
1139
+ }
1141
1140
  rejectedContextSet.add(context)
1142
- trackedContextSet.delete(context)
1143
- deletePendingBatch(context)
1144
- expiredUnpublishedContexts.delete(context)
1145
- fallbackModeContexts.delete(context)
1146
- persistentFallbackModeContexts.delete(context)
1147
- fallbackReasonByContext.delete(context)
1148
- persistentFallbackReasonByContext.delete(context)
1141
+ clearContext(context)
1149
1142
  }
1150
1143
 
1151
1144
  function enableSnapshotFallbackForContext(
@@ -1154,13 +1147,9 @@ export function createCanvas2DCommandRecorder(options) {
1154
1147
  isGlobalOverflow,
1155
1148
  persistent
1156
1149
  ) {
1157
- var fallbackContexts = persistent
1158
- ? persistentFallbackModeContexts
1159
- : fallbackModeContexts
1160
1150
  var fallbackReasons = persistent
1161
1151
  ? persistentFallbackReasonByContext
1162
1152
  : fallbackReasonByContext
1163
- fallbackContexts.add(context)
1164
1153
  if (!fallbackReasons.has(context)) {
1165
1154
  fallbackReasons.set(
1166
1155
  context,
@@ -1314,6 +1303,41 @@ export function createCanvas2DCommandRecorder(options) {
1314
1303
  }
1315
1304
  }
1316
1305
 
1306
+ function recordMutation(context, name, argsOrValue, setter, alwaysSnapshotFallback) {
1307
+ notifyContextMutation(context)
1308
+ try {
1309
+ if (isSnapshotFallbackContext(context)) {
1310
+ markSnapshotFallbackDirty(context)
1311
+ return false
1312
+ }
1313
+ if (alwaysSnapshotFallback) {
1314
+ enableSnapshotFallbackForContext(
1315
+ context,
1316
+ setter ? 'unsupported_canvas_property' : 'unsupported_canvas_method',
1317
+ false,
1318
+ true
1319
+ )
1320
+ return false
1321
+ }
1322
+ } catch (_) {
1323
+ return false
1324
+ }
1325
+
1326
+ try {
1327
+ var reason = !setter && name === 'drawImage' && isUnsupportedDrawImageSource(argsOrValue[0])
1328
+ if (reason) {
1329
+ enableSnapshotFallbackForContext(context, reason)
1330
+ } else {
1331
+ captureCommand(context, name, setter ? [argsOrValue] : argsOrValue, setter)
1332
+ }
1333
+ } catch (_) {
1334
+ try {
1335
+ enableSnapshotFallbackForContext(context, 'command_serialization_error')
1336
+ } catch (_) {}
1337
+ }
1338
+ return true
1339
+ }
1340
+
1317
1341
  function patchMethodOnTarget(
1318
1342
  target,
1319
1343
  methodName,
@@ -1328,55 +1352,9 @@ export function createCanvas2DCommandRecorder(options) {
1328
1352
  maybeTrackContext(this)
1329
1353
  var shouldCapture = shouldCaptureContext(this)
1330
1354
  var result = originalMethod.apply(this, arguments)
1331
- if (shouldCapture) {
1332
- notifyContextMutation(this)
1333
- }
1334
- if (shouldCapture && alwaysSnapshotFallback) {
1335
- try {
1336
- if (isSnapshotFallbackContext(this)) {
1337
- markSnapshotFallbackDirty(this)
1338
- } else {
1339
- enableSnapshotFallbackForContext(
1340
- this,
1341
- 'unsupported_canvas_method',
1342
- false,
1343
- true
1344
- )
1345
- }
1346
- } catch (_) {}
1347
- return result
1348
- }
1349
- if (shouldCapture && isSnapshotFallbackContext(this)) {
1350
- try {
1351
- markSnapshotFallbackDirty(this)
1352
- } catch (_) {}
1353
- return result
1354
- }
1355
- if (shouldCapture) {
1356
- try {
1357
- var drawImageFallbackReason =
1358
- methodName === 'drawImage'
1359
- ? isUnsupportedDrawImageSource(arguments[0])
1360
- : undefined
1361
- if (drawImageFallbackReason) {
1362
- enableSnapshotFallbackForContext(
1363
- this,
1364
- drawImageFallbackReason
1365
- )
1366
- } else {
1367
- captureCommand(this, methodName, arguments, false)
1368
- }
1369
- } catch (_) {
1370
- try {
1371
- enableSnapshotFallbackForContext(
1372
- this,
1373
- 'command_serialization_error'
1374
- )
1375
- } catch (_) {}
1376
- }
1377
- }
1378
1355
  if (
1379
1356
  shouldCapture &&
1357
+ recordMutation(this, methodName, arguments, false, alwaysSnapshotFallback) &&
1380
1358
  (methodName === 'createLinearGradient' ||
1381
1359
  methodName === 'createRadialGradient' ||
1382
1360
  methodName === 'createConicGradient')
@@ -1424,40 +1402,8 @@ export function createCanvas2DCommandRecorder(options) {
1424
1402
  if (originalDescriptor && originalDescriptor.set) {
1425
1403
  originalDescriptor.set.call(this, value)
1426
1404
  }
1427
- var shouldCapture = shouldCaptureContext(this)
1428
- if (shouldCapture) {
1429
- notifyContextMutation(this)
1430
- if (alwaysSnapshotFallback) {
1431
- try {
1432
- if (isSnapshotFallbackContext(this)) {
1433
- markSnapshotFallbackDirty(this)
1434
- } else {
1435
- enableSnapshotFallbackForContext(
1436
- this,
1437
- 'unsupported_canvas_property',
1438
- false,
1439
- true
1440
- )
1441
- }
1442
- } catch (_) {}
1443
- return
1444
- }
1445
- if (isSnapshotFallbackContext(this)) {
1446
- try {
1447
- markSnapshotFallbackDirty(this)
1448
- } catch (_) {}
1449
- return
1450
- }
1451
- try {
1452
- captureCommand(this, propertyName, [value], true)
1453
- } catch (_) {
1454
- try {
1455
- enableSnapshotFallbackForContext(
1456
- this,
1457
- 'command_serialization_error'
1458
- )
1459
- } catch (_) {}
1460
- }
1405
+ if (shouldCaptureContext(this)) {
1406
+ recordMutation(this, propertyName, value, true, alwaysSnapshotFallback)
1461
1407
  }
1462
1408
  }
1463
1409
  try {
@@ -1500,12 +1446,7 @@ export function createCanvas2DCommandRecorder(options) {
1500
1446
  return
1501
1447
  }
1502
1448
  propertyNames.forEach(function (propertyName) {
1503
- if (
1504
- propertyName === 'constructor' ||
1505
- CANVAS_2D_CAPTURED_METHOD_NAMES[propertyName] ||
1506
- CANVAS_2D_CAPTURED_PROPERTY_NAMES[propertyName] ||
1507
- CANVAS_2D_NON_MUTATING_METHODS[propertyName]
1508
- ) {
1449
+ if (propertyName === 'constructor' || knownCanvasMembers[propertyName]) {
1509
1450
  return
1510
1451
  }
1511
1452
  var descriptor
@@ -1546,54 +1487,6 @@ export function createCanvas2DCommandRecorder(options) {
1546
1487
  })
1547
1488
  }
1548
1489
 
1549
- function patchPrototype(context) {
1550
- var prototype = Object.getPrototypeOf(context)
1551
- if (!prototype || prototype === Object.prototype) {
1552
- return false
1553
- }
1554
- var existingRecord = patchedPrototypeRecords.find(function (record) {
1555
- return record.prototype === prototype
1556
- })
1557
- if (existingRecord) {
1558
- return true
1559
- }
1560
- if (
1561
- patchedPrototypeRecords.length >=
1562
- MAX_PATCHED_CANVAS_PROTOTYPE_RECORDS
1563
- ) {
1564
- return false
1565
- }
1566
-
1567
- var restoreFns = []
1568
- CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
1569
- if (
1570
- typeof prototype[methodName] === 'function' &&
1571
- !patchMethodOnTarget(prototype, methodName, restoreFns)
1572
- ) {
1573
- snapshotFallbackPatchTargets.add(prototype)
1574
- }
1575
- })
1576
- CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
1577
- if (
1578
- getPropertyDescriptor(prototype, propertyName) &&
1579
- !patchPropertyOnTarget(prototype, propertyName, restoreFns)
1580
- ) {
1581
- snapshotFallbackPatchTargets.add(prototype)
1582
- }
1583
- })
1584
- patchUnknownMutationsOnTarget(prototype, restoreFns)
1585
-
1586
- patchedPrototypeRecords.push({
1587
- prototype: prototype,
1588
- restore: function () {
1589
- while (restoreFns.length) {
1590
- restoreFns.pop()()
1591
- }
1592
- }
1593
- })
1594
- return true
1595
- }
1596
-
1597
1490
  function patchSharedPrototype(prototype) {
1598
1491
  if (!prototype || prototype === Object.prototype) {
1599
1492
  return false
@@ -1612,23 +1505,7 @@ export function createCanvas2DCommandRecorder(options) {
1612
1505
  }
1613
1506
 
1614
1507
  var restoreFns = []
1615
- CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
1616
- if (
1617
- typeof prototype[methodName] === 'function' &&
1618
- !patchMethodOnTarget(prototype, methodName, restoreFns)
1619
- ) {
1620
- snapshotFallbackPatchTargets.add(prototype)
1621
- }
1622
- })
1623
- CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
1624
- if (
1625
- getPropertyDescriptor(prototype, propertyName) &&
1626
- !patchPropertyOnTarget(prototype, propertyName, restoreFns)
1627
- ) {
1628
- snapshotFallbackPatchTargets.add(prototype)
1629
- }
1630
- })
1631
- patchUnknownMutationsOnTarget(prototype, restoreFns)
1508
+ patchContextTarget(prototype, restoreFns, true)
1632
1509
 
1633
1510
  patchedPrototypeRecords.push({
1634
1511
  prototype: prototype,
@@ -1641,44 +1518,47 @@ export function createCanvas2DCommandRecorder(options) {
1641
1518
  return true
1642
1519
  }
1643
1520
 
1644
- function patchContextInstance(context, restoreFns) {
1521
+ function patchContextTarget(target, restoreFns, isPrototype) {
1645
1522
  CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
1646
1523
  if (
1647
- typeof context[methodName] === 'function' &&
1648
- !patchMethodOnTarget(context, methodName, restoreFns)
1524
+ typeof target[methodName] === 'function' &&
1525
+ !patchMethodOnTarget(target, methodName, restoreFns)
1649
1526
  ) {
1650
- snapshotFallbackPatchTargets.add(context)
1527
+ snapshotFallbackPatchTargets.add(target)
1651
1528
  }
1652
1529
  })
1653
1530
 
1654
1531
  CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
1655
- if (!patchPropertyOnTarget(context, propertyName, restoreFns)) {
1656
- snapshotFallbackPatchTargets.add(context)
1532
+ if (
1533
+ (!isPrototype || getPropertyDescriptor(target, propertyName)) &&
1534
+ !patchPropertyOnTarget(target, propertyName, restoreFns)
1535
+ ) {
1536
+ snapshotFallbackPatchTargets.add(target)
1657
1537
  }
1658
1538
  })
1659
- patchUnknownMutationsOnTarget(context, restoreFns)
1539
+ patchUnknownMutationsOnTarget(target, restoreFns)
1660
1540
  }
1661
1541
 
1662
1542
  function patchContext(context) {
1663
1543
  if (stopped || !context || trackedContextSet.has(context)) {
1664
- return function () {}
1544
+ return noop
1665
1545
  }
1666
1546
 
1667
1547
  var restoreFns = []
1668
1548
  var prototype = Object.getPrototypeOf(context)
1669
1549
  if (prototype && prototype !== Object.prototype) {
1670
- if (!patchPrototype(context)) {
1671
- return function () {}
1550
+ if (!patchSharedPrototype(prototype)) {
1551
+ return noop
1672
1552
  }
1673
1553
  } else {
1674
- patchContextInstance(context, restoreFns)
1554
+ patchContextTarget(context, restoreFns, false)
1675
1555
  }
1676
1556
 
1677
1557
  if (!registerTrackedContext(context, restoreFns)) {
1678
1558
  while (restoreFns.length) {
1679
1559
  restoreFns.pop()()
1680
1560
  }
1681
- return function () {}
1561
+ return noop
1682
1562
  }
1683
1563
  if (
1684
1564
  snapshotFallbackPatchTargets.has(context) ||
@@ -1693,13 +1573,7 @@ export function createCanvas2DCommandRecorder(options) {
1693
1573
  }
1694
1574
 
1695
1575
  return function () {
1696
- trackedContextSet.delete(context)
1697
- deletePendingBatch(context)
1698
- expiredUnpublishedContexts.delete(context)
1699
- fallbackModeContexts.delete(context)
1700
- persistentFallbackModeContexts.delete(context)
1701
- fallbackReasonByContext.delete(context)
1702
- persistentFallbackReasonByContext.delete(context)
1576
+ clearContext(context)
1703
1577
  var trackedIndex = trackedContexts.findIndex(function (tracked) {
1704
1578
  return tracked.context === context
1705
1579
  })
@@ -1716,8 +1590,6 @@ export function createCanvas2DCommandRecorder(options) {
1716
1590
  scheduledFlushId = undefined
1717
1591
  }
1718
1592
  clearPendingBatches()
1719
- fallbackModeContexts = new WeakSet()
1720
- persistentFallbackModeContexts = new WeakSet()
1721
1593
  fallbackReasonByContext = new WeakMap()
1722
1594
  persistentFallbackReasonByContext = new WeakMap()
1723
1595
  expiredUnpublishedContexts = new WeakSet()
@@ -1735,34 +1607,29 @@ export function createCanvas2DCommandRecorder(options) {
1735
1607
  objectRefRegistry.reset()
1736
1608
  }
1737
1609
 
1738
- function pause() {
1739
- paused = true
1610
+ function resetPendingCapture() {
1740
1611
  if (scheduledFlushId !== undefined) {
1741
1612
  cancelAnimationFrameImpl(scheduledFlushId)
1742
1613
  scheduledFlushId = undefined
1743
1614
  }
1744
1615
  clearPendingBatches()
1745
- fallbackModeContexts = new WeakSet()
1746
1616
  fallbackReasonByContext = new WeakMap()
1747
1617
  rejectedContextSet = new WeakSet()
1748
1618
  objectRefRegistry.reset()
1749
1619
  }
1750
1620
 
1621
+ function pause() {
1622
+ paused = true
1623
+ resetPendingCapture()
1624
+ }
1625
+
1751
1626
  function resume() {
1752
1627
  paused = false
1753
1628
  }
1754
1629
 
1755
1630
  function reset() {
1756
1631
  captureGeneration += 1
1757
- if (scheduledFlushId !== undefined) {
1758
- cancelAnimationFrameImpl(scheduledFlushId)
1759
- scheduledFlushId = undefined
1760
- }
1761
- clearPendingBatches()
1762
- fallbackModeContexts = new WeakSet()
1763
- fallbackReasonByContext = new WeakMap()
1764
- rejectedContextSet = new WeakSet()
1765
- objectRefRegistry.reset()
1632
+ resetPendingCapture()
1766
1633
  }
1767
1634
 
1768
1635
  function forceSnapshotFallback(context, reason) {
@@ -1786,7 +1653,6 @@ export function createCanvas2DCommandRecorder(options) {
1786
1653
  return
1787
1654
  }
1788
1655
  expiredUnpublishedContexts.delete(context)
1789
- persistentFallbackModeContexts.add(context)
1790
1656
  if (!persistentFallbackReasonByContext.has(context)) {
1791
1657
  persistentFallbackReasonByContext.set(
1792
1658
  context,
@@ -0,0 +1,11 @@
1
+ import { noop } from '@cloudcare/browser-core'
2
+
3
+ export const replayCanvasSupported = false
4
+
5
+ export function startCanvasCommandCapture() {
6
+ return { flush: noop, reset: noop, stop: noop }
7
+ }
8
+
9
+ export function startContinuousCanvasSnapshotLoop() {
10
+ return { reset: noop, stop: noop }
11
+ }
@@ -8,7 +8,7 @@ function arrayBufferToBase64(buffer) {
8
8
  return btoa(binary)
9
9
  }
10
10
 
11
- function isTypedArray(value) {
11
+ export function isSerializedTypedArray(value) {
12
12
  return (
13
13
  value instanceof Float32Array ||
14
14
  value instanceof Float64Array ||
@@ -39,7 +39,7 @@ function serializeCanvasCommandArgWithRegistry(value, context, registry) {
39
39
  return value
40
40
  }
41
41
 
42
- if (isTypedArray(value)) {
42
+ if (isSerializedTypedArray(value)) {
43
43
  return {
44
44
  rr_type: value.constructor.name,
45
45
  args: [Array.prototype.slice.call(value)]
@@ -1,3 +1,34 @@
1
+ import { isNodeShadowRoot } from '@cloudcare/browser-core'
2
+ import {
3
+ NodePrivacyLevel,
4
+ PRIVACY_ATTR_NAME,
5
+ PRIVACY_ATTR_VALUE_HIDDEN,
6
+ PRIVACY_CLASS_HIDDEN
7
+ } from '../../../constants'
8
+ import { getNodePrivacyLevel } from './privacy'
9
+
10
+ var hiddenCanvasSelector =
11
+ `.${PRIVACY_CLASS_HIDDEN},[${PRIVACY_ATTR_NAME}="${PRIVACY_ATTR_VALUE_HIDDEN}"]`
12
+
13
+ // This runs on the drawing path. Use native ancestor matching and cross shadow
14
+ // boundaries without allocating a privacy cache for every drawing command.
15
+ export function isCanvasHidden(canvas) {
16
+ try {
17
+ var element = canvas
18
+ while (element) {
19
+ if (!element.closest || !element.getRootNode) {
20
+ return getNodePrivacyLevel(element) === NodePrivacyLevel.HIDDEN
21
+ }
22
+ if (element.closest(hiddenCanvasSelector)) return true
23
+ var root = element.getRootNode()
24
+ element = isNodeShadowRoot(root) ? root.host : null
25
+ }
26
+ return false
27
+ } catch (_) {
28
+ return true
29
+ }
30
+ }
31
+
1
32
  var contextTypeByCanvas = new WeakMap()
2
33
  var replayInternalCanvases = new WeakSet()
3
34
 
@@ -58,6 +89,7 @@ export function isWebGLReplayCanvas(canvas) {
58
89
 
59
90
  export function getReplayCanvasRecordingDecision(configuration, canvas) {
60
91
  try {
92
+ if (isCanvasHidden(canvas)) return false
61
93
  return configuration.shouldRecordCanvas
62
94
  ? configuration.shouldRecordCanvas(canvas)
63
95
  : true
@@ -13,7 +13,8 @@ import {
13
13
  isCanvasFrameBelowThreshold
14
14
  } from './canvasFrameSignature'
15
15
  import {
16
- getReplayCanvasRecordingDecision
16
+ getReplayCanvasRecordingDecision,
17
+ isCanvasHidden
17
18
  } from './canvasContext'
18
19
 
19
20
  var DEFAULT_ENCODED_DATA_URL_CACHE_MAX_CHARACTERS = 1024 * 1024
@@ -402,6 +403,9 @@ export function createCanvasObserver(options) {
402
403
  ) {
403
404
  return createSnapshotFailureResult('resized_during_snapshot')
404
405
  }
406
+ if (isCanvasHidden(canvas)) {
407
+ return createSnapshotFailureResult('rejected_by_should_record_canvas')
408
+ }
405
409
  if (!isNodeActive(canvas)) {
406
410
  return createSnapshotFailureResult('not_serialized')
407
411
  }