mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-10 14:43:31 +02:00
Fix search suggestions.
This commit is contained in:
@@ -912,9 +912,9 @@ var Completion = Module("completion", {
|
|||||||
|
|
||||||
// Will, and should, throw an error if !(c in opts)
|
// Will, and should, throw an error if !(c in opts)
|
||||||
Array.forEach(complete, function (c) {
|
Array.forEach(complete, function (c) {
|
||||||
let completer = completion.urlCompleters[c];
|
let completer = this.urlCompleters[c];
|
||||||
context.fork.apply(context, [c, 0, completion, completer.completer].concat(completer.args));
|
context.fork.apply(context, [c, 0, this, completer.completer].concat(completer.args));
|
||||||
});
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
urlCompleters: {},
|
urlCompleters: {},
|
||||||
|
|||||||
@@ -71,14 +71,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
services.add("loginmanager", "@mozilla.org/login-manager;1", Ci.nsILoginManager);
|
services.add("loginmanager", "@mozilla.org/login-manager;1", Ci.nsILoginManager);
|
||||||
services.add("permissions", "@mozilla.org/permissionmanager;1", Ci.nsIPermissionManager);
|
services.add("permissions", "@mozilla.org/permissionmanager;1", Ci.nsIPermissionManager);
|
||||||
|
|
||||||
this.itemMap = {
|
this.itemMap = {};
|
||||||
__iterator__: function () {
|
|
||||||
// For platforms without getOwnPropertyNames :(
|
|
||||||
for (let p in properties(this))
|
|
||||||
if (p !== "__iterator__")
|
|
||||||
yield this[p]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.addItem("all", { description: "Sanitize all items", shouldSanitize: function () false });
|
this.addItem("all", { description: "Sanitize all items", shouldSanitize: function () false });
|
||||||
// Builtin items
|
// Builtin items
|
||||||
@@ -134,7 +127,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
});
|
});
|
||||||
|
|
||||||
function ourItems(persistent) [
|
function ourItems(persistent) [
|
||||||
item for (item in self.itemMap)
|
item for (item in values(self.itemMap))
|
||||||
if (!item.builtin && (!persistent || item.persistent) && item.name !== "all")
|
if (!item.builtin && (!persistent || item.persistent) && item.name !== "all")
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -199,7 +192,8 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
self.withSavedValues(["sanitizing"], function () {
|
self.withSavedValues(["sanitizing"], function () {
|
||||||
self.sanitizing = true;
|
self.sanitizing = true;
|
||||||
sanitize.superapply(this, arguments);
|
sanitize.superapply(this, arguments);
|
||||||
sanitizer.sanitizeItems([item.name for (item in self.itemMap) if (item.shouldSanitize(false))],
|
sanitizer.sanitizeItems([item.name for (item in values(self.itemMap))
|
||||||
|
if (item.shouldSanitize(false))],
|
||||||
Range.fromArray(this.range || []));
|
Range.fromArray(this.range || []));
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
@@ -337,11 +331,10 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
prefToArg: function (pref) pref.replace(/.*\./, "").toLowerCase(),
|
prefToArg: function (pref) pref.replace(/.*\./, "").toLowerCase(),
|
||||||
|
|
||||||
iterCookies: function iterCookies(host) {
|
iterCookies: function iterCookies(host) {
|
||||||
for (let c in iter(services.cookies)) {
|
let iterator = host ? services.cookies.getCookiesFromHost(host)
|
||||||
c.QueryInterface(Ci.nsICookie2);
|
: services.cookies;
|
||||||
if (!host || util.isSubdomain(c.rawHost, host))
|
for (let c in iter(iterator))
|
||||||
yield c;
|
yield c.QueryInterface(Ci.nsICookie2);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
iterPermissions: function iterPermissions(host) {
|
iterPermissions: function iterPermissions(host) {
|
||||||
for (let p in iter(services.permissions)) {
|
for (let p in iter(services.permissions)) {
|
||||||
@@ -546,7 +539,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
"The default list of private items to sanitize",
|
"The default list of private items to sanitize",
|
||||||
"stringlist", "all",
|
"stringlist", "all",
|
||||||
{
|
{
|
||||||
completer: function (value) sanitizer.itemMap,
|
completer: function (value) values(sanitizer.itemMap),
|
||||||
has: modules.Option.has.toggleAll,
|
has: modules.Option.has.toggleAll,
|
||||||
validator: function (values) values.length &&
|
validator: function (values) values.length &&
|
||||||
values.every(function (val) val === "all" || set.has(sanitizer.itemMap, val))
|
values.every(function (val) val === "all" || set.has(sanitizer.itemMap, val))
|
||||||
@@ -557,22 +550,22 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
"stringlist", "",
|
"stringlist", "",
|
||||||
{
|
{
|
||||||
initialValue: true,
|
initialValue: true,
|
||||||
completer: function () [i for (i in sanitizer.itemMap) if (i.persistent || i.builtin)],
|
completer: function () [i for (i in values(sanitizer.itemMap)) if (i.persistent || i.builtin)],
|
||||||
getter: function () !sanitizer.runAtShutdown ? [] : [
|
getter: function () !sanitizer.runAtShutdown ? [] : [
|
||||||
item.name for (item in sanitizer.itemMap)
|
item.name for (item in values(sanitizer.itemMap))
|
||||||
if (item.shouldSanitize(true))
|
if (item.shouldSanitize(true))
|
||||||
],
|
],
|
||||||
setter: function (values) {
|
setter: function (value) {
|
||||||
if (values.length === 0)
|
if (value.length === 0)
|
||||||
sanitizer.runAtShutdown = false;
|
sanitizer.runAtShutdown = false;
|
||||||
else {
|
else {
|
||||||
sanitizer.runAtShutdown = true;
|
sanitizer.runAtShutdown = true;
|
||||||
let have = set(values);
|
let have = set(value);
|
||||||
for (let item in sanitizer.itemMap)
|
for (let item in values(sanitizer.itemMap))
|
||||||
prefs.set(item.shutdownPref,
|
prefs.set(item.shutdownPref,
|
||||||
Boolean(set.has(have, item.name) ^ set.has(have, "all")));
|
Boolean(set.has(have, item.name) ^ set.has(have, "all")));
|
||||||
}
|
}
|
||||||
return values;
|
return value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user