From e782d5f9bb31d62c555249466be6f34991f84074 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 27 Aug 2015 09:43:40 -0500 Subject: [PATCH] * VRFS-3419 - check better for window opener --- .../react-components/MediaControls.js.jsx.coffee | 6 +++++- .../react-components/PopupMediaControls.js.jsx.coffee | 10 +++++++++- .../PopupRecordingStartStop.js.jsx.coffee | 11 ++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/web/app/assets/javascripts/react-components/MediaControls.js.jsx.coffee b/web/app/assets/javascripts/react-components/MediaControls.js.jsx.coffee index 5a2106c81..34899a6cf 100644 --- a/web/app/assets/javascripts/react-components/MediaControls.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/MediaControls.js.jsx.coffee @@ -8,7 +8,11 @@ mixins = [] # this check ensures we attempt to listen if this component is created in a popup reactContext = if window.opener? then window.opener else window # make sure this is actually us opening the window, not someone else (by checking for MixerStore) -reactContext = window unless 'MixerStore' in reactContext +if window.opener? + try + m = window.opener.MixerStore + catch e + reactContext = window MixerStore = reactContext.MixerStore MixerActions = reactContext.MixerActions diff --git a/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee b/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee index cada895b8..37673bf87 100644 --- a/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/PopupMediaControls.js.jsx.coffee @@ -6,7 +6,15 @@ mixins = [] # make sure this is actually us opening the window, not someone else (by checking for MixerStore) -if window.opener? && ('MixerStore' in window.opener) +accessOpener = false +if window.opener? + try + m = window.opener.MixerStore + accessOpener = true + catch e + + +if accessOpener SessionActions = window.opener.SessionActions MediaPlaybackStore = window.opener.MediaPlaybackStore MixerActions = window.opener.MixerActions diff --git a/web/app/assets/javascripts/react-components/PopupRecordingStartStop.js.jsx.coffee b/web/app/assets/javascripts/react-components/PopupRecordingStartStop.js.jsx.coffee index a57836e76..d13f69dc6 100644 --- a/web/app/assets/javascripts/react-components/PopupRecordingStartStop.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/PopupRecordingStartStop.js.jsx.coffee @@ -3,7 +3,16 @@ context = window mixins = [] # make sure this is actually us opening the window, not someone else (by checking for MixerStore) -if window.opener && ('MixerStore' in window.opener) + +accessOpener = false +if window.opener? + try + m = window.opener.MixerStore + accessOpener = true + catch e + + +if accessOpener mixins.push(Reflux.listenTo(window.opener.RecordingStore,"onRecordingStateChanged")) @PopupRecordingStartStop = React.createClass({