@sentry/replay 11.9.0 → 11.11.0

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/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  <p align="center">
2
2
  <a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3
- <img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
3
+ <picture>
4
+ <source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-white.png" media="(prefers-color-scheme: dark)" />
5
+ <source srcset="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" />
6
+ <img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280">
7
+ </picture>
4
8
  </a>
5
9
  </p>
6
10
 
@@ -3,6 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
3
  const core = require('@sentry/core');
4
4
  const browserUtils = require('@sentry/browser-utils');
5
5
 
6
+ const db="sentry.replay_id",kb="sentry.segment.name.source";
7
+
6
8
  const WINDOW = core.GLOBAL_OBJ;
7
9
  const REPLAY_SESSION_KEY = "sentryReplaySession";
8
10
  const REPLAY_EVENT_NAME = "replay_event";
@@ -23,8 +25,6 @@ const MIN_REPLAY_DURATION = 4999;
23
25
  const MIN_REPLAY_DURATION_LIMIT = 5e4;
24
26
  const MAX_REPLAY_DURATION = 36e5;
25
27
 
26
- const Nm="sentry.segment.name.source";
27
-
28
28
  var __defProp = Object.defineProperty;
29
29
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
30
30
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1422,6 +1422,7 @@ function snapshot(n, options) {
1422
1422
  time: true,
1423
1423
  url: true,
1424
1424
  week: true,
1425
+ hidden: true,
1425
1426
  textarea: true,
1426
1427
  select: true
1427
1428
  } : maskAllInputs === false ? {} : maskAllInputs;
@@ -2172,7 +2173,9 @@ class MutationBuffer {
2172
2173
  }
2173
2174
  };
2174
2175
  while (this.mapRemoves.length) {
2175
- this.mirror.removeNodeFromMap(this.mapRemoves.shift());
2176
+ const removedNode = this.mapRemoves.shift();
2177
+ this.mirror.removeNodeFromMap(removedNode);
2178
+ this.shadowDomManager.removeShadowRootsFor(removedNode);
2176
2179
  }
2177
2180
  for (const n2 of this.movedSet) {
2178
2181
  if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(n2.parentNode)) {
@@ -2536,6 +2539,23 @@ class MutationBuffer {
2536
2539
  this.shadowDomManager.reset();
2537
2540
  this.canvasManager.reset();
2538
2541
  }
2542
+ /**
2543
+ * Drops mirror entries for removals this buffer has not emitted yet,
2544
+ * without emitting anything. Used when the buffer's root is torn down.
2545
+ */
2546
+ release(pending) {
2547
+ pending.forEach((m) => {
2548
+ if (m.type === "childList") {
2549
+ m.removedNodes.forEach((n2) => this.mapRemoves.push(n2));
2550
+ }
2551
+ });
2552
+ while (this.mapRemoves.length) {
2553
+ const removedNode = this.mapRemoves.shift();
2554
+ if (inDom(removedNode)) continue;
2555
+ this.mirror.removeNodeFromMap(removedNode);
2556
+ this.shadowDomManager.removeShadowRootsFor(removedNode);
2557
+ }
2558
+ }
2539
2559
  }
2540
2560
  function deepDelete(addsSet, n2) {
2541
2561
  addsSet.delete(n2);
@@ -2571,6 +2591,10 @@ function _isAncestorInSet(set, n2) {
2571
2591
  return _isAncestorInSet(set, parentNode);
2572
2592
  }
2573
2593
  const mutationBuffers = [];
2594
+ function forEachMutationBuffer(cb) {
2595
+ [...mutationBuffers].forEach(cb);
2596
+ }
2597
+ const observerBuffers = /* @__PURE__ */ new WeakMap();
2574
2598
  function getEventTarget(event) {
2575
2599
  try {
2576
2600
  if ("composedPath" in event) {
@@ -2602,12 +2626,23 @@ function initMutationObserver(options, rootEl) {
2602
2626
  if (angularZoneSymbol && window[angularZoneSymbol]) {
2603
2627
  mutationObserverCtor = window[angularZoneSymbol];
2604
2628
  }
2629
+ const { onMutation, blockClass, blockSelector, unblockSelector } = options;
2630
+ const onMutationHelpers = {
2631
+ isBlocked: (node) => isBlocked(node, blockClass, blockSelector, unblockSelector, true)
2632
+ };
2605
2633
  const observer = new mutationObserverCtor(
2606
2634
  callbackWrapper((mutations) => {
2607
- if (options.onMutation && options.onMutation(mutations) === false) {
2608
- return;
2635
+ let toProcess = mutations;
2636
+ if (onMutation) {
2637
+ const result = onMutation(mutations, onMutationHelpers);
2638
+ if (result === false) {
2639
+ return;
2640
+ }
2641
+ if (Array.isArray(result)) {
2642
+ toProcess = result;
2643
+ }
2609
2644
  }
2610
- mutationBuffer.processMutations.bind(mutationBuffer)(mutations);
2645
+ mutationBuffer.processMutations(toProcess);
2611
2646
  })
2612
2647
  );
2613
2648
  observer.observe(rootEl, {
@@ -2618,8 +2653,22 @@ function initMutationObserver(options, rootEl) {
2618
2653
  childList: true,
2619
2654
  subtree: true
2620
2655
  });
2656
+ observerBuffers.set(observer, mutationBuffer);
2621
2657
  return observer;
2622
2658
  }
2659
+ function removeMutationBuffer(observer) {
2660
+ const pending = observer.takeRecords();
2661
+ observer.disconnect();
2662
+ const buffer = observerBuffers.get(observer);
2663
+ if (buffer) {
2664
+ buffer.release(pending);
2665
+ const index = mutationBuffers.indexOf(buffer);
2666
+ if (index !== -1) {
2667
+ mutationBuffers.splice(index, 1);
2668
+ }
2669
+ observerBuffers.delete(observer);
2670
+ }
2671
+ }
2623
2672
  function initMoveObserver({
2624
2673
  mousemoveCb,
2625
2674
  sampling,
@@ -3523,7 +3572,7 @@ function initObservers(o2, _hooks = {}) {
3523
3572
  );
3524
3573
  }
3525
3574
  return callbackWrapper(() => {
3526
- mutationBuffers.forEach((b) => b.reset());
3575
+ forEachMutationBuffer((b) => b.reset());
3527
3576
  mutationObserver?.disconnect();
3528
3577
  mousemoveHandler();
3529
3578
  mouseInteractionHandler();
@@ -3857,12 +3906,15 @@ class ShadowDomManagerNoop {
3857
3906
  }
3858
3907
  observeAttachShadow() {
3859
3908
  }
3909
+ removeShadowRootsFor() {
3910
+ }
3860
3911
  reset() {
3861
3912
  }
3862
3913
  }
3863
3914
  class ShadowDomManager {
3864
3915
  constructor(options) {
3865
3916
  this.shadowDoms = /* @__PURE__ */ new WeakSet();
3917
+ this.shadowRootTeardowns = /* @__PURE__ */ new Map();
3866
3918
  this.restoreHandlers = [];
3867
3919
  this.mutationCb = options.mutationCb;
3868
3920
  this.scrollCb = options.scrollCb;
@@ -3878,6 +3930,8 @@ class ShadowDomManager {
3878
3930
  if (!isNativeShadowDom(shadowRoot)) return;
3879
3931
  if (this.shadowDoms.has(shadowRoot)) return;
3880
3932
  this.shadowDoms.add(shadowRoot);
3933
+ const teardowns = [];
3934
+ this.shadowRootTeardowns.set(shadowRoot, teardowns);
3881
3935
  this.bypassOptions.canvasManager.addShadowRoot(shadowRoot);
3882
3936
  const observer = initMutationObserver(
3883
3937
  {
@@ -3889,8 +3943,8 @@ class ShadowDomManager {
3889
3943
  },
3890
3944
  shadowRoot
3891
3945
  );
3892
- this.restoreHandlers.push(() => observer.disconnect());
3893
- this.restoreHandlers.push(
3946
+ teardowns.push(() => removeMutationBuffer(observer));
3947
+ teardowns.push(
3894
3948
  initScrollObserver({
3895
3949
  ...this.bypassOptions,
3896
3950
  scrollCb: this.scrollCb,
@@ -3901,12 +3955,13 @@ class ShadowDomManager {
3901
3955
  })
3902
3956
  );
3903
3957
  setTimeout$2(() => {
3958
+ if (this.shadowRootTeardowns.get(shadowRoot) !== teardowns) return;
3904
3959
  if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length > 0)
3905
3960
  this.bypassOptions.stylesheetManager.adoptStyleSheets(
3906
3961
  shadowRoot.adoptedStyleSheets,
3907
3962
  this.mirror.getId(shadowRoot.host)
3908
3963
  );
3909
- this.restoreHandlers.push(
3964
+ teardowns.push(
3910
3965
  initAdoptedStyleSheetObserver(
3911
3966
  {
3912
3967
  mirror: this.mirror,
@@ -3917,6 +3972,31 @@ class ShadowDomManager {
3917
3972
  );
3918
3973
  }, 0);
3919
3974
  }
3975
+ /** Disconnects one shadow root and forgets it. */
3976
+ removeShadowRoot(shadowRoot) {
3977
+ const teardowns = this.shadowRootTeardowns.get(shadowRoot);
3978
+ if (teardowns) {
3979
+ teardowns.forEach((teardown) => {
3980
+ try {
3981
+ teardown();
3982
+ } catch (e2) {
3983
+ }
3984
+ });
3985
+ this.shadowRootTeardowns.delete(shadowRoot);
3986
+ }
3987
+ this.shadowDoms.delete(shadowRoot);
3988
+ }
3989
+ removeShadowRootsFor(node) {
3990
+ if (this.shadowRootTeardowns.size === 0) return;
3991
+ if (hasShadowRoot(node)) {
3992
+ const shadowRoot = node.shadowRoot;
3993
+ if (this.shadowDoms.has(shadowRoot) && !inDom(node)) {
3994
+ this.removeShadowRoot(shadowRoot);
3995
+ }
3996
+ this.removeShadowRootsFor(shadowRoot);
3997
+ }
3998
+ node.childNodes?.forEach((child) => this.removeShadowRootsFor(child));
3999
+ }
3920
4000
  /**
3921
4001
  * Monkey patch 'attachShadow' of an IFrameElement to observe newly added shadow doms.
3922
4002
  */
@@ -3961,6 +4041,15 @@ class ShadowDomManager {
3961
4041
  }
3962
4042
  });
3963
4043
  this.restoreHandlers = [];
4044
+ this.shadowRootTeardowns.forEach((teardowns) => {
4045
+ teardowns.forEach((teardown) => {
4046
+ try {
4047
+ teardown();
4048
+ } catch (e2) {
4049
+ }
4050
+ });
4051
+ });
4052
+ this.shadowRootTeardowns = /* @__PURE__ */ new Map();
3964
4053
  this.shadowDoms = /* @__PURE__ */ new WeakSet();
3965
4054
  this.bypassOptions.canvasManager.resetShadowRoots();
3966
4055
  }
@@ -4137,6 +4226,7 @@ function record(options = {}) {
4137
4226
  time: true,
4138
4227
  url: true,
4139
4228
  week: true,
4229
+ hidden: true,
4140
4230
  textarea: true,
4141
4231
  select: true,
4142
4232
  radio: true,
@@ -4157,8 +4247,9 @@ function record(options = {}) {
4157
4247
  headMetaDescKeywords: _slimDOMOptions === "all"
4158
4248
  } : _slimDOMOptions ? _slimDOMOptions : {};
4159
4249
  polyfill();
4160
- let lastFullSnapshotEvent;
4250
+ let lastFullSnapshotTimestamp = 0;
4161
4251
  let incrementalSnapshotCount = 0;
4252
+ let failedSnapshotCount = 0;
4162
4253
  const eventProcessor = (e2) => {
4163
4254
  for (const plugin of plugins || []) {
4164
4255
  if (plugin.eventProcessor) {
@@ -4175,7 +4266,7 @@ function record(options = {}) {
4175
4266
  const e2 = r2;
4176
4267
  e2.timestamp = nowTimestamp();
4177
4268
  if (mutationBuffers[0]?.isFrozen() && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
4178
- mutationBuffers.forEach((buf) => buf.unfreeze());
4269
+ forEachMutationBuffer((buf) => buf.unfreeze());
4179
4270
  }
4180
4271
  if (inEmittingFrame) {
4181
4272
  emit?.(eventProcessor(e2), isCheckout);
@@ -4189,15 +4280,16 @@ function record(options = {}) {
4189
4280
  window.parent.postMessage(message, "*");
4190
4281
  }
4191
4282
  if (e2.type === EventType.FullSnapshot) {
4192
- lastFullSnapshotEvent = e2;
4283
+ lastFullSnapshotTimestamp = e2.timestamp;
4193
4284
  incrementalSnapshotCount = 0;
4285
+ failedSnapshotCount = 0;
4194
4286
  } else if (e2.type === EventType.IncrementalSnapshot) {
4195
4287
  if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) {
4196
4288
  return;
4197
4289
  }
4198
4290
  incrementalSnapshotCount++;
4199
4291
  const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
4200
- const exceedTime = checkoutEveryNms && lastFullSnapshotEvent && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
4292
+ const exceedTime = checkoutEveryNms && lastFullSnapshotTimestamp && e2.timestamp - lastFullSnapshotTimestamp > checkoutEveryNms;
4201
4293
  if (exceedCount || exceedTime) {
4202
4294
  takeFullSnapshot2(true);
4203
4295
  }
@@ -4324,80 +4416,96 @@ function record(options = {}) {
4324
4416
  );
4325
4417
  stylesheetManager.reset();
4326
4418
  shadowDomManager.init();
4327
- mutationBuffers.forEach((buf) => buf.lock());
4328
- const node = snapshot(document, {
4329
- mirror,
4330
- blockClass,
4331
- blockSelector,
4332
- unblockSelector,
4333
- maskAllText,
4334
- maskTextClass,
4335
- unmaskTextClass,
4336
- maskTextSelector,
4337
- unmaskTextSelector,
4338
- inlineStylesheet,
4339
- maskAllInputs: maskInputOptions,
4340
- maskAttributeFn,
4341
- maskInputFn,
4342
- maskTextFn,
4343
- slimDOM: slimDOMOptions,
4344
- dataURLOptions,
4345
- recordCanvas,
4346
- inlineImages,
4347
- onSerialize: (n2) => {
4348
- if (isSerializedIframe(n2, mirror)) {
4349
- iframeManager.addIframe(n2);
4350
- }
4351
- if (isSerializedStylesheet(n2, mirror)) {
4352
- stylesheetManager.trackLinkElement(n2);
4353
- }
4354
- if (hasShadowRoot(n2)) {
4355
- shadowDomManager.addShadowRoot(n2.shadowRoot, document);
4356
- }
4357
- },
4358
- onIframeLoad: (iframe, childSn) => {
4359
- iframeManager.attachIframe(iframe, childSn);
4360
- const contentWindow = getIFrameContentWindow(iframe);
4361
- if (contentWindow) {
4362
- canvasManager.addWindow(contentWindow);
4363
- }
4364
- shadowDomManager.observeAttachShadow(iframe);
4365
- },
4366
- onStylesheetLoad: (linkEl, childSn) => {
4367
- stylesheetManager.attachLinkElement(linkEl, childSn);
4368
- },
4369
- onBlockedImageLoad: (_imageEl, serializedNode, { width, height }) => {
4370
- wrappedMutationEmit({
4371
- adds: [],
4372
- removes: [],
4373
- texts: [],
4374
- attributes: [
4375
- {
4376
- id: serializedNode.id,
4377
- attributes: {
4378
- style: {
4379
- width: `${width}px`,
4380
- height: `${height}px`
4419
+ forEachMutationBuffer((buf) => buf.lock());
4420
+ let snapshotEmitted = false;
4421
+ try {
4422
+ const node = snapshot(document, {
4423
+ mirror,
4424
+ blockClass,
4425
+ blockSelector,
4426
+ unblockSelector,
4427
+ maskAllText,
4428
+ maskTextClass,
4429
+ unmaskTextClass,
4430
+ maskTextSelector,
4431
+ unmaskTextSelector,
4432
+ inlineStylesheet,
4433
+ maskAllInputs: maskInputOptions,
4434
+ maskAttributeFn,
4435
+ maskInputFn,
4436
+ maskTextFn,
4437
+ slimDOM: slimDOMOptions,
4438
+ dataURLOptions,
4439
+ recordCanvas,
4440
+ inlineImages,
4441
+ onSerialize: (n2) => {
4442
+ if (isSerializedIframe(n2, mirror)) {
4443
+ iframeManager.addIframe(n2);
4444
+ }
4445
+ if (isSerializedStylesheet(n2, mirror)) {
4446
+ stylesheetManager.trackLinkElement(n2);
4447
+ }
4448
+ if (hasShadowRoot(n2)) {
4449
+ shadowDomManager.addShadowRoot(n2.shadowRoot, document);
4450
+ }
4451
+ },
4452
+ onIframeLoad: (iframe, childSn) => {
4453
+ iframeManager.attachIframe(iframe, childSn);
4454
+ const contentWindow = getIFrameContentWindow(iframe);
4455
+ if (contentWindow) {
4456
+ canvasManager.addWindow(contentWindow);
4457
+ }
4458
+ shadowDomManager.observeAttachShadow(iframe);
4459
+ },
4460
+ onStylesheetLoad: (linkEl, childSn) => {
4461
+ stylesheetManager.attachLinkElement(linkEl, childSn);
4462
+ },
4463
+ onBlockedImageLoad: (_imageEl, serializedNode, { width, height }) => {
4464
+ wrappedMutationEmit({
4465
+ adds: [],
4466
+ removes: [],
4467
+ texts: [],
4468
+ attributes: [
4469
+ {
4470
+ id: serializedNode.id,
4471
+ attributes: {
4472
+ style: {
4473
+ width: `${width}px`,
4474
+ height: `${height}px`
4475
+ }
4381
4476
  }
4382
4477
  }
4383
- }
4384
- ]
4385
- });
4386
- },
4387
- keepIframeSrcFn,
4388
- ignoreCSSAttributes
4389
- });
4390
- if (!node) {
4391
- return console.warn("Failed to snapshot the document");
4392
- }
4393
- wrappedEmit({
4394
- type: EventType.FullSnapshot,
4395
- data: {
4396
- node,
4397
- initialOffset: getWindowScroll(window)
4478
+ ]
4479
+ });
4480
+ },
4481
+ keepIframeSrcFn,
4482
+ ignoreCSSAttributes
4483
+ });
4484
+ if (!node) {
4485
+ return console.warn("Failed to snapshot the document");
4398
4486
  }
4399
- });
4400
- mutationBuffers.forEach((buf) => buf.unlock());
4487
+ wrappedEmit({
4488
+ type: EventType.FullSnapshot,
4489
+ data: {
4490
+ node,
4491
+ initialOffset: getWindowScroll(window)
4492
+ }
4493
+ });
4494
+ snapshotEmitted = true;
4495
+ } finally {
4496
+ if (!snapshotEmitted) {
4497
+ failedSnapshotCount++;
4498
+ if (checkoutEveryNms) {
4499
+ const retryDelay = Math.min(
4500
+ 1e3 * 2 ** (failedSnapshotCount - 1),
4501
+ checkoutEveryNms
4502
+ );
4503
+ lastFullSnapshotTimestamp = nowTimestamp() - checkoutEveryNms + retryDelay;
4504
+ }
4505
+ incrementalSnapshotCount = 0;
4506
+ }
4507
+ forEachMutationBuffer((buf) => buf.unlock());
4508
+ }
4401
4509
  if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
4402
4510
  stylesheetManager.adoptStyleSheets(
4403
4511
  document.adoptedStyleSheets,
@@ -4783,10 +4891,10 @@ class ClickDetector {
4783
4891
  const timedOutClicks = [];
4784
4892
  const now = nowInSeconds();
4785
4893
  this._clicks.forEach((click) => {
4786
- if (!click.mutationAfter && this._lastMutation) {
4894
+ if (click.mutationAfter === void 0 && this._lastMutation) {
4787
4895
  click.mutationAfter = click.timestamp <= this._lastMutation ? this._lastMutation - click.timestamp : void 0;
4788
4896
  }
4789
- if (!click.scrollAfter && this._lastScroll) {
4897
+ if (click.scrollAfter === void 0 && this._lastScroll) {
4790
4898
  click.scrollAfter = click.timestamp <= this._lastScroll ? this._lastScroll - click.timestamp : void 0;
4791
4899
  }
4792
4900
  if (click.timestamp + this._timeout <= now) {
@@ -4807,8 +4915,8 @@ class ClickDetector {
4807
4915
  /** Generate matching breadcrumb(s) for the click. */
4808
4916
  _generateBreadcrumbs(click) {
4809
4917
  const replay = this._replay;
4810
- const hadScroll = click.scrollAfter && click.scrollAfter <= this._scrollTimeout;
4811
- const hadMutation = click.mutationAfter && click.mutationAfter <= this._threshold;
4918
+ const hadScroll = click.scrollAfter !== void 0 && click.scrollAfter <= this._scrollTimeout;
4919
+ const hadMutation = click.mutationAfter !== void 0 && click.mutationAfter <= this._threshold;
4812
4920
  const isSlowClick = !hadScroll && !hadMutation;
4813
4921
  const { clickCount, clickBreadcrumb } = click;
4814
4922
  if (isSlowClick) {
@@ -4964,7 +5072,7 @@ const handleDomListener = (replay) => {
4964
5072
  if (!replay.isEnabled()) {
4965
5073
  return;
4966
5074
  }
4967
- const result = handleDom(handlerData);
5075
+ const result = handleDom(handlerData, replay.getMaskAttributeFn());
4968
5076
  if (!result) {
4969
5077
  return;
4970
5078
  }
@@ -4994,20 +5102,20 @@ function getBaseDomBreadcrumb(target, message) {
4994
5102
  } : {}
4995
5103
  };
4996
5104
  }
4997
- function handleDom(handlerData) {
4998
- const { target, message } = getDomTarget(handlerData);
5105
+ function handleDom(handlerData, maskAttributeFn) {
5106
+ const { target, message } = getDomTarget(handlerData, maskAttributeFn);
4999
5107
  return createBreadcrumb({
5000
5108
  category: `ui.${handlerData.name}`,
5001
5109
  ...getBaseDomBreadcrumb(target, message)
5002
5110
  });
5003
5111
  }
5004
- function getDomTarget(handlerData) {
5112
+ function getDomTarget(handlerData, maskAttributeFn) {
5005
5113
  const isClick = handlerData.name === "click";
5006
5114
  let message;
5007
5115
  let target = null;
5008
5116
  try {
5009
5117
  target = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event);
5010
- message = browserUtils.htmlTreeAsString(target, { maxStringLength: 200 }) || "<unknown>";
5118
+ message = browserUtils.htmlTreeAsString(target, { maxStringLength: 200, maskAttributeFn }) || "<unknown>";
5011
5119
  } catch {
5012
5120
  message = "<unknown>";
5013
5121
  }
@@ -5022,13 +5130,13 @@ function handleKeyboardEvent(replay, event) {
5022
5130
  return;
5023
5131
  }
5024
5132
  replay.updateUserActivity();
5025
- const breadcrumb = getKeyboardBreadcrumb(event);
5133
+ const breadcrumb = getKeyboardBreadcrumb(event, replay.getMaskAttributeFn());
5026
5134
  if (!breadcrumb) {
5027
5135
  return;
5028
5136
  }
5029
5137
  addBreadcrumbEvent(replay, breadcrumb);
5030
5138
  }
5031
- function getKeyboardBreadcrumb(event) {
5139
+ function getKeyboardBreadcrumb(event, maskAttributeFn) {
5032
5140
  const { metaKey, shiftKey, ctrlKey, altKey, key, target } = event;
5033
5141
  if (!target || isInputElement(target) || !key) {
5034
5142
  return null;
@@ -5038,7 +5146,7 @@ function getKeyboardBreadcrumb(event) {
5038
5146
  if (!hasModifierKey && isCharacterKey) {
5039
5147
  return null;
5040
5148
  }
5041
- const message = browserUtils.htmlTreeAsString(target, { maxStringLength: 200 }) || "<unknown>";
5149
+ const message = browserUtils.htmlTreeAsString(target, { maxStringLength: 200, maskAttributeFn }) || "<unknown>";
5042
5150
  const baseBreadcrumb = getBaseDomBreadcrumb(target, message);
5043
5151
  return createBreadcrumb({
5044
5152
  category: "ui.keyDown",
@@ -6156,6 +6264,9 @@ function shouldSampleForBufferEvent(replay, event) {
6156
6264
  if (!event.exception || event.type) {
6157
6265
  return false;
6158
6266
  }
6267
+ if (event.sdkProcessingMetadata?.hasDefaultSyntheticStacktrace) {
6268
+ return false;
6269
+ }
6159
6270
  return isSampled(replay.getOptions().errorSampleRate);
6160
6271
  }
6161
6272
 
@@ -7346,6 +7457,9 @@ class ReplayContainer {
7346
7457
  getOptions() {
7347
7458
  return this._options;
7348
7459
  }
7460
+ getMaskAttributeFn() {
7461
+ return this._recordingOptions.maskAttributeFn;
7462
+ }
7349
7463
  /** A wrapper to conditionally capture exceptions. */
7350
7464
  handleException(error) {
7351
7465
  DEBUG_BUILD && debug.exception(error);
@@ -7736,7 +7850,7 @@ class ReplayContainer {
7736
7850
  return void 0;
7737
7851
  }
7738
7852
  const spanJson = core.spanToJSON(lastRootSpan);
7739
- const source = spanJson.attributes[Nm];
7853
+ const source = spanJson.attributes[kb];
7740
7854
  if (!source || !["route", "custom"].includes(source)) {
7741
7855
  return void 0;
7742
7856
  }
@@ -8417,7 +8531,7 @@ class Replay {
8417
8531
  processSpan(span) {
8418
8532
  const replayId = this.getReplayId(true);
8419
8533
  if (replayId) {
8420
- core.safeSetSpanJSONAttributes(span, { "sentry.replay_id": replayId });
8534
+ core.safeSetSpanJSONAttributes(span, { [db]: replayId });
8421
8535
  if (this.getRecordingMode() === "buffer") {
8422
8536
  core.safeSetSpanJSONAttributes(span, { "sentry._internal.replay_is_buffering": true });
8423
8537
  }