1window.BX = BX || {}; 2 3BX.PageObject = { 4 getRootWindow: function() 5 { 6 return BX.PageObject.getTopWindowOfCurrentHost(window); 7 }, 8 9 isCrossOriginObject: function(currentWindow) 10 { 11 try 12 { 13 void currentWindow.location.host; 14 } 15 catch (e) 16 { 17 // cross-origin object 18 return true; 19 } 20 21 return false; 22 }, 23 24 getTopWindowOfCurrentHost: function(currentWindow) 25 { 26 if ( 27 !BX.PageObject.isCrossOriginObject(currentWindow.parent) 28 && currentWindow.parent !== currentWindow 29 && currentWindow.parent.location.host === currentWindow.location.host 30 ) 31 { 32 return BX.PageObject.getTopWindowOfCurrentHost(currentWindow.parent); 33 } 34 35 return currentWindow; 36 }, 37 38 getParentWindowOfCurrentHost: function(currentWindow) 39 { 40 if (BX.PageObject.isCrossOriginObject(currentWindow.parent)) 41 { 42 return currentWindow; 43 } 44 45 return currentWindow.parent; 46 } 47};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.