Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Disable feature in private mode
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Sep 9, 2016
1 parent 8db6933 commit 7aded75
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ WindowStore
realm: string
},
isExtendedValidation: boolean, // is using https ev
runInsecureContent: string, // first domain of running active mixed content
runInsecureContent: boolean, // has active mixed content
blockedRunInsecureContent: string, // first domain of blocked active mixed content
},
parentFrameKey: number, // the key of the frame this frame was opened from
Expand Down
2 changes: 1 addition & 1 deletion js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ class Frame extends ImmutableComponent {
const runInsecureContent = parsedUrl.protocol === 'https:' && this.runInsecureContent()
windowActions.setSecurityState(this.frame, {
secure: isSecure,
runInsecureContent: runInsecureContent ? this.props.location : null
runInsecureContent: runInsecureContent
})
if (isSecure) {
// Check that there isn't a cert error.
Expand Down
12 changes: 10 additions & 2 deletions js/components/siteInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class SiteInfo extends ImmutableComponent {
this.props.onHide()
}
onDenyRunInsecureContent () {
appActions.removeSiteSetting(siteUtil.getOrigin(this.runInsecureContent), 'runInsecureContent')
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_LOAD_URL, {}, this.runInsecureContent)
appActions.removeSiteSetting(siteUtil.getOrigin(this.location),
'runInsecureContent', this.isPrivate)
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_LOAD_URL, {}, this.location)
this.props.onHide()
}
get isExtendedValidation () {
Expand All @@ -47,6 +48,9 @@ class SiteInfo extends ImmutableComponent {
get partitionNumber () {
return this.props.frameProps.getIn(['partitionNumber'])
}
get location () {
return this.props.frameProps.getIn(['location'])
}
render () {
let secureIcon
if (this.isSecure && !this.runInsecureContent) {
Expand Down Expand Up @@ -97,6 +101,10 @@ class SiteInfo extends ImmutableComponent {
</ul>
</li>
}
// Disable in private mode for now
if (this.isPrivate) {
runInsecureContentInfo = null
}

return <Dialog onHide={this.props.onHide} className='siteInfo' isClickDismiss>
<ul onClick={(e) => e.stopPropagation()}>
Expand Down
9 changes: 0 additions & 9 deletions js/state/contentSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,6 @@ const getContentSettingsFromSiteSettings = (appState) => {
}
}

// temporarySiteSettings
hostSettings = appState.get('temporarySiteSettings').toJS()
for (let hostPattern in hostSettings) {
let hostSetting = hostSettings[hostPattern]
if (typeof hostSetting.runInsecureContent === 'boolean') {
addContentSettings(contentSettings.runInsecureContent, hostPattern, '*',
hostSetting.runInsecureContent ? 'allow' : 'block')
}
}
return { content_settings: contentSettings }
}

Expand Down
32 changes: 30 additions & 2 deletions test/components/navigationBarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ describe('navigationBar', function () {
.waitForVisible(dismissAllowRunInsecureContentButton)
.waitForVisible(allowRunInsecureContentButton)
.click(allowRunInsecureContentButton)
.tabByUrl(this.page1Url)
.tabByIndex(0)
.waitUntil(() => {
return this.app.client.getCssProperty('body', 'background-color').then((color) =>
color.value === 'rgba(255,0,0,1)'
Expand Down Expand Up @@ -394,8 +394,22 @@ describe('navigationBar', function () {
color.value === 'rgba(128,128,128,1)'
)
})
.windowByUrl(Brave.browserWindowUrl)
.ipcSend(messages.SHORTCUT_NEW_FRAME, page1Url, { partitionNumber: 1 })
.waitUntil(function () {
return this.getWindowState().then((val) => {
return val.value.frames.length === 4
})
})
.windowByUrl(Brave.browserWindowUrl)
.tabByIndex(3)
.waitUntil(() => {
return this.app.client.getCssProperty('body', 'background-color').then((color) =>
color.value === 'rgba(128,128,128,1)'
)
})
})
it('Limit effect of running insecure content in private frame', function * () {
it.skip('Limit effect of running insecure content in private frame', function * () {
const page1Url = 'https://mixed-script.badssl.com/'
yield this.app.client
.ipcSend(messages.SHORTCUT_NEW_FRAME, page1Url, { isPrivate: true })
Expand Down Expand Up @@ -454,6 +468,20 @@ describe('navigationBar', function () {
color.value === 'rgba(128,128,128,1)'
)
})
.windowByUrl(Brave.browserWindowUrl)
.ipcSend(messages.SHORTCUT_NEW_FRAME, page1Url, { partitionNumber: 1 })
.waitUntil(function () {
return this.getWindowState().then((val) => {
return val.value.frames.length === 5
})
})
.windowByUrl(Brave.browserWindowUrl)
.tabByIndex(4)
.waitUntil(() => {
return this.app.client.getCssProperty('body', 'background-color').then((color) =>
color.value === 'rgba(128,128,128,1)'
)
})
})
})

Expand Down

0 comments on commit 7aded75

Please sign in to comment.