File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const framed = pageInIframe();
1111const glocation = ( ! framed ) ? window . location . hostname : document . location . ancestorOrigins [ 0 ] ;
1212const gameIDExtractRG = / \/ ( g a m e _ \w + ) \/ / ;
1313const gameIDExtract = gameIDExtractRG . exec ( window . location . pathname ) ;
14+ const parentOrigin = ( framed && document . location . ancestorOrigins . length > 0 ) ? new URL ( document . location . ancestorOrigins [ 0 ] ) . origin : null ;
1415const gameID = window . ccPorted . gameID || window . gameID || ( ( gameIDExtract ) ? gameIDExtract [ 1 ] : "Unknown Game" ) ;
1516
1617let trackingInterval = null ;
@@ -2246,7 +2247,7 @@ async function getTokensFromParent(timeout = 5000) {
22462247 // Set up message handler
22472248 const messageHandler = ( event ) => {
22482249 // Only accept messages from the parent origin
2249- if ( event . origin !== window . parent . origin ) return ;
2250+ if ( event . origin !== parentOrigin ) return ;
22502251
22512252 const data = event . data ;
22522253
@@ -2280,7 +2281,7 @@ async function getTokensFromParent(timeout = 5000) {
22802281 window . parent . postMessage ( {
22812282 action : "GET_TOKENS" ,
22822283 requestId : requestId
2283- } , window . parent . origin ) ;
2284+ } , parentOrigin ) ;
22842285
22852286 // Set timeout
22862287 setTimeout ( ( ) => {
You can’t perform that action at this time.
0 commit comments