mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-18 18:35:46 +01:00
Fix startup when restoring preferences. Closes issue #291.
This commit is contained in:
@@ -210,10 +210,10 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
get searchEngines() {
|
get searchEngines() {
|
||||||
let searchEngines = [];
|
let searchEngines = [];
|
||||||
let aliases = {};
|
let aliases = {};
|
||||||
return array(services.browserSearch.getVisibleEngines({})).map(function (engine) {
|
return iter(services.browserSearch.getVisibleEngines({})).map(function ([, engine]) {
|
||||||
let alias = engine.alias;
|
let alias = engine.alias;
|
||||||
if (!alias || !/^[a-z_-]+$/.test(alias))
|
if (!alias || !/^[a-z-]+$/.test(alias))
|
||||||
alias = engine.name.replace(/^\W*([a-zA-Z\s_-]+).*/, "$1").replace(/\s+/g, "-").toLowerCase();
|
alias = engine.name.replace(/[a-z_-]+/i, "-").replace(/^-|-$/, "").toLowerCase();
|
||||||
if (!alias)
|
if (!alias)
|
||||||
alias = "search"; // for search engines which we can't find a suitable alias
|
alias = "search"; // for search engines which we can't find a suitable alias
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ var Highlights = Module("Highlight", {
|
|||||||
|
|
||||||
if (/^[[>+: ]/.test(args[1]))
|
if (/^[[>+: ]/.test(args[1]))
|
||||||
obj.selector = this.selector(obj.class) + args[1];
|
obj.selector = this.selector(obj.class) + args[1];
|
||||||
|
else if (args[1])
|
||||||
|
obj.selector = this.selector(args[1]);
|
||||||
|
|
||||||
if (old && old.value != old.defaultValue)
|
if (old && old.value != old.defaultValue)
|
||||||
obj.value = old.value;
|
obj.value = old.value;
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
|||||||
if (this.branch instanceof Ci.nsIPrefBranch2)
|
if (this.branch instanceof Ci.nsIPrefBranch2)
|
||||||
this.branch.QueryInterface(Ci.nsIPrefBranch2);
|
this.branch.QueryInterface(Ci.nsIPrefBranch2);
|
||||||
|
|
||||||
|
this.defaults = defaults ? this : this.constructor(branch, true);
|
||||||
|
|
||||||
if (!defaults)
|
if (!defaults)
|
||||||
this.restore();
|
this.restore();
|
||||||
|
|
||||||
this.defaults = defaults ? this : this.constructor(branch, true);
|
|
||||||
|
|
||||||
this._observers = {};
|
this._observers = {};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user