diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-03-14 09:06:39 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-03-14 09:06:39 +0100 |
commit | 7e6fb9ec87f10f4cc379240fc5824925ebf2bff3 (patch) | |
tree | 7749c4c5bb62ca07cbb5ce8c0f95cab8fa0d8e39 /js | |
parent | b143e5976bd3dbc5445a27052a93ab6f060b361b (diff) | |
download | perl-software-in-gnu-guix-7e6fb9ec87f10f4cc379240fc5824925ebf2bff3.tar perl-software-in-gnu-guix-7e6fb9ec87f10f4cc379240fc5824925ebf2bff3.tar.gz |
avoid npe on iframe postMessage
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/js/reveal.js b/js/reveal.js index 65560a6..3267465 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3377,20 +3377,20 @@ // Generic postMessage API for non-lazy loaded iframes toArray( element.querySelectorAll( 'iframe' ) ).forEach( function( el ) { - el.contentWindow.postMessage( 'slide:stop', '*' ); + if( el.contentWindow ) el.contentWindow.postMessage( 'slide:stop', '*' ); el.removeEventListener( 'load', startEmbeddedIframe ); }); // YouTube postMessage API toArray( element.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) { - if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { + if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) { el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' ); } }); // Vimeo postMessage API toArray( element.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) { - if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { + if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) { el.contentWindow.postMessage( '{"method":"pause"}', '*' ); } }); |