mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 01:17:58 +01:00
Fix hints on Firefox 4.
This commit is contained in:
@@ -346,7 +346,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
echoerr: function echoerr(str, flags) {
|
||||
flags |= commandline.APPEND_TO_MESSAGES;
|
||||
|
||||
if (isinstance(str, ["Error", "Exception"]))
|
||||
if (isinstance(str, ["Error", "Exception"]) || isinstance(str, [XPCWrappedNative_NoHelper]) && /^\[Exception/.test(str))
|
||||
dactyl.reportError(str);
|
||||
if (isObject(str) && "echoerr" in str)
|
||||
str = str.echoerr;
|
||||
|
||||
@@ -506,7 +506,9 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
*/
|
||||
removeHints: function _removeHints(timeout) {
|
||||
for (let { doc, start, end } in values(this.docs)) {
|
||||
delete doc.dactylLabels;
|
||||
// Goddamn stupid fucking Gecko 1.x security manager bullshit.
|
||||
try { delete doc.dactylLabels; } catch (e) { doc.dactylLabels = undefined; }
|
||||
|
||||
for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc))
|
||||
elem.parentNode.removeChild(elem);
|
||||
for (let i in util.range(start, end + 1))
|
||||
|
||||
@@ -37,6 +37,7 @@ if (!Object.create)
|
||||
};
|
||||
if (!Object.defineProperty)
|
||||
Object.defineProperty = function defineProperty(obj, prop, desc) {
|
||||
try {
|
||||
let value = desc.value;
|
||||
if ("value" in desc)
|
||||
if (desc.writable && !__lookupGetter__.call(obj, prop)
|
||||
@@ -55,6 +56,10 @@ if (!Object.defineProperty)
|
||||
objproto.__defineGetter__.call(obj, prop, desc.get);
|
||||
if ("set" in desc)
|
||||
objproto.__defineSetter__.call(obj, prop, desc.set);
|
||||
}
|
||||
catch (e) {
|
||||
throw e.stack ? e : Error(e);
|
||||
}
|
||||
};
|
||||
if (!Object.defineProperties)
|
||||
Object.defineProperties = function defineProperties(obj, props) {
|
||||
@@ -65,6 +70,7 @@ if (!Object.freeze)
|
||||
Object.freeze = function freeze(obj) {};
|
||||
if (!Object.getOwnPropertyDescriptor)
|
||||
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
||||
try {
|
||||
if (!hasOwnProperty.call(obj, prop))
|
||||
return undefined;
|
||||
let desc = {
|
||||
@@ -82,9 +88,14 @@ if (!Object.getOwnPropertyDescriptor)
|
||||
if (set)
|
||||
desc.set = set;
|
||||
return desc;
|
||||
}
|
||||
catch (e) {
|
||||
throw e.stack ? e : Error(e);
|
||||
}
|
||||
};
|
||||
if (!Object.getOwnPropertyNames)
|
||||
Object.getOwnPropertyNames = function getOwnPropertyNames(obj, _debugger) {
|
||||
try {
|
||||
// This is an ugly and unfortunately necessary hack.
|
||||
if (hasOwnProperty.call(obj, "__iterator__")) {
|
||||
var oldIter = obj.__iterator__;
|
||||
@@ -96,6 +107,10 @@ if (!Object.getOwnPropertyNames)
|
||||
res.push("__iterator__");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
catch (e) {
|
||||
throw e.stack ? e : Error(e);
|
||||
}
|
||||
};
|
||||
if (!Object.getPrototypeOf)
|
||||
Object.getPrototypeOf = function getPrototypeOf(obj) obj.__proto__;
|
||||
@@ -591,6 +606,7 @@ function memoize(obj, key, getter) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
@@ -603,6 +619,10 @@ function memoize(obj, key, getter) {
|
||||
Class.replaceProperty(this.instance || this, key, val)
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
obj[key] = getter.call(obj, key);
|
||||
}
|
||||
}
|
||||
|
||||
let sandbox = Cu.Sandbox(this);
|
||||
sandbox.__proto__ = this;
|
||||
|
||||
Reference in New Issue
Block a user