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

fix noscript allow-once for selective scripts #9595

Merged
merged 1 commit into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/renderer/components/frame/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class Frame extends React.Component {
}
const noScriptExceptions = activeSiteSettings.get('noScriptExceptions')
if (noScriptExceptions) {
appActions.noScriptExceptionsAdded(origin, noScriptExceptions.filter((value, host) => value !== 0))
appActions.noScriptExceptionsAdded(origin,
noScriptExceptions.map(value => value === 0 ? false : value))
}
}

Expand Down
46 changes: 46 additions & 0 deletions test/bravery-components/noScriptTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,52 @@ describe('noscript info', function () {
.windowByUrl(Brave.browserWindowUrl)
.waitForVisible(noScriptNavButton)
})

it('can selectively allow scripts once', function * () {
yield this.app.client
.tabByIndex(0)
.url(this.url)
.windowByUrl(Brave.browserWindowUrl)
.waitForVisible(noScriptNavButton)
.click(noScriptNavButton)
.waitForVisible(noScriptInfo)
.waitUntil(function () {
return this.getText('.blockedOriginsList')
.then((text) => {
return text.includes('https://cdnjs.cloudflare.com') && text.includes('http://localhost:')
})
})
.click('[for="checkbox-for-https://cdnjs.cloudflare.com"]') // keep blocking cloudflare
.waitForVisible(noScriptAllowOnceButton)
.click(noScriptAllowOnceButton)
.tabByIndex(0)
.url(this.url)
.windowByUrl(Brave.browserWindowUrl)
.waitForVisible(noScriptNavButton)
.click(noScriptNavButton)
.waitForVisible(noScriptInfo)
.waitUntil(function () {
return this.getText('.blockedOriginsList')
.then((text) => {
return text.includes('https://cdnjs.cloudflare.com') && !text.includes('http://localhost:')
})
})
.newTab()
.closeTabByIndex(0)
.pause(10) // wait for appstate changes
.tabByUrl(Brave.newTabUrl)
.url(this.url)
.windowByUrl(Brave.browserWindowUrl)
.waitForVisible(noScriptNavButton)
.click(noScriptNavButton)
.waitForVisible(noScriptInfo)
.waitUntil(function () {
return this.getText('.blockedOriginsList')
.then((text) => {
return text.includes('https://cdnjs.cloudflare.com') && text.includes('http://localhost:')
})
})
})
})

describe('noscript', function () {
Expand Down