fix security issues(regex not included)

This commit is contained in:
Gerome Matilla 2020-06-16 15:29:44 +08:00
parent 4cbefb0ea7
commit d874dd969f
6 changed files with 11 additions and 11 deletions

View File

@ -54,7 +54,7 @@ class AutoSuggestion {
phraseIndex = phraseButtons.length - 1;
};
const phraseButton = phraseButtons[phraseIndex];
const phraseButton = phraseButtons[parseInt(phraseIndex, 10)];
phraseButton.focus();
}

View File

@ -26,7 +26,7 @@ class Dashboard {
const len = elems.length;
for (let i = 0; i < len; i++) {
elems[i].disabled = status;
elems[parseInt(i, 10)].disabled = status;
}
}

View File

@ -53,9 +53,9 @@ class DockButtons {
for (let i = 0; i < (this.dockSites.length); i++) {
const site = this.dockSites[i].site;
const icon = this.dockSites[i].icon;
const url = this.dockSites[i].url;
const site = this.dockSites[parseInt(i, 10)].site;
const icon = this.dockSites[parseInt(i, 10)].icon;
const url = this.dockSites[parseInt(i, 10)].url;
// Create a href
const aDock = document.createElement('a');

View File

@ -42,7 +42,7 @@ class SearchEngineSettings {
Object.keys(this._searchEngines)
.forEach(key => {
const seValue = key;
const seData = this._searchEngines[key];
const seData = this._searchEngines[String(key)];
const seOption = document.createElement('option');
// Generate search engine suggestions

View File

@ -63,7 +63,7 @@ class WeatherScreen {
'50n': 'nmist.svg'
};
return icon_tbl[code];
return icon_tbl[String(code)];
}
_updateWeatherDockButton = icon => {

View File

@ -41,7 +41,7 @@ class WebMenu {
const len = elems.length;
for (let i = 0; i < len; i++) {
elems[i].disabled = status;
elems[parseInt(i, 10)].disabled = status;
}
}
@ -112,7 +112,7 @@ class WebMenu {
if (string.indexOf(compare) > -1) return true;
for (let i = 0; i < compare.length; i++) {
string.indexOf(compare[i]) > -1 ? matches += 1 : matches -=1;
string.indexOf(compare[parseInt(i)]) > -1 ? matches += 1 : matches -=1;
}
return ((matches / this.length) >= ratio || term === '');
};
@ -131,7 +131,7 @@ class WebMenu {
// Loop through all list items, and focus if matches the search query
for (let i = 0; i < li.length; i++) {
a = li[i].getElementsByClassName('webItemName')[0];
a = li[parseInt(i, 10)].getElementsByClassName('webItemName')[0];
txtValue = a.innerHTML || a.textContent || a.innerText;
// If an item match, hightlight it and focus
@ -144,7 +144,7 @@ class WebMenu {
oldWebItemFocusChild.classList.remove('webItemFocus');
// Update webItemFocus
this._webItemFocus = li[i];
this._webItemFocus = li[parseInt(i)];
// Update weblistindex
this._webListIndex = i;