mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 01:27:59 +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,24 +37,29 @@ if (!Object.create)
|
||||
};
|
||||
if (!Object.defineProperty)
|
||||
Object.defineProperty = function defineProperty(obj, prop, desc) {
|
||||
let value = desc.value;
|
||||
if ("value" in desc)
|
||||
if (desc.writable && !__lookupGetter__.call(obj, prop)
|
||||
&& !__lookupSetter__.call(obj, prop))
|
||||
try {
|
||||
obj[prop] = value;
|
||||
try {
|
||||
let value = desc.value;
|
||||
if ("value" in desc)
|
||||
if (desc.writable && !__lookupGetter__.call(obj, prop)
|
||||
&& !__lookupSetter__.call(obj, prop))
|
||||
try {
|
||||
obj[prop] = value;
|
||||
}
|
||||
catch (e if e instanceof TypeError) {}
|
||||
else {
|
||||
objproto.__defineGetter__.call(obj, prop, function () value);
|
||||
if (desc.writable)
|
||||
objproto.__defineSetter__.call(obj, prop, function (val) { value = val; });
|
||||
}
|
||||
catch (e if e instanceof TypeError) {}
|
||||
else {
|
||||
objproto.__defineGetter__.call(obj, prop, function () value);
|
||||
if (desc.writable)
|
||||
objproto.__defineSetter__.call(obj, prop, function (val) { value = val; });
|
||||
}
|
||||
|
||||
if ("get" in desc)
|
||||
objproto.__defineGetter__.call(obj, prop, desc.get);
|
||||
if ("set" in desc)
|
||||
objproto.__defineSetter__.call(obj, prop, desc.set);
|
||||
if ("get" in desc)
|
||||
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,37 +70,47 @@ if (!Object.freeze)
|
||||
Object.freeze = function freeze(obj) {};
|
||||
if (!Object.getOwnPropertyDescriptor)
|
||||
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
||||
if (!hasOwnProperty.call(obj, prop))
|
||||
return undefined;
|
||||
let desc = {
|
||||
configurable: true,
|
||||
enumerable: propertyIsEnumerable.call(obj, prop)
|
||||
};
|
||||
var get = __lookupGetter__.call(obj, prop),
|
||||
set = __lookupSetter__.call(obj, prop);
|
||||
if (!get && !set) {
|
||||
desc.value = obj[prop];
|
||||
desc.writable = true;
|
||||
try {
|
||||
if (!hasOwnProperty.call(obj, prop))
|
||||
return undefined;
|
||||
let desc = {
|
||||
configurable: true,
|
||||
enumerable: propertyIsEnumerable.call(obj, prop)
|
||||
};
|
||||
var get = __lookupGetter__.call(obj, prop),
|
||||
set = __lookupSetter__.call(obj, prop);
|
||||
if (!get && !set) {
|
||||
desc.value = obj[prop];
|
||||
desc.writable = true;
|
||||
}
|
||||
if (get)
|
||||
desc.get = get;
|
||||
if (set)
|
||||
desc.set = set;
|
||||
return desc;
|
||||
}
|
||||
catch (e) {
|
||||
throw e.stack ? e : Error(e);
|
||||
}
|
||||
if (get)
|
||||
desc.get = get;
|
||||
if (set)
|
||||
desc.set = set;
|
||||
return desc;
|
||||
};
|
||||
if (!Object.getOwnPropertyNames)
|
||||
Object.getOwnPropertyNames = function getOwnPropertyNames(obj, _debugger) {
|
||||
// This is an ugly and unfortunately necessary hack.
|
||||
if (hasOwnProperty.call(obj, "__iterator__")) {
|
||||
var oldIter = obj.__iterator__;
|
||||
delete obj.__iterator__;
|
||||
try {
|
||||
// This is an ugly and unfortunately necessary hack.
|
||||
if (hasOwnProperty.call(obj, "__iterator__")) {
|
||||
var oldIter = obj.__iterator__;
|
||||
delete obj.__iterator__;
|
||||
}
|
||||
let res = [k for (k in obj) if (hasOwnProperty.call(obj, k))];
|
||||
if (oldIter !== undefined) {
|
||||
obj.__iterator__ = oldIter;
|
||||
res.push("__iterator__");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
let res = [k for (k in obj) if (hasOwnProperty.call(obj, k))];
|
||||
if (oldIter !== undefined) {
|
||||
obj.__iterator__ = oldIter;
|
||||
res.push("__iterator__");
|
||||
catch (e) {
|
||||
throw e.stack ? e : Error(e);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
if (!Object.getPrototypeOf)
|
||||
Object.getPrototypeOf = function getPrototypeOf(obj) obj.__proto__;
|
||||
@@ -591,17 +606,22 @@ function memoize(obj, key, getter) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
try {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
|
||||
get: function g_replaceProperty() (
|
||||
Class.replaceProperty(this.instance || this, key, null),
|
||||
Class.replaceProperty(this.instance || this, key, getter.call(this, key))),
|
||||
get: function g_replaceProperty() (
|
||||
Class.replaceProperty(this.instance || this, key, null),
|
||||
Class.replaceProperty(this.instance || this, key, getter.call(this, key))),
|
||||
|
||||
set: function s_replaceProperty(val)
|
||||
Class.replaceProperty(this.instance || this, key, val)
|
||||
});
|
||||
set: function s_replaceProperty(val)
|
||||
Class.replaceProperty(this.instance || this, key, val)
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
obj[key] = getter.call(obj, key);
|
||||
}
|
||||
}
|
||||
|
||||
let sandbox = Cu.Sandbox(this);
|
||||
|
||||
Reference in New Issue
Block a user