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