This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add noScriptInfo checkboxes to allow scripts by origin
fix #6431. adjusts the noScriptInfo dialog so that it can be used to allow scripts by origin, instead of all scripts on the page, when NoScript is globally enabled. removes the option to allow scripts persistently (since this can be done via the Bravery panel anyway) auditors: @bbondy
- Loading branch information
1 parent
7b687a1
commit 4a395a7
Showing
14 changed files
with
236 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* global describe, it, beforeEach */ | ||
|
||
const Brave = require('../lib/brave') | ||
const appConfig = require('../../js/constants/appConfig') | ||
const messages = require('../../js/constants/messages') | ||
const assert = require('assert') | ||
const {urlInput, noScriptNavButton, noScriptInfo, noScriptAllowTempButton, noScriptAllowOnceButton} = require('../lib/selectors') | ||
|
||
describe('noscript info', function () { | ||
function * setup (client) { | ||
yield client | ||
.waitForUrl(Brave.newTabUrl) | ||
.waitForBrowserWindow() | ||
.waitForVisible(urlInput) | ||
.setResourceEnabled(appConfig.resourceNames.NOSCRIPT, true) | ||
} | ||
|
||
const result = '#result' | ||
|
||
Brave.beforeEach(this) | ||
beforeEach(function * () { | ||
this.url = Brave.server.url('noscript.html') | ||
yield setup(this.app.client) | ||
}) | ||
|
||
it('can selectively allow scripts', function * () { | ||
yield this.app.client | ||
.tabByIndex(0) | ||
.loadUrl(this.url) | ||
.waitForTextValue(result, '0') | ||
.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(noScriptAllowTempButton) | ||
.click(noScriptAllowTempButton) | ||
.tabByIndex(0) | ||
.loadUrl(this.url) | ||
.waitForTextValue(result, '1') | ||
.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(noScriptAllowOnceButton) // unblock cloudflare | ||
.tabByIndex(0) | ||
.loadUrl(this.url) | ||
.waitForTextValue(result, '2') | ||
}) | ||
|
||
it('only shows allow once in private tab', function * () { | ||
yield this.app.client | ||
.ipcSend(messages.SHORTCUT_NEW_FRAME, this.url, { isPrivate: true }) | ||
.waitForTabCount(2) | ||
.windowByUrl(Brave.browserWindowUrl) | ||
.waitForVisible(noScriptNavButton) | ||
.click(noScriptNavButton) | ||
.waitForVisible(noScriptAllowOnceButton) | ||
.isExisting(noScriptAllowTempButton).then((isExisting) => assert(!isExisting)) | ||
.click(noScriptAllowOnceButton) | ||
.tabByIndex(1) | ||
.loadUrl(this.url) | ||
.waitForTextValue(result, '2') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<head> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | ||
</head> | ||
<body> | ||
<div id='result'>0</div> | ||
<script> | ||
document.querySelector('#result').innerText = 1 | ||
$('#result').text(2) | ||
</script> | ||
</body> |
Oops, something went wrong.