@@ -214,6 +214,7 @@ class CountlyClass {
214214 this . maxStackTraceLinesPerThread = getConfig ( "max_stack_trace_lines_per_thread" , ob , configurationDefaultValues . MAX_STACKTRACE_LINES_PER_THREAD ) ;
215215 this . maxStackTraceLineLength = getConfig ( "max_stack_trace_line_length" , ob , configurationDefaultValues . MAX_STACKTRACE_LINE_LENGTH ) ;
216216 this . heatmapWhitelist = getConfig ( "heatmap_whitelist" , ob , [ ] ) ;
217+ this . contentWhitelist = getConfig ( "content_whitelist" , ob , [ ] ) ;
217218 this . salt = getConfig ( "salt" , ob , null ) ;
218219 this . hcErrorCount = this . #getValueFromStorage( healthCheckCounterEnum . errorCount ) || 0 ;
219220 this . hcWarningCount = this . #getValueFromStorage( healthCheckCounterEnum . warningCount ) || 0 ;
@@ -276,6 +277,14 @@ class CountlyClass {
276277 }
277278 }
278279
280+ if ( Array . isArray ( this . contentWhitelist ) ) {
281+ this . contentWhitelist . push ( this . url ) ;
282+ this . contentWhitelist = this . contentWhitelist . map ( ( e ) => {
283+ // remove trailing slashes from the entries
284+ return stripTrailingSlash ( e ) ;
285+ } ) ;
286+ }
287+
279288 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) ) {
280289 if ( this . passed_data . token && this . passed_data . purpose ) {
281290 if ( this . passed_data . token !== this . #getValueFromStorage( "cly_old_token" ) ) {
@@ -3825,7 +3834,7 @@ class CountlyClass {
38253834 } ;
38263835
38273836 #interpretContentMessage = ( messageEvent ) => {
3828- if ( messageEvent . origin !== this . url ) {
3837+ if ( this . contentWhitelist . indexOf ( messageEvent . origin ) === - 1 ) {
38293838 // this.#log(logLevelEnums.ERROR, "interpretContentMessage, Received message from invalid origin");
38303839 // silent ignore
38313840 return ;
0 commit comments