@screeb/rrweb 1.0.9 → 1.0.12

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