diff --git a/app/content-scripts/click_to_play.js b/app/content-scripts/click_to_play.js index 0102ff95d..96a7c1fd1 100644 --- a/app/content-scripts/click_to_play.js +++ b/app/content-scripts/click_to_play.js @@ -161,17 +161,17 @@ const Click2PlayContentScript = (function (win, doc) { return false; } - const { name } = request; - const reqMsg = request.msg; - + const { name, message } = request; log('click_to_play.js received message', name); if (name === 'c2p') { - // queue Click-to-Play data so that we process multiple Twitter buttons at once, for example - C2P_DATA[reqMsg.app_id] = [reqMsg.app_id, reqMsg.data, reqMsg.html]; + if (message) { + // queue Click-to-Play data so that we process multiple Twitter buttons at once, for example + C2P_DATA[message.app_id] = [message.app_id, message.data, message.html]; - if (doc.readyState === 'complete') { - applyC2P(reqMsg.app_id, reqMsg.data, reqMsg.html); + if (doc.readyState === 'complete') { + applyC2P(message.app_id, message.data, message.html); + } } } diff --git a/app/content-scripts/notifications.js b/app/content-scripts/notifications.js index 23332fbfe..41256e0ae 100644 --- a/app/content-scripts/notifications.js +++ b/app/content-scripts/notifications.js @@ -731,8 +731,7 @@ const NotificationsContentScript = (function (win, doc) { 'showCMPMessage', 'showBrowseWindow' ]; - const { name } = request; - const reqMsg = request.message; + const { name, message } = request; log('notifications.js received message', name); @@ -744,29 +743,29 @@ const NotificationsContentScript = (function (win, doc) { } if (name === 'showCMPMessage') { - CMP_DATA = reqMsg.data; + CMP_DATA = message.data; showAlert('showCMPMessage', { campaign: CMP_DATA }); ALERT_SHOWN = true; } else if (name === 'showUpgradeAlert') { - NOTIFICATION_TRANSLATIONS = reqMsg.translations; - LANGUAGE = reqMsg.language || 'en'; - showAlert('showUpgradeAlert', reqMsg.major_upgrade); + NOTIFICATION_TRANSLATIONS = message.translations; + LANGUAGE = message.language || 'en'; + showAlert('showUpgradeAlert', message.major_upgrade); ALERT_SHOWN = true; } else if (name === 'showLibraryUpdateAlert') { - NOTIFICATION_TRANSLATIONS = reqMsg.translations; - LANGUAGE = reqMsg.language || 'en'; + NOTIFICATION_TRANSLATIONS = message.translations; + LANGUAGE = message.language || 'en'; showAlert('showLibraryUpdateAlert'); ALERT_SHOWN = true; // Import/Export related messages } else if (name === 'showBrowseWindow') { - showBrowseWindow(reqMsg.translations); + showBrowseWindow(message.translations); ALERT_SHOWN = true; } else if (name === 'onFileImported') { - updateBrowseWindow(reqMsg); + updateBrowseWindow(message); } else if (name === 'exportFile') { - exportFile(reqMsg); + exportFile(message); } // trigger a response callback to src/background so that we can handler errors properly diff --git a/app/panel/components/Summary.jsx b/app/panel/components/Summary.jsx index 930efb2d5..53011911b 100644 --- a/app/panel/components/Summary.jsx +++ b/app/panel/components/Summary.jsx @@ -303,7 +303,7 @@ class Summary extends React.Component { render() { const showBody = (!this.props.is_expanded || !this.props.is_expert); const buttonDisabled = (this.state.disableBlocking || this.props.paused_blocking || this.props.sitePolicy !== false); - const alertText = this.props.paused_blocking ? t('enable_when_paused') : (this.props.sitePolicy === 1) ? t('enable_when_blacklisted') : (this.props.sitePolicy === 2) ? t('enable_when_whitelisted') : this.props.siteNotScanned ? t('enable_when_not_scanned') : ''; + const alertText = this.props.paused_blocking ? t('enable_when_paused') : (this.props.sitePolicy === 1) ? t('enable_when_blacklisted') : (this.props.sitePolicy === 2) ? t('enable_when_whitelisted') : this.state.disableBlocking ? t('enable_when_not_scanned') : ''; const getTooltipClass = () => ((!this.props.is_expert && 'top') || ((this.props.is_expert && this.props.is_expanded) && 'right'));