This repository was archived by the owner on Nov 23, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -440,9 +440,12 @@ Segment.prototype.retrieveCrossDomainId = function(callback) {
440440
441441 var cachedCrossDomainId = this . getCachedCrossDomainId ( ) ;
442442 if ( cachedCrossDomainId ) {
443- callback ( null , {
444- crossDomainId : cachedCrossDomainId
445- } ) ;
443+ // Callback is only provided in tests.
444+ if ( callback ) {
445+ callback ( null , {
446+ crossDomainId : cachedCrossDomainId
447+ } ) ;
448+ }
446449 return ;
447450 }
448451
@@ -461,11 +464,12 @@ Segment.prototype.retrieveCrossDomainId = function(callback) {
461464
462465 getCrossDomainIdFromServerList ( domains , writeKey , function ( err , res ) {
463466 if ( err ) {
464- // We optimize for no conflicting xid as much as possible. So bail out if there is an
465- // error and we cannot be sure that xid does not exist on any other domains
467+ // Callback is only provided in tests.
466468 if ( callback ) {
467469 callback ( err , null ) ;
468470 }
471+ // We optimize for no conflicting xid as much as possible. So bail out if there is an
472+ // error and we cannot be sure that xid does not exist on any other domains.
469473 return ;
470474 }
471475
You can’t perform that action at this time.
0 commit comments