mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-30 01:53:33 +02:00
typeof <embed/> == "function" ... WTF?
This commit is contained in:
@@ -589,7 +589,7 @@ function isString(val) objproto.toString.call(val) == "[object String]";
|
|||||||
* Returns true if and only if its sole argument may be called
|
* Returns true if and only if its sole argument may be called
|
||||||
* as a function. This includes classes and function objects.
|
* as a function. This includes classes and function objects.
|
||||||
*/
|
*/
|
||||||
function callable(val) typeof val === "function";
|
function callable(val) typeof val === "function" && !(val instanceof Ci.nsIDOMElement);
|
||||||
|
|
||||||
function call(fn) {
|
function call(fn) {
|
||||||
fn.apply(arguments[1], Array.slice(arguments, 2));
|
fn.apply(arguments[1], Array.slice(arguments, 2));
|
||||||
@@ -675,18 +675,18 @@ function update(target) {
|
|||||||
if (desc.value instanceof Class.Property)
|
if (desc.value instanceof Class.Property)
|
||||||
desc = desc.value.init(k, target) || desc.value;
|
desc = desc.value.init(k, target) || desc.value;
|
||||||
|
|
||||||
if (typeof desc.value === "function" && target.__proto__) {
|
|
||||||
let func = desc.value.wrapped || desc.value;
|
|
||||||
if (!func.superapply) {
|
|
||||||
func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]);
|
|
||||||
func.superapply = function superapply(self, args)
|
|
||||||
let (meth = Object.getPrototypeOf(target)[k])
|
|
||||||
meth && meth.apply(self, args);
|
|
||||||
func.supercall = function supercall(self)
|
|
||||||
func.superapply(self, Array.slice(arguments, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if (typeof desc.value === "function" && target.__proto__ && !(desc.value instanceof Ci.nsIDOMElement /* wtf? */)) {
|
||||||
|
let func = desc.value.wrapped || desc.value;
|
||||||
|
if (!func.superapply) {
|
||||||
|
func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]);
|
||||||
|
func.superapply = function superapply(self, args)
|
||||||
|
let (meth = Object.getPrototypeOf(target)[k])
|
||||||
|
meth && meth.apply(self, args);
|
||||||
|
func.supercall = function supercall(self)
|
||||||
|
func.superapply(self, Array.slice(arguments, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
Object.defineProperty(target, k, desc);
|
Object.defineProperty(target, k, desc);
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|||||||
@@ -292,6 +292,9 @@ var Template = Module("Template", {
|
|||||||
case "boolean":
|
case "boolean":
|
||||||
return <span highlight="Boolean">{str}</span>;
|
return <span highlight="Boolean">{str}</span>;
|
||||||
case "function":
|
case "function":
|
||||||
|
if (arg instanceof Ci.nsIDOMElement) // wtf?
|
||||||
|
return util.objectToString(arg, !bw);
|
||||||
|
|
||||||
str = str.replace("/* use strict */ \n", "/* use strict */ ");
|
str = str.replace("/* use strict */ \n", "/* use strict */ ");
|
||||||
if (processStrings)
|
if (processStrings)
|
||||||
return <span highlight="Function">{str.replace(/\{(.|\n)*(?:)/g, "{ ... }")}</span>;
|
return <span highlight="Function">{str.replace(/\{(.|\n)*(?:)/g, "{ ... }")}</span>;
|
||||||
|
|||||||
Reference in New Issue
Block a user