Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/prefs.js

Issue 5364137328640000: Make sure to really save prefs when something changes (Closed)
Patch Set: Created Jan. 13, 2014, 11:53 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the Adblock Plus build tools, 2 * This file is part of the Adblock Plus build tools,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Prefs.__defineSetter__(name, function(newValue) 79 Prefs.__defineSetter__(name, function(newValue)
80 { 80 {
81 if (value == newValue) 81 if (value == newValue)
82 return value; 82 return value;
83 83
84 try 84 try
85 { 85 {
86 ignorePrefChanges = true; 86 ignorePrefChanges = true;
87 writeFunc(branch, name, newValue); 87 writeFunc(branch, name, newValue);
88 value = newValue; 88 value = newValue;
89 Services.prefs.savePrefFile(null);
89 triggerListeners(name); 90 triggerListeners(name);
90 } 91 }
91 catch(e) 92 catch(e)
92 { 93 {
93 Cu.reportError(e); 94 Cu.reportError(e);
94 } 95 }
95 finally 96 finally
96 { 97 {
97 ignorePrefChanges = false; 98 ignorePrefChanges = false;
98 } 99 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 { 194 {
194 let str = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsSt ring); 195 let str = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsSt ring);
195 str.data = newValue; 196 str.data = newValue;
196 branch.setComplexValue(pref, Ci.nsISupportsString, str); 197 branch.setComplexValue(pref, Ci.nsISupportsString, str);
197 } 198 }
198 199
199 function getJSONPref(branch, pref) JSON.parse(getCharPref(branch, pref)) 200 function getJSONPref(branch, pref) JSON.parse(getCharPref(branch, pref))
200 function setJSONPref(branch, pref, newValue) setCharPref(branch, pref, JSON.stri ngify(newValue)) 201 function setJSONPref(branch, pref, newValue) setCharPref(branch, pref, JSON.stri ngify(newValue))
201 202
202 init(); 203 init();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld