Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+const TOPIC = "chrome-document-global-created";
+
function observe(window, topic, url) {
- if (topic === "chrome-document-global-created")
+ if (topic === TOPIC)
checkDocument(window.document);
}
function init(id) {
if (id)
ADDON_ID = id;
- Services.obs[id ? "addObserver" : "removeObserver"](observe, "chrome-document-global-created", false);
- for (let doc in chromeDocuments)
+ Services.obs[id ? "addObserver" : "removeObserver"](observe, TOPIC, false);
+ for (let doc in chromeDocuments())
checkDocument(doc, !id);
}
function cleanup() { init(null); }
}
function chromeDocuments() {
- let windows = services.windowMediator.getXULWindowEnumerator(null);
+ let windows = Services.wm.getXULWindowEnumerator(null);
while (windows.hasMoreElements()) {
let window = windows.getNext().QueryInterface(Ci.nsIXULWindow);
for each (let type in ["typeChrome", "typeContent"]) {