From 2c20ad19e98d6f718fa56dec9eb9dc32d237b71e Mon Sep 17 00:00:00 2001 From: David Newell Date: Mon, 22 Apr 2024 16:17:33 +0100 Subject: [PATCH 1/4] upgrade rrweb to alpha-13 --- package.json | 10 +- patches/rrweb@2.0.0-alpha.11.patch | 1202 ---------------------------- patches/rrweb@2.0.0-alpha.12.patch | 251 ------ pnpm-lock.yaml | 46 +- 4 files changed, 24 insertions(+), 1485 deletions(-) delete mode 100644 patches/rrweb@2.0.0-alpha.11.patch delete mode 100644 patches/rrweb@2.0.0-alpha.12.patch diff --git a/package.json b/package.json index e28c78354..e6319afda 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", - "@rrweb/types": "2.0.0-alpha.12", + "@rrweb/types": "2.0.0-alpha.13", "@sentry/types": "7.37.2", "@testing-library/dom": "^9.3.0", "@types/eslint": "^8.44.6", @@ -88,8 +88,8 @@ "rollup": "^4.9.6", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-visualizer": "^5.12.0", - "rrweb": "2.0.0-alpha.12", - "rrweb-snapshot": "2.0.0-alpha.12", + "rrweb": "2.0.0-alpha.13", + "rrweb-snapshot": "2.0.0-alpha.13", "sinon": "9.0.2", "testcafe": "1.19.0", "testcafe-browser-provider-browserstack": "1.14.0", @@ -109,8 +109,6 @@ "> 0.5%, last 2 versions, Firefox ESR, not dead, IE 11" ], "pnpm": { - "patchedDependencies": { - "rrweb@2.0.0-alpha.12": "patches/rrweb@2.0.0-alpha.12.patch" - } + "patchedDependencies": {} } } diff --git a/patches/rrweb@2.0.0-alpha.11.patch b/patches/rrweb@2.0.0-alpha.11.patch deleted file mode 100644 index 2bb5ab4fd..000000000 --- a/patches/rrweb@2.0.0-alpha.11.patch +++ /dev/null @@ -1,1202 +0,0 @@ -diff --git a/es/rrweb/packages/rrweb/src/record/mutation.js b/es/rrweb/packages/rrweb/src/record/mutation.js -index 81ad4520d1435d088752a85f9a55a68ad6e0f514..e19dec6cc98ea782d53328853ca1b46d96e129f7 100644 ---- a/es/rrweb/packages/rrweb/src/record/mutation.js -+++ b/es/rrweb/packages/rrweb/src/record/mutation.js -@@ -1,563 +1,607 @@ --import { isShadowRoot, isNativeShadowDom, getInputType, maskInputValue, ignoreAttribute, transformAttribute, toLowerCase, needMaskingText, IGNORED_NODE, serializeNodeWithId } from '../../../rrweb-snapshot/es/rrweb-snapshot.js'; --import { isIgnored, isBlocked, isSerialized, isAncestorRemoved, hasShadowRoot, inDom, getShadowHost, isSerializedIframe, isSerializedStylesheet } from '../utils.js'; -+import { -+ isShadowRoot, -+ isNativeShadowDom, -+ getInputType, -+ maskInputValue, -+ ignoreAttribute, -+ transformAttribute, -+ toLowerCase, -+ needMaskingText, -+ IGNORED_NODE, -+ serializeNodeWithId, -+} from "../../../rrweb-snapshot/es/rrweb-snapshot.js"; -+import { -+ isIgnored, -+ isBlocked, -+ isSerialized, -+ isAncestorRemoved, -+ hasShadowRoot, -+ inDom, -+ getShadowHost, -+ isSerializedIframe, -+ isSerializedStylesheet, -+} from "../utils.js"; - - function isNodeInLinkedList(n) { -- return '__ln' in n; -+ return "__ln" in n; - } - class DoubleLinkedList { -- constructor() { -- this.length = 0; -- this.head = null; -+ constructor() { -+ this.length = 0; -+ this.head = null; -+ this.tail = null; -+ } -+ get(position) { -+ if (position >= this.length) { -+ throw new Error("Position outside of list range"); -+ } -+ let current = this.head; -+ for (let index = 0; index < position; index++) { -+ current = -+ (current === null || current === void 0 ? void 0 : current.next) || -+ null; -+ } -+ return current; -+ } -+ addNode(n) { -+ const node = { -+ value: n, -+ previous: null, -+ next: null, -+ }; -+ n.__ln = node; -+ if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) { -+ const current = n.previousSibling.__ln.next; -+ node.next = current; -+ node.previous = n.previousSibling.__ln; -+ n.previousSibling.__ln.next = node; -+ if (current) { -+ current.previous = node; -+ } -+ } else if ( -+ n.nextSibling && -+ isNodeInLinkedList(n.nextSibling) && -+ n.nextSibling.__ln.previous -+ ) { -+ const current = n.nextSibling.__ln.previous; -+ node.previous = current; -+ node.next = n.nextSibling.__ln; -+ n.nextSibling.__ln.previous = node; -+ if (current) { -+ current.next = node; -+ } -+ } else { -+ if (this.head) { -+ this.head.previous = node; -+ } -+ node.next = this.head; -+ this.head = node; -+ } -+ if (node.next === null) { -+ this.tail = node; -+ } -+ this.length++; -+ } -+ removeNode(n) { -+ const current = n.__ln; -+ if (!this.head) { -+ return; -+ } -+ if (!current.previous) { -+ this.head = current.next; -+ if (this.head) { -+ this.head.previous = null; -+ } else { - this.tail = null; -+ } -+ } else { -+ current.previous.next = current.next; -+ if (current.next) { -+ current.next.previous = current.previous; -+ } else { -+ this.tail = current.previous; -+ } - } -- get(position) { -- if (position >= this.length) { -- throw new Error('Position outside of list range'); -+ if (n.__ln) { -+ delete n.__ln; -+ } -+ this.length--; -+ } -+} -+const moveKey = (id, parentId) => `${id}@${parentId}`; -+class MutationBuffer { -+ constructor() { -+ this.frozen = false; -+ this.locked = false; -+ this.texts = []; -+ this.attributes = []; -+ this.removes = []; -+ this.mapRemoves = []; -+ this.movedMap = {}; -+ this.addedSet = new Set(); -+ this.movedSet = new Set(); -+ this.droppedSet = new Set(); -+ this.unattachedDoc = null; -+ this.processMutations = (mutations) => { -+ mutations.forEach(this.processMutation); -+ this.emit(); -+ }; -+ this.emit = () => { -+ if (this.frozen || this.locked) { -+ return; -+ } -+ const adds = []; -+ const addedIds = new Set(); -+ const addList = new DoubleLinkedList(); -+ const getNextId = (n) => { -+ let ns = n; -+ let nextId = IGNORED_NODE; -+ while (nextId === IGNORED_NODE) { -+ ns = ns && ns.nextSibling; -+ nextId = ns && this.mirror.getId(ns); - } -- let current = this.head; -- for (let index = 0; index < position; index++) { -- current = (current === null || current === void 0 ? void 0 : current.next) || null; -+ return nextId; -+ }; -+ const pushAdd = (n) => { -+ if (!n.parentNode || !inDom(n)) { -+ return; - } -- return current; -- } -- addNode(n) { -- const node = { -- value: n, -- previous: null, -- next: null, -- }; -- n.__ln = node; -- if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) { -- const current = n.previousSibling.__ln.next; -- node.next = current; -- node.previous = n.previousSibling.__ln; -- n.previousSibling.__ln.next = node; -- if (current) { -- current.previous = node; -- } -+ const parentId = isShadowRoot(n.parentNode) -+ ? this.mirror.getId(getShadowHost(n)) -+ : this.mirror.getId(n.parentNode); -+ const nextId = getNextId(n); -+ if (parentId === -1 || nextId === -1) { -+ return addList.addNode(n); - } -- else if (n.nextSibling && -- isNodeInLinkedList(n.nextSibling) && -- n.nextSibling.__ln.previous) { -- const current = n.nextSibling.__ln.previous; -- node.previous = current; -- node.next = n.nextSibling.__ln; -- n.nextSibling.__ln.previous = node; -- if (current) { -- current.next = node; -+ const sn = serializeNodeWithId(n, { -+ doc: this.doc, -+ mirror: this.mirror, -+ blockClass: this.blockClass, -+ blockSelector: this.blockSelector, -+ maskTextClass: this.maskTextClass, -+ maskTextSelector: this.maskTextSelector, -+ skipChild: true, -+ newlyAddedElement: true, -+ inlineStylesheet: this.inlineStylesheet, -+ maskInputOptions: this.maskInputOptions, -+ maskTextFn: this.maskTextFn, -+ maskInputFn: this.maskInputFn, -+ slimDOMOptions: this.slimDOMOptions, -+ dataURLOptions: this.dataURLOptions, -+ recordCanvas: this.recordCanvas, -+ inlineImages: this.inlineImages, -+ onSerialize: (currentN) => { -+ if (isSerializedIframe(currentN, this.mirror)) { -+ this.iframeManager.addIframe(currentN); - } -- } -- else { -- if (this.head) { -- this.head.previous = node; -+ if (isSerializedStylesheet(currentN, this.mirror)) { -+ this.stylesheetManager.trackLinkElement(currentN); -+ } -+ if (hasShadowRoot(n)) { -+ this.shadowDomManager.addShadowRoot(n.shadowRoot, this.doc); - } -- node.next = this.head; -- this.head = node; -+ }, -+ onIframeLoad: (iframe, childSn) => { -+ this.iframeManager.attachIframe(iframe, childSn); -+ this.shadowDomManager.observeAttachShadow(iframe); -+ }, -+ onStylesheetLoad: (link, childSn) => { -+ this.stylesheetManager.attachLinkElement(link, childSn); -+ }, -+ }); -+ if (sn) { -+ adds.push({ -+ parentId, -+ nextId, -+ node: sn, -+ }); -+ addedIds.add(sn.id); - } -- if (node.next === null) { -- this.tail = node; -+ }; -+ while (this.mapRemoves.length) { -+ this.mirror.removeNodeFromMap(this.mapRemoves.shift()); -+ } -+ for (const n of this.movedSet) { -+ if ( -+ isParentRemoved(this.removes, n, this.mirror) && -+ !this.movedSet.has(n.parentNode) -+ ) { -+ continue; - } -- this.length++; -- } -- removeNode(n) { -- const current = n.__ln; -- if (!this.head) { -- return; -+ pushAdd(n); -+ } -+ for (const n of this.addedSet) { -+ if ( -+ !isAncestorInSet(this.droppedSet, n) && -+ !isParentRemoved(this.removes, n, this.mirror) -+ ) { -+ pushAdd(n); -+ } else if (isAncestorInSet(this.movedSet, n)) { -+ pushAdd(n); -+ } else { -+ this.droppedSet.add(n); - } -- if (!current.previous) { -- this.head = current.next; -- if (this.head) { -- this.head.previous = null; -- } -- else { -- this.tail = null; -- } -+ } -+ let candidate = null; -+ while (addList.length) { -+ let node = null; -+ if (candidate) { -+ const parentId = this.mirror.getId(candidate.value.parentNode); -+ const nextId = getNextId(candidate.value); -+ if (parentId !== -1 && nextId !== -1) { -+ node = candidate; -+ } - } -- else { -- current.previous.next = current.next; -- if (current.next) { -- current.next.previous = current.previous; -- } -- else { -- this.tail = current.previous; -+ if (!node) { -+ let tailNode = addList.tail; -+ while (tailNode) { -+ const _node = tailNode; -+ tailNode = tailNode.previous; -+ if (_node) { -+ const parentId = this.mirror.getId(_node.value.parentNode); -+ const nextId = getNextId(_node.value); -+ if (nextId === -1) continue; -+ else if (parentId !== -1) { -+ node = _node; -+ break; -+ } else { -+ const unhandledNode = _node.value; -+ if ( -+ unhandledNode.parentNode && -+ unhandledNode.parentNode.nodeType === -+ Node.DOCUMENT_FRAGMENT_NODE -+ ) { -+ const shadowHost = unhandledNode.parentNode.host; -+ const parentId = this.mirror.getId(shadowHost); -+ if (parentId !== -1) { -+ node = _node; -+ break; -+ } -+ } -+ } - } -+ } - } -- if (n.__ln) { -- delete n.__ln; -+ if (!node) { -+ while (addList.head) { -+ addList.removeNode(addList.head.value); -+ } -+ break; - } -- this.length--; -- } --} --const moveKey = (id, parentId) => `${id}@${parentId}`; --class MutationBuffer { -- constructor() { -- this.frozen = false; -- this.locked = false; -- this.texts = []; -- this.attributes = []; -- this.removes = []; -- this.mapRemoves = []; -- this.movedMap = {}; -- this.addedSet = new Set(); -- this.movedSet = new Set(); -- this.droppedSet = new Set(); -- this.processMutations = (mutations) => { -- mutations.forEach(this.processMutation); -- this.emit(); -- }; -- this.emit = () => { -- if (this.frozen || this.locked) { -- return; -- } -- const adds = []; -- const addedIds = new Set(); -- const addList = new DoubleLinkedList(); -- const getNextId = (n) => { -- let ns = n; -- let nextId = IGNORED_NODE; -- while (nextId === IGNORED_NODE) { -- ns = ns && ns.nextSibling; -- nextId = ns && this.mirror.getId(ns); -- } -- return nextId; -- }; -- const pushAdd = (n) => { -- if (!n.parentNode || !inDom(n)) { -- return; -- } -- const parentId = isShadowRoot(n.parentNode) -- ? this.mirror.getId(getShadowHost(n)) -- : this.mirror.getId(n.parentNode); -- const nextId = getNextId(n); -- if (parentId === -1 || nextId === -1) { -- return addList.addNode(n); -- } -- const sn = serializeNodeWithId(n, { -- doc: this.doc, -- mirror: this.mirror, -- blockClass: this.blockClass, -- blockSelector: this.blockSelector, -- maskTextClass: this.maskTextClass, -- maskTextSelector: this.maskTextSelector, -- skipChild: true, -- newlyAddedElement: true, -- inlineStylesheet: this.inlineStylesheet, -- maskInputOptions: this.maskInputOptions, -- maskTextFn: this.maskTextFn, -- maskInputFn: this.maskInputFn, -- slimDOMOptions: this.slimDOMOptions, -- dataURLOptions: this.dataURLOptions, -- recordCanvas: this.recordCanvas, -- inlineImages: this.inlineImages, -- onSerialize: (currentN) => { -- if (isSerializedIframe(currentN, this.mirror)) { -- this.iframeManager.addIframe(currentN); -- } -- if (isSerializedStylesheet(currentN, this.mirror)) { -- this.stylesheetManager.trackLinkElement(currentN); -- } -- if (hasShadowRoot(n)) { -- this.shadowDomManager.addShadowRoot(n.shadowRoot, this.doc); -- } -- }, -- onIframeLoad: (iframe, childSn) => { -- this.iframeManager.attachIframe(iframe, childSn); -- this.shadowDomManager.observeAttachShadow(iframe); -- }, -- onStylesheetLoad: (link, childSn) => { -- this.stylesheetManager.attachLinkElement(link, childSn); -- }, -- }); -- if (sn) { -- adds.push({ -- parentId, -- nextId, -- node: sn, -- }); -- addedIds.add(sn.id); -- } -- }; -- while (this.mapRemoves.length) { -- this.mirror.removeNodeFromMap(this.mapRemoves.shift()); -- } -- for (const n of this.movedSet) { -- if (isParentRemoved(this.removes, n, this.mirror) && -- !this.movedSet.has(n.parentNode)) { -- continue; -- } -- pushAdd(n); -- } -- for (const n of this.addedSet) { -- if (!isAncestorInSet(this.droppedSet, n) && -- !isParentRemoved(this.removes, n, this.mirror)) { -- pushAdd(n); -- } -- else if (isAncestorInSet(this.movedSet, n)) { -- pushAdd(n); -- } -- else { -- this.droppedSet.add(n); -- } -- } -- let candidate = null; -- while (addList.length) { -- let node = null; -- if (candidate) { -- const parentId = this.mirror.getId(candidate.value.parentNode); -- const nextId = getNextId(candidate.value); -- if (parentId !== -1 && nextId !== -1) { -- node = candidate; -- } -- } -- if (!node) { -- let tailNode = addList.tail; -- while (tailNode) { -- const _node = tailNode; -- tailNode = tailNode.previous; -- if (_node) { -- const parentId = this.mirror.getId(_node.value.parentNode); -- const nextId = getNextId(_node.value); -- if (nextId === -1) -- continue; -- else if (parentId !== -1) { -- node = _node; -- break; -- } -- else { -- const unhandledNode = _node.value; -- if (unhandledNode.parentNode && -- unhandledNode.parentNode.nodeType === -- Node.DOCUMENT_FRAGMENT_NODE) { -- const shadowHost = unhandledNode.parentNode -- .host; -- const parentId = this.mirror.getId(shadowHost); -- if (parentId !== -1) { -- node = _node; -- break; -- } -- } -- } -- } -- } -+ candidate = node.previous; -+ addList.removeNode(node.value); -+ pushAdd(node.value); -+ } -+ const payload = { -+ texts: this.texts -+ .map((text) => ({ -+ id: this.mirror.getId(text.node), -+ value: text.value, -+ })) -+ .filter((text) => !addedIds.has(text.id)) -+ .filter((text) => this.mirror.has(text.id)), -+ attributes: this.attributes -+ .map((attribute) => { -+ const { attributes } = attribute; -+ if (typeof attributes.style === "string") { -+ const diffAsStr = JSON.stringify(attribute.styleDiff); -+ const unchangedAsStr = JSON.stringify(attribute._unchangedStyles); -+ if (diffAsStr.length < attributes.style.length) { -+ if ( -+ (diffAsStr + unchangedAsStr).split("var(").length === -+ attributes.style.split("var(").length -+ ) { -+ attributes.style = attribute.styleDiff; - } -- if (!node) { -- while (addList.head) { -- addList.removeNode(addList.head.value); -- } -- break; -- } -- candidate = node.previous; -- addList.removeNode(node.value); -- pushAdd(node.value); -+ } - } -- const payload = { -- texts: this.texts -- .map((text) => ({ -- id: this.mirror.getId(text.node), -- value: text.value, -- })) -- .filter((text) => !addedIds.has(text.id)) -- .filter((text) => this.mirror.has(text.id)), -- attributes: this.attributes -- .map((attribute) => { -- const { attributes } = attribute; -- if (typeof attributes.style === 'string') { -- const diffAsStr = JSON.stringify(attribute.styleDiff); -- const unchangedAsStr = JSON.stringify(attribute._unchangedStyles); -- if (diffAsStr.length < attributes.style.length) { -- if ((diffAsStr + unchangedAsStr).split('var(').length === -- attributes.style.split('var(').length) { -- attributes.style = attribute.styleDiff; -- } -- } -- } -- return { -- id: this.mirror.getId(attribute.node), -- attributes: attributes, -- }; -- }) -- .filter((attribute) => !addedIds.has(attribute.id)) -- .filter((attribute) => this.mirror.has(attribute.id)), -- removes: this.removes, -- adds, -+ return { -+ id: this.mirror.getId(attribute.node), -+ attributes: attributes, - }; -- if (!payload.texts.length && -- !payload.attributes.length && -- !payload.removes.length && -- !payload.adds.length) { -- return; -- } -- this.texts = []; -- this.attributes = []; -- this.removes = []; -- this.addedSet = new Set(); -- this.movedSet = new Set(); -- this.droppedSet = new Set(); -- this.movedMap = {}; -- this.mutationCb(payload); -- }; -- this.processMutation = (m) => { -- if (isIgnored(m.target, this.mirror)) { -- return; -- } -- let unattachedDoc; -- try { -- unattachedDoc = document.implementation.createHTMLDocument(); -- } -- catch (e) { -- unattachedDoc = this.doc; -- } -- switch (m.type) { -- case 'characterData': { -- const value = m.target.textContent; -- if (!isBlocked(m.target, this.blockClass, this.blockSelector, false) && -- value !== m.oldValue) { -- this.texts.push({ -- value: needMaskingText(m.target, this.maskTextClass, this.maskTextSelector) && value -- ? this.maskTextFn -- ? this.maskTextFn(value) -- : value.replace(/[\S]/g, '*') -- : value, -- node: m.target, -- }); -- } -- break; -- } -- case 'attributes': { -- const target = m.target; -- let attributeName = m.attributeName; -- let value = m.target.getAttribute(attributeName); -- if (attributeName === 'value') { -- const type = getInputType(target); -- value = maskInputValue({ -- element: target, -- maskInputOptions: this.maskInputOptions, -- tagName: target.tagName, -- type, -- value, -- maskInputFn: this.maskInputFn, -- }); -- } -- if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || -- value === m.oldValue) { -- return; -- } -- let item = this.attributes.find((a) => a.node === m.target); -- if (target.tagName === 'IFRAME' && -- attributeName === 'src' && -- !this.keepIframeSrcFn(value)) { -- if (!target.contentDocument) { -- attributeName = 'rr_src'; -- } -- else { -- return; -- } -- } -- if (!item) { -- item = { -- node: m.target, -- attributes: {}, -- styleDiff: {}, -- _unchangedStyles: {}, -- }; -- this.attributes.push(item); -- } -- if (attributeName === 'type' && -- target.tagName === 'INPUT' && -- (m.oldValue || '').toLowerCase() === 'password') { -- target.setAttribute('data-rr-is-password', 'true'); -- } -- if (!ignoreAttribute(target.tagName, attributeName)) { -- item.attributes[attributeName] = transformAttribute(this.doc, toLowerCase(target.tagName), toLowerCase(attributeName), value); -- if (attributeName === 'style') { -- const old = unattachedDoc.createElement('span'); -- if (m.oldValue) { -- old.setAttribute('style', m.oldValue); -- } -- for (const pname of Array.from(target.style)) { -- const newValue = target.style.getPropertyValue(pname); -- const newPriority = target.style.getPropertyPriority(pname); -- if (newValue !== old.style.getPropertyValue(pname) || -- newPriority !== old.style.getPropertyPriority(pname)) { -- if (newPriority === '') { -- item.styleDiff[pname] = newValue; -- } -- else { -- item.styleDiff[pname] = [newValue, newPriority]; -- } -- } -- else { -- item._unchangedStyles[pname] = [newValue, newPriority]; -- } -- } -- for (const pname of Array.from(old.style)) { -- if (target.style.getPropertyValue(pname) === '') { -- item.styleDiff[pname] = false; -- } -- } -- } -- } -- break; -- } -- case 'childList': { -- if (isBlocked(m.target, this.blockClass, this.blockSelector, true)) -- return; -- m.addedNodes.forEach((n) => this.genAdds(n, m.target)); -- m.removedNodes.forEach((n) => { -- const nodeId = this.mirror.getId(n); -- const parentId = isShadowRoot(m.target) -- ? this.mirror.getId(m.target.host) -- : this.mirror.getId(m.target); -- if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || -- isIgnored(n, this.mirror) || -- !isSerialized(n, this.mirror)) { -- return; -- } -- if (this.addedSet.has(n)) { -- deepDelete(this.addedSet, n); -- this.droppedSet.add(n); -- } -- else if (this.addedSet.has(m.target) && nodeId === -1) ; -- else if (isAncestorRemoved(m.target, this.mirror)) ; -- else if (this.movedSet.has(n) && -- this.movedMap[moveKey(nodeId, parentId)]) { -- deepDelete(this.movedSet, n); -- } -- else { -- this.removes.push({ -- parentId, -- id: nodeId, -- isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) -- ? true -- : undefined, -- }); -- } -- this.mapRemoves.push(n); -- }); -- break; -- } -+ }) -+ .filter((attribute) => !addedIds.has(attribute.id)) -+ .filter((attribute) => this.mirror.has(attribute.id)), -+ removes: this.removes, -+ adds, -+ }; -+ if ( -+ !payload.texts.length && -+ !payload.attributes.length && -+ !payload.removes.length && -+ !payload.adds.length -+ ) { -+ return; -+ } -+ this.texts = []; -+ this.attributes = []; -+ this.removes = []; -+ this.addedSet = new Set(); -+ this.movedSet = new Set(); -+ this.droppedSet = new Set(); -+ this.movedMap = {}; -+ this.mutationCb(payload); -+ }; -+ this.processMutation = (m) => { -+ if (isIgnored(m.target, this.mirror)) { -+ return; -+ } -+ switch (m.type) { -+ case "characterData": { -+ const value = m.target.textContent; -+ if ( -+ !isBlocked(m.target, this.blockClass, this.blockSelector, false) && -+ value !== m.oldValue -+ ) { -+ this.texts.push({ -+ value: -+ needMaskingText( -+ m.target, -+ this.maskTextClass, -+ this.maskTextSelector -+ ) && value -+ ? this.maskTextFn -+ ? this.maskTextFn(value) -+ : value.replace(/[\S]/g, "*") -+ : value, -+ node: m.target, -+ }); -+ } -+ break; -+ } -+ case "attributes": { -+ const target = m.target; -+ let attributeName = m.attributeName; -+ let value = m.target.getAttribute(attributeName); -+ if (attributeName === "value") { -+ const type = getInputType(target); -+ value = maskInputValue({ -+ element: target, -+ maskInputOptions: this.maskInputOptions, -+ tagName: target.tagName, -+ type, -+ value, -+ maskInputFn: this.maskInputFn, -+ }); -+ } -+ if ( -+ isBlocked(m.target, this.blockClass, this.blockSelector, false) || -+ value === m.oldValue -+ ) { -+ return; -+ } -+ let item = this.attributes.find((a) => a.node === m.target); -+ if ( -+ target.tagName === "IFRAME" && -+ attributeName === "src" && -+ !this.keepIframeSrcFn(value) -+ ) { -+ if (!target.contentDocument) { -+ attributeName = "rr_src"; -+ } else { -+ return; - } -- }; -- this.genAdds = (n, target) => { -- if (this.processedNodeManager.inOtherBuffer(n, this)) -- return; -- if (this.addedSet.has(n) || this.movedSet.has(n)) -- return; -- if (this.mirror.hasNode(n)) { -- if (isIgnored(n, this.mirror)) { -- return; -+ } -+ if (!item) { -+ item = { -+ node: m.target, -+ attributes: {}, -+ styleDiff: {}, -+ _unchangedStyles: {}, -+ }; -+ this.attributes.push(item); -+ } -+ if ( -+ attributeName === "type" && -+ target.tagName === "INPUT" && -+ (m.oldValue || "").toLowerCase() === "password" -+ ) { -+ target.setAttribute("data-rr-is-password", "true"); -+ } -+ if (!ignoreAttribute(target.tagName, attributeName)) { -+ item.attributes[attributeName] = transformAttribute( -+ this.doc, -+ toLowerCase(target.tagName), -+ toLowerCase(attributeName), -+ value -+ ); -+ if (attributeName === "style") { -+ if (!this.unattachedDoc) { -+ try { -+ // avoid upsetting original document from a Content Security point of view -+ this.unattachedDoc = -+ document.implementation.createHTMLDocument(); -+ } catch (e) { -+ // fallback to more direct method -+ this.unattachedDoc = this.doc; - } -- this.movedSet.add(n); -- let targetId = null; -- if (target && this.mirror.hasNode(target)) { -- targetId = this.mirror.getId(target); -+ } -+ const old = this.unattachedDoc.createElement("span"); -+ if (m.oldValue) { -+ old.setAttribute("style", m.oldValue); -+ } -+ for (const pname of Array.from(target.style)) { -+ const newValue = target.style.getPropertyValue(pname); -+ const newPriority = target.style.getPropertyPriority(pname); -+ if ( -+ newValue !== old.style.getPropertyValue(pname) || -+ newPriority !== old.style.getPropertyPriority(pname) -+ ) { -+ if (newPriority === "") { -+ item.styleDiff[pname] = newValue; -+ } else { -+ item.styleDiff[pname] = [newValue, newPriority]; -+ } -+ } else { -+ item._unchangedStyles[pname] = [newValue, newPriority]; - } -- if (targetId && targetId !== -1) { -- this.movedMap[moveKey(this.mirror.getId(n), targetId)] = true; -+ } -+ for (const pname of Array.from(old.style)) { -+ if (target.style.getPropertyValue(pname) === "") { -+ item.styleDiff[pname] = false; - } -+ } - } -- else { -- this.addedSet.add(n); -- this.droppedSet.delete(n); -+ } -+ break; -+ } -+ case "childList": { -+ if (isBlocked(m.target, this.blockClass, this.blockSelector, true)) -+ return; -+ m.addedNodes.forEach((n) => this.genAdds(n, m.target)); -+ m.removedNodes.forEach((n) => { -+ const nodeId = this.mirror.getId(n); -+ const parentId = isShadowRoot(m.target) -+ ? this.mirror.getId(m.target.host) -+ : this.mirror.getId(m.target); -+ if ( -+ isBlocked(m.target, this.blockClass, this.blockSelector, false) || -+ isIgnored(n, this.mirror) || -+ !isSerialized(n, this.mirror) -+ ) { -+ return; - } -- if (!isBlocked(n, this.blockClass, this.blockSelector, false)) { -- n.childNodes.forEach((childN) => this.genAdds(childN)); -- if (hasShadowRoot(n)) { -- n.shadowRoot.childNodes.forEach((childN) => { -- this.processedNodeManager.add(childN, this); -- this.genAdds(childN, n); -- }); -- } -+ if (this.addedSet.has(n)) { -+ deepDelete(this.addedSet, n); -+ this.droppedSet.add(n); -+ } else if (this.addedSet.has(m.target) && nodeId === -1); -+ else if (isAncestorRemoved(m.target, this.mirror)); -+ else if ( -+ this.movedSet.has(n) && -+ this.movedMap[moveKey(nodeId, parentId)] -+ ) { -+ deepDelete(this.movedSet, n); -+ } else { -+ this.removes.push({ -+ parentId, -+ id: nodeId, -+ isShadow: -+ isShadowRoot(m.target) && isNativeShadowDom(m.target) -+ ? true -+ : undefined, -+ }); - } -- }; -- } -- init(options) { -- [ -- 'mutationCb', -- 'blockClass', -- 'blockSelector', -- 'maskTextClass', -- 'maskTextSelector', -- 'inlineStylesheet', -- 'maskInputOptions', -- 'maskTextFn', -- 'maskInputFn', -- 'keepIframeSrcFn', -- 'recordCanvas', -- 'inlineImages', -- 'slimDOMOptions', -- 'dataURLOptions', -- 'doc', -- 'mirror', -- 'iframeManager', -- 'stylesheetManager', -- 'shadowDomManager', -- 'canvasManager', -- 'processedNodeManager', -- ].forEach((key) => { -- this[key] = options[key]; -- }); -- } -- freeze() { -- this.frozen = true; -- this.canvasManager.freeze(); -- } -- unfreeze() { -- this.frozen = false; -- this.canvasManager.unfreeze(); -- this.emit(); -- } -- isFrozen() { -- return this.frozen; -- } -- lock() { -- this.locked = true; -- this.canvasManager.lock(); -- } -- unlock() { -- this.locked = false; -- this.canvasManager.unlock(); -- this.emit(); -- } -- reset() { -- this.shadowDomManager.reset(); -- this.canvasManager.reset(); -- } -+ this.mapRemoves.push(n); -+ }); -+ break; -+ } -+ } -+ }; -+ this.genAdds = (n, target) => { -+ if (this.processedNodeManager.inOtherBuffer(n, this)) return; -+ if (this.addedSet.has(n) || this.movedSet.has(n)) return; -+ if (this.mirror.hasNode(n)) { -+ if (isIgnored(n, this.mirror)) { -+ return; -+ } -+ this.movedSet.add(n); -+ let targetId = null; -+ if (target && this.mirror.hasNode(target)) { -+ targetId = this.mirror.getId(target); -+ } -+ if (targetId && targetId !== -1) { -+ this.movedMap[moveKey(this.mirror.getId(n), targetId)] = true; -+ } -+ } else { -+ this.addedSet.add(n); -+ this.droppedSet.delete(n); -+ } -+ if (!isBlocked(n, this.blockClass, this.blockSelector, false)) { -+ n.childNodes.forEach((childN) => this.genAdds(childN)); -+ if (hasShadowRoot(n)) { -+ n.shadowRoot.childNodes.forEach((childN) => { -+ this.processedNodeManager.add(childN, this); -+ this.genAdds(childN, n); -+ }); -+ } -+ } -+ }; -+ } -+ init(options) { -+ [ -+ "mutationCb", -+ "blockClass", -+ "blockSelector", -+ "maskTextClass", -+ "maskTextSelector", -+ "inlineStylesheet", -+ "maskInputOptions", -+ "maskTextFn", -+ "maskInputFn", -+ "keepIframeSrcFn", -+ "recordCanvas", -+ "inlineImages", -+ "slimDOMOptions", -+ "dataURLOptions", -+ "doc", -+ "mirror", -+ "iframeManager", -+ "stylesheetManager", -+ "shadowDomManager", -+ "canvasManager", -+ "processedNodeManager", -+ ].forEach((key) => { -+ this[key] = options[key]; -+ }); -+ } -+ freeze() { -+ this.frozen = true; -+ this.canvasManager.freeze(); -+ } -+ unfreeze() { -+ this.frozen = false; -+ this.canvasManager.unfreeze(); -+ this.emit(); -+ } -+ isFrozen() { -+ return this.frozen; -+ } -+ lock() { -+ this.locked = true; -+ this.canvasManager.lock(); -+ } -+ unlock() { -+ this.locked = false; -+ this.canvasManager.unlock(); -+ this.emit(); -+ } -+ reset() { -+ this.shadowDomManager.reset(); -+ this.canvasManager.reset(); -+ } - } - function deepDelete(addsSet, n) { -- addsSet.delete(n); -- n.childNodes.forEach((childN) => deepDelete(addsSet, childN)); -+ addsSet.delete(n); -+ n.childNodes.forEach((childN) => deepDelete(addsSet, childN)); - } - function isParentRemoved(removes, n, mirror) { -- if (removes.length === 0) -- return false; -- return _isParentRemoved(removes, n, mirror); -+ if (removes.length === 0) return false; -+ return _isParentRemoved(removes, n, mirror); - } - function _isParentRemoved(removes, n, mirror) { -- const { parentNode } = n; -- if (!parentNode) { -- return false; -- } -- const parentId = mirror.getId(parentNode); -- if (removes.some((r) => r.id === parentId)) { -- return true; -- } -- return _isParentRemoved(removes, parentNode, mirror); -+ const { parentNode } = n; -+ if (!parentNode) { -+ return false; -+ } -+ const parentId = mirror.getId(parentNode); -+ if (removes.some((r) => r.id === parentId)) { -+ return true; -+ } -+ return _isParentRemoved(removes, parentNode, mirror); - } - function isAncestorInSet(set, n) { -- if (set.size === 0) -- return false; -- return _isAncestorInSet(set, n); -+ if (set.size === 0) return false; -+ return _isAncestorInSet(set, n); - } - function _isAncestorInSet(set, n) { -- const { parentNode } = n; -- if (!parentNode) { -- return false; -- } -- if (set.has(parentNode)) { -- return true; -- } -- return _isAncestorInSet(set, parentNode); -+ const { parentNode } = n; -+ if (!parentNode) { -+ return false; -+ } -+ if (set.has(parentNode)) { -+ return true; -+ } -+ return _isAncestorInSet(set, parentNode); - } - - export { MutationBuffer as default }; -diff --git a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -index 8746997c9b849ac5c952fdbe0a8dd608d6680a3a..1d9bdac62dff11370df08ee7b4a6ce75ce594eb5 100644 ---- a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -+++ b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -@@ -91,11 +91,22 @@ class CanvasManager { - let rafId; - const getCanvas = () => { - const matchedCanvas = []; -- win.document.querySelectorAll('canvas').forEach((canvas) => { -- if (!isBlocked(canvas, blockClass, blockSelector, true)) { -- matchedCanvas.push(canvas); -- } -- }); -+ -+ const searchCanvas = (root) => { -+ root.querySelectorAll('canvas').forEach((canvas) => { -+ if (!isBlocked(canvas, blockClass, blockSelector, true)) { -+ matchedCanvas.push(canvas); -+ } -+ }); -+ root.querySelectorAll('*').forEach((elem) => { -+ if (elem.shadowRoot) { -+ searchCanvas(elem.shadowRoot); -+ } -+ }); -+ }; -+ -+ searchCanvas(win.document); -+ - return matchedCanvas; - }; - const takeCanvasSnapshots = (timestamp) => { -@@ -111,6 +122,12 @@ class CanvasManager { - const id = this.mirror.getId(canvas); - if (snapshotInProgressMap.get(id)) - return; -+ -+ // The browser throws if the canvas is 0 in size -+ // Uncaught (in promise) DOMException: Failed to execute 'createImageBitmap' on 'Window': The source image width is 0. -+ // Assuming the same happens with height -+ if (canvas.width === 0 || canvas.height === 0) return; -+ - snapshotInProgressMap.set(id, true); - if (['webgl', 'webgl2'].includes(canvas.__context)) { - const context = canvas.getContext(canvas.__context); -@@ -118,12 +135,19 @@ class CanvasManager { - context.clear(context.COLOR_BUFFER_BIT); - } - } -- const bitmap = yield createImageBitmap(canvas); -+ -+ const width = canvas.clientWidth; -+ const height = canvas.clientHeight; -+ -+ const bitmap = yield createImageBitmap(canvas, { -+ resizeWidth: width, -+ resizeHeight: height -+ }) - worker.postMessage({ - id, - bitmap, -- width: canvas.width, -- height: canvas.height, -+ width: width, -+ height: height, - dataURLOptions: options.dataURLOptions, - }, [bitmap]); - })); diff --git a/patches/rrweb@2.0.0-alpha.12.patch b/patches/rrweb@2.0.0-alpha.12.patch deleted file mode 100644 index 81d2ad4d3..000000000 --- a/patches/rrweb@2.0.0-alpha.12.patch +++ /dev/null @@ -1,251 +0,0 @@ -diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js -new file mode 100644 -index 0000000000000000000000000000000000000000..aac399768d59f83e7dd7af272cdec8a4c90da236 ---- /dev/null -+++ b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js -@@ -0,0 +1,31 @@ -+function decodeBase64(base64, enableUnicode) { -+ var binaryString = atob(base64); -+ if (enableUnicode) { -+ var binaryView = new Uint8Array(binaryString.length); -+ for (var i = 0, n = binaryString.length; i < n; ++i) { -+ binaryView[i] = binaryString.charCodeAt(i); -+ } -+ return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer)); -+ } -+ return binaryString; -+} -+ -+function createURL(base64, sourcemapArg, enableUnicodeArg) { -+ var sourcemap = sourcemapArg === undefined ? null : sourcemapArg; -+ var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg; -+ var source = decodeBase64(base64, enableUnicode); -+ var start = source.indexOf('\n', 10) + 1; -+ var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : ''); -+ var blob = new Blob([body], { type: 'application/javascript' }); -+ return URL.createObjectURL(blob); -+} -+ -+function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) { -+ var url; -+ return function WorkerFactory(options) { -+ url = url || createURL(base64, sourcemapArg, enableUnicodeArg); -+ return new Worker(url, options); -+ }; -+} -+ -+export { createBase64WorkerFactory }; -diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js -deleted file mode 100644 -index b39a7674a500ec96f95aa70dde959901bb964de7..0000000000000000000000000000000000000000 -diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__funcToSource.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__funcToSource.js -deleted file mode 100644 -index a0b4e51fb7adeb3b615ad1d8876520779c8af2b1..0000000000000000000000000000000000000000 -diff --git a/es/rrweb/_virtual/image-bitmap-data-url-worker.js b/es/rrweb/_virtual/image-bitmap-data-url-worker.js -index ea868845c4fad3276aa8e5f74abfd3568b466d11..965505de44975e718d431a4e9a62e753e4842158 100644 ---- a/es/rrweb/_virtual/image-bitmap-data-url-worker.js -+++ b/es/rrweb/_virtual/image-bitmap-data-url-worker.js -@@ -1,120 +1,6 @@ --import { createInlineWorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js'; -+import { createBase64WorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js'; - --var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader */function () { --(function () { -- '__worker_loader_strict__'; -- -- /*! ***************************************************************************** -- Copyright (c) Microsoft Corporation. -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. -- ***************************************************************************** */ -- -- function __awaiter(thisArg, _arguments, P, generator) { -- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } -- return new (P || (P = Promise))(function (resolve, reject) { -- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } -- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } -- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } -- step((generator = generator.apply(thisArg, _arguments || [])).next()); -- }); -- } -- -- /* -- * base64-arraybuffer 1.0.1 -- * Copyright (c) 2021 Niklas von Hertzen -- * Released under MIT License -- */ -- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -- // Use a lookup table to find the index. -- var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); -- for (var i = 0; i < chars.length; i++) { -- lookup[chars.charCodeAt(i)] = i; -- } -- var encode = function (arraybuffer) { -- var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = ''; -- for (i = 0; i < len; i += 3) { -- base64 += chars[bytes[i] >> 2]; -- base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; -- base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; -- base64 += chars[bytes[i + 2] & 63]; -- } -- if (len % 3 === 2) { -- base64 = base64.substring(0, base64.length - 1) + '='; -- } -- else if (len % 3 === 1) { -- base64 = base64.substring(0, base64.length - 2) + '=='; -- } -- return base64; -- }; -- -- const lastBlobMap = new Map(); -- const transparentBlobMap = new Map(); -- function getTransparentBlobFor(width, height, dataURLOptions) { -- return __awaiter(this, void 0, void 0, function* () { -- const id = `${width}-${height}`; -- if ('OffscreenCanvas' in globalThis) { -- if (transparentBlobMap.has(id)) -- return transparentBlobMap.get(id); -- const offscreen = new OffscreenCanvas(width, height); -- offscreen.getContext('2d'); -- const blob = yield offscreen.convertToBlob(dataURLOptions); -- const arrayBuffer = yield blob.arrayBuffer(); -- const base64 = encode(arrayBuffer); -- transparentBlobMap.set(id, base64); -- return base64; -- } -- else { -- return ''; -- } -- }); -- } -- const worker = self; -- worker.onmessage = function (e) { -- return __awaiter(this, void 0, void 0, function* () { -- if ('OffscreenCanvas' in globalThis) { -- const { id, bitmap, width, height, dataURLOptions } = e.data; -- const transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions); -- const offscreen = new OffscreenCanvas(width, height); -- const ctx = offscreen.getContext('2d'); -- ctx.drawImage(bitmap, 0, 0); -- bitmap.close(); -- const blob = yield offscreen.convertToBlob(dataURLOptions); -- const type = blob.type; -- const arrayBuffer = yield blob.arrayBuffer(); -- const base64 = encode(arrayBuffer); -- if (!lastBlobMap.has(id) && (yield transparentBase64) === base64) { -- lastBlobMap.set(id, base64); -- return worker.postMessage({ id }); -- } -- if (lastBlobMap.get(id) === base64) -- return worker.postMessage({ id }); -- worker.postMessage({ -- id, -- type, -- base64, -- width, -- height, -- }); -- lastBlobMap.set(id, base64); -- } -- else { -- return worker.postMessage({ id: e.data.id }); -- } -- }); -- }; -- --})(); --}, null); -+var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ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WlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false); - /* eslint-enable */ - - export { WorkerFactory as default }; -diff --git a/es/rrweb/packages/rrweb/src/record/mutation.js b/es/rrweb/packages/rrweb/src/record/mutation.js -index 60c42d46a7ee8f5c6f23a7538c7db726bdf17096..d02b140ddacc923579f1ccf89590962b5ded2179 100644 ---- a/es/rrweb/packages/rrweb/src/record/mutation.js -+++ b/es/rrweb/packages/rrweb/src/record/mutation.js -@@ -257,7 +257,7 @@ class MutationBuffer { - texts: this.texts - .map((text) => { - const n = text.node; -- if (n.parentNode.tagName === 'TEXTAREA') { -+ if (n.parentNode && n.parentNode.tagName === 'TEXTAREA') { - this.genTextAreaValueMutation(n.parentNode); - } - return { -diff --git a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -index 8746997c9b849ac5c952fdbe0a8dd608d6680a3a..b7e0ee4b2a9d144fb86b60515e41ce9cc8adcd31 100644 ---- a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -+++ b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -@@ -91,11 +91,21 @@ class CanvasManager { - let rafId; - const getCanvas = () => { - const matchedCanvas = []; -- win.document.querySelectorAll('canvas').forEach((canvas) => { -- if (!isBlocked(canvas, blockClass, blockSelector, true)) { -- matchedCanvas.push(canvas); -- } -- }); -+ const searchCanvas = (root) => { -+ root.querySelectorAll('canvas').forEach((canvas) => { -+ if (!isBlocked(canvas, blockClass, blockSelector, true)) { -+ matchedCanvas.push(canvas); -+ } -+ }); -+ root.querySelectorAll('*').forEach((elem) => { -+ if (elem.shadowRoot) { -+ searchCanvas(elem.shadowRoot); -+ } -+ }); -+ }; -+ -+ searchCanvas(win.document); -+ - return matchedCanvas; - }; - const takeCanvasSnapshots = (timestamp) => { -@@ -111,6 +121,12 @@ class CanvasManager { - const id = this.mirror.getId(canvas); - if (snapshotInProgressMap.get(id)) - return; -+ -+ // The browser throws if the canvas is 0 in size -+ // Uncaught (in promise) DOMException: Failed to execute 'createImageBitmap' on 'Window': The source image width is 0. -+ // Assuming the same happens with height -+ if (canvas.width === 0 || canvas.height === 0) return; -+ - snapshotInProgressMap.set(id, true); - if (['webgl', 'webgl2'].includes(canvas.__context)) { - const context = canvas.getContext(canvas.__context); -@@ -118,12 +134,20 @@ class CanvasManager { - context.clear(context.COLOR_BUFFER_BIT); - } - } -- const bitmap = yield createImageBitmap(canvas); -+ -+ const width = canvas.clientWidth; -+ const height = canvas.clientHeight; -+ -+ const bitmap = yield createImageBitmap(canvas, { -+ resizeWidth: width, -+ resizeHeight: height -+ }) -+ - worker.postMessage({ - id, - bitmap, -- width: canvas.width, -- height: canvas.height, -+ width: width, -+ height: height, - dataURLOptions: options.dataURLOptions, - }, [bitmap]); - })); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a011a5f8c..6fc9c624f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,14 +1,9 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false -patchedDependencies: - rrweb@2.0.0-alpha.12: - hash: tvatazbysybcdte3poiroo42za - path: patches/rrweb@2.0.0-alpha.12.patch - dependencies: fflate: specifier: ^0.4.8 @@ -49,8 +44,8 @@ devDependencies: specifier: ^11.1.6 version: 11.1.6(rollup@4.9.6)(tslib@2.5.0)(typescript@4.9.5) '@rrweb/types': - specifier: 2.0.0-alpha.12 - version: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 + version: 2.0.0-alpha.13 '@sentry/types': specifier: 7.37.2 version: 7.37.2 @@ -172,11 +167,11 @@ devDependencies: specifier: ^5.12.0 version: 5.12.0(rollup@4.9.6) rrweb: - specifier: 2.0.0-alpha.12 - version: 2.0.0-alpha.12(patch_hash=tvatazbysybcdte3poiroo42za) + specifier: 2.0.0-alpha.13 + version: 2.0.0-alpha.13 rrweb-snapshot: - specifier: 2.0.0-alpha.12 - version: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 + version: 2.0.0-alpha.13 sinon: specifier: 9.0.2 version: 9.0.2 @@ -2652,10 +2647,10 @@ packages: dev: true optional: true - /@rrweb/types@2.0.0-alpha.12: - resolution: {integrity: sha512-dHFMvVBA9JD8MBV+waHtJs8lIeTPCVeT3h+WZ5s8a+EX42TQ08t+ObFMK0OYEszvWgJMJ5WZi5lXTvF46P27Hg==} + /@rrweb/types@2.0.0-alpha.13: + resolution: {integrity: sha512-ytq+MeVm/vP2ybw+gTAN3Xvt7HN2yS+wlbfnwHpQMftxrwzq0kEZHdw+Jp5WUvvpONWzXriNAUU9dW0qLGkzNg==} dependencies: - rrweb-snapshot: 2.0.0-alpha.12 + rrweb-snapshot: 2.0.0-alpha.13 dev: true /@sentry/types@7.37.2: @@ -9192,29 +9187,28 @@ packages: fsevents: 2.3.3 dev: true - /rrdom@2.0.0-alpha.12: - resolution: {integrity: sha512-xdl51tE/ruN+zO0iEalEyyaQtbb4lb2HLULA6ug/zyApQjIVevaDc3BJnyXbDhd0eYgY9flBXTZ2gM64htUwHQ==} + /rrdom@2.0.0-alpha.13: + resolution: {integrity: sha512-GJD3L2MPbIg3+VgCwwfujB4HRXyMfDdg8o3djPjSB9rMX2b52Hx2tBUmwmdnWfgWKtYGDJ2wVX9Dng3tZEBHVA==} dependencies: - rrweb-snapshot: 2.0.0-alpha.12 + rrweb-snapshot: 2.0.0-alpha.13 dev: true - /rrweb-snapshot@2.0.0-alpha.12: - resolution: {integrity: sha512-i4sz9469dbsEGFiBzCkq+7I7M+imPeC3NrKgrrdJ2tXu9H+/eegNe4SrQgCsLBeSZHZDHU0o9L5rxTAiapWbGg==} + /rrweb-snapshot@2.0.0-alpha.13: + resolution: {integrity: sha512-slbhNBCYjxLGCeH95a67ECCy5a22nloXp1F5wF7DCzUNw80FN7tF9Lef1sRGLNo32g3mNqTc2sWLATlKejMxYw==} dev: true - /rrweb@2.0.0-alpha.12(patch_hash=tvatazbysybcdte3poiroo42za): - resolution: {integrity: sha512-lUGwBV7gmbwz1dIgzo9EEayIVyxoTIF6NBF6+Jctqs4Uy45QkyARtikpQlCUfxVCGTCQ0FOee9jeVYsG39oq1g==} + /rrweb@2.0.0-alpha.13: + resolution: {integrity: sha512-a8GXOCnzWHNaVZPa7hsrLZtNZ3CGjiL+YrkpLo0TfmxGLhjNZbWY2r7pE06p+FcjFNlgUVTmFrSJbK3kO7yxvw==} dependencies: - '@rrweb/types': 2.0.0-alpha.12 + '@rrweb/types': 2.0.0-alpha.13 '@types/css-font-loading-module': 0.0.7 '@xstate/fsm': 1.5.2 base64-arraybuffer: 1.0.2 fflate: 0.4.8 mitt: 3.0.0 - rrdom: 2.0.0-alpha.12 - rrweb-snapshot: 2.0.0-alpha.12 + rrdom: 2.0.0-alpha.13 + rrweb-snapshot: 2.0.0-alpha.13 dev: true - patched: true /rsvp@4.8.5: resolution: {integrity: sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==} From 3d3584c7c03120af0b2cf55c0296011563993e89 Mon Sep 17 00:00:00 2001 From: David Newell Date: Mon, 22 Apr 2024 16:27:00 +0100 Subject: [PATCH 2/4] reapply patches --- package.json | 4 +- patches/rrweb@2.0.0-alpha.13.patch | 220 +++++++++++++++++++++++++++++ pnpm-lock.yaml | 10 +- 3 files changed, 231 insertions(+), 3 deletions(-) create mode 100644 patches/rrweb@2.0.0-alpha.13.patch diff --git a/package.json b/package.json index e6319afda..f3f70704a 100644 --- a/package.json +++ b/package.json @@ -109,6 +109,8 @@ "> 0.5%, last 2 versions, Firefox ESR, not dead, IE 11" ], "pnpm": { - "patchedDependencies": {} + "patchedDependencies": { + "rrweb@2.0.0-alpha.13": "patches/rrweb@2.0.0-alpha.13.patch" + } } } diff --git a/patches/rrweb@2.0.0-alpha.13.patch b/patches/rrweb@2.0.0-alpha.13.patch new file mode 100644 index 000000000..1d4840230 --- /dev/null +++ b/patches/rrweb@2.0.0-alpha.13.patch @@ -0,0 +1,220 @@ +diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +new file mode 100644 +index 0000000000000000000000000000000000000000..6635f9e0de57f2ea6f57af4c18ce208318eaa2e3 +--- /dev/null ++++ b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +@@ -0,0 +1,31 @@ ++function decodeBase64(base64, enableUnicode) { ++ var binaryString = atob(base64); ++ if (enableUnicode) { ++ var binaryView = new Uint8Array(binaryString.length); ++ for (var i = 0, n = binaryString.length; i < n; ++i) { ++ binaryView[i] = binaryString.charCodeAt(i); ++ } ++ return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer)); ++ } ++ return binaryString; ++} ++ ++function createURL(base64, sourcemapArg, enableUnicodeArg) { ++ var sourcemap = sourcemapArg === undefined ? null : sourcemapArg; ++ var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg; ++ var source = decodeBase64(base64, enableUnicode); ++ var start = source.indexOf('\n', 10) + 1; ++ var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : ''); ++ var blob = new Blob([body], { type: 'application/javascript' }); ++ return URL.createObjectURL(blob); ++} ++ ++function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) { ++ var url; ++ return function WorkerFactory(options) { ++ url = url || createURL(base64, sourcemapArg, enableUnicodeArg); ++ return new Worker(url, options); ++ }; ++} ++ ++export { createBase64WorkerFactory }; +\ No newline at end of file +diff --git a/es/rrweb/_virtual/image-bitmap-data-url-worker.js b/es/rrweb/_virtual/image-bitmap-data-url-worker.js +index ea868845c4fad3276aa8e5f74abfd3568b466d11..37037c253ffc6bd7468caf51a0345fcae711c390 100644 +--- a/es/rrweb/_virtual/image-bitmap-data-url-worker.js ++++ b/es/rrweb/_virtual/image-bitmap-data-url-worker.js +@@ -1,120 +1,3 @@ +-import { createInlineWorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js'; ++import { createBase64WorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js'; + +-var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader */function () { +-(function () { +- '__worker_loader_strict__'; +- +- /*! ***************************************************************************** +- Copyright (c) Microsoft Corporation. +- +- Permission to use, copy, modify, and/or distribute this software for any +- purpose with or without fee is hereby granted. +- +- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +- PERFORMANCE OF THIS SOFTWARE. +- ***************************************************************************** */ +- +- function __awaiter(thisArg, _arguments, P, generator) { +- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } +- return new (P || (P = Promise))(function (resolve, reject) { +- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } +- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } +- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } +- step((generator = generator.apply(thisArg, _arguments || [])).next()); +- }); +- } +- +- /* +- * base64-arraybuffer 1.0.1 +- * Copyright (c) 2021 Niklas von Hertzen +- * Released under MIT License +- */ +- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +- // Use a lookup table to find the index. +- var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); +- for (var i = 0; i < chars.length; i++) { +- lookup[chars.charCodeAt(i)] = i; +- } +- var encode = function (arraybuffer) { +- var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = ''; +- for (i = 0; i < len; i += 3) { +- base64 += chars[bytes[i] >> 2]; +- base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; +- base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; +- base64 += chars[bytes[i + 2] & 63]; +- } +- if (len % 3 === 2) { +- base64 = base64.substring(0, base64.length - 1) + '='; +- } +- else if (len % 3 === 1) { +- base64 = base64.substring(0, base64.length - 2) + '=='; +- } +- return base64; +- }; +- +- const lastBlobMap = new Map(); +- const transparentBlobMap = new Map(); +- function getTransparentBlobFor(width, height, dataURLOptions) { +- return __awaiter(this, void 0, void 0, function* () { +- const id = `${width}-${height}`; +- if ('OffscreenCanvas' in globalThis) { +- if (transparentBlobMap.has(id)) +- return transparentBlobMap.get(id); +- const offscreen = new OffscreenCanvas(width, height); +- offscreen.getContext('2d'); +- const blob = yield offscreen.convertToBlob(dataURLOptions); +- const arrayBuffer = yield blob.arrayBuffer(); +- const base64 = encode(arrayBuffer); +- transparentBlobMap.set(id, base64); +- return base64; +- } +- else { +- return ''; +- } +- }); +- } +- const worker = self; +- worker.onmessage = function (e) { +- return __awaiter(this, void 0, void 0, function* () { +- if ('OffscreenCanvas' in globalThis) { +- const { id, bitmap, width, height, dataURLOptions } = e.data; +- const transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions); +- const offscreen = new OffscreenCanvas(width, height); +- const ctx = offscreen.getContext('2d'); +- ctx.drawImage(bitmap, 0, 0); +- bitmap.close(); +- const blob = yield offscreen.convertToBlob(dataURLOptions); +- const type = blob.type; +- const arrayBuffer = yield blob.arrayBuffer(); +- const base64 = encode(arrayBuffer); +- if (!lastBlobMap.has(id) && (yield transparentBase64) === base64) { +- lastBlobMap.set(id, base64); +- return worker.postMessage({ id }); +- } +- if (lastBlobMap.get(id) === base64) +- return worker.postMessage({ id }); +- worker.postMessage({ +- id, +- type, +- base64, +- width, +- height, +- }); +- lastBlobMap.set(id, base64); +- } +- else { +- return worker.postMessage({ id: e.data.id }); +- } +- }); +- }; +- +-})(); +-}, null); +-/* eslint-enable */ +- +-export { WorkerFactory as default }; ++var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVE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QogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAg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gICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false); +\ No newline at end of file +diff --git a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +index da2c103fe6b1408a5996f0eb3bf047571e434cc2..abd102e81a55223a226975b54d97d69cf7ece72a 100644 +--- a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js ++++ b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +@@ -91,11 +91,21 @@ class CanvasManager { + let rafId; + const getCanvas = () => { + const matchedCanvas = []; +- win.document.querySelectorAll('canvas').forEach((canvas) => { +- if (!isBlocked(canvas, blockClass, blockSelector, true)) { +- matchedCanvas.push(canvas); +- } +- }); ++ ++ const searchCanvas = (root) => { ++ root.querySelectorAll('canvas').forEach((canvas) => { ++ if (!isBlocked(canvas, blockClass, blockSelector, true)) { ++ matchedCanvas.push(canvas); ++ } ++ }); ++ root.querySelectorAll('*').forEach((elem) => { ++ if (elem.shadowRoot) { ++ searchCanvas(elem.shadowRoot); ++ } ++ }); ++ }; ++ ++ searchCanvas(win.document); + return matchedCanvas; + }; + const takeCanvasSnapshots = (timestamp) => { +@@ -120,12 +130,19 @@ class CanvasManager { + context.clear(context.COLOR_BUFFER_BIT); + } + } +- const bitmap = yield createImageBitmap(canvas); ++ const width = canvas.clientWidth; ++ const height = canvas.clientHeight; ++ ++ const bitmap = yield createImageBitmap(canvas, { ++ resizeWidth: width, ++ resizeHeight: height ++ }) ++ + worker.postMessage({ + id, + bitmap, +- width: canvas.width, +- height: canvas.height, ++ width: width, ++ height: height, + dataURLOptions: options.dataURLOptions, + }, [bitmap]); + })); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fc9c624f..65006279a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + rrweb@2.0.0-alpha.13: + hash: 5qp7mlyswmxzmggk5sopt5qgwq + path: patches/rrweb@2.0.0-alpha.13.patch + dependencies: fflate: specifier: ^0.4.8 @@ -168,7 +173,7 @@ devDependencies: version: 5.12.0(rollup@4.9.6) rrweb: specifier: 2.0.0-alpha.13 - version: 2.0.0-alpha.13 + version: 2.0.0-alpha.13(patch_hash=5qp7mlyswmxzmggk5sopt5qgwq) rrweb-snapshot: specifier: 2.0.0-alpha.13 version: 2.0.0-alpha.13 @@ -9197,7 +9202,7 @@ packages: resolution: {integrity: sha512-slbhNBCYjxLGCeH95a67ECCy5a22nloXp1F5wF7DCzUNw80FN7tF9Lef1sRGLNo32g3mNqTc2sWLATlKejMxYw==} dev: true - /rrweb@2.0.0-alpha.13: + /rrweb@2.0.0-alpha.13(patch_hash=5qp7mlyswmxzmggk5sopt5qgwq): resolution: {integrity: sha512-a8GXOCnzWHNaVZPa7hsrLZtNZ3CGjiL+YrkpLo0TfmxGLhjNZbWY2r7pE06p+FcjFNlgUVTmFrSJbK3kO7yxvw==} dependencies: '@rrweb/types': 2.0.0-alpha.13 @@ -9209,6 +9214,7 @@ packages: rrdom: 2.0.0-alpha.13 rrweb-snapshot: 2.0.0-alpha.13 dev: true + patched: true /rsvp@4.8.5: resolution: {integrity: sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==} From 2f323d56b4f1b97323c4e4fa8a63b9e4ed589e25 Mon Sep 17 00:00:00 2001 From: David Newell Date: Mon, 22 Apr 2024 17:02:32 +0100 Subject: [PATCH 3/4] patch spacing --- patches/rrweb@2.0.0-alpha.13.patch | 48 +++++++++++++++--------------- pnpm-lock.yaml | 6 ++-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/patches/rrweb@2.0.0-alpha.13.patch b/patches/rrweb@2.0.0-alpha.13.patch index 1d4840230..0ab62739d 100644 --- a/patches/rrweb@2.0.0-alpha.13.patch +++ b/patches/rrweb@2.0.0-alpha.13.patch @@ -1,49 +1,49 @@ diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js new file mode 100644 -index 0000000000000000000000000000000000000000..6635f9e0de57f2ea6f57af4c18ce208318eaa2e3 +index 0000000000000000000000000000000000000000..f7775474506e5f4a11539c9ad8fb75c0d2568de4 --- /dev/null +++ b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js @@ -0,0 +1,31 @@ +function decodeBase64(base64, enableUnicode) { -+ var binaryString = atob(base64); -+ if (enableUnicode) { -+ var binaryView = new Uint8Array(binaryString.length); -+ for (var i = 0, n = binaryString.length; i < n; ++i) { -+ binaryView[i] = binaryString.charCodeAt(i); ++ var binaryString = atob(base64); ++ if (enableUnicode) { ++ var binaryView = new Uint8Array(binaryString.length); ++ for (var i = 0, n = binaryString.length; i < n; ++i) { ++ binaryView[i] = binaryString.charCodeAt(i); ++ } ++ return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer)); + } -+ return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer)); -+ } -+ return binaryString; ++ return binaryString; +} + +function createURL(base64, sourcemapArg, enableUnicodeArg) { -+ var sourcemap = sourcemapArg === undefined ? null : sourcemapArg; -+ var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg; -+ var source = decodeBase64(base64, enableUnicode); -+ var start = source.indexOf('\n', 10) + 1; -+ var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : ''); -+ var blob = new Blob([body], { type: 'application/javascript' }); -+ return URL.createObjectURL(blob); ++ var sourcemap = sourcemapArg === undefined ? null : sourcemapArg; ++ var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg; ++ var source = decodeBase64(base64, enableUnicode); ++ var start = source.indexOf('\n', 10) + 1; ++ var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : ''); ++ var blob = new Blob([body], { type: 'application/javascript' }); ++ return URL.createObjectURL(blob); +} + +function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) { -+ var url; -+ return function WorkerFactory(options) { -+ url = url || createURL(base64, sourcemapArg, enableUnicodeArg); -+ return new Worker(url, options); -+ }; ++ var url; ++ return function WorkerFactory(options) { ++ url = url || createURL(base64, sourcemapArg, enableUnicodeArg); ++ return new Worker(url, options); ++ }; +} + +export { createBase64WorkerFactory }; \ No newline at end of file diff --git a/es/rrweb/_virtual/image-bitmap-data-url-worker.js b/es/rrweb/_virtual/image-bitmap-data-url-worker.js -index ea868845c4fad3276aa8e5f74abfd3568b466d11..37037c253ffc6bd7468caf51a0345fcae711c390 100644 +index ea868845c4fad3276aa8e5f74abfd3568b466d11..3ddd0c91d1794226e43477c2be3b1b7eee9d0413 100644 --- a/es/rrweb/_virtual/image-bitmap-data-url-worker.js +++ b/es/rrweb/_virtual/image-bitmap-data-url-worker.js @@ -1,120 +1,3 @@ -import { createInlineWorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js'; +import { createBase64WorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js'; - + -var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader */function () { -(function () { - '__worker_loader_strict__'; @@ -165,7 +165,7 @@ index ea868845c4fad3276aa8e5f74abfd3568b466d11..37037c253ffc6bd7468caf51a0345fca +var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgR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TWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogIC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yhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false); \ No newline at end of file diff --git a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -index da2c103fe6b1408a5996f0eb3bf047571e434cc2..abd102e81a55223a226975b54d97d69cf7ece72a 100644 +index da2c103fe6b1408a5996f0eb3bf047571e434cc2..f04750556f6d509a16678a94dca5b615eb8d3a1d 100644 --- a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +++ b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js @@ -91,11 +91,21 @@ class CanvasManager { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 65006279a..1988625cd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ settings: patchedDependencies: rrweb@2.0.0-alpha.13: - hash: 5qp7mlyswmxzmggk5sopt5qgwq + hash: prunnx6uzpj4zlwe4nur36wn7a path: patches/rrweb@2.0.0-alpha.13.patch dependencies: @@ -173,7 +173,7 @@ devDependencies: version: 5.12.0(rollup@4.9.6) rrweb: specifier: 2.0.0-alpha.13 - version: 2.0.0-alpha.13(patch_hash=5qp7mlyswmxzmggk5sopt5qgwq) + version: 2.0.0-alpha.13(patch_hash=prunnx6uzpj4zlwe4nur36wn7a) rrweb-snapshot: specifier: 2.0.0-alpha.13 version: 2.0.0-alpha.13 @@ -9202,7 +9202,7 @@ packages: resolution: {integrity: sha512-slbhNBCYjxLGCeH95a67ECCy5a22nloXp1F5wF7DCzUNw80FN7tF9Lef1sRGLNo32g3mNqTc2sWLATlKejMxYw==} dev: true - /rrweb@2.0.0-alpha.13(patch_hash=5qp7mlyswmxzmggk5sopt5qgwq): + /rrweb@2.0.0-alpha.13(patch_hash=prunnx6uzpj4zlwe4nur36wn7a): resolution: {integrity: sha512-a8GXOCnzWHNaVZPa7hsrLZtNZ3CGjiL+YrkpLo0TfmxGLhjNZbWY2r7pE06p+FcjFNlgUVTmFrSJbK3kO7yxvw==} dependencies: '@rrweb/types': 2.0.0-alpha.13 From 64c7a8e309a973eb06cd0701c35a33cd8f722c63 Mon Sep 17 00:00:00 2001 From: David Newell Date: Mon, 22 Apr 2024 17:10:19 +0100 Subject: [PATCH 4/4] final patch fixes --- patches/rrweb@2.0.0-alpha.13.patch | 16 +++++++++------- pnpm-lock.yaml | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/patches/rrweb@2.0.0-alpha.13.patch b/patches/rrweb@2.0.0-alpha.13.patch index 0ab62739d..35cde3e86 100644 --- a/patches/rrweb@2.0.0-alpha.13.patch +++ b/patches/rrweb@2.0.0-alpha.13.patch @@ -36,13 +36,16 @@ index 0000000000000000000000000000000000000000..f7775474506e5f4a11539c9ad8fb75c0 + +export { createBase64WorkerFactory }; \ No newline at end of file +diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js +deleted file mode 100644 +index b39a7674a500ec96f95aa70dde959901bb964de7..0000000000000000000000000000000000000000 diff --git a/es/rrweb/_virtual/image-bitmap-data-url-worker.js b/es/rrweb/_virtual/image-bitmap-data-url-worker.js -index ea868845c4fad3276aa8e5f74abfd3568b466d11..3ddd0c91d1794226e43477c2be3b1b7eee9d0413 100644 +index ea868845c4fad3276aa8e5f74abfd3568b466d11..965505de44975e718d431a4e9a62e753e4842158 100644 --- a/es/rrweb/_virtual/image-bitmap-data-url-worker.js +++ b/es/rrweb/_virtual/image-bitmap-data-url-worker.js -@@ -1,120 +1,3 @@ +@@ -1,120 +1,6 @@ -import { createInlineWorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js'; -+import { createBase64WorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js'; ++import { createBase64WorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js'; -var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader */function () { -(function () { @@ -159,11 +162,10 @@ index ea868845c4fad3276aa8e5f74abfd3568b466d11..3ddd0c91d1794226e43477c2be3b1b7e - -})(); -}, null); --/* eslint-enable */ -- --export { WorkerFactory as default }; +var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzd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oYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false); -\ No newline at end of file + /* eslint-enable */ + + export { WorkerFactory as default }; diff --git a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js index da2c103fe6b1408a5996f0eb3bf047571e434cc2..f04750556f6d509a16678a94dca5b615eb8d3a1d 100644 --- a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1988625cd..e634f99ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ settings: patchedDependencies: rrweb@2.0.0-alpha.13: - hash: prunnx6uzpj4zlwe4nur36wn7a + hash: xzot57gbh2vywrm2w2dzrqlgli path: patches/rrweb@2.0.0-alpha.13.patch dependencies: @@ -173,7 +173,7 @@ devDependencies: version: 5.12.0(rollup@4.9.6) rrweb: specifier: 2.0.0-alpha.13 - version: 2.0.0-alpha.13(patch_hash=prunnx6uzpj4zlwe4nur36wn7a) + version: 2.0.0-alpha.13(patch_hash=xzot57gbh2vywrm2w2dzrqlgli) rrweb-snapshot: specifier: 2.0.0-alpha.13 version: 2.0.0-alpha.13 @@ -9202,7 +9202,7 @@ packages: resolution: {integrity: sha512-slbhNBCYjxLGCeH95a67ECCy5a22nloXp1F5wF7DCzUNw80FN7tF9Lef1sRGLNo32g3mNqTc2sWLATlKejMxYw==} dev: true - /rrweb@2.0.0-alpha.13(patch_hash=prunnx6uzpj4zlwe4nur36wn7a): + /rrweb@2.0.0-alpha.13(patch_hash=xzot57gbh2vywrm2w2dzrqlgli): resolution: {integrity: sha512-a8GXOCnzWHNaVZPa7hsrLZtNZ3CGjiL+YrkpLo0TfmxGLhjNZbWY2r7pE06p+FcjFNlgUVTmFrSJbK3kO7yxvw==} dependencies: '@rrweb/types': 2.0.0-alpha.13