@glimt/record 0.0.50 → 0.0.52
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 +39 -16
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +39 -16
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +39 -16
- 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
|
@@ -428,6 +428,14 @@ const index = {
|
|
|
428
428
|
patch
|
|
429
429
|
};
|
|
430
430
|
const shouldTryAnonymousFetchingOnCorsError$1 = () => {
|
|
431
|
+
try {
|
|
432
|
+
console.log(
|
|
433
|
+
"window._rrweb_skip_re_fetching_to_suppress_cors_errors",
|
|
434
|
+
//@ts-expect-error
|
|
435
|
+
window._rrweb_skip_re_fetching_to_suppress_cors_errors
|
|
436
|
+
);
|
|
437
|
+
} catch (err) {
|
|
438
|
+
}
|
|
431
439
|
return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
|
|
432
440
|
};
|
|
433
441
|
function isElement(n2) {
|
|
@@ -1493,17 +1501,18 @@ function serializeElementNode(n2, options) {
|
|
|
1493
1501
|
canvasService = doc.createElement("canvas");
|
|
1494
1502
|
canvasCtx = canvasService.getContext("2d");
|
|
1495
1503
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1504
|
+
const image = n2;
|
|
1505
|
+
let overrideImage = null;
|
|
1506
|
+
const imageSrc = (image.currentSrc || image.getAttribute("src") || "<unknown-src>") + "";
|
|
1498
1507
|
const imageHeight = image.naturalHeight;
|
|
1499
1508
|
const imageWidth = image.naturalWidth;
|
|
1500
|
-
|
|
1509
|
+
console.log("handling inline image", image, imageSrc);
|
|
1501
1510
|
const inlineImageCleanup = () => {
|
|
1502
|
-
|
|
1503
|
-
|
|
1511
|
+
console.log("cleaning up", imageSrc);
|
|
1512
|
+
overrideImage = null;
|
|
1504
1513
|
};
|
|
1505
1514
|
const recordInlineImage = () => {
|
|
1506
|
-
image.removeEventListener("error", onImageLoadError);
|
|
1515
|
+
(overrideImage ?? image).removeEventListener("error", onImageLoadError);
|
|
1507
1516
|
try {
|
|
1508
1517
|
canvasService.width = imageWidth;
|
|
1509
1518
|
canvasService.height = imageHeight;
|
|
@@ -1513,19 +1522,25 @@ function serializeElementNode(n2, options) {
|
|
|
1513
1522
|
dataURLOptions.quality
|
|
1514
1523
|
);
|
|
1515
1524
|
} catch (err) {
|
|
1525
|
+
console.log("detected inline image error", err, imageSrc);
|
|
1516
1526
|
if (image.crossOrigin !== "anonymous") {
|
|
1527
|
+
console.log("crossOrigin is not anonymous", imageSrc);
|
|
1517
1528
|
if (shouldTryAnonymousFetchingOnCorsError$1()) {
|
|
1518
|
-
image
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
if (
|
|
1529
|
+
console.log("overriding image", imageSrc);
|
|
1530
|
+
overrideImage = new Image();
|
|
1531
|
+
overrideImage.src = imageSrc;
|
|
1532
|
+
overrideImage.crossOrigin = "anonymous";
|
|
1533
|
+
overrideImage.height = imageHeight;
|
|
1534
|
+
overrideImage.width = imageWidth;
|
|
1535
|
+
if (overrideImage.complete && overrideImage.naturalWidth !== 0) {
|
|
1525
1536
|
recordInlineImage();
|
|
1526
1537
|
} else {
|
|
1527
|
-
|
|
1528
|
-
|
|
1538
|
+
overrideImage.addEventListener("load", recordInlineImage, {
|
|
1539
|
+
once: true
|
|
1540
|
+
});
|
|
1541
|
+
overrideImage.addEventListener("error", onImageLoadError, {
|
|
1542
|
+
once: true
|
|
1543
|
+
});
|
|
1529
1544
|
}
|
|
1530
1545
|
return;
|
|
1531
1546
|
}
|
|
@@ -1538,7 +1553,7 @@ function serializeElementNode(n2, options) {
|
|
|
1538
1553
|
inlineImageCleanup();
|
|
1539
1554
|
};
|
|
1540
1555
|
const onImageLoadError = () => {
|
|
1541
|
-
image.removeEventListener("load", recordInlineImage);
|
|
1556
|
+
(overrideImage ?? image).removeEventListener("load", recordInlineImage);
|
|
1542
1557
|
inlineImageCleanup();
|
|
1543
1558
|
};
|
|
1544
1559
|
if (image.complete && image.naturalWidth !== 0) recordInlineImage();
|
|
@@ -5583,6 +5598,14 @@ var __defProp22 = Object.defineProperty;
|
|
|
5583
5598
|
var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5584
5599
|
var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5585
5600
|
const shouldTryAnonymousFetchingOnCorsError = () => {
|
|
5601
|
+
try {
|
|
5602
|
+
console.log(
|
|
5603
|
+
"window._rrweb_skip_re_fetching_to_suppress_cors_errors",
|
|
5604
|
+
//@ts-expect-error
|
|
5605
|
+
window._rrweb_skip_re_fetching_to_suppress_cors_errors
|
|
5606
|
+
);
|
|
5607
|
+
} catch (err) {
|
|
5608
|
+
}
|
|
5586
5609
|
return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
|
|
5587
5610
|
};
|
|
5588
5611
|
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|