summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-09-11 15:06:46 -0400
committerKris Maglione <maglione.k@gmail.com>2011-09-11 15:06:46 -0400
commit345cce5a421b9e1a56a1a071f02e5ec73474f43b (patch)
tree031b814916bbaaa42a58ac30ce8d3db4fd05b4b2
parent68d8bf74df55e8bf06ba8660010e6f28f99e598a (diff)
downloadpentadactyl-345cce5a421b9e1a56a1a071f02e5ec73474f43b.tar.gz
Don't Be Evil.
--HG-- rename : pentadactyl/skin/icon.png => pentadactyl/icon16.png
-rw-r--r--common/content/buffer.js10
-rw-r--r--common/content/events.js11
-rw-r--r--common/modules/addons.jsm8
-rw-r--r--common/modules/base.jsm13
-rw-r--r--common/modules/dom.jsm5
-rw-r--r--common/modules/overlay.jsm7
-rw-r--r--common/modules/storage.jsm15
-rw-r--r--pentadactyl/icon16.pngbin0 -> 464 bytes
8 files changed, 41 insertions, 28 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index e3072fcd..78a4e54f 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -270,9 +270,10 @@ var Buffer = Module("buffer", {
*/
get localStore() {
let doc = content.document;
- if (!doc.dactylStore || !buffer.localStorePrototype.isPrototypeOf(doc.dactylStore))
- doc.dactylStore = Object.create(buffer.localStorePrototype);
- return doc.dactylStore.instance = doc.dactylStore;
+ let store = overlay.getData(doc, "buffer");
+ if (!store || !buffer.localStorePrototype.isPrototypeOf(store))
+ store = overlay.setData(doc, "buffer", Object.create(buffer.localStorePrototype));
+ return store.instance = store;
},
localStorePrototype: memoize({
@@ -463,7 +464,8 @@ var Buffer = Module("buffer", {
else
flags = services.focus.FLAG_SHOWRING;
- if (!elem.dactylHadFocus && elem.value &&
+ if (!overlay.getData(elem, "had-focus", false) &&
+ elem.value &&
elem instanceof HTMLInputElement &&
Editor.getEditor(elem) &&
elem.selectionStart != null &&
diff --git a/common/content/events.js b/common/content/events.js
index b2a2ab6d..0cab480a 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -163,10 +163,10 @@ var Events = Module("events", {
if (modes.main != modes.AUTOCOMPLETE)
modes.push(modes.AUTOCOMPLETE);
}
- else if (elem.localName !== "tooltip") {
- if (Events.isHidden(elem))
- if (elem.hidePopup && Events.isHidden(elem.parentNode))
- elem.hidePopup();
+ else if (elem.hidePopup && elem.localName !== "tooltip"
+ && Events.isHidden(elem)
+ && Events.isHidden(elem.parentNode)) {
+ elem.hidePopup();
}
},
@@ -420,6 +420,7 @@ var Events = Module("events", {
toString: function toString() {
if (!arguments.length)
return toString.supercall(this);
+
deprecated.warn(toString, "toString", "DOM.Event.stringify");
return DOM.Event.stringify.apply(DOM.Event, arguments);
},
@@ -584,7 +585,7 @@ var Events = Module("events", {
if (elem == window)
overlay.activeWindow = window;
- elem.dactylHadFocus = true;
+ overlay.setData(elem, "had-focus", true);
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
if (Events.isHidden(elem, true))
elem.blur();
diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm
index 94320779..fa0ff123 100644
--- a/common/modules/addons.jsm
+++ b/common/modules/addons.jsm
@@ -117,8 +117,8 @@ var actions = {
});
},
get filter() {
- let ids = XPIProvider.bootstrappedAddons;
- return function ({ item }) !item.userDisabled && Set.has(ids, item.id);
+ return function ({ item }) !item.userDisabled &&
+ !(item.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE))
},
perm: "disable"
},
@@ -492,10 +492,8 @@ var Addons = Module("addons", {
}
});
-if (!services.has("extensionManager")) {
+if (!services.has("extensionManager"))
Components.utils.import("resource://gre/modules/AddonManager.jsm");
- var { XPIProvider } = Components.utils.import("resource://gre/modules/XPIProvider.jsm", {});
-}
else
var AddonManager = {
PERM_CAN_UNINSTALL: 1,
diff --git a/common/modules/base.jsm b/common/modules/base.jsm
index 9622aa8d..428f864e 100644
--- a/common/modules/base.jsm
+++ b/common/modules/base.jsm
@@ -993,6 +993,12 @@ Class.prototype = {
localizedProperties: {},
magicalProperties: {}
};
+for (let name in properties(Class.prototype)) {
+ let desc = Object.getOwnPropertyDescriptor(Class.prototype, name);
+ desc.enumerable = false;
+ Object.defineProperty(Class.prototype, name, desc);
+}
+
Class.makeClosure = function makeClosure() {
const self = this;
function closure(fn) {
@@ -1059,7 +1065,12 @@ function XPCOMShim(interfaces) {
return (interfaces || []).reduce(function (shim, iface) shim.QueryInterface(Ci[iface]),
ip.data)
};
-function stub() null;
+let stub = Class.Property({
+ configurable: true,
+ enumerable: false,
+ value: function stub() null,
+ writable: true
+});
/**
* An abstract base class for classes that wish to inherit from Error.
diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm
index ee1cc1a6..4be465ec 100644
--- a/common/modules/dom.jsm
+++ b/common/modules/dom.jsm
@@ -77,14 +77,15 @@ var DOM = Class("DOM", {
yield this.eq(i);
},
- get document() this._document || this[0].ownerDocument || this[0].document || this[0],
+ get document() this._document || this[0] && (this[0].ownerDocument || this[0].document || this[0]),
set document(val) this._document = val,
attrHooks: array.toObject([
["", {
href: { get: function (elem) elem.href || elem.getAttribute("href") },
src: { get: function (elem) elem.src || elem.getAttribute("src") },
- checked: { get: function (elem) elem.checked, set: function (elem, val) elem.checked = val },
+ checked: { get: function (elem) elem.hasAttribute("checked") ? elem.getAttribute("checked") == "true" : elem.checked,
+ set: function (elem, val) { elem.setAttribute("checked", !!val); elem.checked = val } },
collapsed: BooleanAttribute("collapsed"),
disabled: BooleanAttribute("disabled"),
hidden: BooleanAttribute("hidden"),
diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm
index ed245550..3fa30c6b 100644
--- a/common/modules/overlay.jsm
+++ b/common/modules/overlay.jsm
@@ -150,11 +150,14 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
getData: function getData(obj, key, constructor) {
let { id } = this;
- if (!(id in obj))
+ if (!(id in obj && obj[id]))
obj[id] = {};
if (obj[id][key] === undefined)
- obj[id][key] = (constructor || Array)();
+ if (constructor === undefined || callable(constructor))
+ obj[id][key] = (constructor || Array)();
+ else
+ obj[id][key] = constructor;
return obj[id][key];
},
diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm
index 81b4e35b..b1d09ab4 100644
--- a/common/modules/storage.jsm
+++ b/common/modules/storage.jsm
@@ -164,10 +164,6 @@ var Storage = Module("Storage", {
this[key].timer.flush();
delete this[key];
}
- for (let ary in values(this.observers))
- for (let obj in values(ary))
- if (obj.ref && obj.ref.get())
- delete obj.ref.get().dactylStorageRefs;
this.keys = {};
this.observers = {};
@@ -201,9 +197,8 @@ var Storage = Module("Storage", {
addObserver: function addObserver(key, callback, ref) {
if (ref) {
- if (!ref.dactylStorageRefs)
- ref.dactylStorageRefs = [];
- ref.dactylStorageRefs.push(callback);
+ let refs = overlay.getData(ref, "storage-refs");
+ refs.push(callback);
var callbackRef = Cu.getWeakReference(callback);
}
else {
@@ -227,7 +222,9 @@ var Storage = Module("Storage", {
removeDeadObservers: function () {
for (let [key, ary] in Iterator(this.observers)) {
- this.observers[key] = ary = ary.filter(function (o) o.callback.get() && (!o.ref || o.ref.get() && o.ref.get().dactylStorageRefs));
+ this.observers[key] = ary = ary.filter(function (o) o.callback.get()
+ && (!o.ref || o.ref.get()
+ && overlay.getData(o.ref.get(), "storage-refs", null)));
if (!ary.length)
delete this.observers[key];
}
@@ -280,7 +277,7 @@ var Storage = Module("Storage", {
},
cleanup: function (dactyl, modules, window) {
- delete window.dactylStorageRefs;
+ overlay.setData(window, "storage-refs", null);
this.removeDeadObservers();
}
});
diff --git a/pentadactyl/icon16.png b/pentadactyl/icon16.png
new file mode 100644
index 00000000..bdd74b76
--- /dev/null
+++ b/pentadactyl/icon16.png
Binary files differ