+ };
+ let frame = Components.stack.caller;
+ let timer = services.Timer(timeout_notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);
+ this.timeouts.push(timer);
+ return timer;
+ },
+ timeouts: [],
+
+ /**
+ * Updates this instance with the properties of the given objects.
+ * Like the update function, but with special semantics for
+ * localized properties.
+ */
+ update: function update() {
+ // XXX: Duplication.
+
+ for (let i = 0; i < arguments.length; i++) {
+ let src = arguments[i];
+ Object.getOwnPropertyNames(src || {}).forEach((k) => {
+ let desc = Object.getOwnPropertyDescriptor(src, k);
+ if (desc.value instanceof Class.Property)
+ desc = desc.value.init(k, this) || desc.value;
+
+ if (typeof desc.value === "function") {
+ let func = desc.value.wrapped || desc.value;
+ if (!func.superapply) {
+ func.__defineGetter__("super", () => Object.getPrototypeOf(this)[k]);
+
+ func.superapply = function superapply(self, args) {
+ let meth = Object.getPrototypeOf(self)[k];
+ return meth && meth.apply(self, args);
+ };
+
+ func.supercall = function supercall(self, ...args) {
+ return func.superapply(self, args);
+ }
+ }
+ }
+
+ try {
+ if ("value" in desc && (this.localizedProperties.has(k) || this.magicalProperties.has(k)))
+ this[k] = desc.value;
+ else
+ Object.defineProperty(this, k, desc);
+ }
+ catch (e) {}
+ }, this);
+ }
+ return this;
+ },
+
+ localizedProperties: RealSet(),
+ magicalProperties: RealSet()
+};
+for (let name in properties(Class.prototype)) {
+ let desc = Object.getOwnPropertyDescriptor(Class.prototype, name);
+ desc.enumerable = false;
+ Object.defineProperty(Class.prototype, name, desc);
+}
+
+var closureHooks = {
+ get: function closure_get(target, prop) {
+ if (hasOwnProperty(target._closureCache, prop))
+ return target._closureCache[prop];
+
+ let p = target[prop]
+ if (callable(p))
+ return target._closureCache[prop] = p.bind(target);
+ return p;
+ }
+
+ /*
+ getOwnPropertyNames: function getOwnPropertyNames(target) {
+ return [k for (k in properties(target, true))];
+ },
+
+ getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, prop) {
+ let self = this;
+ return {
+ configurable: false,
+ writable: false,
+ get value() self.get(target, prop)