mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 20:27:58 +01:00
Clobber focusAndSelectUrlBar.
This commit is contained in:
@@ -40,9 +40,25 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
styles.registerSheet("resource://dactyl-skin/dactyl.css");
|
styles.registerSheet("resource://dactyl-skin/dactyl.css");
|
||||||
|
|
||||||
prefs.safeSet("accessibility.typeaheadfind.autostart", false);
|
prefs.safeSet("accessibility.typeaheadfind.autostart", false);
|
||||||
|
|
||||||
|
this.cleanups = [];
|
||||||
|
this.cleanups.push(util.overlayObject(window, {
|
||||||
|
focusAndSelectUrlBar: function focusAndSelectUrlBar() {
|
||||||
|
switch (options.get("strictfocus").getKey(document.documentURIObject || util.newURI(document.documentURI), "moderate")) {
|
||||||
|
case "laissez-faire":
|
||||||
|
if (!Events.isHidden(window.gURLBar, true))
|
||||||
|
return focusAndSelectUrlBar.superapply(this, arguments);
|
||||||
|
default:
|
||||||
|
// Evil. Ignore.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
cleanup: function () {
|
cleanup: function () {
|
||||||
|
for (let cleanup in values(this.cleanups))
|
||||||
|
cleanup.call(this);
|
||||||
|
|
||||||
delete window.dactyl;
|
delete window.dactyl;
|
||||||
delete window.liberator;
|
delete window.liberator;
|
||||||
|
|
||||||
|
|||||||
@@ -1338,12 +1338,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
|
|
||||||
// Guard against horrible add-ons that use eval-based monkey
|
// Guard against horrible add-ons that use eval-based monkey
|
||||||
// patching.
|
// patching.
|
||||||
|
let value = desc.value;
|
||||||
if (callable(desc.value)) {
|
if (callable(desc.value)) {
|
||||||
let value = desc.value;
|
|
||||||
|
|
||||||
let sentinel = "(function DactylOverlay() {}())"
|
|
||||||
value.toString = function toString() toString.toString.call(this).replace(/\}?$/, sentinel + "; $&");
|
|
||||||
value.toSource = function toSource() toSource.toSource.call(this).replace(/\}?$/, sentinel + "; $&");
|
|
||||||
|
|
||||||
delete desc.value;
|
delete desc.value;
|
||||||
delete desc.writable;
|
delete desc.writable;
|
||||||
@@ -1359,12 +1355,37 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.defineProperty(object, k, desc);
|
try {
|
||||||
|
Object.defineProperty(object, k, desc);
|
||||||
|
|
||||||
|
if (callable(value)) {
|
||||||
|
let sentinel = "(function DactylOverlay() {}())"
|
||||||
|
value.toString = function toString() toString.toString.call(this).replace(/\}?$/, sentinel + "; $&");
|
||||||
|
value.toSource = function toSource() toSource.toSource.call(this).replace(/\}?$/, sentinel + "; $&");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
try {
|
||||||
|
if (value) {
|
||||||
|
object[k] = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (f) {}
|
||||||
|
util.reportError(e);
|
||||||
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
return function unwrap() {
|
return function unwrap() {
|
||||||
for each (let k in Object.getOwnPropertyNames(original))
|
for each (let k in Object.getOwnPropertyNames(original))
|
||||||
Object.defineProperty(object, k, Object.getOwnPropertyDescriptor(original, k));
|
if (Object.getOwnPropertyDescriptor(object, k).configurable)
|
||||||
|
Object.defineProperty(object, k, Object.getOwnPropertyDescriptor(original, k));
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
object[k] = original[k];
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user