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: http://core.svn.wordpress.org/trunk@24384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-05-30 00:08:53 +00:00
parent 1d1286624d
commit bcdb12da79
1 changed files with 11 additions and 2 deletions

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' );