notes plugin allows messsages from current/upcoming slide windows
parent
31407082eb
commit
0247ae7582
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -203,6 +203,7 @@ const Plugin = () => {
|
||||||
// that we remain connected to the notes even if the presentation
|
// that we remain connected to the notes even if the presentation
|
||||||
// is reloaded.
|
// is reloaded.
|
||||||
window.addEventListener( 'message', event => {
|
window.addEventListener( 'message', event => {
|
||||||
|
|
||||||
if( !speakerWindow && typeof event.data === 'string' ) {
|
if( !speakerWindow && typeof event.data === 'string' ) {
|
||||||
let data;
|
let data;
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,8 @@
|
||||||
layoutDropdown,
|
layoutDropdown,
|
||||||
pendingCalls = {},
|
pendingCalls = {},
|
||||||
lastRevealApiCallId = 0,
|
lastRevealApiCallId = 0,
|
||||||
connected = false;
|
connected = false,
|
||||||
|
whitelistedWindows = [window.opener];
|
||||||
|
|
||||||
var SPEAKER_LAYOUTS = {
|
var SPEAKER_LAYOUTS = {
|
||||||
'default': 'Default',
|
'default': 'Default',
|
||||||
|
@ -368,8 +369,8 @@
|
||||||
;
|
;
|
||||||
window.addEventListener( 'message', function( event ) {
|
window.addEventListener( 'message', function( event ) {
|
||||||
|
|
||||||
// Validate the origin of this message to avoid XSS
|
// Validate the origin of this message to prevent XSS
|
||||||
if( window.location.origin !== event.origin && event.source !== window.opener ) {
|
if( window.location.origin !== event.origin && whitelistedWindows.indexOf( event.source ) === -1 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,6 +539,8 @@
|
||||||
upcomingSlide.setAttribute( 'src', upcomingURL );
|
upcomingSlide.setAttribute( 'src', upcomingURL );
|
||||||
document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );
|
document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );
|
||||||
|
|
||||||
|
whitelistedWindows.push( currentSlide.contentWindow, upcomingSlide.contentWindow );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue