@@ -390,6 +390,7 @@ class CountlyClass {
390
390
this . storage = getConfig ( "storage" , ob , "default" ) ;
391
391
this . enableOrientationTracking = ! isBrowser ? undefined : getConfig ( "enable_orientation_tracking" , ob , true ) ;
392
392
this . heatmapWhitelist = getConfig ( "heatmap_whitelist" , ob , [ ] ) ;
393
+ this . contentWhitelist = getConfig ( "content_whitelist" , ob , [ ] ) ;
393
394
this . salt = getConfig ( "salt" , ob , null ) ;
394
395
this . hcErrorCount = this . #getValueFromStorage( healthCheckCounterEnum . errorCount ) || 0 ;
395
396
this . hcWarningCount = this . #getValueFromStorage( healthCheckCounterEnum . warningCount ) || 0 ;
@@ -439,6 +440,14 @@ class CountlyClass {
439
440
}
440
441
}
441
442
443
+ if ( Array . isArray ( this . contentWhitelist ) ) {
444
+ this . contentWhitelist . push ( this . url ) ;
445
+ this . contentWhitelist = this . contentWhitelist . map ( ( e ) => {
446
+ // remove trailing slashes from the entries
447
+ return stripTrailingSlash ( e ) ;
448
+ } ) ;
449
+ }
450
+
442
451
if ( ( this . passed_data && this . passed_data . app_key && this . passed_data . app_key === this . app_key ) || ( this . passed_data && ! this . passed_data . app_key && this . #global) ) {
443
452
if ( this . passed_data . token && this . passed_data . purpose ) {
444
453
if ( this . passed_data . token !== this . #getValueFromStorage( "cly_old_token" ) ) {
@@ -4012,7 +4021,7 @@ class CountlyClass {
4012
4021
} ;
4013
4022
4014
4023
#interpretContentMessage = ( messageEvent ) => {
4015
- if ( messageEvent . origin !== this . url ) {
4024
+ if ( this . contentWhitelist . indexOf ( messageEvent . origin ) === - 1 ) {
4016
4025
// this.#log(logLevelEnums.ERROR, "interpretContentMessage, Received message from invalid origin");
4017
4026
// silent ignore
4018
4027
return ;
0 commit comments