@@ -29,6 +29,7 @@ import {
2929 extractFileExtension ,
3030 absolutifyURLs ,
3131 markCssSplits ,
32+ isElementSrcBlocked ,
3233} from './utils' ;
3334import dom from '@rrweb/utils' ;
3435
@@ -796,16 +797,20 @@ function serializeElementNode(
796797 }
797798 }
798799 // block element
799- if ( needBlock || needMask || ( tagName === 'img' && enableStrictPrivacy ) ) {
800+ if (
801+ needBlock ||
802+ needMask ||
803+ ( enableStrictPrivacy && isElementSrcBlocked ( tagName ) )
804+ ) {
800805 const { width, height } = n . getBoundingClientRect ( ) ;
801806 attributes = {
802807 class : attributes . class ,
803808 rr_width : `${ width } px` ,
804809 rr_height : `${ height } px` ,
805810 } ;
806- if ( enableStrictPrivacy ) {
807- needBlock = true ;
808- }
811+ }
812+ if ( enableStrictPrivacy && isElementSrcBlocked ( tagName ) ) {
813+ needBlock = true ;
809814 }
810815 // iframe
811816 if ( tagName === 'iframe' && ! keepIframeSrcFn ( attributes . src as string ) ) {
@@ -1077,10 +1082,10 @@ export function serializeNodeWithId(
10771082 ! ! serializedNode . needMask ;
10781083
10791084 /** Highlight Code Begin */
1080- // Remove the image's src if enableStrictPrivacy.
1081- if ( strictPrivacy && serializedNode . tagName === 'img' ) {
1085+ // process enableStrictPrivacy obfuscation of non-text elements
1086+ if ( strictPrivacy && isElementSrcBlocked ( serializedNode . tagName ) ) {
10821087 const clone = n . cloneNode ( ) ;
1083- ( clone as unknown as HTMLImageElement ) . src = '' ;
1088+ ( clone as unknown as { src : string } ) . src = '' ;
10841089 mirror . add ( clone , serializedNode ) ;
10851090 }
10861091 /** Highlight Code End */
0 commit comments