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

Built from https://develop.svn.wordpress.org/trunk@29202


git-svn-id: http://core.svn.wordpress.org/trunk@28986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-07-17 00:50:15 +00:00
parent d395142fb9
commit d74a2a9f07
3 changed files with 9 additions and 6 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.0-beta1-20140716'; $wp_version = '4.0-beta1-20140717';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.