Bug 1353722 - Catch errors when parsing preferences from filters and hiddenColumns r=rickychien

MozReview-Commit-ID: 6afGAHkT1rC

--HG--
extra : rebase_source : 422605aa2a3a2f5983e47c51037f0b73cf69e680
This commit is contained in:
Ruben Schmidmeister 2017-04-22 23:19:21 +02:00
Родитель f8de9cd306
Коммит 870d9d0175
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -17,15 +17,22 @@ const { TimingMarkers } = require("../reducers/timing-markers");
const { UI, Columns } = require("../reducers/ui");
function configureStore() {
const getPref = (pref) => {
try {
return JSON.parse(Services.prefs.getCharPref(pref));
} catch (_) {
return [];
}
};
let activeFilters = {};
let filters = JSON.parse(Services.prefs.getCharPref("devtools.netmonitor.filters"));
let filters = getPref("devtools.netmonitor.filters");
filters.forEach((filter) => {
activeFilters[filter] = true;
});
let columns = new Columns();
let hiddenColumns =
JSON.parse(Services.prefs.getCharPref("devtools.netmonitor.hiddenColumns"));
let hiddenColumns = getPref("devtools.netmonitor.hiddenColumns");
for (let [col] of columns) {
columns = columns.withMutations((state) => {