@screeb/rrweb 1.0.9 → 1.0.11

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/dist/rrweb.cjs CHANGED
@@ -14786,11 +14786,19 @@ function createPlayerService(context, { getCastFn, applyEventsSynchronously, emi
14786
14786
  emitter.emit(ReplayerEvents.PlayBack);
14787
14787
  }
14788
14788
  const syncEvents = new Array();
14789
+ let renderedFullSnapshot = false;
14789
14790
  for (const event of neededEvents) {
14791
+ const isFullSnapshot = event.type === EventType.FullSnapshot;
14790
14792
  if (lastPlayedTimestamp && lastPlayedTimestamp < baselineTime && (event.timestamp <= lastPlayedTimestamp || event === lastPlayedEvent)) {
14793
+ if (isFullSnapshot) {
14794
+ renderedFullSnapshot = true;
14795
+ }
14791
14796
  continue;
14792
14797
  }
14793
- if (event.timestamp < baselineTime) {
14798
+ if (event.timestamp <= baselineTime || isFullSnapshot && !renderedFullSnapshot) {
14799
+ if (isFullSnapshot) {
14800
+ renderedFullSnapshot = true;
14801
+ }
14794
14802
  syncEvents.push(event);
14795
14803
  } else {
14796
14804
  const castFn = getCastFn(event, false);
@@ -16497,7 +16505,7 @@ class Replayer {
16497
16505
  return false;
16498
16506
  };
16499
16507
  const appendNode = (mutation) => {
16500
- var _a2, _b;
16508
+ var _a2, _b, _c;
16501
16509
  if (!this.iframe.contentDocument) {
16502
16510
  return this.warn("Looks like your replayer has been destroyed.");
16503
16511
  }
@@ -16510,6 +16518,14 @@ class Replayer {
16510
16518
  }
16511
16519
  return queue.push(mutation);
16512
16520
  }
16521
+ if (mutation.node.type === NodeType.Document && ((_a2 = parent == null ? void 0 : parent.nodeName) == null ? void 0 : _a2.toLowerCase()) !== "iframe") {
16522
+ console.warn(
16523
+ "[Replayer] Skipping invalid document append to a non-iframe parent.",
16524
+ mutation,
16525
+ parent
16526
+ );
16527
+ return;
16528
+ }
16513
16529
  if (mutation.node.isShadow) {
16514
16530
  if (!hasShadowRoot(parent)) {
16515
16531
  parent.attachShadow({ mode: "open" });
@@ -16585,7 +16601,7 @@ class Replayer {
16585
16601
  }
16586
16602
  } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType.Document) {
16587
16603
  const parentDoc = parent;
16588
- if (mutation.node.type === NodeType.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
16604
+ if (mutation.node.type === NodeType.DocumentType && ((_b = parentDoc.childNodes[0]) == null ? void 0 : _b.nodeType) === Node.DOCUMENT_TYPE_NODE)
16589
16605
  parentDoc.removeChild(parentDoc.childNodes[0]);
16590
16606
  if (target.nodeName === "HTML" && parentDoc.documentElement)
16591
16607
  parentDoc.removeChild(
@@ -16603,7 +16619,7 @@ class Replayer {
16603
16619
  parent.appendChild(target);
16604
16620
  }
16605
16621
  afterAppend(target, mutation.node.id);
16606
- if (this.usingVirtualDom && target.nodeName === "#text" && parent.nodeName === "STYLE" && ((_b = parent.rules) == null ? void 0 : _b.length) > 0)
16622
+ if (this.usingVirtualDom && target.nodeName === "#text" && parent.nodeName === "STYLE" && ((_c = parent.rules) == null ? void 0 : _c.length) > 0)
16607
16623
  parent.rules = [];
16608
16624
  if (isSerializedIframe(target, this.mirror)) {
16609
16625
  const targetId = this.mirror.getId(target);