@highlight-run/rrweb 2.0.20 → 2.1.2
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.js +8 -8
- package/dist/plugins/console-record.min.js +8 -8
- 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 +12 -12
- package/dist/rrweb-all.min.js +12 -12
- 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/ext/mitt/dist/mitt.mjs.js +3 -0
- package/es/rrweb/packages/rrdom/es/rrdom.js +66 -10
- package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +3 -11
- package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +10 -7
- package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +9 -6
- package/es/rrweb/packages/rrweb/src/record/mutation.js +5 -3
- package/es/rrweb/packages/rrweb/src/record/observer.js +22 -14
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +1 -1
- package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +7 -4
- package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +3 -2
- package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +1 -2
- package/es/rrweb/packages/rrweb/src/replay/index.js +151 -180
- package/es/rrweb/packages/rrweb/src/replay/timer.js +6 -7
- package/es/rrweb/packages/rrweb/src/utils.js +8 -6
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +60 -10
- package/lib/plugins/console-record.js +26 -26
- package/lib/record/rrweb-record.js +91 -31
- package/lib/replay/rrweb-replay-unpack.js +236 -265
- package/lib/replay/rrweb-replay.js +236 -265
- package/lib/rrweb-all.js +346 -318
- package/lib/rrweb.js +324 -294
- package/package.json +9 -8
- package/typings/plugins/console/record/index.d.ts +1 -1
- package/typings/plugins/console/record/stringify.d.ts +1 -1
- package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
- package/typings/record/shadow-dom-manager.d.ts +1 -1
- package/typings/replay/index.d.ts +0 -2
- package/typings/types.d.ts +5 -6
- package/typings/utils.d.ts +2 -2
- package/es/rrweb/ext/mitt/dist/mitt.es.js +0 -63
- package/typings/record/observers/canvas/webgl2.d.ts +0 -2
|
@@ -51,7 +51,8 @@ if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
|
|
|
51
51
|
function patch(source, name, replacement) {
|
|
52
52
|
try {
|
|
53
53
|
if (!(name in source)) {
|
|
54
|
-
return () => {
|
|
54
|
+
return () => {
|
|
55
|
+
};
|
|
55
56
|
}
|
|
56
57
|
const original = source[name];
|
|
57
58
|
const wrapped = replacement(original);
|
|
@@ -70,7 +71,8 @@ function patch(source, name, replacement) {
|
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
catch (_a) {
|
|
73
|
-
return () => {
|
|
74
|
+
return () => {
|
|
75
|
+
};
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -84,17 +86,9 @@ class StackFrame {
|
|
|
84
86
|
toString() {
|
|
85
87
|
const lineNumber = this.lineNumber || '';
|
|
86
88
|
const columnNumber = this.columnNumber || '';
|
|
87
|
-
if (this.functionName)
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
this.fileName +
|
|
91
|
-
':' +
|
|
92
|
-
lineNumber +
|
|
93
|
-
':' +
|
|
94
|
-
columnNumber +
|
|
95
|
-
')');
|
|
96
|
-
}
|
|
97
|
-
return this.fileName + ':' + lineNumber + ':' + columnNumber;
|
|
89
|
+
if (this.functionName)
|
|
90
|
+
return `${this.functionName} (${this.fileName}:${lineNumber}:${columnNumber})`;
|
|
91
|
+
return `${this.fileName}:${lineNumber}:${columnNumber}`;
|
|
98
92
|
}
|
|
99
93
|
}
|
|
100
94
|
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
@@ -275,7 +269,7 @@ function pathToSelector(node) {
|
|
|
275
269
|
}
|
|
276
270
|
}
|
|
277
271
|
if (domSiblings.length > 1) {
|
|
278
|
-
name +=
|
|
272
|
+
name += `:eq(${domSiblings.indexOf(node)})`;
|
|
279
273
|
}
|
|
280
274
|
path = name + (path ? '>' + path : '');
|
|
281
275
|
node = parent;
|
|
@@ -291,7 +285,8 @@ function isObjTooDeep(obj, limit) {
|
|
|
291
285
|
}
|
|
292
286
|
const keys = Object.keys(obj);
|
|
293
287
|
for (const key of keys) {
|
|
294
|
-
if (isObject(obj[key]) &&
|
|
288
|
+
if (isObject(obj[key]) &&
|
|
289
|
+
isObjTooDeep(obj[key], limit - 1)) {
|
|
295
290
|
return true;
|
|
296
291
|
}
|
|
297
292
|
}
|
|
@@ -325,9 +320,10 @@ function stringify(obj, stringifyOptions) {
|
|
|
325
320
|
else {
|
|
326
321
|
stack.push(value);
|
|
327
322
|
}
|
|
328
|
-
if (value === null
|
|
323
|
+
if (value === null)
|
|
329
324
|
return value;
|
|
330
|
-
|
|
325
|
+
if (value === undefined)
|
|
326
|
+
return 'undefined';
|
|
331
327
|
if (shouldIgnore(value)) {
|
|
332
328
|
return toString(value);
|
|
333
329
|
}
|
|
@@ -336,7 +332,7 @@ function stringify(obj, stringifyOptions) {
|
|
|
336
332
|
for (const eventKey in value) {
|
|
337
333
|
const eventValue = value[eventKey];
|
|
338
334
|
if (Array.isArray(eventValue)) {
|
|
339
|
-
eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
|
|
335
|
+
eventResult[eventKey] = pathToSelector((eventValue.length ? eventValue[0] : null));
|
|
340
336
|
}
|
|
341
337
|
else {
|
|
342
338
|
eventResult[eventKey] = eventValue;
|
|
@@ -364,7 +360,8 @@ function stringify(obj, stringifyOptions) {
|
|
|
364
360
|
if (typeof _obj === 'function') {
|
|
365
361
|
return true;
|
|
366
362
|
}
|
|
367
|
-
if (isObject(_obj) &&
|
|
363
|
+
if (isObject(_obj) &&
|
|
364
|
+
isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
368
365
|
return true;
|
|
369
366
|
}
|
|
370
367
|
return false;
|
|
@@ -403,10 +400,14 @@ const defaultLogOptions = {
|
|
|
403
400
|
lengthThreshold: 1000,
|
|
404
401
|
logger: 'console',
|
|
405
402
|
};
|
|
406
|
-
function initLogObserver(cb, win,
|
|
403
|
+
function initLogObserver(cb, win, options) {
|
|
404
|
+
const logOptions = (options
|
|
405
|
+
? Object.assign({}, defaultLogOptions, options)
|
|
406
|
+
: defaultLogOptions);
|
|
407
407
|
const loggerType = logOptions.logger;
|
|
408
408
|
if (!loggerType) {
|
|
409
|
-
return () => {
|
|
409
|
+
return () => {
|
|
410
|
+
};
|
|
410
411
|
}
|
|
411
412
|
let logger;
|
|
412
413
|
if (typeof loggerType === 'string') {
|
|
@@ -420,7 +421,7 @@ function initLogObserver(cb, win, logOptions) {
|
|
|
420
421
|
if (logOptions.level.includes('error')) {
|
|
421
422
|
if (window) {
|
|
422
423
|
const errorHandler = (event) => {
|
|
423
|
-
const
|
|
424
|
+
const message = event.message, error = event.error;
|
|
424
425
|
const trace = ErrorStackParser.parse(error).map((stackFrame) => stackFrame.toString());
|
|
425
426
|
const payload = [stringify(message, logOptions.stringifyOptions)];
|
|
426
427
|
cb({
|
|
@@ -444,7 +445,8 @@ function initLogObserver(cb, win, logOptions) {
|
|
|
444
445
|
};
|
|
445
446
|
function replace(_logger, level) {
|
|
446
447
|
if (!_logger[level]) {
|
|
447
|
-
return () => {
|
|
448
|
+
return () => {
|
|
449
|
+
};
|
|
448
450
|
}
|
|
449
451
|
return patch(_logger, level, (original) => {
|
|
450
452
|
return (...args) => {
|
|
@@ -483,9 +485,7 @@ const PLUGIN_NAME = 'rrweb/console@1';
|
|
|
483
485
|
const getRecordConsolePlugin = (options) => ({
|
|
484
486
|
name: PLUGIN_NAME,
|
|
485
487
|
observer: initLogObserver,
|
|
486
|
-
options: options
|
|
487
|
-
? Object.assign({}, defaultLogOptions, options)
|
|
488
|
-
: defaultLogOptions,
|
|
488
|
+
options: options,
|
|
489
489
|
});
|
|
490
490
|
|
|
491
491
|
exports.PLUGIN_NAME = PLUGIN_NAME;
|
|
@@ -17,6 +17,9 @@ function isShadowRoot(n) {
|
|
|
17
17
|
var host = n === null || n === void 0 ? void 0 : n.host;
|
|
18
18
|
return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n);
|
|
19
19
|
}
|
|
20
|
+
function isNativeShadowDom(shadowRoot) {
|
|
21
|
+
return Object.prototype.toString.call(shadowRoot) === '[object ShadowRoot]';
|
|
22
|
+
}
|
|
20
23
|
var Mirror = (function () {
|
|
21
24
|
function Mirror() {
|
|
22
25
|
this.idNodeMap = new Map();
|
|
@@ -284,7 +287,8 @@ function getHref() {
|
|
|
284
287
|
return a.href;
|
|
285
288
|
}
|
|
286
289
|
function transformAttribute(doc, tagName, name, value) {
|
|
287
|
-
if (name === 'src' ||
|
|
290
|
+
if (name === 'src' ||
|
|
291
|
+
(name === 'href' && value && !(tagName === 'use' && value[0] === '#'))) {
|
|
288
292
|
return absoluteToDoc(doc, value);
|
|
289
293
|
}
|
|
290
294
|
else if (name === 'xlink:href' && value && value[0] !== '#') {
|
|
@@ -843,7 +847,8 @@ function serializeNodeWithId(n, options) {
|
|
|
843
847
|
mirror.add(clone, serializedNode);
|
|
844
848
|
}
|
|
845
849
|
delete serializedNode.needBlock;
|
|
846
|
-
|
|
850
|
+
var shadowRoot = n.shadowRoot;
|
|
851
|
+
if (shadowRoot && isNativeShadowDom(shadowRoot))
|
|
847
852
|
serializedNode.isShadowHost = true;
|
|
848
853
|
}
|
|
849
854
|
if ((serializedNode.type === NodeType.Document ||
|
|
@@ -891,13 +896,16 @@ function serializeNodeWithId(n, options) {
|
|
|
891
896
|
var childN = _p[_o];
|
|
892
897
|
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
893
898
|
if (serializedChildNode) {
|
|
894
|
-
|
|
899
|
+
isNativeShadowDom(n.shadowRoot) &&
|
|
900
|
+
(serializedChildNode.isShadow = true);
|
|
895
901
|
serializedNode.childNodes.push(serializedChildNode);
|
|
896
902
|
}
|
|
897
903
|
}
|
|
898
904
|
}
|
|
899
905
|
}
|
|
900
|
-
if (n.parentNode &&
|
|
906
|
+
if (n.parentNode &&
|
|
907
|
+
isShadowRoot(n.parentNode) &&
|
|
908
|
+
isNativeShadowDom(n.parentNode)) {
|
|
901
909
|
serializedNode.isShadow = true;
|
|
902
910
|
}
|
|
903
911
|
if (serializedNode.type === NodeType.Element &&
|
|
@@ -974,6 +982,44 @@ function serializeNodeWithId(n, options) {
|
|
|
974
982
|
if (isStylesheetLoaded(n) === false)
|
|
975
983
|
return null;
|
|
976
984
|
}
|
|
985
|
+
if (serializedNode.type === NodeType.Element &&
|
|
986
|
+
serializedNode.tagName === 'link' &&
|
|
987
|
+
serializedNode.attributes.rel === 'stylesheet') {
|
|
988
|
+
onceStylesheetLoaded(n, function () {
|
|
989
|
+
if (onStylesheetLoad) {
|
|
990
|
+
var serializedLinkNode = serializeNodeWithId(n, {
|
|
991
|
+
doc: doc,
|
|
992
|
+
mirror: mirror,
|
|
993
|
+
blockClass: blockClass,
|
|
994
|
+
blockSelector: blockSelector,
|
|
995
|
+
maskTextClass: maskTextClass,
|
|
996
|
+
maskTextSelector: maskTextSelector,
|
|
997
|
+
skipChild: false,
|
|
998
|
+
inlineStylesheet: inlineStylesheet,
|
|
999
|
+
maskInputOptions: maskInputOptions,
|
|
1000
|
+
maskTextFn: maskTextFn,
|
|
1001
|
+
maskInputFn: maskInputFn,
|
|
1002
|
+
slimDOMOptions: slimDOMOptions,
|
|
1003
|
+
dataURLOptions: dataURLOptions,
|
|
1004
|
+
inlineImages: inlineImages,
|
|
1005
|
+
recordCanvas: recordCanvas,
|
|
1006
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
1007
|
+
onSerialize: onSerialize,
|
|
1008
|
+
onIframeLoad: onIframeLoad,
|
|
1009
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
1010
|
+
enableStrictPrivacy: enableStrictPrivacy,
|
|
1011
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
1012
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1013
|
+
keepIframeSrcFn: keepIframeSrcFn
|
|
1014
|
+
});
|
|
1015
|
+
if (serializedLinkNode) {
|
|
1016
|
+
onStylesheetLoad(n, serializedLinkNode);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}, stylesheetLoadTimeout);
|
|
1020
|
+
if (isStylesheetLoaded(n) === false)
|
|
1021
|
+
return null;
|
|
1022
|
+
}
|
|
977
1023
|
return serializedNode;
|
|
978
1024
|
}
|
|
979
1025
|
function snapshot(n, options) {
|
|
@@ -1091,14 +1137,13 @@ if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
|
|
|
1091
1137
|
function throttle(func, wait, options = {}) {
|
|
1092
1138
|
let timeout = null;
|
|
1093
1139
|
let previous = 0;
|
|
1094
|
-
return function (
|
|
1140
|
+
return function (...args) {
|
|
1095
1141
|
const now = Date.now();
|
|
1096
1142
|
if (!previous && options.leading === false) {
|
|
1097
1143
|
previous = now;
|
|
1098
1144
|
}
|
|
1099
1145
|
const remaining = wait - (now - previous);
|
|
1100
1146
|
const context = this;
|
|
1101
|
-
const args = arguments;
|
|
1102
1147
|
if (remaining <= 0 || remaining > wait) {
|
|
1103
1148
|
if (timeout) {
|
|
1104
1149
|
clearTimeout(timeout);
|
|
@@ -1135,7 +1180,8 @@ function hookSetter(target, key, d, isRevoked, win = window) {
|
|
|
1135
1180
|
function patch(source, name, replacement) {
|
|
1136
1181
|
try {
|
|
1137
1182
|
if (!(name in source)) {
|
|
1138
|
-
return () => {
|
|
1183
|
+
return () => {
|
|
1184
|
+
};
|
|
1139
1185
|
}
|
|
1140
1186
|
const original = source[name];
|
|
1141
1187
|
const wrapped = replacement(original);
|
|
@@ -1154,7 +1200,8 @@ function patch(source, name, replacement) {
|
|
|
1154
1200
|
};
|
|
1155
1201
|
}
|
|
1156
1202
|
catch (_a) {
|
|
1157
|
-
return () => {
|
|
1203
|
+
return () => {
|
|
1204
|
+
};
|
|
1158
1205
|
}
|
|
1159
1206
|
}
|
|
1160
1207
|
function getWindowHeight() {
|
|
@@ -1235,8 +1282,9 @@ function polyfill(win = window) {
|
|
|
1235
1282
|
.forEach;
|
|
1236
1283
|
}
|
|
1237
1284
|
if (!Node.prototype.contains) {
|
|
1238
|
-
Node.prototype.contains =
|
|
1239
|
-
|
|
1285
|
+
Node.prototype.contains = (...args) => {
|
|
1286
|
+
let node = args[0];
|
|
1287
|
+
if (!(0 in args)) {
|
|
1240
1288
|
throw new TypeError('1 argument is required');
|
|
1241
1289
|
}
|
|
1242
1290
|
do {
|
|
@@ -1475,6 +1523,7 @@ class MutationBuffer {
|
|
|
1475
1523
|
maskTextClass: this.maskTextClass,
|
|
1476
1524
|
maskTextSelector: this.maskTextSelector,
|
|
1477
1525
|
skipChild: true,
|
|
1526
|
+
newlyAddedElement: true,
|
|
1478
1527
|
inlineStylesheet: this.inlineStylesheet,
|
|
1479
1528
|
maskInputOptions: this.maskInputOptions,
|
|
1480
1529
|
maskTextFn: this.maskTextFn,
|
|
@@ -1501,7 +1550,6 @@ class MutationBuffer {
|
|
|
1501
1550
|
onStylesheetLoad: (link, childSn) => {
|
|
1502
1551
|
this.stylesheetManager.attachStylesheet(link, childSn, this.mirror);
|
|
1503
1552
|
},
|
|
1504
|
-
newlyAddedElement: true,
|
|
1505
1553
|
});
|
|
1506
1554
|
if (sn) {
|
|
1507
1555
|
adds.push({
|
|
@@ -1727,7 +1775,9 @@ class MutationBuffer {
|
|
|
1727
1775
|
this.removes.push({
|
|
1728
1776
|
parentId,
|
|
1729
1777
|
id: nodeId,
|
|
1730
|
-
isShadow: isShadowRoot(m.target)
|
|
1778
|
+
isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target)
|
|
1779
|
+
? true
|
|
1780
|
+
: undefined,
|
|
1731
1781
|
});
|
|
1732
1782
|
}
|
|
1733
1783
|
this.mapRemoves.push(n);
|
|
@@ -1893,7 +1943,8 @@ function initMutationObserver(options, rootEl) {
|
|
|
1893
1943
|
}
|
|
1894
1944
|
function initMoveObserver({ mousemoveCb, sampling, doc, mirror, }) {
|
|
1895
1945
|
if (sampling.mousemove === false) {
|
|
1896
|
-
return () => {
|
|
1946
|
+
return () => {
|
|
1947
|
+
};
|
|
1897
1948
|
}
|
|
1898
1949
|
const threshold = typeof sampling.mousemove === 'number' ? sampling.mousemove : 50;
|
|
1899
1950
|
const callbackThreshold = typeof sampling.mousemoveCallback === 'number'
|
|
@@ -1943,7 +1994,8 @@ function initMoveObserver({ mousemoveCb, sampling, doc, mirror, }) {
|
|
|
1943
1994
|
}
|
|
1944
1995
|
function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror, blockClass, sampling, }) {
|
|
1945
1996
|
if (sampling.mouseInteraction === false) {
|
|
1946
|
-
return () => {
|
|
1997
|
+
return () => {
|
|
1998
|
+
};
|
|
1947
1999
|
}
|
|
1948
2000
|
const disableMap = sampling.mouseInteraction === true ||
|
|
1949
2001
|
sampling.mouseInteraction === undefined
|
|
@@ -2147,7 +2199,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror }, { win }) {
|
|
|
2147
2199
|
adds: [{ rule, index }],
|
|
2148
2200
|
});
|
|
2149
2201
|
}
|
|
2150
|
-
return insertRule.apply(this,
|
|
2202
|
+
return insertRule.apply(this, [rule, index]);
|
|
2151
2203
|
};
|
|
2152
2204
|
const deleteRule = win.CSSStyleSheet.prototype.deleteRule;
|
|
2153
2205
|
win.CSSStyleSheet.prototype.deleteRule = function (index) {
|
|
@@ -2158,7 +2210,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror }, { win }) {
|
|
|
2158
2210
|
removes: [{ index }],
|
|
2159
2211
|
});
|
|
2160
2212
|
}
|
|
2161
|
-
return deleteRule.apply(this,
|
|
2213
|
+
return deleteRule.apply(this, [index]);
|
|
2162
2214
|
};
|
|
2163
2215
|
const supportedNestedCSSRuleTypes = {};
|
|
2164
2216
|
if (isCSSGroupingRuleSupported) {
|
|
@@ -2197,17 +2249,19 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror }, { win }) {
|
|
|
2197
2249
|
],
|
|
2198
2250
|
});
|
|
2199
2251
|
}
|
|
2200
|
-
return unmodifiedFunctions[typeKey].insertRule.apply(this,
|
|
2252
|
+
return unmodifiedFunctions[typeKey].insertRule.apply(this, [rule, index]);
|
|
2201
2253
|
};
|
|
2202
2254
|
type.prototype.deleteRule = function (index) {
|
|
2203
2255
|
const id = mirror.getId(this.parentStyleSheet.ownerNode);
|
|
2204
2256
|
if (id !== -1) {
|
|
2205
2257
|
styleSheetRuleCb({
|
|
2206
2258
|
id,
|
|
2207
|
-
removes: [
|
|
2259
|
+
removes: [
|
|
2260
|
+
{ index: [...getNestedCSSRulePositions(this), index] },
|
|
2261
|
+
],
|
|
2208
2262
|
});
|
|
2209
2263
|
}
|
|
2210
|
-
return unmodifiedFunctions[typeKey].deleteRule.apply(this,
|
|
2264
|
+
return unmodifiedFunctions[typeKey].deleteRule.apply(this, [index]);
|
|
2211
2265
|
};
|
|
2212
2266
|
});
|
|
2213
2267
|
return () => {
|
|
@@ -2235,7 +2289,7 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror }, { win }) {
|
|
|
2235
2289
|
index: getNestedCSSRulePositions(this.parentRule),
|
|
2236
2290
|
});
|
|
2237
2291
|
}
|
|
2238
|
-
return setProperty.apply(this,
|
|
2292
|
+
return setProperty.apply(this, [property, value, priority]);
|
|
2239
2293
|
};
|
|
2240
2294
|
const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
|
|
2241
2295
|
win.CSSStyleDeclaration.prototype.removeProperty = function (property) {
|
|
@@ -2250,7 +2304,7 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror }, { win }) {
|
|
|
2250
2304
|
index: getNestedCSSRulePositions(this.parentRule),
|
|
2251
2305
|
});
|
|
2252
2306
|
}
|
|
2253
|
-
return removeProperty.apply(this,
|
|
2307
|
+
return removeProperty.apply(this, [property]);
|
|
2254
2308
|
};
|
|
2255
2309
|
return () => {
|
|
2256
2310
|
win.CSSStyleDeclaration.prototype.setProperty = setProperty;
|
|
@@ -2285,7 +2339,8 @@ function initMediaInteractionObserver({ mediaInteractionCb, blockClass, mirror,
|
|
|
2285
2339
|
function initFontObserver({ fontCb, doc }) {
|
|
2286
2340
|
const win = doc.defaultView;
|
|
2287
2341
|
if (!win) {
|
|
2288
|
-
return () => {
|
|
2342
|
+
return () => {
|
|
2343
|
+
};
|
|
2289
2344
|
}
|
|
2290
2345
|
const handlers = [];
|
|
2291
2346
|
const fontMap = new WeakMap();
|
|
@@ -2298,8 +2353,7 @@ function initFontObserver({ fontCb, doc }) {
|
|
|
2298
2353
|
descriptors,
|
|
2299
2354
|
fontSource: typeof source === 'string'
|
|
2300
2355
|
? source
|
|
2301
|
-
:
|
|
2302
|
-
JSON.stringify(Array.from(new Uint8Array(source))),
|
|
2356
|
+
: JSON.stringify(Array.from(new Uint8Array(source))),
|
|
2303
2357
|
});
|
|
2304
2358
|
return fontFace;
|
|
2305
2359
|
};
|
|
@@ -2395,7 +2449,8 @@ function mergeHooks(o, hooks) {
|
|
|
2395
2449
|
function initObservers(o, hooks = {}) {
|
|
2396
2450
|
const currentWindow = o.doc.defaultView;
|
|
2397
2451
|
if (!currentWindow) {
|
|
2398
|
-
return () => {
|
|
2452
|
+
return () => {
|
|
2453
|
+
};
|
|
2399
2454
|
}
|
|
2400
2455
|
mergeHooks(o, hooks);
|
|
2401
2456
|
const mutationObserver = initMutationObserver(o, o.doc);
|
|
@@ -2409,7 +2464,10 @@ function initObservers(o, hooks = {}) {
|
|
|
2409
2464
|
const styleDeclarationObserver = initStyleDeclarationObserver(o, {
|
|
2410
2465
|
win: currentWindow,
|
|
2411
2466
|
});
|
|
2412
|
-
const fontObserver = o.collectFonts
|
|
2467
|
+
const fontObserver = o.collectFonts
|
|
2468
|
+
? initFontObserver(o)
|
|
2469
|
+
: () => {
|
|
2470
|
+
};
|
|
2413
2471
|
const pluginHandlers = [];
|
|
2414
2472
|
for (const plugin of o.plugins) {
|
|
2415
2473
|
pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
|
|
@@ -2469,8 +2527,8 @@ class ShadowDomManager {
|
|
|
2469
2527
|
this.mirror = options.mirror;
|
|
2470
2528
|
const manager = this;
|
|
2471
2529
|
this.restorePatches.push(patch(HTMLElement.prototype, 'attachShadow', function (original) {
|
|
2472
|
-
return function () {
|
|
2473
|
-
const shadowRoot = original.
|
|
2530
|
+
return function (option) {
|
|
2531
|
+
const shadowRoot = original.call(this, option);
|
|
2474
2532
|
if (this.shadowRoot)
|
|
2475
2533
|
manager.addShadowRoot(this.shadowRoot, this.ownerDocument);
|
|
2476
2534
|
return shadowRoot;
|
|
@@ -2478,6 +2536,8 @@ class ShadowDomManager {
|
|
|
2478
2536
|
}));
|
|
2479
2537
|
}
|
|
2480
2538
|
addShadowRoot(shadowRoot, doc) {
|
|
2539
|
+
if (!isNativeShadowDom(shadowRoot))
|
|
2540
|
+
return;
|
|
2481
2541
|
initMutationObserver(Object.assign(Object.assign({}, this.bypassOptions), { doc, mutationCb: this.mutationCb, mirror: this.mirror, shadowDomManager: this }), shadowRoot);
|
|
2482
2542
|
initScrollObserver(Object.assign(Object.assign({}, this.bypassOptions), { scrollCb: this.scrollCb, doc: shadowRoot, mirror: this.mirror }));
|
|
2483
2543
|
}
|
|
@@ -2485,8 +2545,8 @@ class ShadowDomManager {
|
|
|
2485
2545
|
if (iframeElement.contentWindow) {
|
|
2486
2546
|
const manager = this;
|
|
2487
2547
|
this.restorePatches.push(patch(iframeElement.contentWindow.HTMLElement.prototype, 'attachShadow', function (original) {
|
|
2488
|
-
return function () {
|
|
2489
|
-
const shadowRoot = original.
|
|
2548
|
+
return function (option) {
|
|
2549
|
+
const shadowRoot = original.call(this, option);
|
|
2490
2550
|
if (this.shadowRoot)
|
|
2491
2551
|
manager.addShadowRoot(this.shadowRoot, iframeElement.contentDocument);
|
|
2492
2552
|
return shadowRoot;
|
|
@@ -2880,7 +2940,7 @@ class CanvasManager {
|
|
|
2880
2940
|
this.rafStamps = { latestId: 0, invokeId: null };
|
|
2881
2941
|
this.frozen = false;
|
|
2882
2942
|
this.locked = false;
|
|
2883
|
-
this.processMutation =
|
|
2943
|
+
this.processMutation = (target, mutation) => {
|
|
2884
2944
|
const newFrame = this.rafStamps.invokeId &&
|
|
2885
2945
|
this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
2886
2946
|
if (newFrame || !this.rafStamps.invokeId)
|