From 4f276b9d53d81b37cb751a6be284e23406cd3d6a Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Fri, 9 Sep 2016 17:39:14 +0800 Subject: [PATCH] Follow-up refactor of https://github.com/brave/browser-laptop/pull/3808 Auditors: @diracdeltas Test Plan: N/A --- docs/state.md | 2 +- docs/windowActions.md | 2 +- js/actions/windowActions.js | 2 +- js/components/frame.js | 2 +- js/components/siteInfo.js | 4 ++-- js/stores/windowStore.js | 5 ++++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/state.md b/docs/state.md index f5c466c1dc6..5f78d35717d 100644 --- a/docs/state.md +++ b/docs/state.md @@ -274,7 +274,7 @@ WindowStore }, isExtendedValidation: boolean, // is using https ev runInsecureContent: boolean, // has active mixed content - blockedRunInsecureContent: string, // first domain of blocked active mixed content + blockedRunInsecureContent: Array // sources of blocked active mixed content }, parentFrameKey: number, // the key of the frame this frame was opened from modalPromptDetail: {...}, diff --git a/docs/windowActions.md b/docs/windowActions.md index cb921022b9e..7c42760a9b7 100644 --- a/docs/windowActions.md +++ b/docs/windowActions.md @@ -755,7 +755,7 @@ Sets the manage autofill credit card popup detail ### setBlockedRunInsecureContent(frameProps, source) -Sets page url with blocked active mixed content. +Sets source of blocked active mixed content. **Parameters** diff --git a/js/actions/windowActions.js b/js/actions/windowActions.js index e0a21f7dbb0..e9046b4071c 100644 --- a/js/actions/windowActions.js +++ b/js/actions/windowActions.js @@ -974,7 +974,7 @@ const windowActions = { }, /** - * Sets page url with blocked active mixed content. + * Sets source of blocked active mixed content. * @param {Object} frameProps - The frame to set source of * blocked active mixed content on * @param {string} source - Source of blocked active mixed content diff --git a/js/components/frame.js b/js/components/frame.js index 16d7093d768..cdb55b3cda2 100644 --- a/js/components/frame.js +++ b/js/components/frame.js @@ -592,7 +592,7 @@ class Frame extends ImmutableComponent { } }) this.webview.addEventListener('did-block-run-insecure-content', (e) => { - windowActions.setBlockedRunInsecureContent(this.frame, this.props.location) + windowActions.setBlockedRunInsecureContent(this.frame, e.details[0]) }) this.webview.addEventListener('context-menu', (e) => { contextMenus.onMainContextMenu(e.params, this.frame) diff --git a/js/components/siteInfo.js b/js/components/siteInfo.js index e5492274b38..332ea25c14b 100644 --- a/js/components/siteInfo.js +++ b/js/components/siteInfo.js @@ -19,9 +19,9 @@ class SiteInfo extends ImmutableComponent { this.onDenyRunInsecureContent = this.onDenyRunInsecureContent.bind(this) } onAllowRunInsecureContent () { - appActions.changeSiteSetting(siteUtil.getOrigin(this.isBlockedRunInsecureContent), + appActions.changeSiteSetting(siteUtil.getOrigin(this.location), 'runInsecureContent', true, this.isPrivate) - ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_LOAD_URL, {}, this.isBlockedRunInsecureContent) + ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_LOAD_URL, {}, this.location) this.props.onHide() } onDenyRunInsecureContent () { diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index 3ee517d6aa9..5366e2c91c5 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -764,8 +764,11 @@ const doAction = (action) => { const blockedRunInsecureContentPath = ['frames', FrameStateUtil.getFramePropsIndex(windowState.get('frames'), action.frameProps)] if (action.source) { + let blockedList = windowState.getIn( + blockedRunInsecureContentPath.concat(['security', 'blockedRunInsecureContent'])) || new Immutable.List() windowState = - windowState.setIn(blockedRunInsecureContentPath.concat(['security', 'blockedRunInsecureContent']), action.source) + windowState.setIn(blockedRunInsecureContentPath.concat(['security', 'blockedRunInsecureContent']), + blockedList.push(action.source)) } else { windowState = windowState.deleteIn(blockedRunInsecureContentPath.concat(['security', 'blockedRunInsecureContent']))