Heartbeat: in isLocalFrame() compare window.location.origin to iframe.src to stop most cases where WebKit triggers errors about different iframe origin, see #23216

git-svn-id: https://develop.svn.wordpress.org/trunk@24384 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2013-05-30 00:08:53 +00:00
parent 936408271f
commit a6503c1091

View File

@ -65,7 +65,16 @@ window.wp = window.wp || {};
return (new Date()).getTime();
}
function isLocalFrame(frame) {
function isLocalFrame( frame ) {
var origin, src = frame.src;
if ( src && /^https?:\/\//.test( src ) ) {
origin = window.location.origin ? window.location.origin : window.location.protocol + '//' + window.location.host;
if ( src.indexOf( origin ) !== 0 )
return false;
}
try {
if ( frame.contentWindow.document )
return true;
@ -150,7 +159,7 @@ window.wp = window.wp || {};
data: send,
dataType: 'json'
}).done( function( response, textStatus, jqXHR ) {
var new_interval, timed;
var new_interval;
if ( ! response )
return errorstate( 'empty' );