@highlight-run/rrweb 2.0.10 → 2.0.14
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/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +3 -3
- package/dist/record/rrweb-record.min.js +3 -3
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.js +4 -4
- package/dist/replay/rrweb-replay-unpack.min.js +4 -4
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.js +4 -4
- package/dist/replay/rrweb-replay.min.js +4 -4
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.js +8 -8
- package/dist/rrweb-all.min.js +8 -8
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.js +5 -5
- package/dist/rrweb.min.js +5 -5
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/packages/rrdom/es/{virtual-dom.js → rrdom.js} +87 -112
- package/es/rrweb/packages/rrweb/src/index.js +1 -1
- package/es/rrweb/packages/rrweb/src/record/index.js +2 -0
- package/es/rrweb/packages/rrweb/src/record/mutation.js +12 -1
- package/es/rrweb/packages/rrweb/src/replay/index.js +3 -3
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +1860 -1861
- package/lib/plugins/console-record.js +8 -8
- package/lib/plugins/console-replay.js +8 -8
- package/lib/record/rrweb-record-pack.js +8 -8
- package/lib/record/rrweb-record.js +1055 -1043
- package/lib/replay/rrweb-replay-unpack.js +971 -996
- package/lib/replay/rrweb-replay.js +971 -996
- package/lib/rrweb-all.js +1963 -1976
- package/lib/rrweb.js +1963 -1976
- package/package.json +4 -4
- package/typings/record/mutation.d.ts +1 -0
- package/typings/replay/index.d.ts +1 -1
- package/typings/types.d.ts +3 -2
- package/typings/utils.d.ts +1 -1
|
@@ -1,1051 +1,1050 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var NodeType;
|
|
4
|
-
(function (NodeType) {
|
|
5
|
-
NodeType[NodeType["Document"] = 0] = "Document";
|
|
6
|
-
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
7
|
-
NodeType[NodeType["Element"] = 2] = "Element";
|
|
8
|
-
NodeType[NodeType["Text"] = 3] = "Text";
|
|
9
|
-
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
10
|
-
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
3
|
+
var NodeType;
|
|
4
|
+
(function (NodeType) {
|
|
5
|
+
NodeType[NodeType["Document"] = 0] = "Document";
|
|
6
|
+
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
7
|
+
NodeType[NodeType["Element"] = 2] = "Element";
|
|
8
|
+
NodeType[NodeType["Text"] = 3] = "Text";
|
|
9
|
+
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
10
|
+
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
11
11
|
})(NodeType || (NodeType = {}));
|
|
12
12
|
|
|
13
|
-
function isElement(n) {
|
|
14
|
-
return n.nodeType === n.ELEMENT_NODE;
|
|
15
|
-
}
|
|
16
|
-
function isShadowRoot(n) {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
text =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return text;
|
|
13
|
+
function isElement(n) {
|
|
14
|
+
return n.nodeType === n.ELEMENT_NODE;
|
|
15
|
+
}
|
|
16
|
+
function isShadowRoot(n) {
|
|
17
|
+
var host = n === null || n === void 0 ? void 0 : n.host;
|
|
18
|
+
return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n);
|
|
19
|
+
}
|
|
20
|
+
var Mirror = (function () {
|
|
21
|
+
function Mirror() {
|
|
22
|
+
this.idNodeMap = new Map();
|
|
23
|
+
this.nodeMetaMap = new WeakMap();
|
|
24
|
+
}
|
|
25
|
+
Mirror.prototype.getId = function (n) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!n)
|
|
28
|
+
return -1;
|
|
29
|
+
var id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
|
|
30
|
+
return id !== null && id !== void 0 ? id : -1;
|
|
31
|
+
};
|
|
32
|
+
Mirror.prototype.getNode = function (id) {
|
|
33
|
+
return this.idNodeMap.get(id) || null;
|
|
34
|
+
};
|
|
35
|
+
Mirror.prototype.getIds = function () {
|
|
36
|
+
return Array.from(this.idNodeMap.keys());
|
|
37
|
+
};
|
|
38
|
+
Mirror.prototype.getMeta = function (n) {
|
|
39
|
+
return this.nodeMetaMap.get(n) || null;
|
|
40
|
+
};
|
|
41
|
+
Mirror.prototype.removeNodeFromMap = function (n) {
|
|
42
|
+
var _this = this;
|
|
43
|
+
var id = this.getId(n);
|
|
44
|
+
this.idNodeMap["delete"](id);
|
|
45
|
+
if (n.childNodes) {
|
|
46
|
+
n.childNodes.forEach(function (childNode) {
|
|
47
|
+
return _this.removeNodeFromMap(childNode);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
Mirror.prototype.has = function (id) {
|
|
52
|
+
return this.idNodeMap.has(id);
|
|
53
|
+
};
|
|
54
|
+
Mirror.prototype.hasNode = function (node) {
|
|
55
|
+
return this.nodeMetaMap.has(node);
|
|
56
|
+
};
|
|
57
|
+
Mirror.prototype.add = function (n, meta) {
|
|
58
|
+
var id = meta.id;
|
|
59
|
+
this.idNodeMap.set(id, n);
|
|
60
|
+
this.nodeMetaMap.set(n, meta);
|
|
61
|
+
};
|
|
62
|
+
Mirror.prototype.replace = function (id, n) {
|
|
63
|
+
this.idNodeMap.set(id, n);
|
|
64
|
+
};
|
|
65
|
+
Mirror.prototype.reset = function () {
|
|
66
|
+
this.idNodeMap = new Map();
|
|
67
|
+
this.nodeMetaMap = new WeakMap();
|
|
68
|
+
};
|
|
69
|
+
return Mirror;
|
|
70
|
+
}());
|
|
71
|
+
function createMirror() {
|
|
72
|
+
return new Mirror();
|
|
73
|
+
}
|
|
74
|
+
function maskInputValue(_a) {
|
|
75
|
+
var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;
|
|
76
|
+
var text = value || '';
|
|
77
|
+
if (maskInputOptions[tagName.toLowerCase()] ||
|
|
78
|
+
maskInputOptions[type]) {
|
|
79
|
+
if (maskInputFn) {
|
|
80
|
+
text = maskInputFn(text);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
text = '*'.repeat(text.length);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return text;
|
|
87
|
+
}
|
|
88
|
+
var ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__';
|
|
89
|
+
function is2DCanvasBlank(canvas) {
|
|
90
|
+
var ctx = canvas.getContext('2d');
|
|
91
|
+
if (!ctx)
|
|
92
|
+
return true;
|
|
93
|
+
var chunkSize = 50;
|
|
94
|
+
for (var x = 0; x < canvas.width; x += chunkSize) {
|
|
95
|
+
for (var y = 0; y < canvas.height; y += chunkSize) {
|
|
96
|
+
var getImageData = ctx.getImageData;
|
|
97
|
+
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData
|
|
98
|
+
? getImageData[ORIGINAL_ATTRIBUTE_NAME]
|
|
99
|
+
: getImageData;
|
|
100
|
+
var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
|
|
101
|
+
if (pixelBuffer.some(function (pixel) { return pixel !== 0; }))
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
function obfuscateText(text) {
|
|
108
|
+
text = text.replace(/[^ -~]+/g, '');
|
|
109
|
+
text =
|
|
110
|
+
(text === null || text === void 0 ? void 0 : text.split(' ').map(function (word) { return Math.random().toString(20).substr(2, word.length); }).join(' ')) || '';
|
|
111
|
+
return text;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
var _id = 1;
|
|
116
|
-
var tagNameRegex = new RegExp('[^a-z0-9-_:]');
|
|
117
|
-
var IGNORED_NODE = -2;
|
|
118
|
-
function genId() {
|
|
119
|
-
return _id++;
|
|
120
|
-
}
|
|
121
|
-
function getValidTagName(element) {
|
|
122
|
-
if (element instanceof HTMLFormElement) {
|
|
123
|
-
return 'form';
|
|
124
|
-
}
|
|
125
|
-
var processedTagName = element.tagName.toLowerCase().trim();
|
|
126
|
-
if (tagNameRegex.test(processedTagName)) {
|
|
127
|
-
return 'div';
|
|
128
|
-
}
|
|
129
|
-
return processedTagName;
|
|
130
|
-
}
|
|
131
|
-
function getCssRulesString(s) {
|
|
132
|
-
try {
|
|
133
|
-
var rules = s.rules || s.cssRules;
|
|
134
|
-
return rules ? Array.from(rules).map(getCssRuleString).join('') : null;
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function getCssRuleString(rule) {
|
|
141
|
-
var cssStringified = rule.cssText;
|
|
142
|
-
if (isCSSImportRule(rule)) {
|
|
143
|
-
try {
|
|
144
|
-
cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
|
|
145
|
-
}
|
|
146
|
-
catch (_a) {
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return cssStringified;
|
|
150
|
-
}
|
|
151
|
-
function isCSSImportRule(rule) {
|
|
152
|
-
return 'styleSheet' in rule;
|
|
153
|
-
}
|
|
154
|
-
function stringifyStyleSheet(sheet) {
|
|
155
|
-
return sheet.cssRules
|
|
156
|
-
? Array.from(sheet.cssRules)
|
|
157
|
-
.map(function (rule) { return rule.cssText || ''; })
|
|
158
|
-
.join('')
|
|
159
|
-
: '';
|
|
160
|
-
}
|
|
161
|
-
function extractOrigin(url) {
|
|
162
|
-
var origin = '';
|
|
163
|
-
if (url.indexOf('//') > -1) {
|
|
164
|
-
origin = url.split('/').slice(0, 3).join('/');
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
origin = url.split('/')[0];
|
|
168
|
-
}
|
|
169
|
-
origin = origin.split('?')[0];
|
|
170
|
-
return origin;
|
|
171
|
-
}
|
|
172
|
-
var canvasService;
|
|
173
|
-
var canvasCtx;
|
|
174
|
-
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
175
|
-
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
|
|
176
|
-
var DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
177
|
-
function absoluteToStylesheet(cssText, href) {
|
|
178
|
-
return (cssText || '').replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {
|
|
179
|
-
var filePath = path1 || path2 || path3;
|
|
180
|
-
var maybeQuote = quote1 || quote2 || '';
|
|
181
|
-
if (!filePath) {
|
|
182
|
-
return origin;
|
|
183
|
-
}
|
|
184
|
-
if (!RELATIVE_PATH.test(filePath)) {
|
|
185
|
-
return "url("
|
|
186
|
-
}
|
|
187
|
-
if (DATA_URI.test(filePath)) {
|
|
188
|
-
return "url("
|
|
189
|
-
}
|
|
190
|
-
if (filePath[0] === '/') {
|
|
191
|
-
return "url("
|
|
192
|
-
}
|
|
193
|
-
var stack = href.split('/');
|
|
194
|
-
var parts = filePath.split('/');
|
|
195
|
-
stack.pop();
|
|
196
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
197
|
-
var part = parts_1[_i];
|
|
198
|
-
if (part === '.') {
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
else if (part === '..') {
|
|
202
|
-
stack.pop();
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
stack.push(part);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return "url("
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
212
|
-
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
213
|
-
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
214
|
-
if (attributeValue.trim() === '') {
|
|
215
|
-
return attributeValue;
|
|
216
|
-
}
|
|
217
|
-
var pos = 0;
|
|
218
|
-
function collectCharacters(regEx) {
|
|
219
|
-
var chars;
|
|
220
|
-
var match = regEx.exec(attributeValue.substring(pos));
|
|
221
|
-
if (match) {
|
|
222
|
-
chars = match[0];
|
|
223
|
-
pos += chars.length;
|
|
224
|
-
return chars;
|
|
225
|
-
}
|
|
226
|
-
return '';
|
|
227
|
-
}
|
|
228
|
-
var output = [];
|
|
229
|
-
while (true) {
|
|
230
|
-
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
231
|
-
if (pos >= attributeValue.length) {
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
235
|
-
if (url.slice(-1) === ',') {
|
|
236
|
-
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
237
|
-
output.push(url);
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
var descriptorsStr = '';
|
|
241
|
-
url = absoluteToDoc(doc, url);
|
|
242
|
-
var inParens = false;
|
|
243
|
-
while (true) {
|
|
244
|
-
var c = attributeValue.charAt(pos);
|
|
245
|
-
if (c === '') {
|
|
246
|
-
output.push((url + descriptorsStr).trim());
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
else if (!inParens) {
|
|
250
|
-
if (c === ',') {
|
|
251
|
-
pos += 1;
|
|
252
|
-
output.push((url + descriptorsStr).trim());
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
else if (c === '(') {
|
|
256
|
-
inParens = true;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
if (c === ')') {
|
|
261
|
-
inParens = false;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
descriptorsStr += c;
|
|
265
|
-
pos += 1;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return output.join(', ');
|
|
270
|
-
}
|
|
271
|
-
function absoluteToDoc(doc, attributeValue) {
|
|
272
|
-
if (!attributeValue || attributeValue.trim() === '') {
|
|
273
|
-
return attributeValue;
|
|
274
|
-
}
|
|
275
|
-
var a = doc.createElement('a');
|
|
276
|
-
a.href = attributeValue;
|
|
277
|
-
return a.href;
|
|
278
|
-
}
|
|
279
|
-
function isSVGElement(el) {
|
|
280
|
-
return Boolean(el.tagName === 'svg' || el.ownerSVGElement);
|
|
281
|
-
}
|
|
282
|
-
function getHref() {
|
|
283
|
-
var a = document.createElement('a');
|
|
284
|
-
a.href = '';
|
|
285
|
-
return a.href;
|
|
286
|
-
}
|
|
287
|
-
function transformAttribute(doc, tagName, name, value) {
|
|
288
|
-
if (name === 'src' || (name === 'href' && value)) {
|
|
289
|
-
return absoluteToDoc(doc, value);
|
|
290
|
-
}
|
|
291
|
-
else if (name === 'xlink:href' && value && value[0] !== '#') {
|
|
292
|
-
return absoluteToDoc(doc, value);
|
|
293
|
-
}
|
|
294
|
-
else if (name === 'background' &&
|
|
295
|
-
value &&
|
|
296
|
-
(tagName === 'table' || tagName === 'td' || tagName === 'th')) {
|
|
297
|
-
return absoluteToDoc(doc, value);
|
|
298
|
-
}
|
|
299
|
-
else if (name === 'srcset' && value) {
|
|
300
|
-
return getAbsoluteSrcsetString(doc, value);
|
|
301
|
-
}
|
|
302
|
-
else if (name === 'style' && value) {
|
|
303
|
-
return absoluteToStylesheet(value, getHref());
|
|
304
|
-
}
|
|
305
|
-
else if (tagName === 'object' && name === 'data' && value) {
|
|
306
|
-
return absoluteToDoc(doc, value);
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
return value;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
313
|
-
if (typeof blockClass === 'string') {
|
|
314
|
-
if (element.classList.contains(blockClass)) {
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
for (var eIndex = element.classList.length; eIndex--;) {
|
|
320
|
-
var className = element.classList[eIndex];
|
|
321
|
-
if (blockClass.test(className)) {
|
|
322
|
-
return true;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if (blockSelector) {
|
|
327
|
-
return element.matches(blockSelector);
|
|
328
|
-
}
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
|
-
function classMatchesRegex(node, regex, checkAncestors) {
|
|
332
|
-
if (!node)
|
|
333
|
-
return false;
|
|
334
|
-
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
335
|
-
if (!checkAncestors)
|
|
336
|
-
return false;
|
|
337
|
-
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
338
|
-
}
|
|
339
|
-
for (var eIndex = node.classList.length; eIndex--;) {
|
|
340
|
-
var className = node.classList[eIndex];
|
|
341
|
-
if (regex.test(className)) {
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
if (!checkAncestors)
|
|
346
|
-
return false;
|
|
347
|
-
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
348
|
-
}
|
|
349
|
-
function needMaskingText(node, maskTextClass, maskTextSelector) {
|
|
350
|
-
var el = node.nodeType === node.ELEMENT_NODE
|
|
351
|
-
? node
|
|
352
|
-
: node.parentElement;
|
|
353
|
-
if (el === null)
|
|
354
|
-
return false;
|
|
355
|
-
if (typeof maskTextClass === 'string') {
|
|
356
|
-
if (el.classList.contains(maskTextClass))
|
|
357
|
-
return true;
|
|
358
|
-
if (el.closest("."
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
if (classMatchesRegex(el, maskTextClass, true))
|
|
363
|
-
return true;
|
|
364
|
-
}
|
|
365
|
-
if (maskTextSelector) {
|
|
366
|
-
if (el.matches(maskTextSelector))
|
|
367
|
-
return true;
|
|
368
|
-
if (el.closest(maskTextSelector))
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
374
|
-
var win = iframeEl.contentWindow;
|
|
375
|
-
if (!win) {
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
var fired = false;
|
|
379
|
-
var readyState;
|
|
380
|
-
try {
|
|
381
|
-
readyState = win.document.readyState;
|
|
382
|
-
}
|
|
383
|
-
catch (error) {
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
if (readyState !== 'complete') {
|
|
387
|
-
var timer_1 = setTimeout(function () {
|
|
388
|
-
if (!fired) {
|
|
389
|
-
listener();
|
|
390
|
-
fired = true;
|
|
391
|
-
}
|
|
392
|
-
}, iframeLoadTimeout);
|
|
393
|
-
iframeEl.addEventListener('load', function () {
|
|
394
|
-
clearTimeout(timer_1);
|
|
395
|
-
fired = true;
|
|
396
|
-
listener();
|
|
397
|
-
});
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
var blankUrl = 'about:blank';
|
|
401
|
-
if (win.location.href !== blankUrl ||
|
|
402
|
-
iframeEl.src === blankUrl ||
|
|
403
|
-
iframeEl.src === '') {
|
|
404
|
-
setTimeout(listener, 0);
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
iframeEl.addEventListener('load', listener);
|
|
408
|
-
}
|
|
409
|
-
function isStylesheetLoaded(link) {
|
|
410
|
-
if (!link.getAttribute('href'))
|
|
411
|
-
return true;
|
|
412
|
-
return link.sheet !== null;
|
|
413
|
-
}
|
|
414
|
-
function onceStylesheetLoaded(link, listener,
|
|
415
|
-
var fired = false;
|
|
416
|
-
var styleSheetLoaded;
|
|
417
|
-
try {
|
|
418
|
-
styleSheetLoaded = link.sheet;
|
|
419
|
-
}
|
|
420
|
-
catch (error) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
if (styleSheetLoaded)
|
|
424
|
-
return;
|
|
425
|
-
var timer = setTimeout(function () {
|
|
426
|
-
if (!fired) {
|
|
427
|
-
listener();
|
|
428
|
-
fired = true;
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
|
-
link.addEventListener('load', function () {
|
|
432
|
-
clearTimeout(timer);
|
|
433
|
-
fired = true;
|
|
434
|
-
listener();
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
function serializeNode(n, options) {
|
|
438
|
-
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
439
|
-
var rootId = getRootId(doc, mirror);
|
|
440
|
-
switch (n.nodeType) {
|
|
441
|
-
case n.DOCUMENT_NODE:
|
|
442
|
-
if (n.compatMode !== 'CSS1Compat') {
|
|
443
|
-
return {
|
|
444
|
-
type: NodeType.Document,
|
|
445
|
-
childNodes: [],
|
|
446
|
-
compatMode: n.compatMode,
|
|
447
|
-
rootId: rootId
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
return {
|
|
452
|
-
type: NodeType.Document,
|
|
453
|
-
childNodes: [],
|
|
454
|
-
rootId: rootId
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
case n.DOCUMENT_TYPE_NODE:
|
|
458
|
-
return {
|
|
459
|
-
type: NodeType.DocumentType,
|
|
460
|
-
name: n.name,
|
|
461
|
-
publicId: n.publicId,
|
|
462
|
-
systemId: n.systemId,
|
|
463
|
-
rootId: rootId
|
|
464
|
-
};
|
|
465
|
-
case n.ELEMENT_NODE:
|
|
466
|
-
return serializeElementNode(n, {
|
|
467
|
-
doc: doc,
|
|
468
|
-
blockClass: blockClass,
|
|
469
|
-
blockSelector: blockSelector,
|
|
470
|
-
inlineStylesheet: inlineStylesheet,
|
|
471
|
-
maskInputOptions: maskInputOptions,
|
|
472
|
-
maskInputFn: maskInputFn,
|
|
473
|
-
dataURLOptions: dataURLOptions,
|
|
474
|
-
inlineImages: inlineImages,
|
|
475
|
-
recordCanvas: recordCanvas,
|
|
476
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
477
|
-
newlyAddedElement: newlyAddedElement,
|
|
478
|
-
enableStrictPrivacy: enableStrictPrivacy,
|
|
479
|
-
rootId: rootId
|
|
480
|
-
});
|
|
481
|
-
case n.TEXT_NODE:
|
|
482
|
-
return serializeTextNode(n, {
|
|
483
|
-
maskTextClass: maskTextClass,
|
|
484
|
-
maskTextSelector: maskTextSelector,
|
|
485
|
-
maskTextFn: maskTextFn,
|
|
486
|
-
enableStrictPrivacy: enableStrictPrivacy,
|
|
487
|
-
rootId: rootId
|
|
488
|
-
});
|
|
489
|
-
case n.CDATA_SECTION_NODE:
|
|
490
|
-
return {
|
|
491
|
-
type: NodeType.CDATA,
|
|
492
|
-
textContent: '',
|
|
493
|
-
rootId: rootId
|
|
494
|
-
};
|
|
495
|
-
case n.COMMENT_NODE:
|
|
496
|
-
return {
|
|
497
|
-
type: NodeType.Comment,
|
|
498
|
-
textContent: n.textContent || '',
|
|
499
|
-
rootId: rootId
|
|
500
|
-
};
|
|
501
|
-
default:
|
|
502
|
-
return false;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
function getRootId(doc, mirror) {
|
|
506
|
-
if (!mirror.hasNode(doc))
|
|
507
|
-
return undefined;
|
|
508
|
-
var docId = mirror.getId(doc);
|
|
509
|
-
return docId === 1 ? undefined : docId;
|
|
510
|
-
}
|
|
511
|
-
function serializeTextNode(n, options) {
|
|
512
|
-
var _a;
|
|
513
|
-
var maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, maskTextFn = options.maskTextFn, enableStrictPrivacy = options.enableStrictPrivacy, rootId = options.rootId;
|
|
514
|
-
var parentTagName = n.parentNode && n.parentNode.tagName;
|
|
515
|
-
var textContent = n.textContent;
|
|
516
|
-
var isStyle = parentTagName === 'STYLE' ? true : undefined;
|
|
517
|
-
var isScript = parentTagName === 'SCRIPT' ? true : undefined;
|
|
518
|
-
var textContentHandled = false;
|
|
519
|
-
if (isStyle && textContent) {
|
|
520
|
-
try {
|
|
521
|
-
if (n.nextSibling || n.previousSibling) {
|
|
522
|
-
}
|
|
523
|
-
else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
|
|
524
|
-
textContent = stringifyStyleSheet(n.parentNode.sheet);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
catch (err) {
|
|
528
|
-
console.warn("Cannot get CSS styles from text's parentNode. Error: "
|
|
529
|
-
}
|
|
530
|
-
textContent = absoluteToStylesheet(textContent, getHref());
|
|
531
|
-
textContentHandled = true;
|
|
532
|
-
}
|
|
533
|
-
if (isScript) {
|
|
534
|
-
textContent = 'SCRIPT_PLACEHOLDER';
|
|
535
|
-
textContentHandled = true;
|
|
536
|
-
}
|
|
537
|
-
else if (parentTagName === 'NOSCRIPT') {
|
|
538
|
-
textContent = '';
|
|
539
|
-
textContentHandled = true;
|
|
540
|
-
}
|
|
541
|
-
if (!isStyle &&
|
|
542
|
-
!isScript &&
|
|
543
|
-
textContent &&
|
|
544
|
-
needMaskingText(n, maskTextClass, maskTextSelector)) {
|
|
545
|
-
textContent = maskTextFn
|
|
546
|
-
? maskTextFn(textContent)
|
|
547
|
-
: textContent.replace(/[\S]/g, '*');
|
|
548
|
-
}
|
|
549
|
-
if (enableStrictPrivacy && !textContentHandled && parentTagName) {
|
|
550
|
-
var IGNORE_TAG_NAMES = new Set([
|
|
551
|
-
'HEAD',
|
|
552
|
-
'TITLE',
|
|
553
|
-
'STYLE',
|
|
554
|
-
'SCRIPT',
|
|
555
|
-
'HTML',
|
|
556
|
-
'BODY',
|
|
557
|
-
'NOSCRIPT',
|
|
558
|
-
]);
|
|
559
|
-
if (!IGNORE_TAG_NAMES.has(parentTagName) && textContent) {
|
|
560
|
-
textContent = obfuscateText(textContent);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
return {
|
|
564
|
-
type: NodeType.Text,
|
|
565
|
-
textContent: textContent || '',
|
|
566
|
-
isStyle: isStyle,
|
|
567
|
-
rootId: rootId
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
function serializeElementNode(n, options) {
|
|
571
|
-
var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c, enableStrictPrivacy = options.enableStrictPrivacy, rootId = options.rootId;
|
|
572
|
-
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
573
|
-
var tagName = getValidTagName(n);
|
|
574
|
-
var attributes = {};
|
|
575
|
-
var len = n.attributes.length;
|
|
576
|
-
for (var i = 0; i < len; i++) {
|
|
577
|
-
var attr = n.attributes[i];
|
|
578
|
-
attributes[attr.name] = transformAttribute(doc, tagName, attr.name, attr.value);
|
|
579
|
-
}
|
|
580
|
-
if (tagName === 'link' && inlineStylesheet) {
|
|
581
|
-
var stylesheet = Array.from(doc.styleSheets).find(function (s) {
|
|
582
|
-
return s.href === n.href;
|
|
583
|
-
});
|
|
584
|
-
var cssText = null;
|
|
585
|
-
if (stylesheet) {
|
|
586
|
-
cssText = getCssRulesString(stylesheet);
|
|
587
|
-
}
|
|
588
|
-
if (cssText) {
|
|
589
|
-
delete attributes.rel;
|
|
590
|
-
delete attributes.href;
|
|
591
|
-
attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
if (tagName === 'style' &&
|
|
595
|
-
n.sheet &&
|
|
596
|
-
!(n.innerText || n.textContent || '').trim().length) {
|
|
597
|
-
var cssText = getCssRulesString(n.sheet);
|
|
598
|
-
if (cssText) {
|
|
599
|
-
attributes._cssText = absoluteToStylesheet(cssText, getHref());
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
if (tagName === 'input' || tagName === 'textarea' || tagName === 'select') {
|
|
603
|
-
var value = n.value;
|
|
604
|
-
if (attributes.type !== 'radio' &&
|
|
605
|
-
attributes.type !== 'checkbox' &&
|
|
606
|
-
attributes.type !== 'submit' &&
|
|
607
|
-
attributes.type !== 'button' &&
|
|
608
|
-
value) {
|
|
609
|
-
attributes.value = maskInputValue({
|
|
610
|
-
type: attributes.type,
|
|
611
|
-
tagName: tagName,
|
|
612
|
-
value: value,
|
|
613
|
-
maskInputOptions: maskInputOptions,
|
|
614
|
-
maskInputFn: maskInputFn
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
else if (n.checked) {
|
|
618
|
-
attributes.checked = n.checked;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
if (tagName === 'option') {
|
|
622
|
-
if (n.selected && !maskInputOptions['select']) {
|
|
623
|
-
attributes.selected = true;
|
|
624
|
-
}
|
|
625
|
-
else {
|
|
626
|
-
delete attributes.selected;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
if (tagName === 'canvas' && recordCanvas) {
|
|
630
|
-
if (n.__context === '2d') {
|
|
631
|
-
if (!is2DCanvasBlank(n)) {
|
|
632
|
-
attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
else if (!('__context' in n)) {
|
|
636
|
-
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
637
|
-
var blankCanvas = document.createElement('canvas');
|
|
638
|
-
blankCanvas.width = n.width;
|
|
639
|
-
blankCanvas.height = n.height;
|
|
640
|
-
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
641
|
-
if (canvasDataURL !== blankCanvasDataURL) {
|
|
642
|
-
attributes.rr_dataURL = canvasDataURL;
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
if (tagName === 'img' && inlineImages) {
|
|
647
|
-
if (!canvasService) {
|
|
648
|
-
canvasService = doc.createElement('canvas');
|
|
649
|
-
canvasCtx = canvasService.getContext('2d');
|
|
650
|
-
}
|
|
651
|
-
var image_1 = n;
|
|
652
|
-
var oldValue_1 = image_1.crossOrigin;
|
|
653
|
-
image_1.crossOrigin = 'anonymous';
|
|
654
|
-
var recordInlineImage = function () {
|
|
655
|
-
try {
|
|
656
|
-
canvasService.width = image_1.naturalWidth;
|
|
657
|
-
canvasService.height = image_1.naturalHeight;
|
|
658
|
-
canvasCtx.drawImage(image_1, 0, 0);
|
|
659
|
-
attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
660
|
-
}
|
|
661
|
-
catch (err) {
|
|
662
|
-
console.warn("Cannot inline img src="
|
|
663
|
-
}
|
|
664
|
-
oldValue_1
|
|
665
|
-
? (attributes.crossOrigin = oldValue_1)
|
|
666
|
-
: image_1.removeAttribute('crossorigin');
|
|
667
|
-
};
|
|
668
|
-
if (image_1.complete && image_1.naturalWidth !== 0)
|
|
669
|
-
recordInlineImage();
|
|
670
|
-
else
|
|
671
|
-
image_1.onload = recordInlineImage;
|
|
672
|
-
}
|
|
673
|
-
if (tagName === 'audio' || tagName === 'video') {
|
|
674
|
-
attributes.rr_mediaState = n.paused
|
|
675
|
-
? 'paused'
|
|
676
|
-
: 'played';
|
|
677
|
-
attributes.rr_mediaCurrentTime = n.currentTime;
|
|
678
|
-
}
|
|
679
|
-
if (!newlyAddedElement) {
|
|
680
|
-
if (n.scrollLeft) {
|
|
681
|
-
attributes.rr_scrollLeft = n.scrollLeft;
|
|
682
|
-
}
|
|
683
|
-
if (n.scrollTop) {
|
|
684
|
-
attributes.rr_scrollTop = n.scrollTop;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
if (needBlock || (tagName === 'img' && enableStrictPrivacy)) {
|
|
688
|
-
var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
|
|
689
|
-
attributes = {
|
|
690
|
-
"class": attributes["class"],
|
|
691
|
-
rr_width: width
|
|
692
|
-
rr_height: height
|
|
693
|
-
};
|
|
694
|
-
needBlock = true;
|
|
695
|
-
}
|
|
696
|
-
if (tagName === 'iframe' && !keepIframeSrcFn(attributes.src)) {
|
|
697
|
-
if (!n.contentDocument) {
|
|
698
|
-
attributes.rr_src = attributes.src;
|
|
699
|
-
}
|
|
700
|
-
delete attributes.src;
|
|
701
|
-
}
|
|
702
|
-
return {
|
|
703
|
-
type: NodeType.Element,
|
|
704
|
-
tagName: tagName,
|
|
705
|
-
attributes: attributes,
|
|
706
|
-
childNodes: [],
|
|
707
|
-
isSVG: isSVGElement(n) || undefined,
|
|
708
|
-
needBlock: needBlock,
|
|
709
|
-
rootId: rootId
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
function lowerIfExists(maybeAttr) {
|
|
713
|
-
if (maybeAttr === undefined) {
|
|
714
|
-
return '';
|
|
715
|
-
}
|
|
716
|
-
else {
|
|
717
|
-
return maybeAttr.toLowerCase();
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
721
|
-
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
722
|
-
return true;
|
|
723
|
-
}
|
|
724
|
-
else if (sn.type === NodeType.Element) {
|
|
725
|
-
if (slimDOMOptions.script &&
|
|
726
|
-
(sn.tagName === 'script' ||
|
|
727
|
-
(sn.tagName === 'link' &&
|
|
728
|
-
sn.attributes.rel === 'preload' &&
|
|
729
|
-
sn.attributes.as === 'script') ||
|
|
730
|
-
(sn.tagName === 'link' &&
|
|
731
|
-
sn.attributes.rel === 'prefetch' &&
|
|
732
|
-
typeof sn.attributes.href === 'string' &&
|
|
733
|
-
sn.attributes.href.endsWith('.js')))) {
|
|
734
|
-
return true;
|
|
735
|
-
}
|
|
736
|
-
else if (slimDOMOptions.headFavicon &&
|
|
737
|
-
((sn.tagName === 'link' && sn.attributes.rel === 'shortcut icon') ||
|
|
738
|
-
(sn.tagName === 'meta' &&
|
|
739
|
-
(lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) ||
|
|
740
|
-
lowerIfExists(sn.attributes.name) === 'application-name' ||
|
|
741
|
-
lowerIfExists(sn.attributes.rel) === 'icon' ||
|
|
742
|
-
lowerIfExists(sn.attributes.rel) === 'apple-touch-icon' ||
|
|
743
|
-
lowerIfExists(sn.attributes.rel) === 'shortcut icon')))) {
|
|
744
|
-
return true;
|
|
745
|
-
}
|
|
746
|
-
else if (sn.tagName === 'meta') {
|
|
747
|
-
if (slimDOMOptions.headMetaDescKeywords &&
|
|
748
|
-
lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
749
|
-
return true;
|
|
750
|
-
}
|
|
751
|
-
else if (slimDOMOptions.headMetaSocial &&
|
|
752
|
-
(lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) ||
|
|
753
|
-
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) ||
|
|
754
|
-
lowerIfExists(sn.attributes.name) === 'pinterest')) {
|
|
755
|
-
return true;
|
|
756
|
-
}
|
|
757
|
-
else if (slimDOMOptions.headMetaRobots &&
|
|
758
|
-
(lowerIfExists(sn.attributes.name) === 'robots' ||
|
|
759
|
-
lowerIfExists(sn.attributes.name) === 'googlebot' ||
|
|
760
|
-
lowerIfExists(sn.attributes.name) === 'bingbot')) {
|
|
761
|
-
return true;
|
|
762
|
-
}
|
|
763
|
-
else if (slimDOMOptions.headMetaHttpEquiv &&
|
|
764
|
-
sn.attributes['http-equiv'] !== undefined) {
|
|
765
|
-
return true;
|
|
766
|
-
}
|
|
767
|
-
else if (slimDOMOptions.headMetaAuthorship &&
|
|
768
|
-
(lowerIfExists(sn.attributes.name) === 'author' ||
|
|
769
|
-
lowerIfExists(sn.attributes.name) === 'generator' ||
|
|
770
|
-
lowerIfExists(sn.attributes.name) === 'framework' ||
|
|
771
|
-
lowerIfExists(sn.attributes.name) === 'publisher' ||
|
|
772
|
-
lowerIfExists(sn.attributes.name) === 'progid' ||
|
|
773
|
-
lowerIfExists(sn.attributes.property).match(/^article:/) ||
|
|
774
|
-
lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
775
|
-
return true;
|
|
776
|
-
}
|
|
777
|
-
else if (slimDOMOptions.headMetaVerification &&
|
|
778
|
-
(lowerIfExists(sn.attributes.name) === 'google-site-verification' ||
|
|
779
|
-
lowerIfExists(sn.attributes.name) === 'yandex-verification' ||
|
|
780
|
-
lowerIfExists(sn.attributes.name) === 'csrf-token' ||
|
|
781
|
-
lowerIfExists(sn.attributes.name) === 'p:domain_verify' ||
|
|
782
|
-
lowerIfExists(sn.attributes.name) === 'verify-v1' ||
|
|
783
|
-
lowerIfExists(sn.attributes.name) === 'verification' ||
|
|
784
|
-
lowerIfExists(sn.attributes.name) === 'shopify-checkout-api-token')) {
|
|
785
|
-
return true;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
return false;
|
|
790
|
-
}
|
|
791
|
-
function serializeNodeWithId(n, options) {
|
|
792
|
-
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, onStylesheetLoad = options.onStylesheetLoad, _h = options.stylesheetLoadTimeout, stylesheetLoadTimeout = _h === void 0 ? 5000 : _h, _j = options.keepIframeSrcFn, keepIframeSrcFn = _j === void 0 ? function () { return false; } : _j, _k = options.newlyAddedElement, newlyAddedElement = _k === void 0 ? false : _k, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
793
|
-
var _l = options.preserveWhiteSpace, preserveWhiteSpace = _l === void 0 ? true : _l;
|
|
794
|
-
var _serializedNode = serializeNode(n, {
|
|
795
|
-
doc: doc,
|
|
796
|
-
mirror: mirror,
|
|
797
|
-
blockClass: blockClass,
|
|
798
|
-
blockSelector: blockSelector,
|
|
799
|
-
maskTextClass: maskTextClass,
|
|
800
|
-
maskTextSelector: maskTextSelector,
|
|
801
|
-
inlineStylesheet: inlineStylesheet,
|
|
802
|
-
maskInputOptions: maskInputOptions,
|
|
803
|
-
maskTextFn: maskTextFn,
|
|
804
|
-
maskInputFn: maskInputFn,
|
|
805
|
-
dataURLOptions: dataURLOptions,
|
|
806
|
-
inlineImages: inlineImages,
|
|
807
|
-
recordCanvas: recordCanvas,
|
|
808
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
809
|
-
newlyAddedElement: newlyAddedElement,
|
|
810
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
811
|
-
});
|
|
812
|
-
if (!_serializedNode) {
|
|
813
|
-
console.warn(n, 'not serialized');
|
|
814
|
-
return null;
|
|
815
|
-
}
|
|
816
|
-
var id;
|
|
817
|
-
if (mirror.hasNode(n)) {
|
|
818
|
-
id = mirror.getId(n);
|
|
819
|
-
}
|
|
820
|
-
else if (slimDOMExcluded(_serializedNode, slimDOMOptions) ||
|
|
821
|
-
(!preserveWhiteSpace &&
|
|
822
|
-
_serializedNode.type === NodeType.Text &&
|
|
823
|
-
!_serializedNode.isStyle &&
|
|
824
|
-
!_serializedNode.textContent.replace(/^\s+|\s+$/gm, '').length)) {
|
|
825
|
-
id = IGNORED_NODE;
|
|
826
|
-
}
|
|
827
|
-
else {
|
|
828
|
-
id = genId();
|
|
829
|
-
}
|
|
830
|
-
if (id === IGNORED_NODE) {
|
|
831
|
-
return null;
|
|
832
|
-
}
|
|
833
|
-
var serializedNode = Object.assign(_serializedNode, { id: id });
|
|
834
|
-
mirror.add(n, serializedNode);
|
|
835
|
-
if (onSerialize) {
|
|
836
|
-
onSerialize(n);
|
|
837
|
-
}
|
|
838
|
-
var recordChild = !skipChild;
|
|
839
|
-
if (serializedNode.type === NodeType.Element) {
|
|
840
|
-
recordChild = recordChild && !serializedNode.needBlock;
|
|
841
|
-
if (serializedNode.needBlock && serializedNode.tagName === 'img') {
|
|
842
|
-
var clone = n.cloneNode();
|
|
843
|
-
clone.src = '';
|
|
844
|
-
mirror.add(clone, serializedNode);
|
|
845
|
-
}
|
|
846
|
-
delete serializedNode.needBlock;
|
|
847
|
-
if (n.shadowRoot)
|
|
848
|
-
serializedNode.isShadowHost = true;
|
|
849
|
-
}
|
|
850
|
-
if ((serializedNode.type === NodeType.Document ||
|
|
851
|
-
serializedNode.type === NodeType.Element) &&
|
|
852
|
-
recordChild) {
|
|
853
|
-
if (slimDOMOptions.headWhitespace &&
|
|
854
|
-
serializedNode.type === NodeType.Element &&
|
|
855
|
-
serializedNode.tagName === 'head') {
|
|
856
|
-
preserveWhiteSpace = false;
|
|
857
|
-
}
|
|
858
|
-
var bypassOptions = {
|
|
859
|
-
doc: doc,
|
|
860
|
-
mirror: mirror,
|
|
861
|
-
blockClass: blockClass,
|
|
862
|
-
blockSelector: blockSelector,
|
|
863
|
-
maskTextClass: maskTextClass,
|
|
864
|
-
maskTextSelector: maskTextSelector,
|
|
865
|
-
skipChild: skipChild,
|
|
866
|
-
inlineStylesheet: inlineStylesheet,
|
|
867
|
-
maskInputOptions: maskInputOptions,
|
|
868
|
-
maskTextFn: maskTextFn,
|
|
869
|
-
maskInputFn: maskInputFn,
|
|
870
|
-
slimDOMOptions: slimDOMOptions,
|
|
871
|
-
dataURLOptions: dataURLOptions,
|
|
872
|
-
inlineImages: inlineImages,
|
|
873
|
-
recordCanvas: recordCanvas,
|
|
874
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
875
|
-
onSerialize: onSerialize,
|
|
876
|
-
onIframeLoad: onIframeLoad,
|
|
877
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
878
|
-
onStylesheetLoad: onStylesheetLoad,
|
|
879
|
-
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
880
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
881
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
882
|
-
};
|
|
883
|
-
for (var _i = 0, _m = Array.from(n.childNodes); _i < _m.length; _i++) {
|
|
884
|
-
var childN = _m[_i];
|
|
885
|
-
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
886
|
-
if (serializedChildNode) {
|
|
887
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
if (isElement(n) && n.shadowRoot) {
|
|
891
|
-
for (var _o = 0, _p = Array.from(n.shadowRoot.childNodes); _o < _p.length; _o++) {
|
|
892
|
-
var childN = _p[_o];
|
|
893
|
-
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
894
|
-
if (serializedChildNode) {
|
|
895
|
-
serializedChildNode.isShadow = true;
|
|
896
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
if (n.parentNode && isShadowRoot(n.parentNode)) {
|
|
902
|
-
serializedNode.isShadow = true;
|
|
903
|
-
}
|
|
904
|
-
if (serializedNode.type === NodeType.Element &&
|
|
905
|
-
serializedNode.tagName === 'iframe') {
|
|
906
|
-
onceIframeLoaded(n, function () {
|
|
907
|
-
var iframeDoc = n.contentDocument;
|
|
908
|
-
if (iframeDoc && onIframeLoad) {
|
|
909
|
-
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
910
|
-
doc: iframeDoc,
|
|
911
|
-
mirror: mirror,
|
|
912
|
-
blockClass: blockClass,
|
|
913
|
-
blockSelector: blockSelector,
|
|
914
|
-
maskTextClass: maskTextClass,
|
|
915
|
-
maskTextSelector: maskTextSelector,
|
|
916
|
-
skipChild: false,
|
|
917
|
-
inlineStylesheet: inlineStylesheet,
|
|
918
|
-
maskInputOptions: maskInputOptions,
|
|
919
|
-
maskTextFn: maskTextFn,
|
|
920
|
-
maskInputFn: maskInputFn,
|
|
921
|
-
slimDOMOptions: slimDOMOptions,
|
|
922
|
-
dataURLOptions: dataURLOptions,
|
|
923
|
-
inlineImages: inlineImages,
|
|
924
|
-
recordCanvas: recordCanvas,
|
|
925
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
926
|
-
onSerialize: onSerialize,
|
|
927
|
-
onIframeLoad: onIframeLoad,
|
|
928
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
929
|
-
onStylesheetLoad: onStylesheetLoad,
|
|
930
|
-
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
931
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
932
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
933
|
-
});
|
|
934
|
-
if (serializedIframeNode) {
|
|
935
|
-
onIframeLoad(n, serializedIframeNode);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}, iframeLoadTimeout);
|
|
939
|
-
}
|
|
940
|
-
if (serializedNode.type === NodeType.Element &&
|
|
941
|
-
serializedNode.tagName === 'link' &&
|
|
942
|
-
serializedNode.attributes.rel === 'stylesheet') {
|
|
943
|
-
onceStylesheetLoaded(n, function () {
|
|
944
|
-
if (onStylesheetLoad) {
|
|
945
|
-
var serializedLinkNode = serializeNodeWithId(n, {
|
|
946
|
-
doc: doc,
|
|
947
|
-
mirror: mirror,
|
|
948
|
-
blockClass: blockClass,
|
|
949
|
-
blockSelector: blockSelector,
|
|
950
|
-
maskTextClass: maskTextClass,
|
|
951
|
-
maskTextSelector: maskTextSelector,
|
|
952
|
-
skipChild: false,
|
|
953
|
-
inlineStylesheet: inlineStylesheet,
|
|
954
|
-
maskInputOptions: maskInputOptions,
|
|
955
|
-
maskTextFn: maskTextFn,
|
|
956
|
-
maskInputFn: maskInputFn,
|
|
957
|
-
slimDOMOptions: slimDOMOptions,
|
|
958
|
-
dataURLOptions: dataURLOptions,
|
|
959
|
-
inlineImages: inlineImages,
|
|
960
|
-
recordCanvas: recordCanvas,
|
|
961
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
962
|
-
onSerialize: onSerialize,
|
|
963
|
-
onIframeLoad: onIframeLoad,
|
|
964
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
965
|
-
onStylesheetLoad: onStylesheetLoad,
|
|
966
|
-
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
967
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
968
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
969
|
-
});
|
|
970
|
-
if (serializedLinkNode) {
|
|
971
|
-
onStylesheetLoad(n, serializedLinkNode);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}, stylesheetLoadTimeout);
|
|
975
|
-
if (isStylesheetLoaded(n) === false)
|
|
976
|
-
return null;
|
|
977
|
-
}
|
|
978
|
-
return serializedNode;
|
|
979
|
-
}
|
|
980
|
-
function snapshot(n, options) {
|
|
981
|
-
var _a = options || {}, _b = _a.mirror, mirror = _b === void 0 ? new Mirror() : _b, _c = _a.blockClass, blockClass = _c === void 0 ? 'highlight-block' : _c, _d = _a.blockSelector, blockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? 'highlight-mask' : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.inlineStylesheet, inlineStylesheet = _g === void 0 ? true : _g, _h = _a.inlineImages, inlineImages = _h === void 0 ? false : _h, _j = _a.recordCanvas, recordCanvas = _j === void 0 ? false : _j, _k = _a.maskAllInputs, maskAllInputs = _k === void 0 ? false : _k, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _l = _a.slimDOM, slimDOM = _l === void 0 ? false : _l, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, onStylesheetLoad = _a.onStylesheetLoad, stylesheetLoadTimeout = _a.stylesheetLoadTimeout, _m = _a.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function () { return false; } : _m, _o = _a.enableStrictPrivacy, enableStrictPrivacy = _o === void 0 ? false : _o;
|
|
982
|
-
var maskInputOptions = maskAllInputs === true
|
|
983
|
-
? {
|
|
984
|
-
color: true,
|
|
985
|
-
date: true,
|
|
986
|
-
'datetime-local': true,
|
|
987
|
-
email: true,
|
|
988
|
-
month: true,
|
|
989
|
-
number: true,
|
|
990
|
-
range: true,
|
|
991
|
-
search: true,
|
|
992
|
-
tel: true,
|
|
993
|
-
text: true,
|
|
994
|
-
time: true,
|
|
995
|
-
url: true,
|
|
996
|
-
week: true,
|
|
997
|
-
textarea: true,
|
|
998
|
-
select: true,
|
|
999
|
-
password: true
|
|
1000
|
-
}
|
|
1001
|
-
: maskAllInputs === false
|
|
1002
|
-
? {
|
|
1003
|
-
password: true
|
|
1004
|
-
}
|
|
1005
|
-
: maskAllInputs;
|
|
1006
|
-
var slimDOMOptions = slimDOM === true || slimDOM === 'all'
|
|
1007
|
-
?
|
|
1008
|
-
{
|
|
1009
|
-
script: true,
|
|
1010
|
-
comment: true,
|
|
1011
|
-
headFavicon: true,
|
|
1012
|
-
headWhitespace: true,
|
|
1013
|
-
headMetaDescKeywords: slimDOM === 'all',
|
|
1014
|
-
headMetaSocial: true,
|
|
1015
|
-
headMetaRobots: true,
|
|
1016
|
-
headMetaHttpEquiv: true,
|
|
1017
|
-
headMetaAuthorship: true,
|
|
1018
|
-
headMetaVerification: true
|
|
1019
|
-
}
|
|
1020
|
-
: slimDOM === false
|
|
1021
|
-
? {}
|
|
1022
|
-
: slimDOM;
|
|
1023
|
-
return serializeNodeWithId(n, {
|
|
1024
|
-
doc: n,
|
|
1025
|
-
mirror: mirror,
|
|
1026
|
-
blockClass: blockClass,
|
|
1027
|
-
blockSelector: blockSelector,
|
|
1028
|
-
maskTextClass: maskTextClass,
|
|
1029
|
-
maskTextSelector: maskTextSelector,
|
|
1030
|
-
skipChild: false,
|
|
1031
|
-
inlineStylesheet: inlineStylesheet,
|
|
1032
|
-
maskInputOptions: maskInputOptions,
|
|
1033
|
-
maskTextFn: maskTextFn,
|
|
1034
|
-
maskInputFn: maskInputFn,
|
|
1035
|
-
slimDOMOptions: slimDOMOptions,
|
|
1036
|
-
dataURLOptions: dataURLOptions,
|
|
1037
|
-
inlineImages: inlineImages,
|
|
1038
|
-
recordCanvas: recordCanvas,
|
|
1039
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
1040
|
-
onSerialize: onSerialize,
|
|
1041
|
-
onIframeLoad: onIframeLoad,
|
|
1042
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
1043
|
-
onStylesheetLoad: onStylesheetLoad,
|
|
1044
|
-
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1045
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
1046
|
-
newlyAddedElement: false,
|
|
1047
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
1048
|
-
});
|
|
114
|
+
var _id = 1;
|
|
115
|
+
var tagNameRegex = new RegExp('[^a-z0-9-_:]');
|
|
116
|
+
var IGNORED_NODE = -2;
|
|
117
|
+
function genId() {
|
|
118
|
+
return _id++;
|
|
119
|
+
}
|
|
120
|
+
function getValidTagName(element) {
|
|
121
|
+
if (element instanceof HTMLFormElement) {
|
|
122
|
+
return 'form';
|
|
123
|
+
}
|
|
124
|
+
var processedTagName = element.tagName.toLowerCase().trim();
|
|
125
|
+
if (tagNameRegex.test(processedTagName)) {
|
|
126
|
+
return 'div';
|
|
127
|
+
}
|
|
128
|
+
return processedTagName;
|
|
129
|
+
}
|
|
130
|
+
function getCssRulesString(s) {
|
|
131
|
+
try {
|
|
132
|
+
var rules = s.rules || s.cssRules;
|
|
133
|
+
return rules ? Array.from(rules).map(getCssRuleString).join('') : null;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function getCssRuleString(rule) {
|
|
140
|
+
var cssStringified = rule.cssText;
|
|
141
|
+
if (isCSSImportRule(rule)) {
|
|
142
|
+
try {
|
|
143
|
+
cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
|
|
144
|
+
}
|
|
145
|
+
catch (_a) {
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return cssStringified;
|
|
149
|
+
}
|
|
150
|
+
function isCSSImportRule(rule) {
|
|
151
|
+
return 'styleSheet' in rule;
|
|
152
|
+
}
|
|
153
|
+
function stringifyStyleSheet(sheet) {
|
|
154
|
+
return sheet.cssRules
|
|
155
|
+
? Array.from(sheet.cssRules)
|
|
156
|
+
.map(function (rule) { return rule.cssText || ''; })
|
|
157
|
+
.join('')
|
|
158
|
+
: '';
|
|
159
|
+
}
|
|
160
|
+
function extractOrigin(url) {
|
|
161
|
+
var origin = '';
|
|
162
|
+
if (url.indexOf('//') > -1) {
|
|
163
|
+
origin = url.split('/').slice(0, 3).join('/');
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
origin = url.split('/')[0];
|
|
167
|
+
}
|
|
168
|
+
origin = origin.split('?')[0];
|
|
169
|
+
return origin;
|
|
170
|
+
}
|
|
171
|
+
var canvasService;
|
|
172
|
+
var canvasCtx;
|
|
173
|
+
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
174
|
+
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
|
|
175
|
+
var DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
176
|
+
function absoluteToStylesheet(cssText, href) {
|
|
177
|
+
return (cssText || '').replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {
|
|
178
|
+
var filePath = path1 || path2 || path3;
|
|
179
|
+
var maybeQuote = quote1 || quote2 || '';
|
|
180
|
+
if (!filePath) {
|
|
181
|
+
return origin;
|
|
182
|
+
}
|
|
183
|
+
if (!RELATIVE_PATH.test(filePath)) {
|
|
184
|
+
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
185
|
+
}
|
|
186
|
+
if (DATA_URI.test(filePath)) {
|
|
187
|
+
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
188
|
+
}
|
|
189
|
+
if (filePath[0] === '/') {
|
|
190
|
+
return "url(".concat(maybeQuote).concat(extractOrigin(href) + filePath).concat(maybeQuote, ")");
|
|
191
|
+
}
|
|
192
|
+
var stack = href.split('/');
|
|
193
|
+
var parts = filePath.split('/');
|
|
194
|
+
stack.pop();
|
|
195
|
+
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
196
|
+
var part = parts_1[_i];
|
|
197
|
+
if (part === '.') {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
else if (part === '..') {
|
|
201
|
+
stack.pop();
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
stack.push(part);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return "url(".concat(maybeQuote).concat(stack.join('/')).concat(maybeQuote, ")");
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
211
|
+
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
212
|
+
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
213
|
+
if (attributeValue.trim() === '') {
|
|
214
|
+
return attributeValue;
|
|
215
|
+
}
|
|
216
|
+
var pos = 0;
|
|
217
|
+
function collectCharacters(regEx) {
|
|
218
|
+
var chars;
|
|
219
|
+
var match = regEx.exec(attributeValue.substring(pos));
|
|
220
|
+
if (match) {
|
|
221
|
+
chars = match[0];
|
|
222
|
+
pos += chars.length;
|
|
223
|
+
return chars;
|
|
224
|
+
}
|
|
225
|
+
return '';
|
|
226
|
+
}
|
|
227
|
+
var output = [];
|
|
228
|
+
while (true) {
|
|
229
|
+
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
230
|
+
if (pos >= attributeValue.length) {
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
234
|
+
if (url.slice(-1) === ',') {
|
|
235
|
+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
236
|
+
output.push(url);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
var descriptorsStr = '';
|
|
240
|
+
url = absoluteToDoc(doc, url);
|
|
241
|
+
var inParens = false;
|
|
242
|
+
while (true) {
|
|
243
|
+
var c = attributeValue.charAt(pos);
|
|
244
|
+
if (c === '') {
|
|
245
|
+
output.push((url + descriptorsStr).trim());
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
else if (!inParens) {
|
|
249
|
+
if (c === ',') {
|
|
250
|
+
pos += 1;
|
|
251
|
+
output.push((url + descriptorsStr).trim());
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
else if (c === '(') {
|
|
255
|
+
inParens = true;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
if (c === ')') {
|
|
260
|
+
inParens = false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
descriptorsStr += c;
|
|
264
|
+
pos += 1;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return output.join(', ');
|
|
269
|
+
}
|
|
270
|
+
function absoluteToDoc(doc, attributeValue) {
|
|
271
|
+
if (!attributeValue || attributeValue.trim() === '') {
|
|
272
|
+
return attributeValue;
|
|
273
|
+
}
|
|
274
|
+
var a = doc.createElement('a');
|
|
275
|
+
a.href = attributeValue;
|
|
276
|
+
return a.href;
|
|
277
|
+
}
|
|
278
|
+
function isSVGElement(el) {
|
|
279
|
+
return Boolean(el.tagName === 'svg' || el.ownerSVGElement);
|
|
280
|
+
}
|
|
281
|
+
function getHref() {
|
|
282
|
+
var a = document.createElement('a');
|
|
283
|
+
a.href = '';
|
|
284
|
+
return a.href;
|
|
285
|
+
}
|
|
286
|
+
function transformAttribute(doc, tagName, name, value) {
|
|
287
|
+
if (name === 'src' || (name === 'href' && value)) {
|
|
288
|
+
return absoluteToDoc(doc, value);
|
|
289
|
+
}
|
|
290
|
+
else if (name === 'xlink:href' && value && value[0] !== '#') {
|
|
291
|
+
return absoluteToDoc(doc, value);
|
|
292
|
+
}
|
|
293
|
+
else if (name === 'background' &&
|
|
294
|
+
value &&
|
|
295
|
+
(tagName === 'table' || tagName === 'td' || tagName === 'th')) {
|
|
296
|
+
return absoluteToDoc(doc, value);
|
|
297
|
+
}
|
|
298
|
+
else if (name === 'srcset' && value) {
|
|
299
|
+
return getAbsoluteSrcsetString(doc, value);
|
|
300
|
+
}
|
|
301
|
+
else if (name === 'style' && value) {
|
|
302
|
+
return absoluteToStylesheet(value, getHref());
|
|
303
|
+
}
|
|
304
|
+
else if (tagName === 'object' && name === 'data' && value) {
|
|
305
|
+
return absoluteToDoc(doc, value);
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
return value;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
312
|
+
if (typeof blockClass === 'string') {
|
|
313
|
+
if (element.classList.contains(blockClass)) {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
for (var eIndex = element.classList.length; eIndex--;) {
|
|
319
|
+
var className = element.classList[eIndex];
|
|
320
|
+
if (blockClass.test(className)) {
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (blockSelector) {
|
|
326
|
+
return element.matches(blockSelector);
|
|
327
|
+
}
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
function classMatchesRegex(node, regex, checkAncestors) {
|
|
331
|
+
if (!node)
|
|
332
|
+
return false;
|
|
333
|
+
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
334
|
+
if (!checkAncestors)
|
|
335
|
+
return false;
|
|
336
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
337
|
+
}
|
|
338
|
+
for (var eIndex = node.classList.length; eIndex--;) {
|
|
339
|
+
var className = node.classList[eIndex];
|
|
340
|
+
if (regex.test(className)) {
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (!checkAncestors)
|
|
345
|
+
return false;
|
|
346
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
347
|
+
}
|
|
348
|
+
function needMaskingText(node, maskTextClass, maskTextSelector) {
|
|
349
|
+
var el = node.nodeType === node.ELEMENT_NODE
|
|
350
|
+
? node
|
|
351
|
+
: node.parentElement;
|
|
352
|
+
if (el === null)
|
|
353
|
+
return false;
|
|
354
|
+
if (typeof maskTextClass === 'string') {
|
|
355
|
+
if (el.classList.contains(maskTextClass))
|
|
356
|
+
return true;
|
|
357
|
+
if (el.closest(".".concat(maskTextClass)))
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
if (classMatchesRegex(el, maskTextClass, true))
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
if (maskTextSelector) {
|
|
365
|
+
if (el.matches(maskTextSelector))
|
|
366
|
+
return true;
|
|
367
|
+
if (el.closest(maskTextSelector))
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
373
|
+
var win = iframeEl.contentWindow;
|
|
374
|
+
if (!win) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
var fired = false;
|
|
378
|
+
var readyState;
|
|
379
|
+
try {
|
|
380
|
+
readyState = win.document.readyState;
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (readyState !== 'complete') {
|
|
386
|
+
var timer_1 = setTimeout(function () {
|
|
387
|
+
if (!fired) {
|
|
388
|
+
listener();
|
|
389
|
+
fired = true;
|
|
390
|
+
}
|
|
391
|
+
}, iframeLoadTimeout);
|
|
392
|
+
iframeEl.addEventListener('load', function () {
|
|
393
|
+
clearTimeout(timer_1);
|
|
394
|
+
fired = true;
|
|
395
|
+
listener();
|
|
396
|
+
});
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
var blankUrl = 'about:blank';
|
|
400
|
+
if (win.location.href !== blankUrl ||
|
|
401
|
+
iframeEl.src === blankUrl ||
|
|
402
|
+
iframeEl.src === '') {
|
|
403
|
+
setTimeout(listener, 0);
|
|
404
|
+
return iframeEl.addEventListener('load', listener);
|
|
405
|
+
}
|
|
406
|
+
iframeEl.addEventListener('load', listener);
|
|
407
|
+
}
|
|
408
|
+
function isStylesheetLoaded(link) {
|
|
409
|
+
if (!link.getAttribute('href'))
|
|
410
|
+
return true;
|
|
411
|
+
return link.sheet !== null;
|
|
412
|
+
}
|
|
413
|
+
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
414
|
+
var fired = false;
|
|
415
|
+
var styleSheetLoaded;
|
|
416
|
+
try {
|
|
417
|
+
styleSheetLoaded = link.sheet;
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (styleSheetLoaded)
|
|
423
|
+
return;
|
|
424
|
+
var timer = setTimeout(function () {
|
|
425
|
+
if (!fired) {
|
|
426
|
+
listener();
|
|
427
|
+
fired = true;
|
|
428
|
+
}
|
|
429
|
+
}, styleSheetLoadTimeout);
|
|
430
|
+
link.addEventListener('load', function () {
|
|
431
|
+
clearTimeout(timer);
|
|
432
|
+
fired = true;
|
|
433
|
+
listener();
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function serializeNode(n, options) {
|
|
437
|
+
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
438
|
+
var rootId = getRootId(doc, mirror);
|
|
439
|
+
switch (n.nodeType) {
|
|
440
|
+
case n.DOCUMENT_NODE:
|
|
441
|
+
if (n.compatMode !== 'CSS1Compat') {
|
|
442
|
+
return {
|
|
443
|
+
type: NodeType.Document,
|
|
444
|
+
childNodes: [],
|
|
445
|
+
compatMode: n.compatMode,
|
|
446
|
+
rootId: rootId
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
return {
|
|
451
|
+
type: NodeType.Document,
|
|
452
|
+
childNodes: [],
|
|
453
|
+
rootId: rootId
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
case n.DOCUMENT_TYPE_NODE:
|
|
457
|
+
return {
|
|
458
|
+
type: NodeType.DocumentType,
|
|
459
|
+
name: n.name,
|
|
460
|
+
publicId: n.publicId,
|
|
461
|
+
systemId: n.systemId,
|
|
462
|
+
rootId: rootId
|
|
463
|
+
};
|
|
464
|
+
case n.ELEMENT_NODE:
|
|
465
|
+
return serializeElementNode(n, {
|
|
466
|
+
doc: doc,
|
|
467
|
+
blockClass: blockClass,
|
|
468
|
+
blockSelector: blockSelector,
|
|
469
|
+
inlineStylesheet: inlineStylesheet,
|
|
470
|
+
maskInputOptions: maskInputOptions,
|
|
471
|
+
maskInputFn: maskInputFn,
|
|
472
|
+
dataURLOptions: dataURLOptions,
|
|
473
|
+
inlineImages: inlineImages,
|
|
474
|
+
recordCanvas: recordCanvas,
|
|
475
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
476
|
+
newlyAddedElement: newlyAddedElement,
|
|
477
|
+
enableStrictPrivacy: enableStrictPrivacy,
|
|
478
|
+
rootId: rootId
|
|
479
|
+
});
|
|
480
|
+
case n.TEXT_NODE:
|
|
481
|
+
return serializeTextNode(n, {
|
|
482
|
+
maskTextClass: maskTextClass,
|
|
483
|
+
maskTextSelector: maskTextSelector,
|
|
484
|
+
maskTextFn: maskTextFn,
|
|
485
|
+
enableStrictPrivacy: enableStrictPrivacy,
|
|
486
|
+
rootId: rootId
|
|
487
|
+
});
|
|
488
|
+
case n.CDATA_SECTION_NODE:
|
|
489
|
+
return {
|
|
490
|
+
type: NodeType.CDATA,
|
|
491
|
+
textContent: '',
|
|
492
|
+
rootId: rootId
|
|
493
|
+
};
|
|
494
|
+
case n.COMMENT_NODE:
|
|
495
|
+
return {
|
|
496
|
+
type: NodeType.Comment,
|
|
497
|
+
textContent: n.textContent || '',
|
|
498
|
+
rootId: rootId
|
|
499
|
+
};
|
|
500
|
+
default:
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function getRootId(doc, mirror) {
|
|
505
|
+
if (!mirror.hasNode(doc))
|
|
506
|
+
return undefined;
|
|
507
|
+
var docId = mirror.getId(doc);
|
|
508
|
+
return docId === 1 ? undefined : docId;
|
|
509
|
+
}
|
|
510
|
+
function serializeTextNode(n, options) {
|
|
511
|
+
var _a;
|
|
512
|
+
var maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, maskTextFn = options.maskTextFn, enableStrictPrivacy = options.enableStrictPrivacy, rootId = options.rootId;
|
|
513
|
+
var parentTagName = n.parentNode && n.parentNode.tagName;
|
|
514
|
+
var textContent = n.textContent;
|
|
515
|
+
var isStyle = parentTagName === 'STYLE' ? true : undefined;
|
|
516
|
+
var isScript = parentTagName === 'SCRIPT' ? true : undefined;
|
|
517
|
+
var textContentHandled = false;
|
|
518
|
+
if (isStyle && textContent) {
|
|
519
|
+
try {
|
|
520
|
+
if (n.nextSibling || n.previousSibling) {
|
|
521
|
+
}
|
|
522
|
+
else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
|
|
523
|
+
textContent = stringifyStyleSheet(n.parentNode.sheet);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
catch (err) {
|
|
527
|
+
console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(err), n);
|
|
528
|
+
}
|
|
529
|
+
textContent = absoluteToStylesheet(textContent, getHref());
|
|
530
|
+
textContentHandled = true;
|
|
531
|
+
}
|
|
532
|
+
if (isScript) {
|
|
533
|
+
textContent = 'SCRIPT_PLACEHOLDER';
|
|
534
|
+
textContentHandled = true;
|
|
535
|
+
}
|
|
536
|
+
else if (parentTagName === 'NOSCRIPT') {
|
|
537
|
+
textContent = '';
|
|
538
|
+
textContentHandled = true;
|
|
539
|
+
}
|
|
540
|
+
if (!isStyle &&
|
|
541
|
+
!isScript &&
|
|
542
|
+
textContent &&
|
|
543
|
+
needMaskingText(n, maskTextClass, maskTextSelector)) {
|
|
544
|
+
textContent = maskTextFn
|
|
545
|
+
? maskTextFn(textContent)
|
|
546
|
+
: textContent.replace(/[\S]/g, '*');
|
|
547
|
+
}
|
|
548
|
+
if (enableStrictPrivacy && !textContentHandled && parentTagName) {
|
|
549
|
+
var IGNORE_TAG_NAMES = new Set([
|
|
550
|
+
'HEAD',
|
|
551
|
+
'TITLE',
|
|
552
|
+
'STYLE',
|
|
553
|
+
'SCRIPT',
|
|
554
|
+
'HTML',
|
|
555
|
+
'BODY',
|
|
556
|
+
'NOSCRIPT',
|
|
557
|
+
]);
|
|
558
|
+
if (!IGNORE_TAG_NAMES.has(parentTagName) && textContent) {
|
|
559
|
+
textContent = obfuscateText(textContent);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return {
|
|
563
|
+
type: NodeType.Text,
|
|
564
|
+
textContent: textContent || '',
|
|
565
|
+
isStyle: isStyle,
|
|
566
|
+
rootId: rootId
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function serializeElementNode(n, options) {
|
|
570
|
+
var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c, enableStrictPrivacy = options.enableStrictPrivacy, rootId = options.rootId;
|
|
571
|
+
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
572
|
+
var tagName = getValidTagName(n);
|
|
573
|
+
var attributes = {};
|
|
574
|
+
var len = n.attributes.length;
|
|
575
|
+
for (var i = 0; i < len; i++) {
|
|
576
|
+
var attr = n.attributes[i];
|
|
577
|
+
attributes[attr.name] = transformAttribute(doc, tagName, attr.name, attr.value);
|
|
578
|
+
}
|
|
579
|
+
if (tagName === 'link' && inlineStylesheet) {
|
|
580
|
+
var stylesheet = Array.from(doc.styleSheets).find(function (s) {
|
|
581
|
+
return s.href === n.href;
|
|
582
|
+
});
|
|
583
|
+
var cssText = null;
|
|
584
|
+
if (stylesheet) {
|
|
585
|
+
cssText = getCssRulesString(stylesheet);
|
|
586
|
+
}
|
|
587
|
+
if (cssText) {
|
|
588
|
+
delete attributes.rel;
|
|
589
|
+
delete attributes.href;
|
|
590
|
+
attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (tagName === 'style' &&
|
|
594
|
+
n.sheet &&
|
|
595
|
+
!(n.innerText || n.textContent || '').trim().length) {
|
|
596
|
+
var cssText = getCssRulesString(n.sheet);
|
|
597
|
+
if (cssText) {
|
|
598
|
+
attributes._cssText = absoluteToStylesheet(cssText, getHref());
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (tagName === 'input' || tagName === 'textarea' || tagName === 'select') {
|
|
602
|
+
var value = n.value;
|
|
603
|
+
if (attributes.type !== 'radio' &&
|
|
604
|
+
attributes.type !== 'checkbox' &&
|
|
605
|
+
attributes.type !== 'submit' &&
|
|
606
|
+
attributes.type !== 'button' &&
|
|
607
|
+
value) {
|
|
608
|
+
attributes.value = maskInputValue({
|
|
609
|
+
type: attributes.type,
|
|
610
|
+
tagName: tagName,
|
|
611
|
+
value: value,
|
|
612
|
+
maskInputOptions: maskInputOptions,
|
|
613
|
+
maskInputFn: maskInputFn
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
else if (n.checked) {
|
|
617
|
+
attributes.checked = n.checked;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (tagName === 'option') {
|
|
621
|
+
if (n.selected && !maskInputOptions['select']) {
|
|
622
|
+
attributes.selected = true;
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
delete attributes.selected;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (tagName === 'canvas' && recordCanvas) {
|
|
629
|
+
if (n.__context === '2d') {
|
|
630
|
+
if (!is2DCanvasBlank(n)) {
|
|
631
|
+
attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
else if (!('__context' in n)) {
|
|
635
|
+
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
636
|
+
var blankCanvas = document.createElement('canvas');
|
|
637
|
+
blankCanvas.width = n.width;
|
|
638
|
+
blankCanvas.height = n.height;
|
|
639
|
+
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
640
|
+
if (canvasDataURL !== blankCanvasDataURL) {
|
|
641
|
+
attributes.rr_dataURL = canvasDataURL;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (tagName === 'img' && inlineImages) {
|
|
646
|
+
if (!canvasService) {
|
|
647
|
+
canvasService = doc.createElement('canvas');
|
|
648
|
+
canvasCtx = canvasService.getContext('2d');
|
|
649
|
+
}
|
|
650
|
+
var image_1 = n;
|
|
651
|
+
var oldValue_1 = image_1.crossOrigin;
|
|
652
|
+
image_1.crossOrigin = 'anonymous';
|
|
653
|
+
var recordInlineImage = function () {
|
|
654
|
+
try {
|
|
655
|
+
canvasService.width = image_1.naturalWidth;
|
|
656
|
+
canvasService.height = image_1.naturalHeight;
|
|
657
|
+
canvasCtx.drawImage(image_1, 0, 0);
|
|
658
|
+
attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
659
|
+
}
|
|
660
|
+
catch (err) {
|
|
661
|
+
console.warn("Cannot inline img src=".concat(image_1.currentSrc, "! Error: ").concat(err));
|
|
662
|
+
}
|
|
663
|
+
oldValue_1
|
|
664
|
+
? (attributes.crossOrigin = oldValue_1)
|
|
665
|
+
: image_1.removeAttribute('crossorigin');
|
|
666
|
+
};
|
|
667
|
+
if (image_1.complete && image_1.naturalWidth !== 0)
|
|
668
|
+
recordInlineImage();
|
|
669
|
+
else
|
|
670
|
+
image_1.onload = recordInlineImage;
|
|
671
|
+
}
|
|
672
|
+
if (tagName === 'audio' || tagName === 'video') {
|
|
673
|
+
attributes.rr_mediaState = n.paused
|
|
674
|
+
? 'paused'
|
|
675
|
+
: 'played';
|
|
676
|
+
attributes.rr_mediaCurrentTime = n.currentTime;
|
|
677
|
+
}
|
|
678
|
+
if (!newlyAddedElement) {
|
|
679
|
+
if (n.scrollLeft) {
|
|
680
|
+
attributes.rr_scrollLeft = n.scrollLeft;
|
|
681
|
+
}
|
|
682
|
+
if (n.scrollTop) {
|
|
683
|
+
attributes.rr_scrollTop = n.scrollTop;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
if (needBlock || (tagName === 'img' && enableStrictPrivacy)) {
|
|
687
|
+
var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
|
|
688
|
+
attributes = {
|
|
689
|
+
"class": attributes["class"],
|
|
690
|
+
rr_width: "".concat(width, "px"),
|
|
691
|
+
rr_height: "".concat(height, "px")
|
|
692
|
+
};
|
|
693
|
+
needBlock = true;
|
|
694
|
+
}
|
|
695
|
+
if (tagName === 'iframe' && !keepIframeSrcFn(attributes.src)) {
|
|
696
|
+
if (!n.contentDocument) {
|
|
697
|
+
attributes.rr_src = attributes.src;
|
|
698
|
+
}
|
|
699
|
+
delete attributes.src;
|
|
700
|
+
}
|
|
701
|
+
return {
|
|
702
|
+
type: NodeType.Element,
|
|
703
|
+
tagName: tagName,
|
|
704
|
+
attributes: attributes,
|
|
705
|
+
childNodes: [],
|
|
706
|
+
isSVG: isSVGElement(n) || undefined,
|
|
707
|
+
needBlock: needBlock,
|
|
708
|
+
rootId: rootId
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
function lowerIfExists(maybeAttr) {
|
|
712
|
+
if (maybeAttr === undefined) {
|
|
713
|
+
return '';
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
return maybeAttr.toLowerCase();
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
720
|
+
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
721
|
+
return true;
|
|
722
|
+
}
|
|
723
|
+
else if (sn.type === NodeType.Element) {
|
|
724
|
+
if (slimDOMOptions.script &&
|
|
725
|
+
(sn.tagName === 'script' ||
|
|
726
|
+
(sn.tagName === 'link' &&
|
|
727
|
+
sn.attributes.rel === 'preload' &&
|
|
728
|
+
sn.attributes.as === 'script') ||
|
|
729
|
+
(sn.tagName === 'link' &&
|
|
730
|
+
sn.attributes.rel === 'prefetch' &&
|
|
731
|
+
typeof sn.attributes.href === 'string' &&
|
|
732
|
+
sn.attributes.href.endsWith('.js')))) {
|
|
733
|
+
return true;
|
|
734
|
+
}
|
|
735
|
+
else if (slimDOMOptions.headFavicon &&
|
|
736
|
+
((sn.tagName === 'link' && sn.attributes.rel === 'shortcut icon') ||
|
|
737
|
+
(sn.tagName === 'meta' &&
|
|
738
|
+
(lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) ||
|
|
739
|
+
lowerIfExists(sn.attributes.name) === 'application-name' ||
|
|
740
|
+
lowerIfExists(sn.attributes.rel) === 'icon' ||
|
|
741
|
+
lowerIfExists(sn.attributes.rel) === 'apple-touch-icon' ||
|
|
742
|
+
lowerIfExists(sn.attributes.rel) === 'shortcut icon')))) {
|
|
743
|
+
return true;
|
|
744
|
+
}
|
|
745
|
+
else if (sn.tagName === 'meta') {
|
|
746
|
+
if (slimDOMOptions.headMetaDescKeywords &&
|
|
747
|
+
lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
748
|
+
return true;
|
|
749
|
+
}
|
|
750
|
+
else if (slimDOMOptions.headMetaSocial &&
|
|
751
|
+
(lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) ||
|
|
752
|
+
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) ||
|
|
753
|
+
lowerIfExists(sn.attributes.name) === 'pinterest')) {
|
|
754
|
+
return true;
|
|
755
|
+
}
|
|
756
|
+
else if (slimDOMOptions.headMetaRobots &&
|
|
757
|
+
(lowerIfExists(sn.attributes.name) === 'robots' ||
|
|
758
|
+
lowerIfExists(sn.attributes.name) === 'googlebot' ||
|
|
759
|
+
lowerIfExists(sn.attributes.name) === 'bingbot')) {
|
|
760
|
+
return true;
|
|
761
|
+
}
|
|
762
|
+
else if (slimDOMOptions.headMetaHttpEquiv &&
|
|
763
|
+
sn.attributes['http-equiv'] !== undefined) {
|
|
764
|
+
return true;
|
|
765
|
+
}
|
|
766
|
+
else if (slimDOMOptions.headMetaAuthorship &&
|
|
767
|
+
(lowerIfExists(sn.attributes.name) === 'author' ||
|
|
768
|
+
lowerIfExists(sn.attributes.name) === 'generator' ||
|
|
769
|
+
lowerIfExists(sn.attributes.name) === 'framework' ||
|
|
770
|
+
lowerIfExists(sn.attributes.name) === 'publisher' ||
|
|
771
|
+
lowerIfExists(sn.attributes.name) === 'progid' ||
|
|
772
|
+
lowerIfExists(sn.attributes.property).match(/^article:/) ||
|
|
773
|
+
lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
774
|
+
return true;
|
|
775
|
+
}
|
|
776
|
+
else if (slimDOMOptions.headMetaVerification &&
|
|
777
|
+
(lowerIfExists(sn.attributes.name) === 'google-site-verification' ||
|
|
778
|
+
lowerIfExists(sn.attributes.name) === 'yandex-verification' ||
|
|
779
|
+
lowerIfExists(sn.attributes.name) === 'csrf-token' ||
|
|
780
|
+
lowerIfExists(sn.attributes.name) === 'p:domain_verify' ||
|
|
781
|
+
lowerIfExists(sn.attributes.name) === 'verify-v1' ||
|
|
782
|
+
lowerIfExists(sn.attributes.name) === 'verification' ||
|
|
783
|
+
lowerIfExists(sn.attributes.name) === 'shopify-checkout-api-token')) {
|
|
784
|
+
return true;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return false;
|
|
789
|
+
}
|
|
790
|
+
function serializeNodeWithId(n, options) {
|
|
791
|
+
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, onStylesheetLoad = options.onStylesheetLoad, _h = options.stylesheetLoadTimeout, stylesheetLoadTimeout = _h === void 0 ? 5000 : _h, _j = options.keepIframeSrcFn, keepIframeSrcFn = _j === void 0 ? function () { return false; } : _j, _k = options.newlyAddedElement, newlyAddedElement = _k === void 0 ? false : _k, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
792
|
+
var _l = options.preserveWhiteSpace, preserveWhiteSpace = _l === void 0 ? true : _l;
|
|
793
|
+
var _serializedNode = serializeNode(n, {
|
|
794
|
+
doc: doc,
|
|
795
|
+
mirror: mirror,
|
|
796
|
+
blockClass: blockClass,
|
|
797
|
+
blockSelector: blockSelector,
|
|
798
|
+
maskTextClass: maskTextClass,
|
|
799
|
+
maskTextSelector: maskTextSelector,
|
|
800
|
+
inlineStylesheet: inlineStylesheet,
|
|
801
|
+
maskInputOptions: maskInputOptions,
|
|
802
|
+
maskTextFn: maskTextFn,
|
|
803
|
+
maskInputFn: maskInputFn,
|
|
804
|
+
dataURLOptions: dataURLOptions,
|
|
805
|
+
inlineImages: inlineImages,
|
|
806
|
+
recordCanvas: recordCanvas,
|
|
807
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
808
|
+
newlyAddedElement: newlyAddedElement,
|
|
809
|
+
enableStrictPrivacy: enableStrictPrivacy
|
|
810
|
+
});
|
|
811
|
+
if (!_serializedNode) {
|
|
812
|
+
console.warn(n, 'not serialized');
|
|
813
|
+
return null;
|
|
814
|
+
}
|
|
815
|
+
var id;
|
|
816
|
+
if (mirror.hasNode(n)) {
|
|
817
|
+
id = mirror.getId(n);
|
|
818
|
+
}
|
|
819
|
+
else if (slimDOMExcluded(_serializedNode, slimDOMOptions) ||
|
|
820
|
+
(!preserveWhiteSpace &&
|
|
821
|
+
_serializedNode.type === NodeType.Text &&
|
|
822
|
+
!_serializedNode.isStyle &&
|
|
823
|
+
!_serializedNode.textContent.replace(/^\s+|\s+$/gm, '').length)) {
|
|
824
|
+
id = IGNORED_NODE;
|
|
825
|
+
}
|
|
826
|
+
else {
|
|
827
|
+
id = genId();
|
|
828
|
+
}
|
|
829
|
+
if (id === IGNORED_NODE) {
|
|
830
|
+
return null;
|
|
831
|
+
}
|
|
832
|
+
var serializedNode = Object.assign(_serializedNode, { id: id });
|
|
833
|
+
mirror.add(n, serializedNode);
|
|
834
|
+
if (onSerialize) {
|
|
835
|
+
onSerialize(n);
|
|
836
|
+
}
|
|
837
|
+
var recordChild = !skipChild;
|
|
838
|
+
if (serializedNode.type === NodeType.Element) {
|
|
839
|
+
recordChild = recordChild && !serializedNode.needBlock;
|
|
840
|
+
if (serializedNode.needBlock && serializedNode.tagName === 'img') {
|
|
841
|
+
var clone = n.cloneNode();
|
|
842
|
+
clone.src = '';
|
|
843
|
+
mirror.add(clone, serializedNode);
|
|
844
|
+
}
|
|
845
|
+
delete serializedNode.needBlock;
|
|
846
|
+
if (n.shadowRoot)
|
|
847
|
+
serializedNode.isShadowHost = true;
|
|
848
|
+
}
|
|
849
|
+
if ((serializedNode.type === NodeType.Document ||
|
|
850
|
+
serializedNode.type === NodeType.Element) &&
|
|
851
|
+
recordChild) {
|
|
852
|
+
if (slimDOMOptions.headWhitespace &&
|
|
853
|
+
serializedNode.type === NodeType.Element &&
|
|
854
|
+
serializedNode.tagName === 'head') {
|
|
855
|
+
preserveWhiteSpace = false;
|
|
856
|
+
}
|
|
857
|
+
var bypassOptions = {
|
|
858
|
+
doc: doc,
|
|
859
|
+
mirror: mirror,
|
|
860
|
+
blockClass: blockClass,
|
|
861
|
+
blockSelector: blockSelector,
|
|
862
|
+
maskTextClass: maskTextClass,
|
|
863
|
+
maskTextSelector: maskTextSelector,
|
|
864
|
+
skipChild: skipChild,
|
|
865
|
+
inlineStylesheet: inlineStylesheet,
|
|
866
|
+
maskInputOptions: maskInputOptions,
|
|
867
|
+
maskTextFn: maskTextFn,
|
|
868
|
+
maskInputFn: maskInputFn,
|
|
869
|
+
slimDOMOptions: slimDOMOptions,
|
|
870
|
+
dataURLOptions: dataURLOptions,
|
|
871
|
+
inlineImages: inlineImages,
|
|
872
|
+
recordCanvas: recordCanvas,
|
|
873
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
874
|
+
onSerialize: onSerialize,
|
|
875
|
+
onIframeLoad: onIframeLoad,
|
|
876
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
877
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
878
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
879
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
880
|
+
enableStrictPrivacy: enableStrictPrivacy
|
|
881
|
+
};
|
|
882
|
+
for (var _i = 0, _m = Array.from(n.childNodes); _i < _m.length; _i++) {
|
|
883
|
+
var childN = _m[_i];
|
|
884
|
+
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
885
|
+
if (serializedChildNode) {
|
|
886
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
if (isElement(n) && n.shadowRoot) {
|
|
890
|
+
for (var _o = 0, _p = Array.from(n.shadowRoot.childNodes); _o < _p.length; _o++) {
|
|
891
|
+
var childN = _p[_o];
|
|
892
|
+
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
893
|
+
if (serializedChildNode) {
|
|
894
|
+
serializedChildNode.isShadow = true;
|
|
895
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
if (n.parentNode && isShadowRoot(n.parentNode)) {
|
|
901
|
+
serializedNode.isShadow = true;
|
|
902
|
+
}
|
|
903
|
+
if (serializedNode.type === NodeType.Element &&
|
|
904
|
+
serializedNode.tagName === 'iframe') {
|
|
905
|
+
onceIframeLoaded(n, function () {
|
|
906
|
+
var iframeDoc = n.contentDocument;
|
|
907
|
+
if (iframeDoc && onIframeLoad) {
|
|
908
|
+
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
909
|
+
doc: iframeDoc,
|
|
910
|
+
mirror: mirror,
|
|
911
|
+
blockClass: blockClass,
|
|
912
|
+
blockSelector: blockSelector,
|
|
913
|
+
maskTextClass: maskTextClass,
|
|
914
|
+
maskTextSelector: maskTextSelector,
|
|
915
|
+
skipChild: false,
|
|
916
|
+
inlineStylesheet: inlineStylesheet,
|
|
917
|
+
maskInputOptions: maskInputOptions,
|
|
918
|
+
maskTextFn: maskTextFn,
|
|
919
|
+
maskInputFn: maskInputFn,
|
|
920
|
+
slimDOMOptions: slimDOMOptions,
|
|
921
|
+
dataURLOptions: dataURLOptions,
|
|
922
|
+
inlineImages: inlineImages,
|
|
923
|
+
recordCanvas: recordCanvas,
|
|
924
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
925
|
+
onSerialize: onSerialize,
|
|
926
|
+
onIframeLoad: onIframeLoad,
|
|
927
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
928
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
929
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
930
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
931
|
+
enableStrictPrivacy: enableStrictPrivacy
|
|
932
|
+
});
|
|
933
|
+
if (serializedIframeNode) {
|
|
934
|
+
onIframeLoad(n, serializedIframeNode);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}, iframeLoadTimeout);
|
|
938
|
+
}
|
|
939
|
+
if (serializedNode.type === NodeType.Element &&
|
|
940
|
+
serializedNode.tagName === 'link' &&
|
|
941
|
+
serializedNode.attributes.rel === 'stylesheet') {
|
|
942
|
+
onceStylesheetLoaded(n, function () {
|
|
943
|
+
if (onStylesheetLoad) {
|
|
944
|
+
var serializedLinkNode = serializeNodeWithId(n, {
|
|
945
|
+
doc: doc,
|
|
946
|
+
mirror: mirror,
|
|
947
|
+
blockClass: blockClass,
|
|
948
|
+
blockSelector: blockSelector,
|
|
949
|
+
maskTextClass: maskTextClass,
|
|
950
|
+
maskTextSelector: maskTextSelector,
|
|
951
|
+
skipChild: false,
|
|
952
|
+
inlineStylesheet: inlineStylesheet,
|
|
953
|
+
maskInputOptions: maskInputOptions,
|
|
954
|
+
maskTextFn: maskTextFn,
|
|
955
|
+
maskInputFn: maskInputFn,
|
|
956
|
+
slimDOMOptions: slimDOMOptions,
|
|
957
|
+
dataURLOptions: dataURLOptions,
|
|
958
|
+
inlineImages: inlineImages,
|
|
959
|
+
recordCanvas: recordCanvas,
|
|
960
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
961
|
+
onSerialize: onSerialize,
|
|
962
|
+
onIframeLoad: onIframeLoad,
|
|
963
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
964
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
965
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
966
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
967
|
+
enableStrictPrivacy: enableStrictPrivacy
|
|
968
|
+
});
|
|
969
|
+
if (serializedLinkNode) {
|
|
970
|
+
onStylesheetLoad(n, serializedLinkNode);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}, stylesheetLoadTimeout);
|
|
974
|
+
if (isStylesheetLoaded(n) === false)
|
|
975
|
+
return null;
|
|
976
|
+
}
|
|
977
|
+
return serializedNode;
|
|
978
|
+
}
|
|
979
|
+
function snapshot(n, options) {
|
|
980
|
+
var _a = options || {}, _b = _a.mirror, mirror = _b === void 0 ? new Mirror() : _b, _c = _a.blockClass, blockClass = _c === void 0 ? 'highlight-block' : _c, _d = _a.blockSelector, blockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? 'highlight-mask' : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.inlineStylesheet, inlineStylesheet = _g === void 0 ? true : _g, _h = _a.inlineImages, inlineImages = _h === void 0 ? false : _h, _j = _a.recordCanvas, recordCanvas = _j === void 0 ? false : _j, _k = _a.maskAllInputs, maskAllInputs = _k === void 0 ? false : _k, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _l = _a.slimDOM, slimDOM = _l === void 0 ? false : _l, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, onStylesheetLoad = _a.onStylesheetLoad, stylesheetLoadTimeout = _a.stylesheetLoadTimeout, _m = _a.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function () { return false; } : _m, _o = _a.enableStrictPrivacy, enableStrictPrivacy = _o === void 0 ? false : _o;
|
|
981
|
+
var maskInputOptions = maskAllInputs === true
|
|
982
|
+
? {
|
|
983
|
+
color: true,
|
|
984
|
+
date: true,
|
|
985
|
+
'datetime-local': true,
|
|
986
|
+
email: true,
|
|
987
|
+
month: true,
|
|
988
|
+
number: true,
|
|
989
|
+
range: true,
|
|
990
|
+
search: true,
|
|
991
|
+
tel: true,
|
|
992
|
+
text: true,
|
|
993
|
+
time: true,
|
|
994
|
+
url: true,
|
|
995
|
+
week: true,
|
|
996
|
+
textarea: true,
|
|
997
|
+
select: true,
|
|
998
|
+
password: true
|
|
999
|
+
}
|
|
1000
|
+
: maskAllInputs === false
|
|
1001
|
+
? {
|
|
1002
|
+
password: true
|
|
1003
|
+
}
|
|
1004
|
+
: maskAllInputs;
|
|
1005
|
+
var slimDOMOptions = slimDOM === true || slimDOM === 'all'
|
|
1006
|
+
?
|
|
1007
|
+
{
|
|
1008
|
+
script: true,
|
|
1009
|
+
comment: true,
|
|
1010
|
+
headFavicon: true,
|
|
1011
|
+
headWhitespace: true,
|
|
1012
|
+
headMetaDescKeywords: slimDOM === 'all',
|
|
1013
|
+
headMetaSocial: true,
|
|
1014
|
+
headMetaRobots: true,
|
|
1015
|
+
headMetaHttpEquiv: true,
|
|
1016
|
+
headMetaAuthorship: true,
|
|
1017
|
+
headMetaVerification: true
|
|
1018
|
+
}
|
|
1019
|
+
: slimDOM === false
|
|
1020
|
+
? {}
|
|
1021
|
+
: slimDOM;
|
|
1022
|
+
return serializeNodeWithId(n, {
|
|
1023
|
+
doc: n,
|
|
1024
|
+
mirror: mirror,
|
|
1025
|
+
blockClass: blockClass,
|
|
1026
|
+
blockSelector: blockSelector,
|
|
1027
|
+
maskTextClass: maskTextClass,
|
|
1028
|
+
maskTextSelector: maskTextSelector,
|
|
1029
|
+
skipChild: false,
|
|
1030
|
+
inlineStylesheet: inlineStylesheet,
|
|
1031
|
+
maskInputOptions: maskInputOptions,
|
|
1032
|
+
maskTextFn: maskTextFn,
|
|
1033
|
+
maskInputFn: maskInputFn,
|
|
1034
|
+
slimDOMOptions: slimDOMOptions,
|
|
1035
|
+
dataURLOptions: dataURLOptions,
|
|
1036
|
+
inlineImages: inlineImages,
|
|
1037
|
+
recordCanvas: recordCanvas,
|
|
1038
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
1039
|
+
onSerialize: onSerialize,
|
|
1040
|
+
onIframeLoad: onIframeLoad,
|
|
1041
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
1042
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
1043
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1044
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
1045
|
+
newlyAddedElement: false,
|
|
1046
|
+
enableStrictPrivacy: enableStrictPrivacy
|
|
1047
|
+
});
|
|
1049
1048
|
}
|
|
1050
1049
|
|
|
1051
1050
|
function on(type, fn, target = document) {
|
|
@@ -1641,6 +1640,16 @@ class MutationBuffer {
|
|
|
1641
1640
|
return;
|
|
1642
1641
|
}
|
|
1643
1642
|
let item = this.attributes.find((a) => a.node === m.target);
|
|
1643
|
+
if (target.tagName === 'IFRAME' &&
|
|
1644
|
+
m.attributeName === 'src' &&
|
|
1645
|
+
!this.keepIframeSrcFn(value)) {
|
|
1646
|
+
if (!target.contentDocument) {
|
|
1647
|
+
m.attributeName = 'rr_src';
|
|
1648
|
+
}
|
|
1649
|
+
else {
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1644
1653
|
if (!item) {
|
|
1645
1654
|
item = {
|
|
1646
1655
|
node: m.target,
|
|
@@ -1686,7 +1695,7 @@ class MutationBuffer {
|
|
|
1686
1695
|
break;
|
|
1687
1696
|
}
|
|
1688
1697
|
}
|
|
1689
|
-
item.attributes[m.attributeName] = transformAttribute(this.doc,
|
|
1698
|
+
item.attributes[m.attributeName] = transformAttribute(this.doc, target.tagName, m.attributeName, value);
|
|
1690
1699
|
}
|
|
1691
1700
|
break;
|
|
1692
1701
|
}
|
|
@@ -1760,6 +1769,7 @@ class MutationBuffer {
|
|
|
1760
1769
|
'maskInputOptions',
|
|
1761
1770
|
'maskTextFn',
|
|
1762
1771
|
'maskInputFn',
|
|
1772
|
+
'keepIframeSrcFn',
|
|
1763
1773
|
'recordCanvas',
|
|
1764
1774
|
'inlineImages',
|
|
1765
1775
|
'slimDOMOptions',
|
|
@@ -3199,6 +3209,7 @@ function record(options = {}) {
|
|
|
3199
3209
|
iframeManager,
|
|
3200
3210
|
stylesheetManager,
|
|
3201
3211
|
canvasManager,
|
|
3212
|
+
keepIframeSrcFn,
|
|
3202
3213
|
enableStrictPrivacy
|
|
3203
3214
|
},
|
|
3204
3215
|
mirror,
|
|
@@ -3335,6 +3346,7 @@ function record(options = {}) {
|
|
|
3335
3346
|
doc,
|
|
3336
3347
|
maskInputFn,
|
|
3337
3348
|
maskTextFn,
|
|
3349
|
+
keepIframeSrcFn,
|
|
3338
3350
|
blockSelector,
|
|
3339
3351
|
slimDOMOptions,
|
|
3340
3352
|
mirror,
|