1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 09:42:28 +01:00

First work towards group-local option values.

This commit is contained in:
Kris Maglione
2011-08-23 22:42:38 -04:00
parent 9ad4be54a9
commit 435f30f7eb
7 changed files with 279 additions and 188 deletions

View File

@@ -478,6 +478,16 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
dequote: function dequote(pattern, chars)
pattern.replace(/\\(.)/, function (m0, m1) chars.indexOf(m1) >= 0 ? m1 : m0),
/**
* Returns the nsIDocShell for a given window.
*
* @param {Window} win The window.
* @returns {nsIDocShell}
*/
docShell: function docShell(win)
win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell),
/**
* Prints a message to the console. If *msg* is an object it is pretty
* printed.
@@ -748,11 +758,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* Iterates over all currently open documents, including all
* top-level window and sub-frames thereof.
*/
iterDocuments: function iterDocuments() {
iterDocuments: function iterDocuments(types) {
types = types || ["chrome", "content"];
types = types.map(function (t) "type" + util.capitalize(t));
let windows = services.windowMediator.getXULWindowEnumerator(null);
while (windows.hasMoreElements()) {
let window = windows.getNext().QueryInterface(Ci.nsIXULWindow);
for each (let type in ["typeChrome", "typeContent"]) {
for each (let type in types) {
let docShells = window.docShell.getDocShellEnumerator(Ci.nsIDocShellTreeItem[type],
Ci.nsIDocShell.ENUMERATE_FORWARDS);
while (docShells.hasMoreElements())