@@ -390,6 +390,7 @@ class CountlyClass {
390390 this . storage = getConfig ( "storage" , ob , "default" ) ;
391391 this . enableOrientationTracking = ! isBrowser ? undefined : getConfig ( "enable_orientation_tracking" , ob , true ) ;
392392 this . heatmapWhitelist = getConfig ( "heatmap_whitelist" , ob , [ ] ) ;
393+ this . contentWhitelist = getConfig ( "content_whitelist" , ob , [ ] ) ;
393394 this . salt = getConfig ( "salt" , ob , null ) ;
394395 this . hcErrorCount = this . #getValueFromStorage( healthCheckCounterEnum . errorCount ) || 0 ;
395396 this . hcWarningCount = this . #getValueFromStorage( healthCheckCounterEnum . warningCount ) || 0 ;
@@ -439,6 +440,14 @@ class CountlyClass {
439440 }
440441 }
441442
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+
442451 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) ) {
443452 if ( this . passed_data . token && this . passed_data . purpose ) {
444453 if ( this . passed_data . token !== this . #getValueFromStorage( "cly_old_token" ) ) {
@@ -4012,7 +4021,7 @@ class CountlyClass {
40124021 } ;
40134022
40144023 #interpretContentMessage = ( messageEvent ) => {
4015- if ( messageEvent . origin !== this . url ) {
4024+ if ( this . contentWhitelist . indexOf ( messageEvent . origin ) === - 1 ) {
40164025 // this.#log(logLevelEnums.ERROR, "interpretContentMessage, Received message from invalid origin");
40174026 // silent ignore
40184027 return ;
0 commit comments