@openreplay/tracker
Advanced tools
Comparing version 14.0.6-beta.0 to 14.0.6-beta.1
@@ -97,3 +97,3 @@ "use strict"; | ||
this.activityState = ActivityState.NotActive; | ||
this.version = '14.0.6-beta.0'; // TODO: version compatability check inside each plugin. | ||
this.version = '14.0.6-beta.1'; // TODO: version compatability check inside each plugin. | ||
this.socketMode = false; | ||
@@ -100,0 +100,0 @@ this.compressionThreshold = 24 * 1000; |
@@ -14,3 +14,3 @@ import App from '../index.js'; | ||
/** | ||
* Unbinds the old content document in case of iframe src change. | ||
* Unbinds the removed nodes in case of iframe src change. | ||
*/ | ||
@@ -17,0 +17,0 @@ private handleIframeSrcChange; |
@@ -83,3 +83,3 @@ "use strict"; | ||
if (target instanceof HTMLIFrameElement && name === 'src') { | ||
this.handleIframeSrcChange(target, id); | ||
this.handleIframeSrcChange(target); | ||
} | ||
@@ -108,9 +108,29 @@ let attr = this.attributesMap.get(id); | ||
/** | ||
* Unbinds the old content document in case of iframe src change. | ||
* Unbinds the removed nodes in case of iframe src change. | ||
*/ | ||
handleIframeSrcChange(iframe, id) { | ||
handleIframeSrcChange(iframe) { | ||
const oldContentDocument = iframe.contentDocument; | ||
if (oldContentDocument) { | ||
this.recents.set(id, RecentsType.Removed); | ||
this.unbindTree(oldContentDocument, true); | ||
const id = this.app.nodes.getID(oldContentDocument); | ||
if (id !== undefined) { | ||
const walker = document.createTreeWalker(oldContentDocument, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, { | ||
acceptNode: (node) => isIgnored(node) || this.app.nodes.getID(node) === undefined | ||
? NodeFilter.FILTER_REJECT | ||
: NodeFilter.FILTER_ACCEPT, | ||
}, | ||
// @ts-ignore | ||
false); | ||
let removed = 0; | ||
const totalBeforeRemove = this.app.nodes.getNodeCount(); | ||
while (walker.nextNode()) { | ||
if (!iframe.contentDocument.contains(walker.currentNode)) { | ||
removed += 1; | ||
this.app.nodes.unregisterNode(walker.currentNode); | ||
} | ||
} | ||
const removedPercent = Math.floor((removed / totalBeforeRemove) * 100); | ||
if (removedPercent > 30) { | ||
this.app.send((0, messages_gen_js_1.UnbindNodes)(removedPercent)); | ||
} | ||
} | ||
} | ||
@@ -203,7 +223,4 @@ } | ||
} | ||
unbindTree(node, force) { | ||
unbindTree(node) { | ||
const id = this.app.nodes.unregisterNode(node); | ||
if (force && id) { | ||
this.recents.set(id, RecentsType.Removed); | ||
} | ||
if (id !== undefined && this.recents.get(id) === RecentsType.Removed) { | ||
@@ -210,0 +227,0 @@ // Sending RemoveNode only for parent to maintain |
@@ -101,3 +101,3 @@ "use strict"; | ||
req.send(JSON.stringify({ | ||
trackerVersion: '14.0.6-beta.0', | ||
trackerVersion: '14.0.6-beta.1', | ||
projectKey: this.options.projectKey, | ||
@@ -104,0 +104,0 @@ doNotTrack, |
@@ -68,3 +68,3 @@ import { gzip } from 'fflate'; | ||
this.activityState = ActivityState.NotActive; | ||
this.version = '14.0.6-beta.0'; // TODO: version compatability check inside each plugin. | ||
this.version = '14.0.6-beta.1'; // TODO: version compatability check inside each plugin. | ||
this.socketMode = false; | ||
@@ -71,0 +71,0 @@ this.compressionThreshold = 24 * 1000; |
@@ -14,3 +14,3 @@ import App from '../index.js'; | ||
/** | ||
* Unbinds the old content document in case of iframe src change. | ||
* Unbinds the removed nodes in case of iframe src change. | ||
*/ | ||
@@ -17,0 +17,0 @@ private handleIframeSrcChange; |
@@ -81,3 +81,3 @@ import { createMutationObserver } from '../../utils.js'; | ||
if (target instanceof HTMLIFrameElement && name === 'src') { | ||
this.handleIframeSrcChange(target, id); | ||
this.handleIframeSrcChange(target); | ||
} | ||
@@ -106,9 +106,29 @@ let attr = this.attributesMap.get(id); | ||
/** | ||
* Unbinds the old content document in case of iframe src change. | ||
* Unbinds the removed nodes in case of iframe src change. | ||
*/ | ||
handleIframeSrcChange(iframe, id) { | ||
handleIframeSrcChange(iframe) { | ||
const oldContentDocument = iframe.contentDocument; | ||
if (oldContentDocument) { | ||
this.recents.set(id, RecentsType.Removed); | ||
this.unbindTree(oldContentDocument, true); | ||
const id = this.app.nodes.getID(oldContentDocument); | ||
if (id !== undefined) { | ||
const walker = document.createTreeWalker(oldContentDocument, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, { | ||
acceptNode: (node) => isIgnored(node) || this.app.nodes.getID(node) === undefined | ||
? NodeFilter.FILTER_REJECT | ||
: NodeFilter.FILTER_ACCEPT, | ||
}, | ||
// @ts-ignore | ||
false); | ||
let removed = 0; | ||
const totalBeforeRemove = this.app.nodes.getNodeCount(); | ||
while (walker.nextNode()) { | ||
if (!iframe.contentDocument.contains(walker.currentNode)) { | ||
removed += 1; | ||
this.app.nodes.unregisterNode(walker.currentNode); | ||
} | ||
} | ||
const removedPercent = Math.floor((removed / totalBeforeRemove) * 100); | ||
if (removedPercent > 30) { | ||
this.app.send(UnbindNodes(removedPercent)); | ||
} | ||
} | ||
} | ||
@@ -201,7 +221,4 @@ } | ||
} | ||
unbindTree(node, force) { | ||
unbindTree(node) { | ||
const id = this.app.nodes.unregisterNode(node); | ||
if (force && id) { | ||
this.recents.set(id, RecentsType.Removed); | ||
} | ||
if (id !== undefined && this.recents.get(id) === RecentsType.Removed) { | ||
@@ -208,0 +225,0 @@ // Sending RemoveNode only for parent to maintain |
@@ -70,3 +70,3 @@ import App, { DEFAULT_INGEST_POINT } from './app/index.js'; | ||
req.send(JSON.stringify({ | ||
trackerVersion: '14.0.6-beta.0', | ||
trackerVersion: '14.0.6-beta.1', | ||
projectKey: this.options.projectKey, | ||
@@ -73,0 +73,0 @@ doNotTrack, |
{ | ||
"name": "@openreplay/tracker", | ||
"description": "The OpenReplay tracker main package", | ||
"version": "14.0.6-beta.0", | ||
"version": "14.0.6-beta.1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "logging", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4025720
24465