PK f~7L !locale/de/inspector/inspector.dtd PK K32W`olocale/de/inspector/prefs.dtd PK K32Saalocale/de/inspector/editing.dtd PK K326Z$locale/de/inspector/tasksOverlay.dtd PK si2? locale/de/inspector/contents.rdf PK \7"Y0locale/de/inspector/viewers/accessibleEvents.dtd PK \7 33/locale/de/inspector/viewers/accessibleProps.dtd PK ea7?nc3locale/de/inspector/viewers/accessibleRelations.dtd PK \7wWJ.locale/de/inspector/viewers/accessibleTree.dtd PK f~7| #locale/de/inspector/viewers/dom.dtd PK \7g  'locale/de/inspector/viewers/domNode.dtd PK f~7 *locale/de/inspector/viewers/styleRules.dtd PK ;=4VV+locale/de/inspector/viewers/stylesheets.dtd PK L32+locale/de/inspector/viewers/xblBindings.dtd PK L32go(locale/de/inspector/viewers/boxModel.dtd PK L325-locale/de/inspector/viewers/computedStyle.dtd PK f~7s$~~(locale/de/inspector/viewers/jsObject.dtd PK \7\FF(locale/de/inspector/inspector.properties inspectURL.title = URL inspizieren inspectURL.message = Geben Sie eine URL an: inspectWindow.noDocuments.message = (Keines) styleRuleNewProperty.title = Neue Style-Regel styleRuleEditProperty.title = Style-Regel bearbeiten styleRulePropertyValue.message = Geben Sie den Eigenschaftswert ein: styleRulePropertyName.message = Geben Sie den Eigenschaftsnamen ein: sidebar.title = DOM Inspector sidebarInstalled = Die Sidebar ist installiert. newAttribute.title = Neues Attribut editAttribute.title = Attribut bearbeiten findNodesDocumentEnd.message = Ende des Dokuments erreicht. findNodesDocumentEnd.title = Knoten suchen root.title = Subjekt 1 = Element 2 = Attribut 3 = Text 4 = CDATA-Bereich 5 = Entity-Referenz 6 = Entity 7 = Durchführungsanweisung 8 = Kommentar 9 = Dokument 10 = Dokument-Typ 11 = Dokument-Fragment 12 = Notation PK |A}7$locale/en-US/inspector/inspector.dtd PK L*3) locale/en-US/inspector/prefs.dtd PK .n+]44"locale/en-US/inspector/editing.dtd PK X2Q'locale/en-US/inspector/tasksOverlay.dtd PK si2!#locale/en-US/inspector/contents.rdf PK T7B3locale/en-US/inspector/viewers/accessibleEvents.dtd PK d6IG112locale/en-US/inspector/viewers/accessibleProps.dtd PK FJ7(}6locale/en-US/inspector/viewers/accessibleRelations.dtd PK Ɲ 7ʸ1locale/en-US/inspector/viewers/accessibleTree.dtd PK |A}73O&locale/en-US/inspector/viewers/dom.dtd PK 6j#*locale/en-US/inspector/viewers/domNode.dtd PK |A}7je*-locale/en-US/inspector/viewers/styleRules.dtd PK b2a(.locale/en-US/inspector/viewers/stylesheets.dtd PK b2:K5.locale/en-US/inspector/viewers/xblBindings.dtd PK b2u;  +locale/en-US/inspector/viewers/boxModel.dtd PK b2ai,0locale/en-US/inspector/viewers/computedStyle.dtd PK |A}7r xcc+locale/en-US/inspector/viewers/jsObject.dtd PK Ƌ 5Tzx+locale/en-US/inspector/inspector.properties inspectURL.title = Inspect URL inspectURL.message = Enter a URL: inspectWindow.noDocuments.message = (None) styleRuleNewProperty.title = New Style Rule styleRuleEditProperty.title = Edit Style Rule styleRulePropertyValue.message = Enter the property value: styleRulePropertyName.message = Enter the property name: sidebar.title = DOM Inspector sidebarInstalled = The sidebar is installed. newAttribute.title = New Attribute editAttribute.title = Edit Attribute findNodesDocumentEnd.message = End of document reached. findNodesDocumentEnd.title = Find Nodes root.title = Subject 1 = Element 2 = Attribute 3 = Text 4 = CDATA Section 5 = Entity Reference 6 = Entity 7 = Processing Instruction 8 = Comment 9 = Document 10 = Document Type 11 = Document Fragment 12 = Notation PK n7!locale/fr/inspector/inspector.dtd PK ,7399locale/fr/inspector/prefs.dtd PK S:y5sSSlocale/fr/inspector/editing.dtd PK ,73zvQ$locale/fr/inspector/tasksOverlay.dtd PK si2ov locale/fr/inspector/contents.rdf PK T%70locale/fr/inspector/viewers/accessibleEvents.dtd PK x6U BB/locale/fr/inspector/viewers/accessibleProps.dtd PK ca7gO3locale/fr/inspector/viewers/accessibleRelations.dtd PK T%7wZ.locale/fr/inspector/viewers/accessibleTree.dtd PK n7__#locale/fr/inspector/viewers/dom.dtd PK lY6g55'locale/fr/inspector/viewers/domNode.dtd PK q4@2*locale/fr/inspector/viewers/styleRules.dtd PK ,737Y+locale/fr/inspector/viewers/stylesheets.dtd PK ,73:+locale/fr/inspector/viewers/xblBindings.dtd PK ,73^ (locale/fr/inspector/viewers/boxModel.dtd PK ,73-locale/fr/inspector/viewers/computedStyle.dtd PK @M59\(locale/fr/inspector/viewers/jsObject.dtd PK @M512(locale/fr/inspector/inspector.properties inspectURL.title = Examiner une URL inspectURL.message = Entrez une URL : inspectWindow.noDocuments.message = (Aucune) styleRuleNewProperty.title = Nouvelle r\u00e8gle de style styleRuleEditProperty.title = \u00c9diter la r\u00e8gle de style styleRulePropertyValue.message = Entrez la valeur de la propri\u00e9t\u00e9 : styleRulePropertyName.message = Entrez le nom de la propri\u00e9t\u00e9 : sidebar.title = Inspecteur DOM sidebarInstalled = Le panneau \u00ab\u00a0Inspecteur DOM\u00a0\u00bb est install\u00e9 dans la barre lat\u00e9rale. newAttribute.title = Nouvel attribut editAttribute.title = \u00c9diter l'attribut findNodesDocumentEnd.message = La fin du document a \u00e9t\u00e9 atteinte. findNodesDocumentEnd.title = Trouver les n\u0153uds root.title = Sujet 1 = \u00c9l\u00e9ment 2 = Attribut 3 = Texte 4 = Section CDATA 5 = R\u00e9f\u00e9rence d'entit\u00e9 6 = Entit\u00e9 7 = Instruction de traitement 8 = Commentaire 9 = Document 10 = Type de document 11 = Fragment de document 12 = Notation PK p7>q!locale/sk/inspector/inspector.dtd PK :[f7v  locale/sk/inspector/prefs.dtd PK :[f7AլVVlocale/sk/inspector/editing.dtd PK :[f7|+$locale/sk/inspector/tasksOverlay.dtd PK si2FPt locale/sk/inspector/contents.rdf PK Mbf7:0locale/sk/inspector/viewers/accessibleEvents.dtd PK :[f72y11/locale/sk/inspector/viewers/accessibleProps.dtd PK Mbf7 [w3locale/sk/inspector/viewers/accessibleRelations.dtd PK Mbf7d.locale/sk/inspector/viewers/accessibleTree.dtd PK p7*#locale/sk/inspector/viewers/dom.dtd PK :[f7 ,'locale/sk/inspector/viewers/domNode.dtd PK :[f7)*locale/sk/inspector/viewers/styleRules.dtd PK :[f7{+locale/sk/inspector/viewers/stylesheets.dtd PK :[f7e.+locale/sk/inspector/viewers/xblBindings.dtd PK :[f7w'(locale/sk/inspector/viewers/boxModel.dtd PK x803wP/-locale/sk/inspector/viewers/computedStyle.dtd PK :[f7nww(locale/sk/inspector/viewers/jsObject.dtd PK :[f7(locale/sk/inspector/inspector.properties inspectURL.title=Preskúmať URL inspectURL.message=Zadajte URL: inspectWindow.noDocuments.message = (Žiadne) styleRuleNewProperty.title=Nové pravidlo štýlu styleRuleEditProperty.title=Úprava pravidla štýlu styleRulePropertyValue.message=Zadajte hodnotu vlastnosti: styleRulePropertyName.message=Zadajte názov vlastnosti sidebar.title=DOM Inspector sidebarInstalled=Bočný panel je nainštalovaný newAttribute.title=Nový atribút editAttribute.title=Úpravy atribútu findNodesDocumentEnd.message=Dosiahnutý koniec dokumentu findNodesDocumentEnd.title=Hľadať uzly root.title = Predmet 1 = Prvok 2 = Atribút 3 = Text 4 = Sekcia CDATA 5 = Odkaz entity 6 = Entita 7 = Vykonávanie inštrukcie 8 = Komentár 9 = Dokument 10 = Typ dokumentu 11 = Fragment dokumentu 12 = Poznámka PK f6 `content/inspector/inspector.xul %dtd1; %dtd2; ]> PK f6HHHcontent/inspector/inspector.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * Jason Barnabe * Shawn Wilsher * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * InspectorApp ------------------------------------------------- * The primary object that controls the Inspector application. ****************************************************************/ //////////// global variables ///////////////////// var inspector; //////////// global constants //////////////////// const kClipboardHelperCID = "@mozilla.org/widget/clipboardhelper;1"; const kPromptServiceCID = "@mozilla.org/embedcomp/prompt-service;1"; const kFOStreamCID = "@mozilla.org/network/file-output-stream;1"; const kEncoderCIDbase = "@mozilla.org/layout/documentEncoder;1?type="; const kSerializerCID = "@mozilla.org/xmlextras/xmlserializer;1"; const nsIWebNavigation = Components.interfaces.nsIWebNavigation; const nsIDocShellTreeItem = Components.interfaces.nsIDocShellTreeItem; const nsIDocShell = Components.interfaces.nsIDocShell; const nsIFileOutputStream = Components.interfaces.nsIFileOutputStream; const nsIDocumentEncoder = Components.interfaces.nsIDocumentEncoder; const nsIDOMSerializer = Components.interfaces.nsIDOMSerializer; ////////////////////////////////////////////////// window.addEventListener("load", InspectorApp_initialize, false); window.addEventListener("unload", InspectorApp_destroy, false); function InspectorApp_initialize() { inspector = new InspectorApp(); // window.arguments may be either a string or a node. // If passed via a command line handler, it will be a uri string. // If passed via navigator hooks, it will be a dom node to inspect. var initNode, initURI; if (window.arguments && window.arguments.length) { if (typeof window.arguments[0] == "string") { initURI = window.arguments[0]; } else if (window.arguments[0] instanceof Components.interfaces.nsIDOMNode) { initNode = window.arguments[0]; } } inspector.initialize(initNode, initURI); // Disables the Mac Specific VK_BACK for delete key for non-mac systems if (!/Mac/.test(navigator.platform)) { document.getElementById("keyEditDeleteMac") .setAttribute("disabled", "true"); } } function InspectorApp_destroy() { inspector.destroy(); } //////////////////////////////////////////////////////////////////////////// //// class InspectorApp function InspectorApp() { } InspectorApp.prototype = { //////////////////////////////////////////////////////////////////////////// //// Initialization mShowBrowser: false, mClipboardHelper: null, mPromptService: null, get document() { return this.mDocPanel.viewer.subject }, get panelset() { return this.mPanelSet; }, initialize: function(aTarget, aURI) { this.mInitTarget = aTarget; var el = document.getElementById("bxBrowser"); el.addEventListener("pageshow", BrowserPageShowListener, true); this.setBrowser(false, true); this.mClipboardHelper = XPCU.getService(kClipboardHelperCID, "nsIClipboardHelper"); this.mPromptService = XPCU.getService(kPromptServiceCID, "nsIPromptService"); this.mPanelSet = document.getElementById("bxPanelSet"); this.mPanelSet.addObserver("panelsetready", this, false); this.mPanelSet.initialize(); // check if accessibility service is available var cmd = document.getElementById("cmd:toggleAccessibleNodes"); if (cmd) { if (!("@mozilla.org/accessibleRetrieval;1" in Components.classes)) cmd.setAttribute("disabled", "true"); } if (aURI) { this.gotoURL(aURI); } }, destroy: function() { InsUtil.persistAll("bxDocPanel"); InsUtil.persistAll("bxObjectPanel"); }, //////////////////////////////////////////////////////////////////////////// //// Viewer Panels initViewerPanels: function() { this.mDocPanel = this.mPanelSet.getPanel(0); this.mDocPanel.addObserver("subjectChange", this, false); this.mObjectPanel = this.mPanelSet.getPanel(1); if (this.mInitTarget) { if (this.mInitTarget.nodeType == Node.DOCUMENT_NODE) this.setTargetDocument(this.mInitTarget); else if (this.mInitTarget.nodeType == Node.ELEMENT_NODE) { this.setTargetDocument(this.mInitTarget.ownerDocument); this.mDocPanel.params = this.mInitTarget; } this.mInitTarget = null; } }, onEvent: function(aEvent) { switch (aEvent.type) { case "panelsetready": this.initViewerPanels(); break; case "subjectChange": if (aEvent.target == this.mDocPanel.viewer && aEvent.subject && "location" in aEvent.subject) { this.locationText = aEvent.subject.location; // display document url var docTitle = aEvent.subject.title || aEvent.subject.location; if (/Mac/.test(navigator.platform)) { document.title = docTitle; } else { document.title = docTitle + " - " + document.documentElement.getAttribute("title"); } this.updateCommand("cmdSave"); } break; } }, //////////////////////////////////////////////////////////////////////////// //// UI Commands updateCommand: function inspector_updateCommand(aCommand) { var command = document.getElementById(aCommand); var disabled = false; switch (aCommand) { case "cmdSave": var doc = this.mDocPanel.subject; disabled = !((kEncoderCIDbase + doc.contentType) in Components.classes || (kSerializerCID in Components.classes)); break; } command.setAttribute("disabled", disabled); }, doViewerCommand: function(aCommand) { this.mPanelSet.execCommand(aCommand); }, showOpenURLDialog: function() { var bundle = this.mPanelSet.stringBundle; var msg = bundle.getString("inspectURL.message"); var title = bundle.getString("inspectURL.title"); var url = { value: "http://" }; var dummy = { value: false }; var go = this.mPromptService.prompt(window, title, msg, url, null, dummy); if (go) { this.gotoURL(url.value); } }, showPrefsDialog: function() { goPreferences("advancedItem", "chrome://inspector/content/prefs/pref-inspector.xul", "inspector"); }, toggleBrowser: function(aToggleSplitter) { this.setBrowser(!this.mShowBrowser, aToggleSplitter) }, setBrowser: function(aValue, aToggleSplitter) { this.mShowBrowser = aValue; if (aToggleSplitter) this.openSplitter("Browser", aValue); var cmd = document.getElementById("cmdToggleBrowser"); cmd.setAttribute("checked", aValue); }, openSplitter: function(aName, aTruth) { var splitter = document.getElementById("spl" + aName); if (aTruth) splitter.open(); else splitter.close(); }, /** * Saves the current document state in the inspector. */ save: function save() { var picker = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); var title = document.getElementById("mi-save").label; picker.init(window, title, picker.modeSave) picker.appendFilters(picker.filterHTML | picker.filterXML | picker.filterXUL); if (picker.show() == picker.returnCancel) return; var fos = Components.classes[kFOStreamCID] .createInstance(nsIFileOutputStream); const flags = 0x02 | 0x08 | 0x20; // write, create, truncate var doc = this.mDocPanel.subject; if ((kEncoderCIDbase + doc.contentType) in Components.classes) { // first we try to use the document encoder for that content type. If // that fails, we move on to the xml serializer. var encoder = Components.classes[kEncoderCIDbase + doc.contentType] .createInstance(nsIDocumentEncoder); encoder.init(doc, doc.contentType, encoder.OutputRaw); encoder.setCharset(doc.characterSet); fos.init(picker.file, flags, 0666, 0); try { encoder.encodeToStream(fos); } finally { fos.close(); } } else { var serializer = Components.classes[kSerializerCID] .createInstance(nsIDOMSerializer); fos.init(picker.file, flags, 0666, 0); try { serializer.serializeToStream(doc, fos); } finally { fos.close(); } } }, exit: function() { window.close(); // Todo: remove observer service here }, //////////////////////////////////////////////////////////////////////////// //// Navigation gotoTypedURL: function() { var url = document.getElementById("tfURLBar").value; this.gotoURL(url); }, gotoURL: function(aURL, aNoSaveHistory) { this.mPendingURL = aURL; this.mPendingNoSave = aNoSaveHistory; this.browseToURL(aURL); this.setBrowser(true, true); }, browseToURL: function(aURL) { try { this.webNavigation.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); } catch(ex) { // nsIWebNavigation.loadURI will spit out an appropriate user prompt, so // we don't need to do anything here. See nsDocShell::DisplayLoadError() } }, /** * Creates the submenu for Inspect Content/Chrome Document */ showInspectDocumentList: function showInspectDocumentList(aEvent, aChrome) { const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var menu = aEvent.target; var ww = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var windows = ww.getXULWindowEnumerator(null); var docs = []; while (windows.hasMoreElements()) { try { // Get the window's main docshell var windowDocShell = windows.getNext() .QueryInterface(Components.interfaces.nsIXULWindow) .docShell; this.appendContainedDocuments(docs, windowDocShell, aChrome ? nsIDocShellTreeItem.typeChrome : nsIDocShellTreeItem.typeContent); } catch (ex) { // We've failed with this window somehow, but we're catching the error // so the others will still work Components.utils.reportError(ex); } } // Clear out any previous menu this.emptyChildren(menu); // Now add what we found to the menu if (!docs.length) { var noneMenuItem = document.createElementNS(XULNS, "menuitem"); noneMenuItem.setAttribute("label", this.mPanelSet.stringBundle .getString("inspectWindow.noDocuments.message")); noneMenuItem.setAttribute("disabled", true); menu.appendChild(noneMenuItem); } else { for (var i = 0; i < docs.length; i++) this.addInspectDocumentMenuItem(menu, docs[i], i + 1); } }, /** * Appends to the array the documents contained in docShell (including the passed * docShell itself). * * @param array the array to append to * @param docShell the docshell to look for documents in * @param type one of the types defined in nsIDocShellTreeItem */ appendContainedDocuments: function appendContainedDocuments(array, docShell, type) { // Load all the window's content docShells var containedDocShells = docShell.getDocShellEnumerator(type, nsIDocShell.ENUMERATE_FORWARDS); while (containedDocShells.hasMoreElements()) { try { // Get the corresponding document for this docshell var childDoc = containedDocShells.getNext().QueryInterface(nsIDocShell) .contentViewer.DOMDocument; // Ignore the DOM Insector's browser docshell if it's not being used if (docShell.contentViewer.DOMDocument.location.href != document.location.href || childDoc.location.href != "about:blank") { array.push(childDoc); } } catch (ex) { // We've failed with this document somehow, but we're catching the error so // the others will still work dump(ex + "\n"); } } }, /** * Creates a menu item for Inspect Document. * * @param doc document related to this menu item * @param docNumber the position of the document */ addInspectDocumentMenuItem: function addInspectDocumentMenuItem(parent, doc, docNumber) { const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var menuItem = document.createElementNS(XULNS, "menuitem"); menuItem.doc = doc; // Use the URL if there's no title var title = doc.title || doc.location.href; // The first ten items get numeric access keys if (docNumber < 10) { menuItem.setAttribute("label", docNumber + " " + title); menuItem.setAttribute("accesskey", docNumber); } else { menuItem.setAttribute("label", title); } parent.appendChild(menuItem); }, setTargetWindow: function(aWindow) { this.setTargetDocument(aWindow.document); }, setTargetDocument: function(aDoc) { this.mDocPanel.subject = aDoc; }, get webNavigation() { var browser = document.getElementById("ifBrowser"); return browser.webNavigation; }, //////////////////////////////////////////////////////////////////////////// //// UI Labels getters and setters get locationText() { return document.getElementById("tfURLBar").value; }, set locationText(aText) { document.getElementById("tfURLBar").value = aText; }, get statusText() { return document.getElementById("txStatus").value; }, set statusText(aText) { document.getElementById("txStatus").value = aText; }, get progress() { return document.getElementById("pmStatus").value; }, set progress(aPct) { document.getElementById("pmStatus").value = aPct; }, //////////////////////////////////////////////////////////////////////////// //// Document Loading documentLoaded: function() { this.setTargetWindow(_content); var url = this.webNavigation.currentURI.spec; // put the url into the urlbar this.locationText = url; // add url to the history, unless explicity told not to if (!this.mPendingNoSave) this.addToHistory(url); this.mPendingURL = null; this.mPendingNoSave = null; }, //////////////////////////////////////////////////////////////////////////// //// History addToHistory: function(aURL) { }, //////////////////////////////////////////////////////////////////////////// //// Uncategorized get isViewingContent() { return this.mPanelSet.getPanel(0).subject != null; }, fillInTooltip: function(tipElement) { var retVal = false; var textNode = document.getElementById("txTooltip"); if (textNode) { try { var tipText = tipElement.getAttribute("tooltiptext"); if (tipText != "") { textNode.setAttribute("value", tipText); retVal = true; } } catch (e) { } } return retVal; }, initPopup: function(aPopup) { var items = aPopup.getElementsByTagName("menuitem"); var js, fn, item; for (var i = 0; i < items.length; i++) { item = items[i]; fn = "isDisabled" in item ? item.isDisabled : null; if (!fn) { js = item.getAttribute("isDisabled"); if (js) { fn = new Function(js); item.isDisabled = fn; } else { item.isDisabled = null; // to prevent annoying "strict" warning messages } } if (fn) { if (item.isDisabled()) item.setAttribute("disabled", "true"); else item.removeAttribute("disabled"); } fn = null; } }, emptyChildren: function(aNode) { while (aNode.hasChildNodes()) { aNode.removeChild(aNode.lastChild); } }, onSplitterOpen: function(aSplitter) { if (aSplitter.id == "splBrowser") { this.setBrowser(aSplitter.isOpened, false); } }, // needed by overlayed commands from viewer to get references to a specific // viewer object by name getViewer: function(aUID) { return this.mPanelSet.registry.getViewerByUID(aUID); } }; //////////////////////////////////////////////////////////////////////////// //// event listeners function BrowserPageShowListener(aEvent) { // since we will also get pageshow events for frame documents, // make sure we respond to the top-level document load if (aEvent.target.defaultView == _content) inspector.documentLoaded(); } function UtilWindowOpenListener(aWindow) { inspector.doViewSearchItem(aWindow); } PK y00  content/inspector/inspector.css/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ @import url("chrome://inspector/content/extensions/titledSplitter.css"); @import url("chrome://inspector/content/extensions/multipanel.css"); @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); *[hide="true"] { visibility: hidden; } domi-panelset { -moz-binding: url("chrome://inspector/content/inspector.xml#panelset"); display: -moz-box; } domi-panel { -moz-binding: url("chrome://inspector/content/inspector.xml#panel"); display: -moz-box; } #ppsViewerPopupset { display: none; } .tree-list > treecol, .tree-list > .tree-columns > treecol { -moz-binding: none; background-color: transparent !important; margin: 0px !important; border: none !important; padding: 0px !important; } .tree-nocolpicker > .tree-columns > .tree-columnpicker { visibility: collapse; } PK F7  content/inspector/inspector.xml null null [] -1 null return this.getElementsByTagName("domi-panel"); return this.panels.length; = 0; else if (aCommand == "cmdEditRedo") { enabled = this.mCommandPtr+1 < this.mCommandStack.length; if (!enabled && (this.mCommandPtr > -1)) { var lastCmd = this.mCommandStack[this.mCommandPtr]; enabled = ((lastCmd instanceof nsITransactionManager) && (lastCmd.numberOfRedoItems > 0)); } } else { if (this.focusedPanel && this.focusedPanel.viewer) { enabled = this.focusedPanel.viewer.isCommandEnabled(aCommand); } } this.setCommandAttribute(aCommand, "disabled", !enabled); ]]> = 0) { var command = this.mCommandStack[this.mCommandPtr]; if ((command instanceof nsITransactionManager) && (command.numberOfUndoItems > 0)) { command.undoTransaction(); if (command.numberOfUndoItems == 0) { --this.mCommandPtr; } } else { --this.mCommandPtr; //try { command.undoCommand(); /*} catch (ex) { dump("Unable to successfully undo command.\n"); return; }*/ } this.updateCommand("cmdEditUndo"); this.updateCommand("cmdEditRedo"); } ]]> = -1) { if (!((command instanceof nsITransactionManager)&&(command.numberOfRedoItems > 0))) { ++this.mCommandPtr; command = this.mCommandStack[this.mCommandPtr]; } if ((command instanceof nsITransactionManager)&&(command.numberOfRedoItems > 0)) { command.redoTransaction(); } else { try { command.doCommand(); } catch (ex) { dump("Unable to successfully redo command.\n"); return; } } this.updateCommand("cmdEditUndo"); this.updateCommand("cmdEditRedo"); } ]]> null null null null null null null null return this.mLinkedPanel; if (this.mLinkedPanel) this.mLinkedPanel.removeObserver("viewerChange", this); this.mLinkedPanel = val; if (val) val.addObserver("viewerChange", this); null null null null PK XT4Y"F==content/inspector/sidebar.xul %dtd1; %dtd2; ]> PK %6;%content/inspector/tasksOverlay-sb.xul PK %6-%content/inspector/tasksOverlay-tb.xul PK \5J5U" $content/inspector/editingOverlay.xul PK n+NYK content/inspector/utilWindow.xul PK y0r$$content/inspector/Flasher.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * Flasher --------------------------------------------------- * Object for controlling a timed flashing animation which * paints a border around an element. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////// global variables ///////////////////// var gFlasherRegistry = []; //////////// global constants //////////////////// //////////////////////////////////////////////////////////////////////////// //// class Flasher function Flasher(aColor, aThickness, aDuration, aSpeed, aInvert) { this.mShell = XPCU.getService("@mozilla.org/inspector/flasher;1", "inIFlasher"); this.mShell.color = aColor; this.mShell.thickness = aThickness; this.mShell.invert = aInvert; this.duration = aDuration; this.mSpeed = aSpeed; this.register(); } Flasher.prototype = { //////////////////////////////////////////////////////////////////////////// //// Initialization mFlashTimeout: null, mElement:null, mRegistryId: null, mFlashes: 0, mStartTime: 0, mDuration: 0, mSpeed: 0, //////////////////////////////////////////////////////////////////////////// //// Properties get flashing() { return this.mFlashTimeout != null; }, get element() { return this.mElement; }, set element(val) { if (val && val.nodeType == Node.ELEMENT_NODE) { this.mElement = val; this.mShell.scrollElementIntoView(val); } else throw "Invalid node type."; }, get color() { return this.mShell.color; }, set color(aVal) { return this.mShell.color = aVal; }, get thickness() { return this.mShell.thickness; }, set thickness(aVal) { this.mShell.thickness = aVal; }, get duration() { return this.mDuration; }, set duration(aVal) { this.mDuration = aVal; }, get speed() { return this.mSpeed; }, set speed(aVal) { this.mSpeed = aVal; }, get invert() { return this.mShell.invert; }, set invert(aVal) { this.mShell.invert = aVal; }, // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // :::::::::::::::::::: Methods :::::::::::::::::::::::::::: // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: register: function() { var length = gFlasherRegistry.length; gFlasherRegistry[length] = this; this.mRegistryId = length; }, start: function(aDuration, aSpeed, aHold) { this.mUDuration = aDuration ? aDuration*1000 : this.mDuration; this.mUSpeed = aSpeed ? aSpeed : this.mSpeed this.mHold = aHold; this.mFlashes = 0; this.mStartTime = new Date(); this.doFlash(); }, doFlash: function() { if (this.mHold || this.mFlashes%2) { this.paintOn(); } else { this.paintOff(); } this.mFlashes++; if (this.mUDuration < 0 || new Date() - this.mStartTime < this.mUDuration) { this.mFlashTimeout = window.setTimeout("gFlasherRegistry["+this.mRegistryId+"].doFlash()", this.mUSpeed); } else { this.stop(); } }, stop: function() { if (this.flashing) { window.clearTimeout(this.mFlashTimeout); this.mFlashTimeout = null; this.paintOff(); } }, paintOn: function() { this.mShell.drawElementOutline(this.mElement); }, paintOff: function() { this.mShell.repaintElement(this.mElement); } }; PK f5==#content/inspector/ViewerRegistry.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * ViewerRegistry ----------------------------------------------- * The central registry where information about all installed * viewers is kept. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: * chrome://inspector/content/jsutil/xpcom/XPCU.js * chrome://inspector/content/jsutil/rdf/RDFU.js ****************************************************************/ //////////// global variables ///////////////////// //////////// global constants //////////////////// const kViewerURLPrefix = "chrome://inspector/content/viewers/"; const kViewerRegURL = "chrome://inspector/content/res/viewer-registry.rdf"; //////////////////////////////////////////////////////////////////////////// //// class ViewerRegistry function ViewerRegistry() // implements inIViewerRegistry { this.mViewerHash = {}; } ViewerRegistry.prototype = { //////////////////////////////////////////////////////////////////////////// //// interface inIViewerRegistry // not yet formalized... //////////////////////////////////////////////////////////////////////////// //// Initialization mDS: null, mObserver: null, mViewerDS: null, mViewerHash: null, mFilters: null, get url() { return this.mURL; }, //// Loading Methods load: function(aURL, aObserver) { this.mURL = aURL; this.mObserver = aObserver; RDFU.loadDataSource(aURL, new ViewerRegistryLoadObserver(this)); }, onError: function(aStatus, aErrorMsg) { this.mObserver.onViewerRegistryLoadError(aStatus, aErrorMsg); }, onLoad: function(aDS) { this.mDS = aDS; this.prepareRegistry(); this.mObserver.onViewerRegistryLoad(); }, prepareRegistry: function prepareRegistry() { this.mViewerDS = RDFArray.fromContainer(this.mDS, "inspector:viewers", kInspectorNSURI); // create and cache the filter functions var js, fn; this.mFilters = []; for (var i = 0; i < this.mViewerDS.length; ++i) { js = this.getEntryProperty(i, "filter"); try { fn = new Function("object", "linkedViewer", js); } catch (ex) { fn = new Function("return false"); debug("### ERROR - Syntax error in filter for viewer \"" + this.getEntryProperty(i, "description") + "\"\n"); } this.mFilters.push(fn); } }, /////////////////////////////////////////////////////////////////////////// // Returns the absolute url where the xul file for a viewer can be found. // // @param long aIndex - the index of the entry representing the viewer // @return wstring - the fully cannonized url /////////////////////////////////////////////////////////////////////////// getEntryURL: function(aIndex) { var uid = this.getEntryProperty(aIndex, "uid"); return kViewerURLPrefix + uid + "/" + uid + ".xul"; }, //// Lookup Methods /** * Searches the viewer registry for all viewers that can view a particular * object. * * @param Object aObject - the object being searched against * @param String aPanelId - the id of the panel requesting viewers * @param Object aLinkedViewer - the view object of linked panel * * @return nsIRDFResource[] - array of entries in the viewer registry */ findViewersForObject: function findViewersForObject(aObject, aPanelId, aLinkedViewer) { // check each entry in the registry var len = this.mViewerDS.length; var entry; var urls = []; for (var i = 0; i < len; ++i) { if (this.getEntryProperty(i, "panels").indexOf(aPanelId) == -1) { continue; } if (this.objectMatchesEntry(aObject, aLinkedViewer, i)) { if (this.getEntryProperty(i, "important")) { urls.unshift(i); } else { urls.push(i); } } } return urls; }, /** * Determines if an object is eligible to be viewed by a particular viewer. * * @param Object aObject - the object being checked for eligibility * @param Object aLinkedViewer - the view object of linked panel * @param long aIndex - the index of the entry * * @return boolean - true if object can be viewed */ objectMatchesEntry: function objectMatchesEntry(aObject, aLinkedViewer, aIndex) { return this.mFilters[aIndex](aObject, aLinkedViewer); }, /////////////////////////////////////////////////////////////////////////// // Notifies the registry that a viewer has been instantiated, and that // it corresponds to a particular entry in the viewer registry. // // @param /////////////////////////////////////////////////////////////////////////// cacheViewer: function(aViewer, aIndex) { var uid = this.getEntryProperty(aIndex, "uid"); this.mViewerHash[uid] = { viewer: aViewer, entry: aIndex }; }, uncacheViewer: function(aViewer) { delete this.mViewerHash[aViewer.uid]; }, // for previously loaded viewers only getViewerByUID: function(aUID) { return this.mViewerHash[aUID].viewer; }, // for previously loaded viewers only getEntryForViewer: function(aViewer) { return this.mViewerHash[aViewer.uid].entry; }, // for previously loaded viewers only getEntryByUID: function(aUID) { return this.mViewerHash[aUID].aIndex; }, getEntryProperty: function(aIndex, aProp) { return this.mViewerDS.get(aIndex, aProp); }, getEntryCount: function() { return this.mViewerDS.length; }, //////////////////////////////////////////////////////////////////////////// //// Viewer Registration addNewEntry: function(aUID, aDescription, aFilter) { }, removeEntry: function(aIndex) { }, saveRegistry: function() { } }; //////////////////////////////////////////////////////////////////////////// //// Listener Objects function ViewerRegistryLoadObserver(aTarget) { this.mTarget = aTarget; } ViewerRegistryLoadObserver.prototype = { mTarget: null, onError: function(aStatus, aErrorMsg) { this.mTarget.onError(aStatus, aErrorMsg); }, onDataSourceReady: function(aDS) { this.mTarget.onLoad(aDS); } }; PK )35?("("content/inspector/utils.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * Jason Barnabe * Shawn Wilsher * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * Inspector Utils ---------------------------------------------- * Common functions and constants used across the app. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: * chrome://inspector/content/jsutil/xpcom/XPCU.js * chrome://inspector/content/jsutil/rdf/RDFU.js ****************************************************************/ //////////// global constants //////////////////// const kInspectorNSURI = "http://www.mozilla.org/inspector#"; const kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const kHTMLNSURI = "http://www.w3.org/1999/xhtml"; const nsITransactionManager = Components.interfaces.nsITransactionManager; var gEntityConverter; const kCharTable = { '&': "&", '<': "<", '>': ">", '"': """ }; var InsUtil = { /****************************************************************************** * Convenience function for calling nsIChromeRegistry::convertChromeURL *******************************************************************************/ convertChromeURL: function(aURL) { var uri = XPCU.getService("@mozilla.org/network/io-service;1", "nsIIOService") .newURI(aURL, null, null); var reg = XPCU.getService("@mozilla.org/chrome/chrome-registry;1", "nsIChromeRegistry"); return reg.convertChromeURL(uri); }, /****************************************************************************** * Convenience function for getting a literal value from nsIRDFDataSource::GetTarget *******************************************************************************/ getDSProperty: function(/*nsISupports*/ aDS, /*String*/ aId, /*String*/ aPropName) { var ruleRes = gRDF.GetResource(aId); var ds = XPCU.QI(aDS, "nsIRDFDataSource"); // just to be sure var propRes = ds.GetTarget(ruleRes, gRDF.GetResource(kInspectorNSURI+aPropName), true); propRes = XPCU.QI(propRes, "nsIRDFLiteral"); return propRes.Value; }, /****************************************************************************** * Convenience function for persisting an element's persisted attributes. *******************************************************************************/ persistAll: function(aId) { var el = document.getElementById(aId); if (el) { var attrs = el.getAttribute("persist").split(" "); for (var i = 0; i < attrs.length; ++i) { document.persist(aId, attrs[i]); } } }, /****************************************************************************** * Convenience function for escaping HTML strings. *******************************************************************************/ unicodeToEntity: function(text) { const entityVersion = Components.interfaces.nsIEntityConverter.entityW3C; function charTableLookup(letter) { return kCharTable[letter]; } function convertEntity(letter) { try { return gEntityConverter.ConvertToEntity(letter, entityVersion); } catch (ex) { return letter; } } if (!gEntityConverter) { try { gEntityConverter = Components.classes["@mozilla.org/intl/entityconverter;1"] .createInstance(Components.interfaces.nsIEntityConverter); } catch (ex) { } } // replace chars in our charTable text = text.replace(/[<>&"]/g, charTableLookup); // replace chars > 0x7f via nsIEntityConverter text = text.replace(/[^\0-\u007f]/g, convertEntity); return text; } }; // ::::::: debugging utilities :::::: function debug(aText) { // XX comment out to reduce noise consoleDump(aText); //dump(aText); } // dump text to the Error Console function consoleDump(aText) { var csClass = Components.classes['@mozilla.org/consoleservice;1']; var cs = csClass.getService(Components.interfaces.nsIConsoleService); cs.logStringMessage(aText); } function dumpDOM(aNode, aIndent) { if (!aIndent) aIndent = ""; debug(aIndent + "<" + aNode.localName + "\n"); var attrs = aNode.attributes; var attr; for (var a = 0; a < attrs.length; ++a) { attr = attrs[a]; debug(aIndent + " " + attr.nodeName + "=\"" + attr.nodeValue + "\"\n"); } debug(aIndent + ">\n"); aIndent += " "; for (var i = 0; i < aNode.childNodes.length; ++i) dumpDOM(aNode.childNodes[i], aIndent); } // ::::::: nsITransaction helper functions ::::::: function txnQueryInterface(theUID, theResult) { const nsITransaction = Components.interfaces.nsITransaction; const nsISupports = Components.interfaces.nsISupports; if (theUID == nsITransaction || theUID == nsISupports) { return this; } return null; } function txnMerge() { return false; } function txnRedoTransaction() { this.doTransaction(); } /** * A nsITransaction for clipboard copy. * @param an array of objects that define a clipboard flavor, a delimiter, and * toString(). */ function cmdEditCopy(aObjects) { // remove this line for bug 179621, Phase Three this.txnType = "standard"; // required for nsITransaction this.QueryInterface = txnQueryInterface; this.merge = txnMerge; this.isTransient = true; this.objects = aObjects; } cmdEditCopy.prototype.doTransaction = function doTransaction() { if (this.objects.length == 1) viewer.pane.panelset.setClipboardData(this.objects[0], this.objects[0].flavor, this.objects.toString()); else viewer.pane.panelset.setClipboardData(this.objects, this.objects[0].flavor + "s", this.objects.join(this.objects[0].delimiter)); } /** * Represents a CSS declaration. * @param aProperty the property of the declaration * @param aValue the value of the declaration */ function CSSDeclaration(aProperty, aValue, aImportant) { this.flavor = "inspector/css-declaration"; this.delimiter = "\n"; this.property = aProperty; this.value = aValue; this.important = aImportant == true; } /** * Returns a usable CSS string for the CSSDeclaration. * @return a string in the form "property: value;" */ CSSDeclaration.prototype.toString = function toString() { return this.property + ": " + this.value + (this.important ? " !important" : "") + ";"; } /** * Represents a DOM attribute. * @param aNode the attribute node */ function DOMAttribute(aNode) { this.flavor = "inspector/dom-attribute"; this.node = aNode.cloneNode(false); this.delimiter = " "; } /** * Returns a string representing an attribute name/value pair * @return a string in the form of 'name="value"' */ DOMAttribute.prototype.toString = function toString() { return this.node.nodeName + "=\"" + InsUtil.unicodeToEntity(this.node.nodeValue) + "\""; }; PK 6LGcontent/inspector/hooks.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ function inspectDOMDocument(aDocument, aModal) { window.openDialog("chrome://inspector/content/", "_blank", "chrome,all,dialog=no"+(aModal?",modal":""), aDocument); } function inspectDOMNode(aNode, aModal) { window.openDialog("chrome://inspector/content/", "_blank", "chrome,all,dialog=no"+(aModal?",modal":""), aNode); } function inspectObject(aObject, aModal) { window.openDialog("chrome://inspector/content/object.xul", "_blank", "chrome,all,dialog=no"+(aModal?",modal":""), aObject); } PK O*ؑmmcontent/inspector/util.dtd PK EJ7j099)content/inspector/res/viewer-registry.rdf PK y0oZrr/content/inspector/extensions/titledSplitter.css/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ @import url("chrome://inspector/skin/titledSplitter.css"); .titled-splitter { -moz-binding: url("titledSplitter.xml#titledSplitter") !important; } PK .KE E /content/inspector/extensions/titledSplitter.xml PK y0_y-content/inspector/extensions/treeEditable.css/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ @import url("chrome://inspector/skin/treeEditable.css"); .tree-editable { -moz-binding: url("treeEditable.xml#treeEditable"); } .treecell-editable { -moz-binding: url("treeEditable.xml#treecellEditable"); } treeitem[editing="true"] > treerow { background-color: transparent !important; }PK .`(ۿ-content/inspector/extensions/treeEditable.xml new Function("event", this.getAttribute("onstartedit")); new Function("event", this.getAttribute("onafteredit")); PK y0Ngg+content/inspector/extensions/multipanel.css/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); multipanelset { -moz-binding: url("chrome://inspector/content/extensions/multipanel.xml#multipanelset"); display: -moz-box; -moz-box-orient: vertical; } multipanel { -moz-binding: url("chrome://inspector/content/extensions/multipanel.xml#multipanel"); display: -moz-box; -moz-box-orient: vertical; } PK L.D@@+content/inspector/extensions/multipanel.xml PK y0Q Q /content/inspector/extensions/wsm-colorpicker.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * wsm-colorpicker ---------------------------------------------- * Quick script which adds support for the color picker widget * to nsWidgetStateManager in the pref winodw. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ function AddColorPicker(aCallback) { window.addEventListener("load", AddColorPicker_delayCheck, false); window.AddColorPicker_callback = aCallback; } function AddColorPicker_delayCheck() { if (parent.hPrefWindow) AddColorPicker_addColorHandlers() else setTimeout("AddColorPicker_delayCheck()", 1); } function AddColorPicker_addColorHandlers() { parent.hPrefWindow.wsm.handlers.colorpicker = { set: function (aElementID, aDataObject) { var wsm = parent.hPrefWindow.wsm; var element = wsm.contentArea.document.getElementById( aElementID ); element.color = aDataObject.color; }, get: function (aElementID) { var wsm = parent.hPrefWindow.wsm; var element = wsm.contentArea.document.getElementById( aElementID ); var dataObject = wsm.generic_Get(element); if(dataObject) { dataObject.color = element.color; return dataObject; } return null; } } window.AddColorPicker_callback(); } PK y0UQe(content/inspector/jsutil/rdf/RDFArray.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * RDFArray ----------------------------------------------- * A convenience routine for creating an RDF-based 2d array * indexed by number and hashkey. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: * chrome://inspector/content/utils.js * chrome://inspector/content/jsutil/xpcom/XPCU.js * chrome://inspector/content/jsutil/rdf/RDFU.js ****************************************************************/ //////////// global constants //////////////////// RDFArray.URI = "http://www.joehewitt.com/mozilla/util/RDFArray#"; RDFArray.RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; ///// class RDFArray ///////////////////////// function RDFArray(aNSURI, aRootURN, aArcName) { this.mNSURI = aNSURI; this.mRootURN = aRootURN; this.mArcName = aArcName ? aArcName : "list"; } RDFArray.prototype = { get datasource() { return this.mDS; }, get length() { return this.mLength } , initialize: function() { this.mLength = 0; this.mDS = XPCU.createInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", "nsIRDFDataSource"); var root = gRDF.GetResource(this.mRootURN); var res = gRDF.GetAnonymousResource(); this.mDS.Assert(root, gRDF.GetResource(this.mNSURI+this.mArcName), res, true); this.mSeq = gRDFCU.MakeSeq(this.mDS, res); }, add: function(aObject) { var res = this.createResourceFrom(aObject); this.addResource(res); }, addResource: function(aResource) { this.mSeq.AppendElement(aResource); this.mLength++; }, insertAt: function(aIndex, aObject) { var res = this.createResourceFrom(aObject); this.insertResourceAt(aIndex, res); }, insertResourceAt: function(aIndex, aResource) { }, removeAt: function(aIndex) { this.mSeq.RemoveElementAt(aIndex+1, true); this.mLength--; }, removeById: function(aId) { var proj = gRDF.GetResource(aId); proj = XPCU.QI(proj, "nsIRDFNode"); this.mSeq.RemoveElement(proj, true); this.mLength--; }, get: function(aIndex, aKey) { var res = RDFU.getSeqElementAt(this.mSeq, aIndex); return RDFU.readAttribute(this.mDS, res, this.mNSURI+aKey); }, set: function(aIndex, aKey, aValue) { var res = RDFU.getSeqElementAt(this.mSeq, aIndex); RDFU.writeAttribute(this.mDS, res, this.mNSURI+aKey, aValue); }, getResource: function(aIndex) { return RDFU.getSeqElementAt(this.mSeq, aIndex); }, getResourceId: function(aIndex) { var el = RDFU.getSeqElementAt(this.mSeq, aIndex); return el.Value; }, save: function() { RDFU.saveDataSource(this.mDS); }, clear: function() { while (this.mLength) { this.mSeq.RemoveElementAt(1, true); this.mLength--; } }, createResourceFrom: function(aObject) { var el = gRDF.GetAnonymousResource(); // add a literal node for each property being added for (var name in aObject) { this.mDS.Assert(el, gRDF.GetResource(this.mNSURI+name), gRDF.GetLiteral(aObject[name]), true); } return el; } }; /////////// static factory methods ///////////////////////// RDFArray.fromContainer = function(aDS, aResourceID, aNSURI) { var list = new RDFArray(aNSURI); list.mDS = aDS; var seq = RDFU.findSeq(aDS, aResourceID); list.mSeq = seq; list.mLength = seq.GetCount(); return list; } RDFArray.fromContainerArc = function(aDS, aSourceId, aTargetId, aNSURI) { var list = new RDFArray(aNSURI); list.mDS = aDS; var source = gRDF.GetResource(aSourceId); var target = gRDF.GetResource(aTargetId); var seqRes = aDS.GetTarget(source, target, true); var seq = RDFU.makeSeq(aDS, seqRes); list.mSeq = seq; list.mLength = seq.GetCount(); return list; } PK H2i4$content/inspector/jsutil/rdf/RDFU.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * RDFU ----------------------------------------------- * Convenience routines for common RDF commands. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: * chrome://inspector/content/jsutil/xpcom/XPCU.js ****************************************************************/ //////////// global constants //////////////////// try { var gRDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService(); gRDF = gRDF.QueryInterface(Components.interfaces.nsIRDFService); var gRDFCU = Components.classes['@mozilla.org/rdf/container-utils;1'].getService(); gRDFCU = gRDFCU.QueryInterface(Components.interfaces.nsIRDFContainerUtils); } catch (ex) { alert("RDFU: " + ex); } /////////////////////////////////////////////////// var RDFU = { getSeqElementAt: function(aSeq, aIndex) { var ordinal = gRDFCU.IndexToOrdinalResource(aIndex+1); return aSeq.DataSource.GetTarget(aSeq.Resource, ordinal, true); }, readAttribute: function(aDS, aRes, aName) { var attr = aDS.GetTarget(aRes, gRDF.GetResource(aName), true); if (attr) attr = XPCU.QI(attr, "nsIRDFLiteral"); return attr ? attr.Value : null; }, writeAttribute: function(aDS, aRes, aName, aValue) { var attr = aDS.GetTarget(aRes, gRDF.GetResource(aName), true); if (attr) aDS.Change(aRes, gRDF.GetResource(aName), attr, gRDF.GetLiteral(aValue)); }, findSeq: function(aDS, aResName) { try { var res = gRDF.GetResource(aResName); var seq = this.makeSeq(aDS, res); } catch (ex) { alert("Unable to find sequence:" + ex); } return seq; }, makeSeq: function(aDS, aRes) { var seq = XPCU.createInstance("@mozilla.org/rdf/container;1", "nsIRDFContainer"); seq.Init(aDS, aRes); return seq; }, createSeq: function(aDS, aBaseRes, aArcRes) { var res = gRDF.GetAnonymousResource(); aDS.Assert(aBaseRes, aArcRes, res, true); var seq = gRDFCU.MakeSeq(aDS, res); return seq; }, loadDataSource: function(aURL, aListener) { var ds = gRDF.GetDataSource(aURL); var rds = XPCU.QI(ds, "nsIRDFRemoteDataSource"); var observer = new DSLoadObserver(aListener); if (rds.loaded) { observer.onEndLoad(ds); } else { var sink = XPCU.QI(ds, "nsIRDFXMLSink"); sink.addXMLSinkObserver(observer); } }, saveDataSource: function(aDS) { var ds = XPCU.QI(aDS, "nsIRDFRemoteDataSource"); ds.Flush(); } }; /////////// function DSLoadObserver(aListener) { this.mListener = aListener; } DSLoadObserver.prototype = { onBeginLoad: function(aSink) { }, onInterrupt: function(aSink) {}, onResume: function(aSink) {}, onError: function(aSink, aStatus, aErrorMsg) { this.mListener.onError(aStatus, aErrorMsg); aSink.removeXMLSinkObserver(this); }, onEndLoad: function(aSink) { var ds = XPCU.QI(aSink, "nsIRDFDataSource"); this.mListener.onDataSourceReady(ds); aSink = XPCU.QI(aSink, "nsIRDFXMLSink"); aSink.removeXMLSinkObserver(this); } }; PK y0}-content/inspector/jsutil/system/DiskSearch.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * DiskSearch ------------------------------------------------- * A utility for handily searching the disk for files matching * a certain criteria. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////// global variables ///////////////////// //////////// global constants //////////////////// //////////////////////////////////////////////////////////////////////////// //// class DiskSearch var DiskSearch = { findFiles: function(aRootDir, aExtList, aRecurse) { // has the file extensions so we don't have to // linear search the array every time through var extHash = {}; for (var i = 0; i < aExtList.length; i++) { extHash[aExtList[i]] = true; } var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); this.fileHandler = ios.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler); // recursively build the list of results var results = []; this.recurseDir(aRootDir, extHash, aRecurse, results); return results; }, recurseDir: function(aDir, aExtHash, aRecurse, aResults) { debug("("+aResults.length+") entering " + aDir.path + "\n"); var entries = aDir.directoryEntries; var entry, ext; while (entries.hasMoreElements()) { entry = XPCU.QI(entries.getNext(), "nsIFile"); if (aRecurse && entry.isDirectory()) this.recurseDir(entry, aExtHash, aRecurse, aResults); ext = this.getExtension(entry.leafName); if (ext) { if (aExtHash[ext]) aResults.push(this.fileHandler.getURLSpecFromFile(entry)); } } }, getExtension: function(aFileName) { var dotpt = aFileName.lastIndexOf("."); if (dotpt) return aFileName.substr(dotpt+1).toLowerCase(); return null; } }; PK y0]5,XX2content/inspector/jsutil/system/FilePickerUtils.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * FilePickerUtils ------------------------------------------------- * A utility for easily dealing with the file picker dialog. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////// global constants //////////////////// const kFilePickerCID = "@mozilla.org/filepicker;1"; const kLFileCID = "@mozilla.org/file/local;1"; const nsIFilePicker = Components.interfaces.nsIFilePicker; //////////////////////////////////////////////////////////////////////////// //// class FilePickerUtils var FilePickerUtils = { pickFile: function(aTitle, aInitPath, aFilters, aMode) { try { var modeStr = aMode ? "mode" + aMode : "modeOpen"; var mode; try { mode = nsIFilePicker[modeStr]; } catch (ex) { dump("WARNING: Invalid FilePicker mode '"+aMode+"'. Defaulting to 'Open'.\n"); mode = nsIFilePicker.modeOpen; } var fp = XPCU.createInstance(kFilePickerCID, "nsIFilePicker"); fp.init(window, aTitle, mode); // join array of filter names into bit string var filters = this.prepareFilters(aFilters); if (aInitPath) { var dir = XPCU.createInstance(kLFileCID, "nsILocalFile"); dir.initWithPath(aInitPath); fp.displayDirectory = dir; } if (fp.show() == nsIFilePicker.returnOK) { return fp.file; } } catch (ex) { dump("ERROR: Unable to open file picker.\n" + ex + "\n"); } return null; }, pickDir: function(aTitle, aInitPath) { try { var fp = XPCU.createInstance(kFilePickerCID, "nsIFilePicker"); fp.init(window, aTitle, nsIFilePicker.modeGetFolder); if (aInitPath) { var dir = XPCU.createInstance(kLFileCID, "nsILocalFile"); dir.initWithPath(aInitPath); fp.displayDirectory = dir; } if (fp.show() == nsIFilePicker.returnOK) { return fp.file; } } catch (ex) { dump("ERROR: Unable to open directory picker.\n" + ex + "\n"); } return null; }, prepareFilters: function(aFilters) { // join array of filter names into bit string var filters = 0; for (var i = 0; i < aFilters.length; ++i) filters = filters | nsIFilePicker[aFilters[i]]; return filters; } }; PK cs54,content/inspector/jsutil/system/PrefUtils.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * PrefUtils ------------------------------------------------- * Utility for easily using the Mozilla preferences system. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////// global variables ///////////////////// //////////// global constants //////////////////// const nsIPrefBranch = Components.interfaces.nsIPrefBranch; //////////////////////////////////////////////////////////////////////////// //// class PrefUtils var PrefUtils = { mPrefs: null, init: function() { var prefService = XPCU.getService("@mozilla.org/preferences-service;1", "nsIPrefService"); this.mPrefs = prefService.getBranch(null); }, addObserver: function addObserver(aDomain, aFunction) { if (!this.mPrefs) this.init(); var pbi = XPCU.QI(this.mPrefs, "nsIPrefBranch2"); if (pbi) pbi.addObserver(aDomain, aFunction, false); }, removeObserver: function removeObserver(aDomain, aFunction) { if (!this.mPrefs) this.init(); var pbi = XPCU.QI(this.mPrefs, "nsIPrefBranch2"); if (pbi) pbi.removeObserver(aDomain, aFunction); }, setPref: function(aName, aValue) { if (!this.mPrefs) this.init(); var type = this.mPrefs.getPrefType(aName); try { if (type == nsIPrefBranch.PREF_STRING) { var str = Components.classes["@mozilla.org/supports-string;1"] .createInstance(Components.interfaces.nsISupportsString); str.data = aValue; this.mPrefs.setComplexValue(aName, Components.interfaces.nsISupportsString, str); } else if (type == nsIPrefBranch.PREF_BOOL) { this.mPrefs.setBoolPref(aName, aValue); } else if (type == nsIPrefBranch.PREF_INT) { this.mPrefs.setIntPref(aName, aValue); } } catch(ex) { debug("ERROR: Unable to write pref \"" + aName + "\".\n"); } }, getPref: function(aName) { if (!this.mPrefs) this.init(); var type = this.mPrefs.getPrefType(aName); try { if (type == nsIPrefBranch.PREF_STRING) { return this.mPrefs.getComplexValue(aName, Components.interfaces.nsISupportsString).data; } else if (type == nsIPrefBranch.PREF_BOOL) { return this.mPrefs.getBoolPref(aName); } else if (type == nsIPrefBranch.PREF_INT) { return this.mPrefs.getIntPref(aName); } } catch(ex) { debug("ERROR: Unable to read pref \"" + aName + "\".\n"); } return null; } }; PK y0w AA'content/inspector/jsutil/system/file.js/*** -*- Mode: Javascript; tab-width: 2; ***** BEGIN LICENSE BLOCK ***** Version: MPL 1.1/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Collabnet code. The Initial Developer of the Original Code is Collabnet. The Initial Developer of the Original Code is Collabnet. Portions created by the Initial Developer are Copyright (C) 2000 the Initial Developer. All Rights Reserved. Contributor(s): Pete Collins, Doug Turner, Brendan Eich, Warren Harris, Eric Plaster Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. ***** END LICENSE BLOCK ***** */ /****************** Globals **********************/ const JSLIB_FILE = "file.js"; const JSFILE_LOCAL_CID = "@mozilla.org/file/local;1"; const JSFILE_F_CHANNEL_CID = "@mozilla.org/network/file-input-stream;1"; const JSFILE_I_STREAM_CID = "@mozilla.org/scriptableinputstream;1"; const JSFILE_I_LOCAL_FILE = "nsILocalFile"; const JSFILE_I_FILE_CHANNEL = "nsIFileChannel"; const JSFILE_I_SCRIPTABLE_IN_STREAM = "nsIScriptableInputStream"; const JSFILE_INIT_W_PATH = "initWithPath"; const JSFILE_READ = 0x01; // 1 const JSFILE_WRITE = 0x08; // 8 const JSFILE_APPEND = 0x10; // 16 const JSFILE_READ_MODE = "r"; const JSFILE_WRITE_MODE = "w"; const JSFILE_APPEND_MODE = "a"; const JSFILE_FILETYPE = 0x00; // 0 const JSFILE_CHUNK = 1024; // buffer for readline => set to 1k const JSFILE_OK = true; const JSFILE_FilePath = new Components.Constructor( JSFILE_LOCAL_CID, JSFILE_I_LOCAL_FILE, JSFILE_INIT_W_PATH); const JSFILE_FileChannel = new Components.Constructor( JSFILE_F_CHANNEL_CID, JSFILE_I_FILE_CHANNEL ); const JSFILE_InputStream = new Components.Constructor( JSFILE_I_STREAM_CID, JSFILE_I_SCRIPTABLE_IN_STREAM ); /****************** Globals **********************/ /****************** File Object Class *********************/ function File(aPath) { if(aPath) this.mPath= aPath; } // constructor File.prototype = { mPath : null, mode : null, fileInst : null, fileChannel : null, inputStream : null, lineBuffer : null, /********************* OPEN *****************************/ open : function(aSetMode) { if(!this.mPath) { dump(JSLIB_FILE+":open:ERROR: Missing member path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } this.close(); if(!aSetMode) aSetMode=JSFILE_READ_MODE; try { this.fileInst = new JSFILE_FilePath(this.mPath); } catch (e) { dump(JSLIB_FILE+":open:ERROR: UNEXPECTED"+e.name+" "+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } var fileExists = this.exists(); if(fileExists) { if(this.fileInst.isDirectory()) { dump(JSLIB_FILE+":open:ERROR: Can't open directory "+this.mPath+" as a file!\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } } var retval; switch(aSetMode) { case JSFILE_WRITE_MODE: { if(fileExists) { try { this.fileInst.remove(false); fileExists=false; } catch(e) { dump(JSLIB_FILE+":open:ERROR: Failed to delete file "+this.mPath+"\nNS_ERROR_NUMBER: "); this.close(); return Components.results.NS_ERROR_FAILURE; } } if (!fileExists) { try { this.fileInst.create(JSFILE_FILETYPE, 0644); fileExists=true; } catch(e) { dump(JSLIB_FILE+":open:ERROR: Failed to create file "+this.mPath+"\nNS_ERROR_NUMBER: "); this.close(); return Components.results.NS_ERROR_FAILURE; } } this.mode=JSFILE_WRITE; retval=JSFILE_OK; break; } case JSFILE_APPEND_MODE: { if(!fileExists) { try { this.fileInst.create(JSFILE_FILETYPE, 0644); fileExists=true; } catch(e) { dump(JSLIB_FILE+":open:ERROR: Failed to create file "+this.mPath+"\nNS_ERROR_NUMBER: "); this.close(); return Components.results.NS_ERROR_FAILURE; } } this.mode=JSFILE_APPEND; retval=JSFILE_OK; break; } case JSFILE_READ_MODE: { if(!fileExists) { dump(JSLIB_FILE+"open:ERROR: "+this.mPath+" doesn't exist!\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE } try { this.lineBuffer = new Array(); this.fileChannel = new JSFILE_FileChannel(); this.inputStream = new JSFILE_InputStream(); try { var perm = this.fileInst.permissions; } catch(e){ perm=null; } this.fileChannel.init(this.fileInst, JSFILE_READ, perm); this.inputStream.init(this.fileChannel.openInputStream()); retval=JSFILE_OK; } catch (e) { dump(JSLIB_FILE+":open:ERROR: reading... "+e.name+" "+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } break; } default: dump(JSLIB_FILE+":open:WARNING: \""+setMode+"\" is an Invalid file mode\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_INVALID_ARG; } return retval; }, /********************* EXISTS ***************************/ exists : function () { var retval = null; try { var file = new JSFILE_FilePath(this.mPath); retval=file.exists(); } catch(e) { dump(JSLIB_FILE+":exists:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return retval; }, /********************* WRITE ****************************/ write : function(aBuffer, aPerms) { if(!this.fileInst) { dump(JSLIB_FILE+":write:ERROR: Please open a file handle first\n NS_ERROR_NUMBER:"); return Components.results.NS_ERROR_NOT_INITIALIZED; } if(!aBuffer) throw(JSLIB_FILE+":write:ERROR: must have a buffer to write!\n"); if(this.mode == JSFILE_READ) throw(JSLIB_FILE+":write:ERROR: not in write or append mode!\n"); var buffSize = aBuffer.length; try { if(!this.fileChannel) this.fileChannel = new JSFILE_FileChannel(); if(aPerms) { var checkPerms = this.validatePermissions(aPerms); if(!checkPerms) { dump(JSLIB_FILE+":write:ERROR: invalid permissions set: "+aPerms+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_INVALID_ARG } } if(!aPerms) aPerms=0644; this.fileChannel.init(this.fileInst, this.mode, aPerms); try { this.fileInst.permissions=aPerms; } catch(e){ } var outStream = this.fileChannel.openOutputStream(); outStream.write(aBuffer, buffSize); outStream.flush(); outStream.close(); } catch (e) { dump(JSLIB_FILE+":write:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return JSFILE_OK; }, /********************* READ *****************************/ read : function() { var retval = null; try { if(!this.fileInst || !this.inputStream) { dump(JSLIB_FILE+":read:ERROR: Please open a valid file handle for reading\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } retval = this.inputStream.read(this.fileInst.fileSize); this.inputStream.close(); } catch (e) { dump(JSLIB_FILE+":read:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } return retval; }, eof : function() { if(!this.fileInst || !this.inputStream) { dump(JSLIB_FILE+":readline:ERROR: Please open a valid file handle for reading\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } if((this.lineBuffer.length > 0) || (this.inputStream.available() > 0)) return false; else return JSFILE_OK; }, /********************* READLINE *****************************/ readline : function() { var retval = null; var buf = null; try { if(!this.fileInst || !this.inputStream) { dump(JSLIB_FILE+":readline:ERROR: Please open a valid file handle for reading\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } if(this.lineBuffer.length < 2) { buf = this.inputStream.read(JSFILE_CHUNK); if(buf) { var tmp = null; if(this.lineBuffer.length == 1) { tmp = this.lineBuffer.shift(); buf = tmp+buf; } this.lineBuffer = buf.split(/[\n\r]/); } } retval = this.lineBuffer.shift(); } catch (e) { dump(JSLIB_FILE+":readline:ERROR: "+e.name+" "+e.message+"\nNS_ERROR_NUMBER: "); throw(e); } return retval; }, /********************* PATH *****************************/ path : function () { return this.mPath; }, /********************* PATH *****************************/ /********************* LEAF *****************************/ leaf : function () { if(!this.mPath) { dump(JSLIB_FILE+":leaf:ERROR: Missing path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_INVALID_ARG; } if(!this.exists()) { dump(JSLIB_FILE+":leaf:ERROR: File doesn't exist\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } var retval; try { var fileInst = new JSFILE_FilePath(this.mPath); retval=fileInst.leafName; } catch(e) { dump(JSLIB_FILE+":leaf:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } return retval; }, /********************* VALIDATE PERMISSIONS *************/ validatePermissions : function(aNum) { if ( parseInt(aNum.toString(10).length) < 3 ) return false; return JSFILE_OK; }, /********************* PERMISSIONS **********************/ permissions : function () { if(!this.mPath) { dump(JSLIB_FILE+":permissions:ERROR: Missing path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } if(!this.exists()) { dump(JSLIB_FILE+":permissions:ERROR: File doesn't exist\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } var retval; try { var fileInst = new JSFILE_FilePath(this.mPath); retval=fileInst.permissions.toString(8); } catch(e) { dump(JSLIB_FILE+":permissions:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return retval; }, /********************* MODIFIED *************************/ dateModified : function () { if(!this.mPath) { dump(JSLIB_FILE+":dateModified:ERROR: Missing path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; } if(!this.exists()) { dump(JSLIB_FILE+":dateModified:ERROR: File doesn't exist\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } var retval; try { var fileInst = new JSFILE_FilePath(this.mPath); var date = new Date(fileInst.lastModifiedTime).toLocaleString(); retval=date; } catch(e) { dump(JSLIB_FILE+":dateModified:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return retval; }, /********************* SIZE *****************************/ size : function () { if(!this.mPath) { dump(JSLIB_FILE+":size:ERROR: Missing member path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } if(!this.exists()) { dump(JSLIB_FILE+":size:ERROR: File doesn't exist\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } var retval; try { var fileInst = new JSFILE_FilePath(this.mPath); retval = fileInst.fileSize; } catch(e) { dump(JSLIB_FILE+":size:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return retval; }, /********************* EXTENSION ************************/ extension : function () { if(!this.mPath) { dump(JSLIB_FILE+":extension:ERROR: Missing member path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } if(!this.exists()) { dump(JSLIB_FILE+":extension:ERROR: File doesn't exist\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_FAILURE; } var retval; try { var fileInst = new JSFILE_FilePath(this.mPath); var leafName = fileInst.leafName; var dotIndex = leafName.lastIndexOf('.'); retval=(dotIndex >= 0) ? leafName.substring(dotIndex+1) : ""; } catch(e) { dump(JSLIB_FILE+":extension:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return retval; }, /********************* DIRPATH **************************/ dirPath : function () { if(!this.mPath) { dump(JSLIB_FILE+":dirPath:ERROR: Missing member path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } var retval; try { var fileInst = new JSFILE_FilePath(this.mPath); if(fileInst.isFile()) retval=fileInst.path.replace(this.leaf(), ""); if(fileInst.isDirectory()) retval=fileInst.path; } catch (e) { dump(JSLIB_FILE+":dirPath:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return retval; }, /********************* nsIFILE **************************/ nsIFile : function () { if(!this.mPath) { dump(JSLIB_FILE+":nsIFile:ERROR: Missing member path argument\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_NOT_INITIALIZED; } var retval; try { retval = new JSFILE_FilePath(this.mPath); } catch (e) { dump(JSLIB_FILE+":nsIFile:ERROR: "+e.name+"\n"+e.message+"\nNS_ERROR_NUMBER: "); return Components.results.NS_ERROR_UNEXPECTED; } return retval; }, /********************* HELP *****************************/ help : function() { var help = "\n\nFunction List:\n" + "\n" + " open(aMode);\n" + " exists();\n" + " read();\n" + " readline(aDone);\n" + " write(aContents, aPermissions);\n" + " leaf();\n" + " permissions();\n" + " dateModified();\n" + " size();\n" + " extension();\n" + " dirPath();\n" + " nsIFile();\n" + " help();\n"; dump(help+"\n"); return ""; }, /********************* CLOSE ****************************/ close : function() { /***************** Destroy Instances *********************/ if(this.fileInst) delete this.fileInst; if(this.fileChannel) delete this.fileChannel; if(this.inputStream) delete this.inputStream; if(this.mode) this.mode=null; /***************** Destroy Instances *********************/ return JSFILE_OK; } }; PK y0D &content/inspector/jsutil/xpcom/XPCU.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var XPCU = { getService: function(aURL, aInterface) { try { return Components.classes[aURL].getService(Components.interfaces[aInterface]); } catch (ex) { dump("Error getting service: " + aURL + ", " + aInterface + "\n" + ex); return null; } }, createInstance: function (aURL, aInterface) { try { return Components.classes[aURL].createInstance(Components.interfaces[aInterface]); } catch (ex) { dump("Error creating instance: " + aURL + ", " + aInterface + "\n" + ex); return null; } }, QI: function(aEl, aIName) { try { return aEl.QueryInterface(Components.interfaces[aIName]); } catch (ex) { throw("Unable to QI " + aEl + " to " + aIName); } } };PK y0J>9``(content/inspector/jsutil/xul/DNDUtils.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * DNDUtils ------------------------------------------------- * Utility functions for common drag and drop tasks. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////// global variables ///////////////////// var app; //////////// global constants //////////////////// //////////////////////////////////////////////////////////////////////////// //// class DNDUtils var DNDUtils = { invokeSession: function(aTarget, aTypes, aValues) { var transData, trans, supports; var transArray = XPCU.createInstance("@mozilla.org/supports-array;1", "nsISupportsArray"); for (var i = 0; i < aTypes.length; ++i) { transData = this.createTransferableData(aValues[i]); trans = XPCU.createInstance("@mozilla.org/widget/transferable;1", "nsITransferable"); trans.addDataFlavor(aTypes[i]); trans.setTransferData (aTypes[i], transData.data, transData.size); supports = trans.QueryInterface(Components.interfaces.nsISupports); transArray.AppendElement(supports); } var nsIDragService = Components.interfaces.nsIDragService; var dragService = XPCU.getService("@mozilla.org/widget/dragservice;1", "nsIDragService"); dragService.invokeDragSession(aTarget, transArray, null, nsIDragService.DRAGDROP_ACTION_MOVE); }, createTransferableData: function(aValue) { var obj = {}; if (typeof(aValue) == "string") { obj.data = XPCU.createInstance("@mozilla.org/supports-string;1", "nsISupportsString"); obj.data.data = aValue; obj.size = aValue.length*2; } else if (false) { // TODO: create data for other primitive types } return obj; }, checkCanDrop: function(aType) { var dragService = XPCU.getService("@mozilla.org/widget/dragservice;1", "nsIDragService"); var dragSession = dragService.getCurrentSession(); var gotFlavor = false; for (var i = 0; i < arguments.length; ++i) gotFlavor |= dragSession.isDataFlavorSupported(arguments[i]); dragSession.canDrop = gotFlavor; return gotFlavor; }, getData: function(aType, aIndex) { var dragService = XPCU.getService("@mozilla.org/widget/dragservice;1", "nsIDragService"); var dragSession = dragService.getCurrentSession(); var trans = XPCU.createInstance("@mozilla.org/widget/transferable;1", "nsITransferable"); trans.addDataFlavor(aType); dragSession.getData(trans, aIndex); var data = new Object(); trans.getAnyTransferData ({}, data, {}); return data.value; } }; PK y0' -content/inspector/jsutil/xul/FrameExchange.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * FrameExchange ---------------------------------------------- * Utility for passing specific data to a document loaded * through an iframe * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////// implementation //////////////////// var FrameExchange = { mData: {}, loadURL: function(aFrame, aURL, aData) { this.mData[aURL] = aData; aFrame.setAttribute("src", aURL); }, receiveData: function(aWindow) { var id = aWindow.location.href; var data = this.mData[id]; this.mData[id] = null; return data; } }; PK y0-content/inspector/jsutil/xul/inFormManager.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * inFormManager ------------------------------------------------- * Manages the reading and writing of forms via simple maps of * attribute/value pairs. A "form" is simply a XUL window which * contains "form widgets" such as textboxes and menulists. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////////////////////////////////////////////////////////////////////// //// class inFormManager var inFormManager = { // Object readWindow: function(aWindow, aIds) { var el, fn; var doc = aWindow.document; var map = {}; for (var i = 0; i < aIds.length; i++) { el = doc.getElementById(aIds[i]); if (el) { this.persistIf(doc, el); fn = this["read_"+el.localName]; if (fn) map[aIds[i]] = fn(el); } } return map; }, // void writeWindow: function(aWindow, aMap) { var el, fn; var doc = aWindow.document; for (var i = 0; i < aIds.length; i++) { el = doc.getElementById(aIds[i]); if (el) { fn = this["write_"+el.localName]; if (fn) fn(el, aMap[aIds[i]]); } } }, persistIf: function(aDoc, aEl) { if (aEl.getAttribute("persist") == "true" && aEl.hasAttribute("id")) { aEl.setAttribute("value", aEl.value); aDoc.persist(aEl.getAttribute("id"), "value"); } }, read_textbox: function(aEl) { return aEl.value; }, read_menulist: function(aEl) { return aEl.getAttribute("value"); }, read_checkbox: function(aEl) { return aEl.getAttribute("checked") == "true"; }, read_radiogroup: function(aEl) { return aEl.getAttribute("value"); }, read_colorpicker: function(aEl) { return aEl.getAttribute("color"); }, write_textbox: function(aEl, aValue) { aEl.setAttribute("value", aValue); }, write_menulist: function(aEl, aValue) { aEl.setAttribute("value", aValue); }, write_checkbox: function(aEl, aValue) { aEl.setAttribute("checked", aValue); }, write_radiogroup: function(aEl, aValue) { aEl.setAttribute("value", aValue); }, write_colorpicker: function(aEl, aValue) { aEl.color = aValue; } }; PK y00lG8K8K-content/inspector/jsutil/xul/inTreeBuilder.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * inTreeBuilder ------------------------------------------------- * Automatically builds up an tree so that it will display a tabular * set of data with titled columns and optionally an icon for each row. * The tree that is supplied must have an treechildren with an * empty template inside of it. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: * chrome://inspector/content/jsutil/xul/DNDUtils.js ****************************************************************/ //////////// global variables ///////////////////// var inTreeBuilderPartCount = 0; //////////// global constants //////////////////// //////////////////////////////////////////////////////////////////////////// //// class inTreeBuilder function inTreeBuilder(aTree, aNameSpace, aArcName) { this.tree = aTree; this.nameSpace = aNameSpace; this.arcName = aArcName; this.mColumns = []; this.mExtras = []; } inTreeBuilder.prototype = { mTree: null, mTreeBody: null, // datasource stuff mNameSpace: null, mArcName: null, mIsRefContainer: false, mIsContainer: true, // table structure stuff mIsIconic: false, mColumns: null, mSplitters: true, mRowFields: null, mRowAttrs: null, mAllowDND: false, mLastDragCol: null, mLastDragColWhere: null, //////////////////////////////////////////////////////////////////////////// //// properties // the xul tree node we will construct get tree() { return this.mTree }, set tree(aVal) { this.mTree = aVal; if (aVal) this.mTreeBody = aVal.getElementsByTagName("treechildren")[0]; aVal._treeBuilder = this }, // the namespace to use for all fields get nameSpace() { return this.mNameSpace }, set nameSpace(aVal) { this.mNameSpace = aVal }, // the name of the arc to the container get arcName() { return this.mArcName }, set arcName(aVal) { this.mArcName = aVal }, // is the datasource ref an arc to a container, or a container itself get isRefContainer() { return this.mIsRefContainer }, set isRefContainer(aVal) { this.mIsRefContainer = aVal }, // is each row a potential container? get isContainer() { return this.mIsContainer }, set isContainer(aVal) { this.mIsContainer = aVal }, // place an icon before the first column of each row get isIconic() { return this.mIsIconic }, set isIconic(aVal) { this.mIsIconic = aVal }, // put splitters between the columns? get useSplitters() { return this.mSplitters }, set useSplitters(aVal) { this.mSplitters = aVal }, // extra attributes to set on the treeitem get rowAttributes() { return this.mRowAttrs }, set rowAttributes(aVal) { this.mRowAttrs = aVal }, // extra data fields to set on the treeitem get rowFields() { return this.mRowFields }, set rowFields(aVal) { this.mRowFields = aVal }, // extra data fields to set on the treeitem get allowDragColumns() { return this.mAllowDND }, set allowDragColumns(aVal) { this.mAllowDND = aVal }, //////////////////////////////////////////////////////////////////////////// //// event handlers get onColumnAdd() { return this.mOnColumnAdd }, set onColumnAdd(aFn) { this.mOnColumnAdd = aFn }, get onColumnRemove() { return this.mOnColumnRemove }, set onColumnRemove(aFn) { this.mOnColumnRemove = aFn }, //////////////////////////////////////////////////////////////////////////// //// initialization initialize: function() { this.initColumns(); this.initTemplate(); }, initColumns: function() { this.initDND(); }, initTemplate: function() { var template = this.mTree.getElementsByTagNameNS(kXULNSURI, "template")[0]; this.mTemplate = template; this.clearChildren(template); var rule = document.createElementNS(kXULNSURI, "rule"); template.appendChild(rule); this.mRule = rule; this.createDefaultConditions(); var bindings = document.createElementNS(kXULNSURI, "bindings"); rule.appendChild(bindings); this.mBindings = bindings; this.createDefaultAction(); }, createDefaultConditions: function() { var conditions = document.createElementNS(kXULNSURI, "conditions"); this.mRule.appendChild(conditions); var content = document.createElementNS(kXULNSURI, "treerow"); content.setAttribute("uri", "?uri"); conditions.appendChild(content); var triple = this.createTriple("?uri", this.mNameSpace+this.mArcName, this.mIsRefContainer ? "?table" : "?row"); conditions.appendChild(triple); if (this.mIsRefContainer) { var member = this.createMember("?table", "?row"); conditions.appendChild(member); } }, createDefaultAction: function() { var action = document.createElementNS(kXULNSURI, "action"); this.mRule.appendChild(action); var orow = this.createTemplatePart("treerow"); orow.setAttribute("uri", "?row"); action.appendChild(orow); this.mTreeRow = orow; // assign the item attributes if (this.mRowAttrs) for (key in this.mRowAttrs) orow.setAttribute(key, this.mRowAttrs[key]); }, createDefaultBindings: function() { // assign the item fields var binding; if (this.mRowFields) { var props = ""; for (key in this.mRowFields) { binding = this.createBinding(this.mRowFields[key]); this.mBindings.appendChild(binding); props += key+"-?"+this.mRowFields[key]+" "; } this.mTreeRow.setAttribute("properties", props); } }, createTriple: function(aSubject, aPredicate, aObject) { var triple = document.createElementNS(kXULNSURI, "triple"); triple.setAttribute("subject", aSubject); triple.setAttribute("predicate", aPredicate); triple.setAttribute("object", aObject); return triple; }, createMember: function(aContainer, aChild) { var member = document.createElementNS(kXULNSURI, "member"); member.setAttribute("container", aContainer); member.setAttribute("child", aChild); return member; }, reset: function() { this.mColumns = []; this.mIsIconic = false; this.resetTree(); }, resetTree: function() { var kids = this.mTree.childNodes; for (var i = kids.length - 1; i >= 0; --i) if (kids[i].localName != "treechildren") this.mTree.removeChild(kids[i]); this.clearChildren(this.mBindings); this.clearChildren(this.mTreeRow); this.createDefaultBindings(); }, clearChildren: function(aEl) { while (aEl.hasChildNodes()) aEl.removeChild(aEl.lastChild); }, //////////////////////////////////////////////////////////////////////////// //// column drag and drop initDND: function() { if (this.mAllowDND) { // addEventListener doesn't work for dnd events, apparently... so we use the attributes this.addDNDListener(this.mTree, "ondragenter"); this.addDNDListener(this.mTree, "ondragover"); this.addDNDListener(this.mTree, "ondragexit"); this.addDNDListener(this.mTree, "ondraggesture"); this.addDNDListener(this.mTree, "ondragdrop"); } }, onDragEnter: function(aEvent) { }, onDragOver: function(aEvent) { if (!DNDUtils.checkCanDrop("TreeBuilder/column-add")) return; var idx = this.getColumnIndexFromX(aEvent.clientX, 0.5); this.mColumnInsertIndex = idx; var col = this.getColumnAt(idx); if (idx == -1) this.markColumnInsert(col, "after"); else this.markColumnInsert(col, "before"); }, onDragExit: function(aEvent) { }, onDragDrop: function(aEvent) { this.markColumnInsert(null); var dragService = XPCU.getService("@mozilla.org/widget/dragservice;1", "nsIDragService"); var dragSession = dragService.getCurrentSession(); if (!dragSession.isDataFlavorSupported("TreeBuilder/column-add")) return false; var trans = XPCU.createInstance("@mozilla.org/widget/transferable;1", "nsITransferable"); trans.addDataFlavor("TreeBuilder/column-add"); dragSession.getData(trans, 0); var data = {}; trans.getAnyTransferData ({}, data, {}); var string = XPCU.QI(data.value, "nsISupportsString"); this.insertColumn(this.mColumnInsertIndex, { name: string.data, title: string.data, flex: 1 }); // if we rebuildContent during this thread, it will crash in the dnd service setTimeout(function(me) { me.build(); me.buildContent() }, 1, this); // bug 56270 - dragSession.sourceDocument is null -- // causes me to code this very temporary, very nasty hack // to tell columnsDialog.js about the drop if (this.mTree.onClientDrop) { this.mTree.onClientDrop(); } }, markColumnInsert: function (aColumn, aWhere) { var col = this.mLastDragCol; var lastWhere = this.mLastDragColWhere; if (col) col.setAttribute("properties", ""); if (aWhere != "before" && aWhere != "after") { this.mLastDragCol = null; this.mLastDragColWhere = null; return; } col = aColumn; if (col) { this.mLastDragCol = col; this.mLastDragColWhere = aWhere; col.setAttribute("properties", "dnd-insert-"+aWhere); } var bx = this.mTree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject); bx.invalidate(); }, getColumnIndexFromX: function(aX, aThresh) { var width = 0; var col, cw; for (var i = 0; i < this.columnCount; ++i) { col = this.getColumnAt(i); cw = col.boxObject.width; width += cw; if (width-(cw*aThresh) > aX) return i; } return -1; }, getColumnIndexFromHeader: function(aHeader) { var headers = this.mTree.getElementsByTagName("treecol"); for (var i = 0; i < headers.length; ++i) { if (headers[i] == aHeader) return i; } return -1; }, //// for drag-n-drop removal/arrangement of columns onDragGesture: function(aEvent) { var target = aEvent.target; if (target.parentNode == this.mTree) { var column = target.getAttribute("label"); var idx = this.getColumnIndexFromHeader(target); if (idx == -1) return; this.mColumnDragging = idx; DNDUtils.invokeSession(target, ["TreeBuilder/column-remove"], [column]); } }, addColumnDropTarget: function(aBox) { aBox._treeBuilderDropTarget = this; this.addDNDListener(aBox, "ondragover", "Target"); this.addDNDListener(aBox, "ondragdrop", "Target"); }, removeColumnDropTarget: function(aBox) { aBox._treeBuilderDropTarget = this; this.removeDNDListener(aBox, "ondragover", "Target"); this.removeDNDListener(aBox, "ondragdrop", "Target"); }, onDragOverTarget: function(aBox, aEvent) { DNDUtils.checkCanDrop("TreeBuilder/column-remove"); }, onDragDropTarget: function(aBox, aEvent) { this.removeColumn(this.mColumnDragging); this.build(); // if we rebuildContent during this thread, it will crash in the dnd service setTimeout(function(aTreeBuilder) { aTreeBuilder.buildContent() }, 1, this); }, // these are horrible hacks to compensate for the lack of true multiple // listener support for the DND events addDNDListener: function(aBox, aType, aModifier) { var js = "inTreeBuilder_"+aType+(aModifier?"_"+aModifier:"")+"(this, event);"; var attr = aBox.getAttribute(aType); attr = attr ? attr : ""; aBox.setAttribute(aType, attr + js); }, removeDNDListener: function(aBox, aType, aModifier) { var js = "inTreeBuilder_"+aType+(aModifier?"_"+aModifier:"")+"(this, event);"; var attr = aBox.getAttribute(aType); var idx = attr.indexOf(js); if (idx != -1) attr = attr.substr(0,idx) + attr.substr(idx+1); aBox.setAttribute(aType, attr); }, //////////////////////////////////////////////////////////////////////////// //// column properties addColumn: function(aData) { this.mColumns.push(aData); if (this.mOnColumnAdd) this.mOnColumnAdd(this.mColumns.length-1) }, insertColumn: function(aIndex, aData) { var idx; if (aIndex == -1) { this.mColumns.push(aData); idx = this.mColumns.length-1; } else { this.mColumns.splice(aIndex, 0, aData); idx = aIndex; } if (this.mOnColumnAdd) this.mOnColumnAdd(idx); }, removeColumn: function(aIndex) { this.mColumns.splice(aIndex, 1); if (this.mOnColumnRemove) this.mOnColumnRemove(aIndex); }, getColumnAt: function(aIndex) { var kids = this.mTree.getElementsByTagName("treecol"); return aIndex < 0 || aIndex >= kids.length ? kids[kids.length-1] : kids[aIndex]; }, get columnCount() { return this.mColumns.length }, getColumnName: function(aIndex) { return this.mColumns[aIndex].name }, setColumnName: function(aIndex, aValue) { this.mColumns[aIndex].name = aValue }, getColumnTitle: function(aIndex) { return this.mColumns[aIndex].title }, setColumnTitle: function(aIndex, aValue) { this.mColumns[aIndex].title = aValue }, getColumnClassName: function(aIndex) { return this.mColumns[aIndex].className }, setColumnClassName: function(aIndex, aValue) { this.mColumns[aIndex].className = aValue }, getColumnFlex: function(aIndex) { return this.mColumns[aIndex].flex }, setColumnFlex: function(aIndex, aValue) { this.mColumns[aIndex].flex = aValue }, getExtras: function(aIndex) { return this.mColumns[aIndex].extras }, setExtras: function(aIndex, aValue) { this.mColumns[aIndex].extras = aExtras }, getAttrs: function(aIndex) { return this.mColumns[aIndex].attrs }, setAttrs: function(aIndex, aValue) { this.mColumns[aIndex].attrs = aExtras }, //////////////////////////////////////////////////////////////////////////// //// template building build: function(aBuildContent) { try { this.resetTree(); this.buildColumns(); this.buildTemplate(); if (aBuildContent) this.buildContent(); } catch (ex) { debug("### ERROR - inTreeBuilder::build failed.\n" + ex); } //dumpDOM2(this.mTree); }, buildContent: function() { this.mTreeBody.builder.rebuild(); }, buildColumns: function() { var cols = document.createElementNS(kXULNSURI, "treecols"); var col, val, split; for (var i = 0; i < this.mColumns.length; i++) { col = document.createElementNS(kXULNSURI, "treecol"); col.setAttribute("id", "treecol-"+this.mColumns[i].name); col.setAttribute("persist", "width"); col.setAttribute("label", this.mColumns[i].title); // mark first node as primary, if necessary if (i == 0 && this.mIsContainer) col.setAttribute("primary", "true"); val = cols[i].className; if (val) col.setAttribute("class", val); val = cols[i].flex; if (val) col.setAttribute("flex", val); cols.appendChild(col); if (this.mSplitters && i < this.mColumns.length-1) { split = document.createElementNS(kXULNSURI, "splitter"); split.setAttribute("class", "tree-splitter"); cols.appendChild(split); } } this.mTree.appendChild(cols); }, buildTemplate: function() { var cols = this.mColumns; var bindings = this.mBindings; var row = this.mTreeRow; var cell, binding, val, extras, attrs, key, className; if (this.mIsIconic) { binding = this.createBinding("_icon"); bindings.appendChild(binding); } for (var i = 0; i < cols.length; ++i) { val = cols[i].name; if (!val) throw "Column data is incomplete - missing name at index " + i + "."; cell = this.createTemplatePart("treecell"); className = ""; // build the default value data field binding = this.createBinding(val); bindings.appendChild(binding); cell.setAttribute("label", "?" + val); cell.setAttribute("ref", "treecol-"+cols[i].name); cell.setAttribute("class", className); var props = ""; for (key in this.mRowFields) props += key+"-?"+this.mRowFields[key]+" "; cell.setAttribute("properties", props); row.appendChild(cell); } }, createBinding: function(aName) { var binding = document.createElementNS(kXULNSURI, "binding"); binding.setAttribute("subject", "?row"); binding.setAttribute("predicate", this.mNameSpace+aName); binding.setAttribute("object", "?" + aName); return binding; }, createTemplatePart: function(aTagName) { var el = document.createElementNS(kXULNSURI, aTagName); el.setAttribute("id", "templatePart"+inTreeBuilderPartCount); inTreeBuilderPartCount++; return el; } }; function inTreeBuilder_ondraggesture(aTree, aEvent) { return aTree._treeBuilder.onDragGesture(aEvent); } function inTreeBuilder_ondragenter(aTree, aEvent) { return aTree._treeBuilder.onDragEnter(aEvent); } function inTreeBuilder_ondragover(aTree, aEvent) { return aTree._treeBuilder.onDragOver(aEvent); } function inTreeBuilder_ondragexit(aTree, aEvent) { return aTree._treeBuilder.onDragExit(aEvent); } function inTreeBuilder_ondragdrop(aTree, aEvent) { return aTree._treeBuilder.onDragDrop(aEvent); } function inTreeBuilder_ondragover_Target(aBox, aEvent) { return aBox._treeBuilderDropTarget.onDragOverTarget(aBox, aEvent); } function inTreeBuilder_ondragdrop_Target(aBox, aEvent) { return aBox._treeBuilderDropTarget.onDragDropTarget(aBox, aEvent); } PK h4(*/.content/inspector/jsutil/xul/inBaseTreeView.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * inBaseTreeView ------------------------------------------------- * Simple tree view object meant to be extended. * * Usage example: MyView.prototype = new inBaseTreeView(); ****************************************************************/ //XXX Don't use anonymous functions function inBaseTreeView() { } inBaseTreeView.prototype = { mRowCount: 0, mTree: null, get rowCount() { return this.mRowCount; }, setTree: function(aTree) { this.mTree = aTree; }, getCellText: function(aRow, aCol) { return ""; }, getRowProperties: function(aIndex, aProperties) {}, getCellProperties: function(aIndex, aCol, aProperties) {}, getColumnProperties: function(aCol, aProperties) {}, getParentIndex: function(aRowIndex) { }, hasNextSibling: function(aRowIndex, aAfterIndex) { }, getLevel: function(aIndex) {}, getImageSrc: function(aRow, aCol) {}, getProgressMode: function(aRow, aCol) {}, getCellValue: function(aRow, aCol) {}, isContainer: function(aIndex) {}, isContainerOpen: function(aIndex) {}, isContainerEmpty: function(aIndex) {}, isSeparator: function(aIndex) {}, isSorted: function() {}, toggleOpenState: function(aIndex) {}, selectionChanged: function() {}, cycleHeader: function(aCol) {}, cycleCell: function(aRow, aCol) {}, isEditable: function(aRow, aCol) {}, isSelectable: function(aRow, aCol) {}, setCellValue: function(aRow, aCol, aValue) {}, setCellText: function(aRow, aCol, aValue) {}, performAction: function(aAction) {}, performActionOnRow: function(aAction, aRow) {}, performActionOnCell: function(aAction, aRow, aCol) {}, // extra utility stuff createAtom: function createAtom(aVal) { try { var i = Components.interfaces.nsIAtomService; var svc = Components.classes["@mozilla.org/atom-service;1"].getService(i); return svc.getAtom(aVal); } catch(ex) { return null; } }, /** * Returns an array of selected indices in the tree. * @return an array of indices */ getSelectedIndices: function getSelectedIndices() { var indices = []; var rangeCount = this.selection.getRangeCount(); for (var i = 0; i < rangeCount; i++) { var start = {}; var end = {}; this.selection.getRangeAt(i,start,end); for (var c = start.value; c <= end.value; c++) { indices.push(c); } } return indices; }, /** * Returns an array of row objects selected in the tree. * @return an array of row objects */ getSelectedRowObjects: function getSelectedRowObjects() { var declarations = []; var indices = this.getSelectedIndices(); for (var i = 0; i < indices.length; i++) { declarations.push(this.getRowObjectFromIndex(indices[i])); } return declarations; } }; PK y0jrЬ 2content/inspector/jsutil/events/ObserverManager.js/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Joe Hewitt (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /*************************************************************** * ObserverManager ----------------------------------------------- * Manages observer and event dispatching for an object. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * REQUIRED IMPORTS: ****************************************************************/ //////////////////////////////////////////////////////////////////////////// //// class ObserverManager function ObserverManager(aTarget) { this.mTarget = aTarget; this.mObservers = {}; } ObserverManager.prototype = { addObserver: function(aEventName, aObserver) { var list; if (!(aEventName in this.mObservers)) { list = []; this.mObservers[aEventName] = list; } else list = this.mObservers[aEventName]; list.push(aObserver); }, removeObserver: function(aEventName, aObserver) { if (aEventName in this.mObservers) { var list = this.mObservers[aEventName]; for (var i = 0; i < list.length; ++i) { if (list[i] == aObserver) { list.splice(i, 1); return; } } } }, dispatchEvent: function(aEventName, aEventData) { if (aEventName in this.mObservers) { if (!("target" in aEventData)) aEventData.target = this.mTarget; aEventData.type = aEventName; var list = this.mObservers[aEventName]; for (var i = 0; i < list.length; ++i) list[i].onEvent(aEventData); } } }; PK L*3 4GG*content/inspector/prefs/pref-inspector.xul &installHowTo.label;