@glimt/record 0.0.47 → 0.0.49
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/record.cjs +28 -14
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +28 -14
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +28 -14
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +22 -22
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.cjs
CHANGED
|
@@ -427,6 +427,9 @@ const index = {
|
|
|
427
427
|
mutationObserver: mutationObserverCtor,
|
|
428
428
|
patch
|
|
429
429
|
};
|
|
430
|
+
const shouldTryAnonymousFetchingOnCorsError$1 = () => {
|
|
431
|
+
return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
|
|
432
|
+
};
|
|
430
433
|
function isElement(n2) {
|
|
431
434
|
return n2.nodeType === n2.ELEMENT_NODE;
|
|
432
435
|
}
|
|
@@ -938,6 +941,7 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
938
941
|
forElement,
|
|
939
942
|
requestCssId
|
|
940
943
|
}) {
|
|
944
|
+
if (!shouldTryAnonymousFetchingOnCorsError$1()) return;
|
|
941
945
|
if (this.currentHref != null && document.location.href !== this.currentHref)
|
|
942
946
|
this.blowCache();
|
|
943
947
|
this.currentHref = document.location.href;
|
|
@@ -1489,17 +1493,18 @@ function serializeElementNode(n2, options) {
|
|
|
1489
1493
|
canvasService = doc.createElement("canvas");
|
|
1490
1494
|
canvasCtx = canvasService.getContext("2d");
|
|
1491
1495
|
}
|
|
1492
|
-
let image = n2
|
|
1496
|
+
let image = n2;
|
|
1493
1497
|
const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
|
|
1498
|
+
const imageHeight = image.naturalHeight;
|
|
1499
|
+
const imageWidth = image.naturalWidth;
|
|
1494
1500
|
const inlineImageCleanup = () => {
|
|
1495
1501
|
image = null;
|
|
1496
1502
|
};
|
|
1497
1503
|
const recordInlineImage = () => {
|
|
1498
|
-
image.removeEventListener("load", recordInlineImage);
|
|
1499
1504
|
image.removeEventListener("error", onImageLoadError);
|
|
1500
1505
|
try {
|
|
1501
|
-
canvasService.width =
|
|
1502
|
-
canvasService.height =
|
|
1506
|
+
canvasService.width = imageWidth;
|
|
1507
|
+
canvasService.height = imageHeight;
|
|
1503
1508
|
canvasCtx.drawImage(image, 0, 0);
|
|
1504
1509
|
attributes.rr_dataURL = canvasService.toDataURL(
|
|
1505
1510
|
dataURLOptions.type,
|
|
@@ -1507,14 +1512,20 @@ function serializeElementNode(n2, options) {
|
|
|
1507
1512
|
);
|
|
1508
1513
|
} catch (err) {
|
|
1509
1514
|
if (image.crossOrigin !== "anonymous") {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
image.
|
|
1515
|
-
image.
|
|
1515
|
+
if (shouldTryAnonymousFetchingOnCorsError$1()) {
|
|
1516
|
+
image = new Image();
|
|
1517
|
+
image.src = imageSrc;
|
|
1518
|
+
image.crossOrigin = "anonymous";
|
|
1519
|
+
image.height = imageHeight;
|
|
1520
|
+
image.width = imageWidth;
|
|
1521
|
+
if (image.complete && image.naturalWidth !== 0) {
|
|
1522
|
+
recordInlineImage();
|
|
1523
|
+
} else {
|
|
1524
|
+
image.addEventListener("load", recordInlineImage, { once: true });
|
|
1525
|
+
image.addEventListener("error", onImageLoadError, { once: true });
|
|
1526
|
+
}
|
|
1527
|
+
return;
|
|
1516
1528
|
}
|
|
1517
|
-
return;
|
|
1518
1529
|
} else {
|
|
1519
1530
|
console.warn(
|
|
1520
1531
|
`Cannot inline img src=${imageSrc}! Error: ${err}`
|
|
@@ -1525,13 +1536,12 @@ function serializeElementNode(n2, options) {
|
|
|
1525
1536
|
};
|
|
1526
1537
|
const onImageLoadError = () => {
|
|
1527
1538
|
image.removeEventListener("load", recordInlineImage);
|
|
1528
|
-
image.removeEventListener("error", onImageLoadError);
|
|
1529
1539
|
inlineImageCleanup();
|
|
1530
1540
|
};
|
|
1531
1541
|
if (image.complete && image.naturalWidth !== 0) recordInlineImage();
|
|
1532
1542
|
else {
|
|
1533
|
-
image.addEventListener("load", recordInlineImage);
|
|
1534
|
-
image.addEventListener("error", onImageLoadError);
|
|
1543
|
+
image.addEventListener("load", recordInlineImage, { once: true });
|
|
1544
|
+
image.addEventListener("error", onImageLoadError, { once: true });
|
|
1535
1545
|
}
|
|
1536
1546
|
}
|
|
1537
1547
|
if (tagName === "audio" || tagName === "video") {
|
|
@@ -5569,6 +5579,9 @@ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "
|
|
|
5569
5579
|
var __defProp22 = Object.defineProperty;
|
|
5570
5580
|
var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5571
5581
|
var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5582
|
+
const shouldTryAnonymousFetchingOnCorsError = () => {
|
|
5583
|
+
return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
|
|
5584
|
+
};
|
|
5572
5585
|
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
5573
5586
|
if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
|
|
5574
5587
|
cssText = cssText.replace(
|
|
@@ -5825,6 +5838,7 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5825
5838
|
forElement,
|
|
5826
5839
|
requestCssId
|
|
5827
5840
|
}) {
|
|
5841
|
+
if (!shouldTryAnonymousFetchingOnCorsError()) return;
|
|
5828
5842
|
if (this.currentHref != null && document.location.href !== this.currentHref)
|
|
5829
5843
|
this.blowCache();
|
|
5830
5844
|
this.currentHref = document.location.href;
|