Skip to content

Commit

Permalink
Use noScript state per site instead of blocking scripts
Browse files Browse the repository at this point in the history
fix brave#3189

auditor: @bbondy
  • Loading branch information
darkdh committed Aug 16, 2016
1 parent 0304281 commit fb9709c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,6 @@ class Main extends ImmutableComponent {
enableNoScript={this.enableNoScript(activeSiteSettings)}
settings={this.props.appState.get('settings')}
noScriptIsVisible={noScriptIsVisible}
blockedScripts={activeFrame && activeFrame.getIn(['noScript', 'blocked'])}
/>
{
siteInfoIsVisible
Expand Down
2 changes: 1 addition & 1 deletion js/components/navigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class NavigationBar extends ImmutableComponent {
endLoadTime={this.props.endLoadTime}
titleMode={this.titleMode}
urlbar={this.props.navbar.get('urlbar')}
isBlockingScripts={this.props.blockedScripts && this.props.blockedScripts.size > 0}
enableNoScript={this.props.enableNoScript}
/>
{
isSourceAboutUrl(this.props.location)
Expand Down
5 changes: 3 additions & 2 deletions js/components/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ class UrlBar extends ImmutableComponent {
location = location.replace(replaceRE, '')
searchUrl = this.searchSelectEntry.search.replace('{searchTerms}', encodeURIComponent(location))
}

if ((defaultEngine === 'DuckDuckGo' ||
(this.searchSelectEntry && this.searchSelectEntry.name === 'DuckDuckGo')) &&
this.props.isBlockingScripts) {
this.props.enableNoScript) {
searchUrl = searchUrl.replace('?q=', 'html?q=')
}
location = isLocationUrl ? location : searchUrl
Expand Down Expand Up @@ -462,7 +463,7 @@ class UrlBar extends ImmutableComponent {
urlPreview={this.props.urlbar.get('urlPreview')}
searchSelectEntry={this.searchSelectEntry}
previewActiveIndex={this.props.previewActiveIndex || 0}
isBlockingScripts={this.props.isBlockingScripts} />
enableNoScript={this.props.enableNoScript} />
: null
}
</form>
Expand Down
2 changes: 1 addition & 1 deletion js/components/urlBarSuggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class UrlBarSuggestions extends ImmutableComponent {
let searchURL = this.props.searchSelectEntry
? this.props.searchSelectEntry.search : this.props.searchDetail.get('searchURL')
if (getSetting(settings.DEFAULT_SEARCH_ENGINE) === 'DuckDuckGo' &&
this.props.isBlockingScripts) {
this.props.enableNoScript) {
searchURL = searchURL.replace('?q=', 'html?q=')
}
return searchURL.replace('{searchTerms}', encodeURIComponent(searchTerms))
Expand Down

1 comment on commit fb9709c

@bbondy
Copy link

@bbondy bbondy commented on fb9709c Aug 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.