diff --git a/js/components/frame.js b/js/components/frame.js index 720a658922d..126cde03928 100644 --- a/js/components/frame.js +++ b/js/components/frame.js @@ -133,8 +133,7 @@ class Frame extends ImmutableComponent { if (!this.props.allSiteSettings) { return false } - const activeSiteSettings = siteSettings.getSiteSettingsForHostPattern(this.props.allSiteSettings, - origin) + const activeSiteSettings = siteSettings.getSiteSettingsForHostPattern(this.props.allSiteSettings, origin) if (activeSiteSettings && typeof activeSiteSettings.get('widevine') === 'number') { return true } @@ -144,8 +143,7 @@ class Frame extends ImmutableComponent { expireContentSettings (origin) { // Expired Flash settings should be deleted when the webview is // navigated or closed. Same for NoScript's allow-once option. - const activeSiteSettings = siteSettings.getSiteSettingsForHostPattern(this.props.allSiteSettings, - origin) + const activeSiteSettings = siteSettings.getSiteSettingsForHostPattern(this.props.allSiteSettings, origin) if (!activeSiteSettings) { return } @@ -174,12 +172,12 @@ class Frame extends ImmutableComponent { updateWebview (cb, prevProps, newSrc) { // lazy load webview if (!this.webview && !this.props.isActive && !this.props.isPreview && - // allow force loading of new frames - this.props.unloaded === true && - // don't lazy load about pages - !aboutUrls.get(getBaseUrl(this.props.src)) && - // pinned tabs don't serialize their state so the icon is lost for lazy loading - !this.props.pinnedLocation) { + // allow force loading of new frames + this.props.unloaded === true && + // don't lazy load about pages + !aboutUrls.get(getBaseUrl(this.props.src)) && + // pinned tabs don't serialize their state so the icon is lost for lazy loading + !this.props.pinnedLocation) { return } @@ -313,7 +311,7 @@ class Frame extends ImmutableComponent { // make sure the webview content updates to // match the fullscreen state of the frame if (prevProps.isFullScreen !== this.props.isFullScreen || - (this.props.isFullScreen && !this.props.isActive)) { + (this.props.isFullScreen && !this.props.isActive)) { if (this.props.isFullScreen && this.props.isActive) { this.enterHtmlFullScreen() } else { @@ -1043,7 +1041,8 @@ class Frame extends ImmutableComponent { ? siteSettings.getSiteSettingsForURL(allSiteSettings, frame.get('location')) : undefined const contextMenu = currentWindow.get('contextMenuDetail') - const tab = tabState.getTabIndexByTabId(state, frame.tabId) + const tabId = frame.get('tabId') + const tab = tabId && tabId > -1 && tabState.getByTabId(state, tabId) const props = {} // used in renderer @@ -1055,7 +1054,7 @@ class Frame extends ImmutableComponent { props.location = frame.get('location') props.hrefPreview = frame.get('hrefPreview') props.showOnRight = frame.get('showOnRight') - props.tabId = frame.get('tabId') + props.tabId = tabId props.showMessageBox = tab && tab.get('messageBoxDetail') // used in other functions @@ -1079,15 +1078,13 @@ class Frame extends ImmutableComponent { props.pinnedLocation = frame.get('pinnedLocation') props.src = frame.get('src') props.guestInstanceId = frame.get('guestInstanceId') - props.tabId = frame.get('tabId') props.aboutDetailsUrl = frame.getIn(['aboutDetails', 'url']) props.aboutDetailsFrameKey = frame.getIn(['aboutDetails', 'frameKey']) props.aboutDetailsErrorCode = frame.getIn(['aboutDetails', 'errorCode']) props.unloaded = frame.get('unloaded') props.isWidevineEnabled = state.get('widevine') && state.getIn(['widevine', 'enabled']) - props.siteZoomLevel = frameSiteSettings.get('zoomLevel') + props.siteZoomLevel = frameSiteSettings && frameSiteSettings.get('zoomLevel') props.allSiteSettings = allSiteSettings // TODO remove - props.frameSiteSettings = frameSiteSettings // TODO remove return Object.assign({}, ownProps, props) }