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 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace noscript with javascript content setting
- Loading branch information
1 parent
440e93f
commit 6b0d144
Showing
9 changed files
with
36 additions
and
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
if (chrome.contentSettings.javascript == 'block') { | ||
document.querySelectorAll('script').forEach((s) => { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
// TODO: Send all of these in one IPC call | ||
chrome.ipc.sendToHost('scripts-blocked', | ||
s.src ? s.src : window.location.href) | ||
}) | ||
} |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -79,7 +79,18 @@ const getContentSettingsFromSiteSettings = (appState) => { | |
setting: getPasswordManagerEnabled(appState) ? 'allow' : 'block', | ||
primaryPattern: '*' | ||
}], | ||
javascript: [], | ||
javascript: [{ | ||
setting: braveryDefaults.noScript ? 'block' : 'allow', | ||
primaryPattern: '*' | ||
}, { | ||
setting: 'allow', | ||
secondaryPattern: '*', | ||
primaryPattern: 'file:///*' | ||
}, { | ||
setting: 'allow', | ||
secondaryPattern: '*', | ||
primaryPattern: 'chrome-extension://*' | ||
This comment has been minimized.
Sorry, something went wrong.
bridiver
Collaborator
|
||
}], | ||
canvasFingerprinting: [{ | ||
setting: braveryDefaults.fingerprintingProtection ? 'block' : 'allow', | ||
primaryPattern: '*' | ||
|
@@ -97,9 +108,10 @@ const getContentSettingsFromSiteSettings = (appState) => { | |
let hostSettings = appState.get('siteSettings').toJS() | ||
for (var hostPattern in hostSettings) { | ||
let hostSetting = hostSettings[hostPattern] | ||
if (hostSetting.noScript) { | ||
// TODO(bridiver) - enable this when we support temporary overrides | ||
// addContentSettings(contentSettings.javascript, hostPattern) | ||
if (typeof hostSetting.noScript === 'boolean') { | ||
// TODO: support temporary override | ||
addContentSettings(contentSettings.javascript, hostPattern, '*', | ||
hostSetting.noScript ? 'block' : 'allow') | ||
} | ||
if (hostSetting.cookieControl) { | ||
if (hostSetting.cookieControl === 'block3rdPartyCookie') { | ||
|
I'm pretty sure you don't need this. You should be able to get them in
this.webview.addEventListener('content-blocked', ...