home *** CD-ROM | disk | FTP | other *** search
- /* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents (ry
- *
- * ***** END LICENSE BLOCK *****
- */
-
- function showCacheViewer() {
- var sepwin = gPrefService.getBoolPref("extensions.cacheviewer.open_in_separate_window");
- var needToOpen = true;
- var windowType = "CacheViewer";
- if (sepwin) {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var windows = wm.getEnumerator(windowType);
- while (windows.hasMoreElements()) {
- var theEM = windows.getNext().QueryInterface(Components.interfaces.nsIDOMWindowInternal);
- if (theEM.document.documentElement.getAttribute("windowtype") == windowType) {
- theEM.focus();
- needToOpen = false;
- break;
- }
- }
- if (needToOpen) {
- const EMURL = "chrome://cacheviewer/content/cacheviewer.xul";
- const EMFEATURES = "chrome, all, dialog=no, centerscreen";
- window.openDialog(EMURL, "", EMFEATURES);
- }
- } else {
- var tab = getBrowser().mTabContainer.firstChild;
- while (tab) {
- if (getBrowser().getBrowserForTab(tab).contentDocument.documentElement.getAttribute("windowtype") == windowType) {
- getBrowser().selectedTab = tab;
- needToOpen = false;
- break;
- }
- tab = tab.nextSibling;
- }
- if (needToOpen) {
- getBrowser().selectedTab = getBrowser().addTab("chrome://cacheviewer/content/cacheviewer.xul");
- }
- }
- }