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

Commit

Permalink
fix available language check for locale prefix
Browse files Browse the repository at this point in the history
restrict spellcheck and themecolor content script to main frame
auditors: @bbondy
related #3904
  • Loading branch information
bridiver committed Sep 12, 2016
1 parent 6248ed7 commit fa53c2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,33 @@ let generateBraveManifest = () => {
'content/scripts/adInsertion.js',
'content/scripts/passwordManager.js',
'content/scripts/flashListener.js',
'content/scripts/themeColor.js',
'content/scripts/pageInformation.js'
]
},
{
run_at: 'document_end',
all_frames: false,
matches: ['<all_urls>'],
include_globs: [
'http://*/*', 'https://*/*', 'file://*', 'data:*', 'about:srcdoc'
'http://*/*', 'https://*/*', 'file://*', 'data:*', 'about:srcdoc',
getIndexHTML(),
getAppUrl('about-*.html'),
getAppUrl('about-*.html') + '#*'
],
exclude_globs: [
getIndexHTML()
getAppUrl('about-blank.html'),
getAppUrl('about-blank.html') + '#*'
],
js: [
'content/scripts/spellCheck.js'
'content/scripts/spellCheck.js',
'content/scripts/themeColor.js'
]
},
{
run_at: 'document_start',
js: [
'content/scripts/util.js',
'content/scripts/spellCheck.js',
'content/scripts/inputHandler.js',
'content/scripts/themeColor.js'
'content/scripts/inputHandler.js'
],
matches: [
'<all_urls>'
Expand All @@ -88,7 +91,8 @@ let generateBraveManifest = () => {
getAppUrl('about-*.html') + '#*'
],
exclude_globs: [
getAppUrl('about-blank.html')
getAppUrl('about-blank.html'),
getAppUrl('about-blank.html') + '#*'
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions app/spellCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ module.exports.init = () => {
contractions.forEach((word) => contractionSet.add(word.replace(/'.*/, '')))

const availableDictionaries = spellchecker.getAvailableDictionaries()
let dict = getSetting(settings.LANGUAGE) || app.getLocale().replace('-', '_')
let dict = (getSetting(settings.LANGUAGE) || app.getLocale()).replace('-', '_')
if (availableDictionaries.includes(dict)) {
dictionaryLocale = dict
spellchecker.setDictionary(dict)
} else {
dict = dict.split('-')[0]
dict = dict.split('_')[0]
if (availableDictionaries.includes(dict)) {
dictionaryLocale = dict
spellchecker.setDictionary(dict)
Expand Down

1 comment on commit fa53c2e

@bbondy
Copy link
Member

@bbondy bbondy commented on fa53c2e Sep 12, 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.