mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 04:37: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) {
|
echoerr: function echoerr(str, flags) {
|
||||||
flags |= commandline.APPEND_TO_MESSAGES;
|
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);
|
dactyl.reportError(str);
|
||||||
if (isObject(str) && "echoerr" in str)
|
if (isObject(str) && "echoerr" in str)
|
||||||
str = str.echoerr;
|
str = str.echoerr;
|
||||||
|
|||||||
@@ -506,7 +506,9 @@ var HintSession = Class("HintSession", CommandMode, {
|
|||||||
*/
|
*/
|
||||||
removeHints: function _removeHints(timeout) {
|
removeHints: function _removeHints(timeout) {
|
||||||
for (let { doc, start, end } in values(this.docs)) {
|
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))
|
for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc))
|
||||||
elem.parentNode.removeChild(elem);
|
elem.parentNode.removeChild(elem);
|
||||||
for (let i in util.range(start, end + 1))
|
for (let i in util.range(start, end + 1))
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ if (!Object.create)
|
|||||||
};
|
};
|
||||||
if (!Object.defineProperty)
|
if (!Object.defineProperty)
|
||||||
Object.defineProperty = function defineProperty(obj, prop, desc) {
|
Object.defineProperty = function defineProperty(obj, prop, desc) {
|
||||||
|
try {
|
||||||
let value = desc.value;
|
let value = desc.value;
|
||||||
if ("value" in desc)
|
if ("value" in desc)
|
||||||
if (desc.writable && !__lookupGetter__.call(obj, prop)
|
if (desc.writable && !__lookupGetter__.call(obj, prop)
|
||||||
@@ -55,6 +56,10 @@ if (!Object.defineProperty)
|
|||||||
objproto.__defineGetter__.call(obj, prop, desc.get);
|
objproto.__defineGetter__.call(obj, prop, desc.get);
|
||||||
if ("set" in desc)
|
if ("set" in desc)
|
||||||
objproto.__defineSetter__.call(obj, prop, desc.set);
|
objproto.__defineSetter__.call(obj, prop, desc.set);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
throw e.stack ? e : Error(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if (!Object.defineProperties)
|
if (!Object.defineProperties)
|
||||||
Object.defineProperties = function defineProperties(obj, props) {
|
Object.defineProperties = function defineProperties(obj, props) {
|
||||||
@@ -65,6 +70,7 @@ if (!Object.freeze)
|
|||||||
Object.freeze = function freeze(obj) {};
|
Object.freeze = function freeze(obj) {};
|
||||||
if (!Object.getOwnPropertyDescriptor)
|
if (!Object.getOwnPropertyDescriptor)
|
||||||
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
||||||
|
try {
|
||||||
if (!hasOwnProperty.call(obj, prop))
|
if (!hasOwnProperty.call(obj, prop))
|
||||||
return undefined;
|
return undefined;
|
||||||
let desc = {
|
let desc = {
|
||||||
@@ -82,9 +88,14 @@ if (!Object.getOwnPropertyDescriptor)
|
|||||||
if (set)
|
if (set)
|
||||||
desc.set = set;
|
desc.set = set;
|
||||||
return desc;
|
return desc;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
throw e.stack ? e : Error(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if (!Object.getOwnPropertyNames)
|
if (!Object.getOwnPropertyNames)
|
||||||
Object.getOwnPropertyNames = function getOwnPropertyNames(obj, _debugger) {
|
Object.getOwnPropertyNames = function getOwnPropertyNames(obj, _debugger) {
|
||||||
|
try {
|
||||||
// This is an ugly and unfortunately necessary hack.
|
// This is an ugly and unfortunately necessary hack.
|
||||||
if (hasOwnProperty.call(obj, "__iterator__")) {
|
if (hasOwnProperty.call(obj, "__iterator__")) {
|
||||||
var oldIter = obj.__iterator__;
|
var oldIter = obj.__iterator__;
|
||||||
@@ -96,6 +107,10 @@ if (!Object.getOwnPropertyNames)
|
|||||||
res.push("__iterator__");
|
res.push("__iterator__");
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
throw e.stack ? e : Error(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if (!Object.getPrototypeOf)
|
if (!Object.getPrototypeOf)
|
||||||
Object.getPrototypeOf = function getPrototypeOf(obj) obj.__proto__;
|
Object.getPrototypeOf = function getPrototypeOf(obj) obj.__proto__;
|
||||||
@@ -591,6 +606,7 @@ function memoize(obj, key, getter) {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
Object.defineProperty(obj, key, {
|
Object.defineProperty(obj, key, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
@@ -603,6 +619,10 @@ function memoize(obj, key, getter) {
|
|||||||
Class.replaceProperty(this.instance || this, key, val)
|
Class.replaceProperty(this.instance || this, key, val)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
obj[key] = getter.call(obj, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let sandbox = Cu.Sandbox(this);
|
let sandbox = Cu.Sandbox(this);
|
||||||
sandbox.__proto__ = this;
|
sandbox.__proto__ = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user