Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement per-origin noscript #97
Conversation
|
Built on Mac, will make sure other platforms built before merging. |
|
Please leave this PR for me to merge since I would like to include extension DEPS update commit in this PR when everything is reviewed and ready to merged. |
| @@ -25,14 +26,55 @@ BraveContentSettingsObserver::BraveContentSettingsObserver( | |||
| BraveContentSettingsObserver::~BraveContentSettingsObserver() { | |||
| } | |||
|
|
|||
| void BraveContentSettingsObserver::DidFinishLoad() { | |||
| temporarily_allowed_scripts_.clear(); | |||
This comment has been minimized.
This comment has been minimized.
bbondy
May 11, 2018
Member
Doing this clear here will cause a bad experience for NoScript users because a lot of resource loads for an origin happen after the onload. On browser-laptop in frame.js we clear it when the component is unmounted (tab is closed) or when the user navigates to a different origin.
I think we could instead clear it when there's a different origin than was set in allow once in WillCommitProvisionalLoad or something like that.
You can try it out on my website to see how it doesn't really work well. It probably works for some test sites just fine though.
We don't have to be consistent completely with how browser-laptop works but just more usable.
| temporarily_allowed_scripts_.clear(); | ||
| } | ||
|
|
||
| bool BraveContentSettingsObserver::OnMessageReceived(const IPC::Message& message) { |
This comment has been minimized.
This comment has been minimized.
bbondy
May 11, 2018
Member
Just noting an alternate way to do this might be to create temporary content settings that we later clear. But I'm ok with the current method you used.
This comment has been minimized.
This comment has been minimized.
bridiver
May 16, 2018
Collaborator
that actually doesn't work because it will affect other loads that might be happening in the background
This comment has been minimized.
This comment has been minimized.
bridiver
May 16, 2018
Collaborator
even this had to be tweaked slightly from the original to avoid any race conditoins
| <html><head><title>load js from origins</title></head> | ||
| <body> | ||
| <script src="/cross-site/a.com/create_iframe.js"></script> | ||
| <script src="/cross-site/b.com/create_iframe.js"></script> |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
yrliou
May 19, 2018
Author
Member
Addressed, comments about how this works are added into html file.
|
|
||
| // Send IPC msg to update the list in this tab's content settings observers | ||
| contents->SendToAllFrames( | ||
| new BraveFrameMsg_AllowScriptsOnce(MSG_ROUTING_NONE, params->origins)); |
This comment has been minimized.
This comment has been minimized.
yrliou
May 15, 2018
Author
Member
Noted there is an issue here that frames which might be created after this will not get this list.
Probably could be solved by saving the list (which is specific to one webcontent) in the browser process (maybe in BraveWebContentsObserver or BraveTabSpecificContentSetting) and send the list in RenderFrameCreated to those subsequent frames that are created later.
This comment has been minimized.
This comment has been minimized.
|
|
||
| void BraveContentSettingsObserver::OnAllowScriptsOnce( | ||
| const std::vector<std::string>& origins) { | ||
| temporarily_allowed_scripts_.clear(); |
This comment has been minimized.
This comment has been minimized.
bridiver
May 15, 2018
Collaborator
do we need an extra setting here or can we just set the existing cached_script_permissions_? cached_script_permissions_ gets cleared on navigation
|
@bbondy, @bridiver PR is updated, please take a look again when you're available, thanks! |
|
lgtm |
Autocontribute monthly values other than defaults are now added
Adds styled components names into class names
Adds styled components names into class names
Adds styled components names into class names


yrliou commentedMay 2, 2018
•
edited
Fix brave/brave-browser#6
Support per-tab per-origin noScript settings which will be cleared when navigating away.
See also: brave/brave-extension/pull/21
Submitter Checklist:
git rebase -ito squash commits (if needed).Test Plan:
An automated browser test is added for this feature.
Reviewer Checklist: