TinyMCE wpView: prevent fatal (security) errors when trying to access iframe.contentWindow in pausePlayers() and unsetPlayers(). See #28905.

git-svn-id: https://develop.svn.wordpress.org/trunk@29202 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-07-17 00:49:11 +00:00
parent 283fa473e6
commit 50f7313fdd
1 changed files with 7 additions and 4 deletions

View File

@ -132,6 +132,7 @@ window.wp = window.wp || {};
frameBorder: '0',
allowTransparency: 'true',
scrolling: 'no',
'class': 'wpview-sandbox',
style: {
width: '100%',
display: 'block'
@ -554,9 +555,10 @@ window.wp = window.wp || {};
pausePlayers: function() {
this.getNodes( function( editor, node, content ) {
var p, win = $( 'iframe', content ).get(0).contentWindow;
var p, win,
iframe = $( 'iframe.wpview-sandbox', content ).get(0);
if ( win && win.mejs ) {
if ( iframe && ( win = iframe.contentWindow ) && win.mejs ) {
for ( p in win.mejs.players ) {
win.mejs.players[p].pause();
}
@ -566,9 +568,10 @@ window.wp = window.wp || {};
unsetPlayers: function() {
this.getNodes( function( editor, node, content ) {
var p, win = $( 'iframe', content ).get(0).contentWindow;
var p, win,
iframe = $( 'iframe.wpview-sandbox', content ).get(0);
if ( win && win.mejs ) {
if ( iframe && ( win = iframe.contentWindow ) && win.mejs ) {
for ( p in win.mejs.players ) {
win.mejs.players[p].remove();
}