diff --git a/mozilla/extensions/inspector/resources/content/extensions/titledSplitter.css b/mozilla/extensions/inspector/resources/content/extensions/titledSplitter.css
new file mode 100644
index 00000000000..9870bbca700
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/extensions/titledSplitter.css
@@ -0,0 +1,6 @@
+
+@import url("chrome://inspector/skin/titledSplitter.css");
+
+.titled-splitter {
+ -moz-binding: url("titledSplitter.xml#titledSplitter") !important;
+}
diff --git a/mozilla/extensions/inspector/resources/content/extensions/titledSplitter.xml b/mozilla/extensions/inspector/resources/content/extensions/titledSplitter.xml
new file mode 100644
index 00000000000..7b7b4a1b23c
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/extensions/titledSplitter.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/extensions/treeEditable.css b/mozilla/extensions/inspector/resources/content/extensions/treeEditable.css
new file mode 100644
index 00000000000..4e279a0ebc8
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/extensions/treeEditable.css
@@ -0,0 +1,11 @@
+
+@import url("chrome://inspector/skin/treeEditable.css");
+
+.tree-editable {
+ -moz-binding: url("treeEditable.xml#treeEditable");
+}
+
+.treecell-editable {
+ -moz-binding: url("treeEditable.xml#treecellEditable");
+}
+
diff --git a/mozilla/extensions/inspector/resources/content/extensions/treeEditable.xml b/mozilla/extensions/inspector/resources/content/extensions/treeEditable.xml
new file mode 100644
index 00000000000..bc95174b104
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/extensions/treeEditable.xml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new Function("event", this.getAttribute("onstartedit"));
+
+
+
+ new Function("event", this.getAttribute("onafteredit"));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/extensions/wsm-colorpicker.js b/mozilla/extensions/inspector/resources/content/extensions/wsm-colorpicker.js
new file mode 100644
index 00000000000..730a966a8d2
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/extensions/wsm-colorpicker.js
@@ -0,0 +1,47 @@
+/***************************************************************
+* 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();
+}
diff --git a/mozilla/extensions/inspector/resources/content/jar.mn b/mozilla/extensions/inspector/resources/content/jar.mn
index 992fccbe18e..f2d5aa01ee2 100644
--- a/mozilla/extensions/inspector/resources/content/jar.mn
+++ b/mozilla/extensions/inspector/resources/content/jar.mn
@@ -52,12 +52,7 @@ inspector.jar:
content/inspector/search/modules/junkImgs/dialog.js (search/modules/junkImgs/dialog.js)
content/inspector/sidebar/sidebar.xul (sidebar/sidebar.xul)
content/inspector/sidebar/InspectorSidebar.js (sidebar/InspectorSidebar.js)
- content/inspector/tests/test1.html (tests/test1.html)
- content/inspector/tests/test2.xul (tests/test2.xul)
- content/inspector/tests/selectors.xul (tests/selectors.xul)
- content/inspector/tests/selectors.css (tests/selectors.css)
content/inspector/tests/allskin.xul (tests/allskin.xul)
- content/inspector/tests/allskin-ns.xul (tests/allskin-ns.xul)
content/inspector/viewers/computedStyle/computedStyle.xul (viewers/computedStyle/computedStyle.xul)
content/inspector/viewers/computedStyle/computedStyle.js (viewers/computedStyle/computedStyle.js)
content/inspector/viewers/dom/dom.xul (viewers/dom/dom.xul)
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/rdf/RDFArray.js b/mozilla/extensions/inspector/resources/content/jsutil/rdf/RDFArray.js
new file mode 100644
index 00000000000..9a797d66fe2
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/rdf/RDFArray.js
@@ -0,0 +1,159 @@
+/***************************************************************
+* 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;
+}
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/rdf/RDFU.js b/mozilla/extensions/inspector/resources/content/jsutil/rdf/RDFU.js
new file mode 100644
index 00000000000..2a004f082c0
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/rdf/RDFU.js
@@ -0,0 +1,114 @@
+/***************************************************************
+* 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);
+ 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(aErrorMsg);
+ },
+
+ onEndLoad: function(aSink)
+ {
+ var ds = XPCU.QI(aSink, "nsIRDFDataSource");
+ this.mListener.onDataSourceReady(ds);
+ }
+
+};
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/system/ClipboardUtils.js b/mozilla/extensions/inspector/resources/content/jsutil/system/ClipboardUtils.js
new file mode 100644
index 00000000000..a96008b0ee1
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/system/ClipboardUtils.js
@@ -0,0 +1,35 @@
+/***************************************************************
+* ClipboardUtils -------------------------------------------------
+* Utility functions for painless clipboard interaction.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+//////////// global constants ////////////////////
+
+////////////////////////////////////////////////////////////////////////////
+//// class ClipboardUtils
+
+var ClipboardUtils = {
+
+ writeString: function(aString)
+ {
+ var clipboard = XPCU.getService("@mozilla.org/widget/clipboard;1", "nsIClipboard");
+ var transferable = XPCU.createInstance("@mozilla.org/widget/transferable;1", "nsITransferable");
+
+ if (clipboard && transferable) {
+ transferable.addDataFlavor("text/unicode");
+
+ var data = XPCU.createInstance("@mozilla.org/supports-wstring;1", "nsISupportsWString");
+
+ if (data) {
+ data.data = aString;
+ transferable.setTransferData("text/unicode", data, aString.length * 2);
+ clipboard.setData(transferable, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
+ }
+ }
+ }
+
+};
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/system/DiskSearch.js b/mozilla/extensions/inspector/resources/content/jsutil/system/DiskSearch.js
new file mode 100644
index 00000000000..fe43350ab88
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/system/DiskSearch.js
@@ -0,0 +1,59 @@
+/***************************************************************
+* 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;
+ }
+
+ // 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(entry.URL);
+ }
+ }
+ },
+
+ getExtension: function(aFileName)
+ {
+ var dotpt = aFileName.lastIndexOf(".");
+ if (dotpt)
+ return aFileName.substr(dotpt+1).toLowerCase();
+
+ return null;
+ }
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/system/FilePickerUtils.js b/mozilla/extensions/inspector/resources/content/jsutil/system/FilePickerUtils.js
new file mode 100644
index 00000000000..bedda1cbeed
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/system/FilePickerUtils.js
@@ -0,0 +1,86 @@
+/***************************************************************
+* 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;
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/system/PrefUtils.js b/mozilla/extensions/inspector/resources/content/jsutil/system/PrefUtils.js
new file mode 100644
index 00000000000..c42b3deebca
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/system/PrefUtils.js
@@ -0,0 +1,78 @@
+/***************************************************************
+* PrefUtils -------------------------------------------------
+* Utility for easily using the Mozilla preferences system.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+//////////// global constants ////////////////////
+
+const nsIPref = Components.interfaces.nsIPref;
+
+////////////////////////////////////////////////////////////////////////////
+//// class PrefUtils
+
+var PrefUtils =
+{
+ mPrefs: null,
+
+ init: function()
+ {
+ this.mPrefs = XPCU.getService("@mozilla.org/preferences;1", "nsIPref");
+ },
+
+ addObserver: function(aDomain, aFunction)
+ {
+ if (!this.mPrefs) this.init();
+
+ this.mPrefs.addObserver(aDomain, aFunction);
+ },
+
+ removeObserver: function(aDomain, aFunction)
+ {
+ if (!this.mPrefs) this.init();
+
+ this.mPrefs.removeObserver(aDomain, aFunction);
+ },
+
+ setPref: function(aName, aValue)
+ {
+ if (!this.mPrefs) this.init();
+
+ var type = this.mPrefs.GetPrefType(aName);
+ try {
+ if (type == nsIPref.ePrefString) {
+ this.mPrefs.SetUnicharPref(aName, aValue);
+ } else if (type == nsIPref.ePrefBool) {
+ this.mPrefs.SetBoolPref(aName, aValue);
+ } else if (type == nsIPref.ePrefInt) {
+ 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 == nsIPref.ePrefString) {
+ return this.mPrefs.CopyUnicharPref(aName);
+ } else if (type == nsIPref.ePrefBool) {
+ return this.mPrefs.GetBoolPref(aName);
+ } else if (type == nsIPref.ePrefInt) {
+ return this.mPrefs.GetIntPref(aName);
+ }
+ } catch(ex) {
+ debug("ERROR: Unable to read pref \"" + aName + "\".\n");
+ }
+ return null;
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/system/file.js b/mozilla/extensions/inspector/resources/content/jsutil/system/file.js
new file mode 100644
index 00000000000..6df1367632b
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/system/file.js
@@ -0,0 +1,701 @@
+/*** -*- Mode: Javascript; tab-width: 2;
+
+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.
+
+Portions created by Collabnet are
+Copyright (C) 2000 Collabnet. All
+Rights Reserved.
+
+Contributor(s): Pete Collins, Doug Turner, Brendan Eich, Warren Harris, Eric Plaster
+
+
+ File API (The purpose of this file is to make it a little easier to do file IO from js)
+
+ file.js
+
+ Function List
+
+ // Constructor
+ File(aPath) // creates the File object and sets the file path
+
+ open(aMode); // open a file handle for reading, writing or appending
+ close(); // closes a file handle
+ exists(); // check to see if a file exists
+ read(); // returns the contents of a file
+ readline(aDone); // returns the next line in the file. aDone == true at EOF
+ write(aContents, aPermissions); // permissions are optional
+ eof(); // check 'end of file' status
+
+ // file attributes
+ permissions(); // returns the files permissions
+ dateModified(); // returns the last modified date in locale string
+ size(); // returns the file size
+
+ // file string manipulation
+ path(); // returns the path
+ leaf(); // leaf is the endmost file string ex: foo.html in /myDir/foo.html
+ extension(); // returns a file extension if there is one
+ dirPath() // returns the dir part of a path
+
+ // direct manipulation
+ nsIFIle() // returns an nsIFile obj
+
+ // help!
+ help(); // currently dumps a list of available functions
+
+ Instructions:
+
+ First include this js file in your xul file. Next, create an File object:
+
+ var file = new File("/path/file.ext");
+
+ To see if the file exists, call the exists() member. This is a good check before going into some
+ deep code to try and extract information from a non-existant file.
+
+ To open a file for reading<"r">, writing<"w"> or appending<"a">,
+ just call:
+
+ file.open("w");
+
+ where in this case you will be creating a new file called '/path/file.ext', with a mode of "w"
+ which means you want to write a new file.
+
+ If you want to read from a file, just call:
+
+ file.open("r");
+ var theFilesContents = file.read();
+
+ The file contents will be returned to the caller so you can do something usefull with it.
+
+ file.close();
+
+ Calling 'close()' destroys any created objects. If you forget to use file.close() no probs
+ all objects are discarded anyway.
+
+ Warning: these API's are not for religious types
+
+************/
+
+/****************** Globals **********************/
+
+const JSLIB_FILE = "file.js";
+
+const JSFILE_LOCAL_CID = "@mozilla.org/file/local;1";
+const JSFILE_F_CHANNEL_CID = "@mozilla.org/network/local-file-channel;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_DELETE = "delete";
+
+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[JSFILE_DELETE](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.lastModificationDate).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;
+}
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/xpcom/XPCU.js b/mozilla/extensions/inspector/resources/content/jsutil/xpcom/XPCU.js
new file mode 100644
index 00000000000..ec097b6ffa6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/xpcom/XPCU.js
@@ -0,0 +1,31 @@
+
+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);
+ }
+ },
+
+ createInstance: function (aURL, aInterface)
+ {
+ try {
+ return Components.classes[aURL].createInstance(Components.interfaces[aInterface]);
+ } catch (ex) {
+ dump("Error creating instance: " + aURL + ", " + aInterface + "\n" + ex);
+ }
+ },
+
+ QI: function(aEl, aIName)
+ {
+ try {
+ return aEl.QueryInterface(Components.interfaces[aIName]);
+ } catch (ex) {
+ dump("Error in QI: " + aIName + "\n" + ex);
+ }
+ }
+
+};
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/xul/DNDUtils.js b/mozilla/extensions/inspector/resources/content/jsutil/xul/DNDUtils.js
new file mode 100644
index 00000000000..7d5e5cdfdf9
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/xul/DNDUtils.js
@@ -0,0 +1,79 @@
+/***************************************************************
+* 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-wstring;1", "nsISupportsWString");
+ 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;
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/xul/FrameExchange.js b/mozilla/extensions/inspector/resources/content/jsutil/xul/FrameExchange.js
new file mode 100644
index 00000000000..48914338eac
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/xul/FrameExchange.js
@@ -0,0 +1,36 @@
+/***************************************************************
+* FrameExchange ----------------------------------------------
+* Utility for passing specific data to a document loaded
+* through an iframe
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+****************************************************************/
+
+//////////// implementation ////////////////////
+
+var FrameExchange = {
+ mData: {},
+ mCount: 0,
+
+ loadURL: function(aFrame, aURL, aData)
+ {
+ var id = "entry-"+this.mCount;
+ this.mCount++;
+
+ this.mData[id] = aData;
+
+ var url = aURL + "?" + id;
+ aFrame.setAttribute("src", url);
+ },
+
+ receiveData: function(aWindow)
+ {
+ var id = aWindow.location.search.substr(1);
+ var data = this.mData[id];
+ this.mData[id] = null;
+
+ return data;
+ }
+};
+
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/xul/inFormManager.js b/mozilla/extensions/inspector/resources/content/jsutil/xul/inFormManager.js
new file mode 100644
index 00000000000..5c8279b6cee
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/xul/inFormManager.js
@@ -0,0 +1,107 @@
+/***************************************************************
+* 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 textfields 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_textfield: function(aEl)
+ {
+ return aEl.value;
+ },
+
+ read_menulist: function(aEl)
+ {
+ return aEl.getAttribute("data");
+ },
+
+ read_checkbox: function(aEl)
+ {
+ return aEl.getAttribute("checked") == "true";
+ },
+
+ read_radiogroup: function(aEl)
+ {
+ return aEl.getAttribute("data");
+ },
+
+ read_colorpicker: function(aEl)
+ {
+ return aEl.getAttribute("color");
+ },
+
+ write_textfield: function(aEl, aValue)
+ {
+ aEl.setAttribute("value", aValue);
+ },
+
+ write_menulist: function(aEl, aValue)
+ {
+ aEl.setAttribute("data", aValue);
+ },
+
+ write_checkbox: function(aEl, aValue)
+ {
+ aEl.setAttribute("checked", aValue);
+ },
+
+ write_radiogroup: function(aEl, aValue)
+ {
+ aEl.setAttribute("data", aValue);
+ },
+
+ write_colorpicker: function(aEl, aValue)
+ {
+ aEl.color = aValue;
+ }
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/jsutil/xul/inTreeTableBuilder.js b/mozilla/extensions/inspector/resources/content/jsutil/xul/inTreeTableBuilder.js
new file mode 100644
index 00000000000..18665992816
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/jsutil/xul/inTreeTableBuilder.js
@@ -0,0 +1,659 @@
+/***************************************************************
+* inTreeTableBuilder -------------------------------------------------
+* Automatically builds up a 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 begin with no children other than
+* a single template element. The template is required.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xul/DNDUtils.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var inTreeTableBuilderPartCount = 0;
+
+//////////// global constants ////////////////////
+
+////////////////////////////////////////////////////////////////////////////
+//// class inTreeTableBuilder
+
+function inTreeTableBuilder(aTree, aNameSpace, aArcName)
+{
+ this.tree = aTree;
+ this.nameSpace = aNameSpace;
+ this.arcName = aArcName;
+
+ this.mColumns = [];
+ this.mExtras = [];
+}
+
+inTreeTableBuilder.prototype =
+{
+ mTree: null,
+ // datasource stuff
+ mNameSpace: null,
+ mArcName: null,
+ mIsRefContainer: true,
+ mIsContainer: false,
+
+ // table structure stuff
+ mIsIconic: false,
+ mColumns: null,
+ mSplitters: true,
+ mItemFields: null,
+ mItemAttrs: 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; 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 itemAttributes() { return this.mItemAttrs },
+ set itemAttributes(aVal) { this.mItemAttrs = aVal },
+
+ // extra data fields to set on the treeitem
+ get itemFields() { return this.mItemFields },
+ set itemFields(aVal) { this.mItemFields = 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()
+ {
+ // initialize the treehead
+ var treehead = document.createElementNS(kXULNSURI, "treehead");
+ var treerow = document.createElementNS(kXULNSURI, "treerow");
+ this.mTreeHeadRow = treerow;
+
+ treehead.appendChild(treerow);
+ this.mTree.appendChild(treehead);
+
+ // initialize the treecolgroup
+ var colgroup = document.createElementNS(kXULNSURI, "treecolgroup");
+ this.mColGroup = colgroup;
+ this.mTree.appendChild(colgroup);
+
+ 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, "content");
+ content.setAttribute("uri", "?uri");
+ conditions.appendChild(content);
+
+ var triple = this.createTriple("?uri", this.mNameSpace+this.mArcName,
+ this.mIsRefContainer ? "?table" : "?item");
+ conditions.appendChild(triple);
+
+ if (this.mIsRefContainer) {
+ var member = this.createMember("?table", "?item");
+ conditions.appendChild(member);
+ }
+ },
+
+ createDefaultAction: function()
+ {
+ var action = document.createElementNS(kXULNSURI, "action");
+ this.mRule.appendChild(action);
+
+ var treechildren = this.createTemplatePart("treechildren");
+ action.appendChild(treechildren);
+ treechildren.setAttribute("flex", "1");
+ var treeitem = this.createTemplatePart("treeitem");
+ treechildren.appendChild(treeitem);
+ treeitem.setAttribute("uri", "?item");
+ this.mTreeItem = treeitem;
+ var treerow = this.createTemplatePart("treerow");
+ treeitem.appendChild(treerow);
+ this.mTreeRow = treerow;
+
+ // assign the item attributes
+ if (this.mItemAttrs)
+ for (key in this.mItemAttrs)
+ treeitem.setAttribute(key, this.mItemAttrs[key]);
+ },
+
+ createDefaultBindings: function()
+ {
+ // assign the item fields
+ var binding;
+ if (this.mItemFields) {
+ for (key in this.mItemFields) {
+ binding = this.createBinding(this.mItemFields[key]);
+ this.mBindings.appendChild(binding);
+ this.mTreeItem.setAttribute(key, "?" + this.mItemFields[key]);
+ }
+ }
+ },
+
+ 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()
+ {
+ this.clearChildren(this.mColGroup);
+ this.clearChildren(this.mTreeHeadRow);
+ this.clearChildren(this.mBindings);
+ this.clearChildren(this.mTreeRow);
+ this.createDefaultBindings();
+ },
+
+ clearChildren: function(aEl)
+ {
+ while (aEl.childNodes.length)
+ 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("TreeTableBuilder/column-add"))
+ return;
+
+ var idx = this.getColumnIndexFromX(aEvent.clientX, 50);
+ this.mColumnInsertIndex = idx;
+ var kids = this.mColGroup.childNodes;
+ var col = this.getColumnAt(idx);
+ if (idx == -1)
+ this.markColumnInsert(col, "after", idx);
+ else
+ this.markColumnInsert(col, "before", idx);
+ },
+
+ 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("TreeTableBuilder/column-add"))
+ return false;
+
+ var trans = XPCU.createInstance("@mozilla.org/widget/transferable;1", "nsITransferable");
+ trans.addDataFlavor("TreeTableBuilder/column-add");
+
+ dragSession.getData(trans, 0);
+ var data = new Object();
+ trans.getAnyTransferData ({}, data, {});
+
+ var string = XPCU.QI(data.value, "nsISupportsWString");
+
+ this.insertColumn(this.mColumnInsertIndex,
+ {
+ name: string.data,
+ title: string.data,
+ flex: 1
+ });
+ this.build();
+ // if we rebuildContent during this thread, it will crash in the dnd service
+ setTimeout(function(aTreeBuilder) { aTreeBuilder.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, aIdx)
+ {
+ var col = this.mLastDragCol;
+ var lastWhere = this.mLastDragColWhere;
+ if (col)
+ col.setAttribute("dnd-insert-"+lastWhere, "false");
+
+ if (aWhere != "before" && aWhere != "after") {
+ this.mLastDragCol = null;
+ this.mLastDragColWhere = null;
+ return;
+ }
+
+ col = aColumn;
+ if (col) {
+ this.mLastDragCol = col;
+ this.mLastDragColWhere = aWhere;
+ col.setAttribute("dnd-insert-"+aWhere, "true");
+ }
+ },
+
+ getColumnIndexFromX: function(aX, aThresh)
+ {
+ var colgroup = this.mColGroup;
+ var width = 0, cw;
+ var col;
+ var pct = aThresh/100;
+ for (var i = 0; i < this.columnCount; ++i) {
+ col = this.getColumnAt(i);
+ cw = col.boxObject.width;
+ width += cw;
+ if (width-(cw*pct) > aX)
+ return i;
+ }
+
+ return -1;
+ },
+
+ getColumnIndexFromHeader: function(aHeader)
+ {
+ var headers = this.mTreeHeadRow.childNodes;
+ 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.mTreeHeadRow) {
+ var column = target.getAttribute("value");
+
+ var idx = this.getColumnIndexFromHeader(target);
+ if (idx == -1) return;
+ this.mColumnDragging = idx;
+
+ DNDUtils.invokeSession(target, ["TreeTableBuilder/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("TreeTableBuilder/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 = "inTreeTableBuilder_"+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 = "inTreeTableBuilder_"+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 idx;
+ var kids = this.mColGroup.childNodes;
+ if (aIndex == -1)
+ idx = kids.length-1;
+ else {
+ // step by 2 to skip over splitters, if they are used
+ var step = this.mSplitters ? 2 : 1;
+ idx = aIndex*step;
+ }
+ return kids[idx]
+ },
+
+ 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.buildColGroup();
+ this.buildTreeHead();
+ this.buildTemplate();
+ if (aBuildContent)
+ this.buildContent();
+ } catch (ex) {
+ debug("### ERROR - inTreeTableBuilder::build failed.\n" + ex);
+ }
+
+ //if ("dumpDOM" in window)
+ //dumpDOM(this.mTemplate);
+
+ },
+
+ buildContent: function()
+ {
+ this.mTree.builder.rebuild();
+ },
+
+ buildColGroup: function()
+ {
+ var cols = this.mColumns;
+ var colgroup = this.mColGroup;
+ var col, val, split;
+ for (var i = 0; i < cols.length; i++) {
+ col = document.createElementNS(kXULNSURI, "treecol");
+ col.setAttribute("id", "treecol-"+cols[i].name);
+ col.setAttribute("persist", "width");
+ val = cols[i].className;
+ if (val)
+ col.setAttribute("class", val);
+ val = cols[i].flex;
+ if (val)
+ col.setAttribute("flex", val);
+
+ colgroup.appendChild(col);
+
+ if (this.mSplitters && i < cols.length-1) {
+ split = document.createElementNS(kXULNSURI, "splitter");
+ split.setAttribute("class", "tree-splitter");
+ colgroup.appendChild(split);
+ }
+ }
+ },
+
+ buildTreeHead: function()
+ {
+ var cols = this.mColumns;
+ var row = this.mTreeHeadRow;
+ var cell, val;
+ for (var i = 0; i < cols.length; i++) {
+ cell = document.createElementNS(kXULNSURI, "treecell");
+ cell.setAttribute("class", "treecell-header");
+ val = cols[i].title;
+ if (val)
+ cell.setAttribute("value", val);
+ row.appendChild(cell);
+ }
+ },
+
+ 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 icon data field
+ if (i == 0 && this.mIsIconic) {
+ className += "treecell-iconic ";
+ cell.setAttribute("src", "?_icon");
+ }
+
+ // mark first node as a container, if necessary
+ if (i == 0 && this.mIsContainer)
+ className += "treecell-indent";
+
+ // build the default value data field
+ binding = this.createBinding(val);
+ bindings.appendChild(binding);
+ cell.setAttribute("value", "?" + val);
+
+ cell.setAttribute("class", className);
+ row.appendChild(cell);
+ }
+ },
+
+ createBinding: function(aName)
+ {
+ var binding = document.createElementNS(kXULNSURI, "binding");
+ binding.setAttribute("subject", "?item");
+ 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"+inTreeTableBuilderPartCount);
+ inTreeTableBuilderPartCount++;
+ return el;
+ }
+
+};
+
+function inTreeTableBuilder_ondraggesture(aTree, aEvent)
+{
+ return aTree._treeBuilder.onDragGesture(aEvent);
+}
+
+function inTreeTableBuilder_ondragenter(aTree, aEvent)
+{
+ return aTree._treeBuilder.onDragEnter(aEvent);
+}
+
+function inTreeTableBuilder_ondragover(aTree, aEvent)
+{
+ return aTree._treeBuilder.onDragOver(aEvent);
+}
+
+function inTreeTableBuilder_ondragexit(aTree, aEvent)
+{
+ return aTree._treeBuilder.onDragExit(aEvent);
+}
+
+function inTreeTableBuilder_ondragdrop(aTree, aEvent)
+{
+ return aTree._treeBuilder.onDragDrop(aEvent);
+}
+
+function inTreeTableBuilder_ondragover_Target(aBox, aEvent)
+{
+ return aBox._treeBuilderDropTarget.onDragOverTarget(aBox, aEvent);
+}
+
+function inTreeTableBuilder_ondragdrop_Target(aBox, aEvent)
+{
+ return aBox._treeBuilderDropTarget.onDragDropTarget(aBox, aEvent);
+}
diff --git a/mozilla/extensions/inspector/resources/content/makefile.win b/mozilla/extensions/inspector/resources/content/makefile.win
new file mode 100644
index 00000000000..9b7d837fdd2
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/makefile.win
@@ -0,0 +1,32 @@
+#!nmake
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+DEPTH=..\..\..\..
+include <$(DEPTH)/config/config.mak>
+
+install::
+ $(MAKE_INSTALL) inspector-history.rdf $(DIST)\bin\chrome\inspector
+ $(MAKE_INSTALL) inspector-prefs.rdf $(DIST)\bin\chrome\inspector
+ $(MAKE_INSTALL) viewer-registry.rdf $(DIST)\bin\chrome\inspector
+ $(MAKE_INSTALL) search-registry.rdf $(DIST)\bin\chrome\inspector
+ $(MAKE_INSTALL) prefs\inspector.js $(DIST)\bin\defaults\pref
+
+include <$(DEPTH)\config\rules.mak>
diff --git a/mozilla/extensions/inspector/resources/content/popupOverlay.xul b/mozilla/extensions/inspector/resources/content/popupOverlay.xul
new file mode 100644
index 00000000000..daad8ef29d0
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/popupOverlay.xul
@@ -0,0 +1,67 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/prefs/inspector.js b/mozilla/extensions/inspector/resources/content/prefs/inspector.js
new file mode 100644
index 00000000000..ed0aab402fe
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/prefs/inspector.js
@@ -0,0 +1,6 @@
+pref("inspector.blink.border-color", "#CC0000");
+pref("inspector.blink.border-width", 2);
+pref("inspector.blink.duration", 2);
+pref("inspector.blink.on", true);
+pref("inspector.blink.speed", 100);
+pref("inspector.dom.columns", "localName,@id");
diff --git a/mozilla/extensions/inspector/resources/content/prefs/pref-inspector.xul b/mozilla/extensions/inspector/resources/content/prefs/pref-inspector.xul
new file mode 100644
index 00000000000..e4d66f30167
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/prefs/pref-inspector.xul
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/prefs/pref-sidebar.js b/mozilla/extensions/inspector/resources/content/prefs/pref-sidebar.js
new file mode 100644
index 00000000000..0f6dd75ab95
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/prefs/pref-sidebar.js
@@ -0,0 +1,127 @@
+/***************************************************************
+* SidebarPrefs -------------------------------------------------
+* The controller for the lovely sidebar prefs panel.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/jsutil/rdf/RDFU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var pref;
+
+//////////// global constants ////////////////////
+
+const kDirServiceCID = "@mozilla.org/file/directory_service;1"
+const kStandardURLCID = "@mozilla.org/network/standard-url;1"
+const kNCURI = "http://home.netscape.com/NC-rdf#";
+const kSidebarPanelId = "UPnls"; // directory services property to find panels.rdf
+const kSidebarURNPanelList = "urn:sidebar:current-panel-list";
+const kSidebarURN3rdParty = "urn:sidebar:3rdparty-panel";
+const kSidebarURL = "chrome://inspector/content/sidebar/sidebar.xul";
+const kSidebarTitle = "Document Inspector";
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", SidebarPrefs_initialize, false);
+
+function SidebarPrefs_initialize()
+{
+ pref = new SidebarPrefs();
+ pref.initSidebarData();
+}
+
+///// class SidebarPrefs /////////////////////////
+
+function SidebarPrefs()
+{
+}
+
+SidebarPrefs.prototype =
+{
+
+ init: function()
+ {
+ var not = this.isSidebarInstalled() ? "" : "Not";
+ var el = document.getElementById("bxSidebar"+not+"Installed");
+ el.setAttribute("collapsed", "false");
+ },
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Because nsSidebar has been so mean to me, I'm going to re-write it's
+ // addPanel code right here so I don't have to fight with it. Pbbbbt!
+ ///////////////////////////////////////////////////////////////////////////
+
+ initSidebarData: function()
+ {
+ var file = this.getDirectoryFile(kSidebarPanelId);
+ if (file)
+ RDFU.loadDataSource(file, gSidebarLoadListener);
+ },
+
+ initSidebarData2: function(aDS)
+ {
+ var res = aDS.GetTarget(gRDF.GetResource(kSidebarURNPanelList), gRDF.GetResource(kNCURI + "panel-list"), true);
+ this.mDS = aDS;
+ this.mPanelSeq = RDFU.makeSeq(aDS, res);
+ this.mPanelRes = gRDF.GetResource(kSidebarURN3rdParty + ":" + kSidebarURL);
+
+ this.init();
+ },
+
+ isSidebarInstalled: function()
+ {
+ return this.mPanelSeq.IndexOf(this.mPanelRes) != -1;
+ },
+
+ installSidebar: function()
+ {
+ if (!this.isSidebarInstalled()) {
+ this.mDS.Assert(this.mPanelRes, gRDF.GetResource(kNCURI + "title"), gRDF.GetLiteral(kSidebarTitle), true);
+ this.mDS.Assert(this.mPanelRes, gRDF.GetResource(kNCURI + "content"), gRDF.GetLiteral(kSidebarURL), true);
+ this.mPanelSeq.AppendElement(this.mPanelRes);
+ this.forceSidebarRefresh();
+ return true;
+ } else
+ return false;
+ },
+
+ forceSidebarRefresh: function()
+ {
+ var listRes = gRDF.GetResource(kSidebarURNPanelList);
+ var refreshRes = gRDF.GetResource(kNCURI + "refresh");
+ var trueRes = gRDF.GetLiteral("true");
+ this.mDS.Assert(listRes, refreshRes, trueRes, true);
+ this.mDS.Unassert(listRes, refreshRes, trueRes);
+ },
+
+ getDirectoryFile: function(aFileId)
+ {
+ try {
+ var dirService = XPCU.getService(kDirServiceCID, "nsIProperties");
+ var file = dirService.get(aFileId, Components.interfaces.nsIFile);
+ if (!file.exists())
+ return null;
+
+ var fileURL = XPCU.createInstance(kStandardURLCID, "nsIFileURL");
+ fileURL.file = file;
+ return fileURL.spec;
+ } catch (ex) {
+ return null;
+ }
+ }
+
+};
+
+var gSidebarLoadListener = {
+ onDataSourceReady: function(aDS)
+ {
+ pref.initSidebarData2(aDS);
+ },
+
+ onError: function()
+ {
+ }
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/prefs/pref-sidebar.xul b/mozilla/extensions/inspector/resources/content/prefs/pref-sidebar.xul
new file mode 100644
index 00000000000..f88955f0acb
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/prefs/pref-sidebar.xul
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/prefs/prefs.xul b/mozilla/extensions/inspector/resources/content/prefs/prefs.xul
new file mode 100644
index 00000000000..ba46fbbf9d3
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/prefs/prefs.xul
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/prefs/prefsOverlay.xul b/mozilla/extensions/inspector/resources/content/prefs/prefsOverlay.xul
new file mode 100644
index 00000000000..6646b11678c
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/prefs/prefsOverlay.xul
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/search-registry.rdf b/mozilla/extensions/inspector/resources/content/search-registry.rdf
new file mode 100644
index 00000000000..38460eeb638
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search-registry.rdf
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/search/inSearchModule.js b/mozilla/extensions/inspector/resources/content/search/inSearchModule.js
new file mode 100644
index 00000000000..0ad1c55e2d6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/inSearchModule.js
@@ -0,0 +1,487 @@
+/***************************************************************
+* inSearchModule -----------------------------------------------
+* Encapsulates an ISML module and exposes it to inSearchService.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/jsutil/rdf/RDFU.js
+* chrome://inspector/content/jsutil/rdf/RDFArray.js
+* chrome://inspector/content/jsutil/xul/inFormManager.js
+* chrome://inspector/content/search/xul/inSearchUtils.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+//////////// global constants ////////////////////
+
+////////////////////////////////////////////////////////////////////////////
+//// class inSearchModule
+
+function inSearchModule(aBaseURL)
+{
+ this.mObservers = [];
+ this.mBaseURL = aBaseURL;
+}
+
+inSearchModule.prototype =
+{
+ mTitle: null,
+ mBaseURL: null,
+ mImpl: null,
+ mDialogElementIds: null,
+ mDialogURL: null,
+ mContextMenuItems: null,
+ mColumns: null,
+ mColDelimiter: null,
+ mNameSpace: null,
+
+ mRDFArray: null,
+ mResult: null,
+ mObservers: null,
+
+ mStartTime: null,
+ mElapsed: 0,
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Properties
+
+ get searchService() { return this.mSearchService},
+ set searchService(aVal) { this.mSearchService = aVal },
+
+ get title() { return this.mTitle },
+ get baseURL() { return this.mBaseURL },
+ get defaultIconURL() { return this.mDefaultIconURL },
+
+ get datasource() { return this.mRDFArray.datasource },
+ get resultCount() { return this.mRDFArray.length },
+ get progressPercent() { return this.mImpl.progressPercent },
+ get progressText() { return this.mImp.progressText },
+ get isPastMilestone() { return this.mImpl.isPastMilestone },
+ get elapsed() { return this.mElapsed },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ initFromElement: function(aSearchEl)
+ {
+ this.parseSearch(aSearchEl);
+
+ if (this.mImpl.constructor)
+ this.mImpl.constructor();
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Parser
+
+ parseSearch: function(aSearchEl)
+ {
+ // get the title
+ this.mTitle = aSearchEl.getAttribute("title");
+ // get the default icon url
+ this.mDefaultIconURL = aSearchEl.getAttribute("defaultIcon");
+ // get the namespace
+ var ns = aSearchEl.getAttribute("namespace")
+ this.mNameSpace = ns ? ns : kInspectorNSURI;
+
+ this.parseDialog(aSearchEl);
+ this.parseContextMenu(aSearchEl);
+ this.parseColumns(aSearchEl);
+ this.parseImplementation(aSearchEl);
+ },
+
+ parseDialog: function(aSearchEl)
+ {
+ var els = aSearchEl.getElementsByTagNameNS(kISMLNSURI, "dialog");
+ if (els.length > 0) {
+ var dialogEl = els[0];
+
+ // get the array of dialog element ids
+ var ids = dialogEl.getAttribute("elements");
+ if (ids)
+ this.mDialogElementIds = ids.split(",");
+
+ // get the dialog url
+ this.setDialogURL(dialogEl.getAttribute("href"));
+ // get the dialog parameters
+ this.mDialogResizable = (dialogEl.getAttribute("resizable") == "true") ? true : false;
+ }
+ },
+
+ parseContextMenu: function(aSearchEl)
+ {
+ var els = aSearchEl.getElementsByTagNameNS(kISMLNSURI, "contextmenu");
+ if (els.length > 0) {
+ var kids = els[0].childNodes;
+ this.mContextMenu = [];
+ for (var i = 0; i < kids.length; ++i) {
+ this.mContextMenu[i] = kids[i].cloneNode(true);
+ }
+ }
+ },
+
+ parseColumns: function(aSearchEl)
+ {
+ // get the result columns
+ var els = aSearchEl.getElementsByTagNameNS(kISMLNSURI, "columns");
+ if (els.length > 0) {
+ this.mColumns = [];
+ var cols = els[0];
+ this.mColDelimiter = cols.getAttribute("delimiter");
+
+ var kids = cols.childNodes;
+ var col, data;
+ for (var i= 0; i < kids.length; ++i) {
+ col = kids[i];
+ if (col.nodeType == 1) { // ignore non-element nodes
+ data = {
+ name: col.getAttribute("name"),
+ title: col.getAttribute("title"),
+ flex: col.getAttribute("flex"),
+ className: col.getAttribute("class"),
+ copy: col.getAttribute("copy") == "true"
+ };
+ this.mColumns.push(data);
+ }
+ }
+ }
+ },
+
+ parseImplementation: function(aSearchEl)
+ {
+ this.mImpl = this.getDefaultImplementation();
+
+ // get the implementation object
+ var els = aSearchEl.getElementsByTagNameNS(kISMLNSURI, "implementation");
+ if (els.length > 0) {
+ var kids = aSearchEl.getElementsByTagNameNS(kISMLNSURI, "*");
+ for (var i = 0; i < kids.length; i++) {
+ if (kids[i].localName == "property")
+ this.parseProperty(kids[i]);
+ if (kids[i].localName == "method")
+ this.parseMethod(kids[i]);
+ }
+ }
+ },
+
+ parseProperty: function(aPropEl)
+ {
+ var name = aPropEl.getAttribute("name");
+
+ // look for a getter
+ try {
+ var fn = this.getCodeTagFunction(aPropEl, "getter", null);
+ if (fn)
+ this.mImpl.__defineGetter__(name, fn);
+ } catch (ex) {
+ throw "### SYNTAX ERROR IN ISML GETTER \"" + name + "\" ###\n" + ex;
+ }
+
+ // look for a setter
+ try {
+ var fn = this.getCodeTagFunction(aPropEl, "setter", ["val"]);
+ if (fn)
+ this.mImpl.__defineSetter__(name, fn);
+ } catch (ex) {
+ throw "### SYNTAX ERROR IN ISML SETTER \"" + name + "\" ###\n" + ex;
+ }
+ },
+
+ parseMethod: function(aMethodEl)
+ {
+ var name = aMethodEl.getAttribute("name");
+ var def = aMethodEl.getAttribute("defaultCommand") == "true";
+
+ // get all the parameters
+ var els = aMethodEl.getElementsByTagNameNS(kISMLNSURI, "parameter");
+ var params = [];
+ for (var i = 0; i < els.length; i++) {
+ params[i] = els[i].getAttribute("name");
+ }
+
+ // get the body javascript and create the function
+ try {
+ var fn = this.getCodeTagFunction(aMethodEl, "body", params);
+ this.mImpl[name] = fn;
+ if (def)
+ this.mImpl.__DefaultCmd__ = fn;
+ } catch (ex) {
+ throw "### SYNTAX ERROR IN ISML METHOD \"" + name + "\" ###\n" + ex;
+ }
+ },
+
+ getCodeTagFunction: function(aParent, aLocalName, aParams)
+ {
+ var els = aParent.getElementsByTagNameNS(kISMLNSURI, aLocalName);
+ if (els.length) {
+ var body = els[0];
+ // try to determine where the code is located
+ var node = body.childNodes.length > 0 ? body.firstChild : body;
+ return this.getJSFunction(aParams, node.nodeValue);
+ }
+
+ return null;
+ },
+
+ getJSFunction: function(aParams, aCode)
+ {
+ var params = "";
+ if (aParams) {
+ for (var i = 0; i < aParams.length; i++) {
+ params += aParams[i];
+ if (i < aParams.length-1) params += ",";
+ }
+ }
+
+ var js = "function(" + params + ") " +
+ "{" +
+ (aCode ? aCode : "") +
+ "}";
+
+ var fn;
+ eval("fn = " + js);
+ return fn;
+ },
+
+ getDefaultImplementation: function()
+ {
+ return { module: this };
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Dialog box
+
+ openDialog: function()
+ {
+ window.openDialog(this.mDialogURL, "inSearchModule_dialog",
+ "chrome,modal,resizable="+this.mDialogResizable, this);
+ },
+
+ processDialog: function(aWindow)
+ {
+ var map = inFormManager.readWindow(aWindow, this.mDialogElementIds);
+ this.implStartSearch(map);
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Searching
+
+ startSearch: function()
+ {
+ if (this.mDialogURL) {
+ this.openDialog();
+ } else
+ this.implStartSearch(null);
+ },
+
+ implStartSearch: function(aMap)
+ {
+ this.mStartTime = new Date();
+ this.mElapsed = 0;
+
+ this.notifySearchStart();
+ this.initDataSource();
+ this.prepareForResult();
+ this.mImpl.searchStart(aMap);
+ },
+
+ stopSearch: function()
+ {
+ this.searchEnd();
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Result Returns
+
+ setResultProperty: function(aAttr, aValue)
+ {
+ this.mResult[aAttr] = aValue;
+ },
+
+ searchResultReady: function()
+ {
+ this.mRDFArray.add(this.mResult);
+ this.notifySearchResult();
+ this.prepareForResult();
+ },
+
+ searchError: function(aMsg)
+ {
+ },
+
+ searchEnd: function()
+ {
+ this.mElapsed = new Date() - this.mStartTime;
+ this.notifySearchEnd();
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Columns
+
+ get columnCount() { return this.mColumns.length },
+
+ getColumn: function(aIndex) { return this.mColumns[aIndex] },
+ getColumnName: function(aIndex) { return this.mColumns[aIndex].name },
+ getColumnTitle: function(aIndex) { return this.mColumns[aIndex].title },
+ getColumnClassName: function(aIndex) { return this.mColumns[aIndex].className },
+ getColumnFlex: function(aIndex) { return this.mColumns[aIndex].flex },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// RDF Datasource
+
+ initDataSource: function()
+ {
+ this.mRDFArray = new RDFArray(this.mNameSpace, "inspector:searchResults", "results");
+ this.mRDFArray.initialize();
+ },
+
+ getResultPropertyAt: function(aIndex, aProp)
+ {
+ return this.mRDFArray.get(aIndex, aProp);
+ },
+
+ getItemText: function(aIndex)
+ {
+ var cols = this.mColumns;
+ var text = [];
+ for (var i = 0; i < cols.length; ++i) {
+ if (cols[i].copy) {
+ text.push(this.getResultPropertyAt(aIndex, cols[i].name));
+ }
+ }
+ return text.join(this.mColDelimiter);
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Context Menu
+
+ installContextMenu: function(aMenu, aInsertionPoint, aDir)
+ {
+ if (this.mContextMenu) {
+ aMenu._searchModule = this;
+ var item;
+ this.mMenuItems = [];
+ if (this.mContextMenu.length == 0)
+ aInsertionPoint.setAttribute("hide", "true");
+ for (var i = 0; i < this.mContextMenu.length; ++i) {
+ item = this.mContextMenu[i];
+ this.mMenuItems.push(item);
+ this.installSearchReference(item);
+ if (aDir == inSearchService.INSERT_BEFORE)
+ aMenu.insertBefore(item, aInsertionPoint);
+ else {
+ // NOT YET IMPLEMENTED
+ }
+ }
+ }
+ },
+
+ uninstallContextMenu: function(aMenu, aInsertionPoint, aDir)
+ {
+ if (this.mContextMenu) {
+ if (this.mContextMenu.length == 0)
+ aInsertionPoint.setAttribute("hide", "false");
+ // remove the menu items
+ for (var i = 0; i < this.mContextMenu.length; ++i)
+ aMenu.removeChild(this.mMenuItems[i]);
+ }
+ },
+
+ installSearchReference: function(aItem)
+ {
+ if (aItem.nodeType == 1) {
+ if (aItem.localName == "menuitem") {
+ aItem.search = this.mImpl;
+ for (var i = 0; i < aItem.childNodes.length; ++i)
+ this.installSearchReference(aItem.childNodes[i]);
+ }
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Event Notification
+
+ // NOTE TO SELF - this code could be cut down to nothing if you write a module
+ // called "ObserverManager" to do the work for you
+
+ addSearchObserver: function(aObserver)
+ {
+ this.mObservers.push(aObserver);
+ },
+
+ removeSearchObserver: function(aObserver)
+ {
+ var o;
+ var obs = this.mObservers;
+ for (var i = 0; i < obs.length; i++) {
+ o = obs[i];
+ if (o == aObserver) {
+ obs.splice(i, 1);
+ return;
+ }
+ }
+ },
+
+ notifySearchStart: function()
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchStart(this);
+ },
+
+ notifySearchResult: function()
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchResult(this);
+ },
+
+ notifySearchEnd: function(aResult)
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchEnd(this, aResult);
+ },
+
+ notifySearchError: function(aMsg)
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchError(this, aMsg);
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Uncategorized
+
+ callDefaultCommand: function()
+ {
+ if (this.mImpl.__DefaultCmd__)
+ this.mImpl.__DefaultCmd__();
+ },
+
+ prepareForResult: function()
+ {
+ this.mResult = { _icon: this.mDefaultIconURL };
+ },
+
+ setDialogURL: function(aURL)
+ {
+ this.mDialogURL = aURL;
+ // This block below doesn't work for now because none of the local file implementations
+ // implement SetURL. So, for now, the url in the search file MUST be absolute :(
+ /* this.mDialogURL = aURL;
+ var baseFile = inSearchUtils.createLocalFile(this.mBaseURL);
+ try {
+ baseFile.append(aURL);
+ } catch (ex) {
+ basefile = inSearchUtils.createLocalFile(aURL);
+ }
+ var file = XPCU.QI(file, "nsIFile");
+ this.mDialogURL = basefile.URL;
+ */
+ }
+
+};
+
+//////////////////////////////////////////////////////////////////////////
+//// Event Listeners
+
diff --git a/mozilla/extensions/inspector/resources/content/search/inSearchService.js b/mozilla/extensions/inspector/resources/content/search/inSearchService.js
new file mode 100644
index 00000000000..65ddd6b6133
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/inSearchService.js
@@ -0,0 +1,381 @@
+/***************************************************************
+* inSearchService -----------------------------------------------
+* The centry registry where information about all installed
+* search modules is kept.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* Until Bug 54237 is fixed, there be some ugly hacks in this
+* file. We'll need to load search modules via a XUL document
+* within an iframe, instead of using the xml loader for now.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/search/inSearchTreeBuilder.js
+* chrome://inspector/content/search/inSearchModule.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+//////////// global constants ////////////////////
+
+var kSearchURLPrefix = "chrome://inspector/content/search/";
+
+////////////////////////////////////////////////////////////////////////////
+//// class inSearchService
+
+function inSearchService()
+{
+ this.mInstances = {};
+ this.mObservers = [];
+
+ // the browser and webnav are a hack. We should be able to use
+ // the xmlextras facility for loading xml, but it's broken, so
+ // we use a browser for onw
+ var browser = document.getElementById("inSearchServiceLoader");
+ browser.addEventListener("load", inSearchService_LoadListener, true);
+ this.mWebNav = browser.webNavigation;
+}
+
+// constants
+inSearchService.INSERT_BEFORE = 1;
+inSearchService.INSERT_AFTER = 2;
+
+inSearchService.prototype =
+{
+ mInstances: null,
+ mObservers: null,
+ mCurrentModule: null,
+
+ mTree: null,
+ mContextMenu: null,
+ mCMInsertPt: null,
+ mCMInsert: inSearchService.INSERT_BEFORE,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Properties
+
+ get currentModule() { return this.mCurrentModule },
+
+ get resultsTree() { return this.mTree },
+ set resultsTree(aTree) {
+ // XX this condition could be fixed with a little bit of effort
+ if (this.mTree) throw "inSearchService.tree should only be set once"
+
+ this.mTree = aTree;
+ aTree._searchService = this;
+
+ this.mTreeBuilder = new inSearchTreeBuilder(aTree, kInspectorNSURI, "results");
+ this.mTreeBuilder.isIconic = true;
+
+ // XX HACKERY AT IT'S FINEST - the click event won't fire when I add it to the tree -- go figure
+ // in the mean time I'll add it to the parentNode, which seems to work. FIX ME!
+ var parent = aTree.parentNode;
+ parent._tempTreeYuckyHack = aTree;
+ parent.addEventListener("click", inSearchService_TreeClickListener, false);
+ },
+
+ get contextMenu() { return this.mContextMenu },
+ set contextMenu(aVal)
+ {
+ this.mContextMenu = aVal;
+ aVal._searchService = this;
+ },
+
+ get contextMenuInsertPt() { return this.mCMInsertPt },
+ set contextMenuInsertPt(aVal) { this.mCMInsertPt = aVal },
+
+ get contextMenuInsert() { return this.mCMInsert },
+ set contextMenuInsert(aVal) { this.mCMInsert = aVal },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Running Modules
+
+ startModule: function(aURL)
+ {
+ var instance = this.mInstances[aURL];
+ if (instance)
+ this.doStartModule(instance);
+ else
+ this.loadModule(aURL);
+ },
+
+ doStartModule: function(aModule)
+ {
+ aModule.startSearch();
+ },
+
+ startSearch: function(aModule)
+ {
+ this.mCurrentModule = aModule;
+
+ // build up the context menu
+ this.installContextMenu();
+
+ // build up the search results tree
+ this.mTreeBuilder.module = aModule;
+ },
+
+ clearSearch: function()
+ {
+ var mod = this.mCurrentModule;
+ if (mod) {
+ // clear datasource from search tree
+ this.mTreeBuilder.module = null;
+ this.mTreeBuilder.buildContent();
+
+ // clear context menu
+ this.uninstallContextMenu();
+ }
+
+ this.mCurrentModule = null;
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Loading Modules
+
+ loadModule: function(aURL)
+ {
+ this.mWebNav.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE);
+ this.mLoadingURL = aURL;
+ /*
+ // This method of loading the xml doesn't work, but it should. See bug 54237...
+ var doc = document.implementation.createDocument("", "", null);
+ doc.addEventListener("load", SearchFileLoadListener, false);
+ doc.load(aURL, "text/xml");
+ */
+ },
+
+ searchFileLoaded: function()
+ {
+ var mod = this.createModule(this.mWebNav.document);
+ mod.addSearchObserver(this);
+ this.mInstances[this.mLoadingURL] = mod;
+ this.doStartModule(mod);
+ },
+
+ createModule: function(aDocument)
+ {
+ var mod = new inSearchModule(aDocument.location);
+ mod.searchService = this;
+ mod.initFromElement(aDocument.documentElement);
+
+ return mod;
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inISearchObserver
+
+ onSearchStart: function(aModule)
+ {
+ this.startSearch(aModule);
+ this.notifySearchStart();
+ },
+
+ onSearchResult: function(aModule)
+ {
+ this.notifySearchResult();
+ },
+
+ onSearchEnd: function(aModule, aResult)
+ {
+ this.notifySearchEnd(aResult);
+ },
+
+ onSearchError: function(aModule, aMessage)
+ {
+ this.notifySearchError(aMessage);
+ this.clearSearch();
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Results Tree
+
+ get selectedItemCount()
+ {
+ return this.mTree ? this.mTree.selectedItems.length : null;
+ },
+
+ getSelectedIndex: function(aIdx)
+ {
+ if (this.mTree) {
+ var items = this.mTree.selectedItems;
+ return this.mTree.getIndexOfItem(items[aIdx]);
+ }
+ return null;
+ },
+
+ onTreeDblClick: function()
+ {
+ this.mCurrentModule.callDefaultCommand();
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// ContextMenu
+
+ installContextMenu: function()
+ {
+ var mod = this.mCurrentModule;
+ if (mod) {
+ var menu = this.mContextMenu;
+ menu.addEventListener("create", inSearchService_onCreatePopup, true);
+ mod.installContextMenu(menu, this.mCMInsertPt, this.mCMInsert);
+ }
+ },
+
+ uninstallContextMenu: function()
+ {
+ var mod = this.mCurrentModule;
+ if (mod) {
+ // remove the createion listener
+ var menu = this.mContextMenu;
+ menu.removeEventListener("create", inSearchService_onCreatePopup, true);
+ mod.uninstallContextMenu(menu, this.mCMInsertPt, this.mCMInsert);
+ }
+ },
+
+ onCreatePopup: function(aMenu)
+ {
+
+ },
+
+ //////////////////////////////////////////////////////////////////////////
+ //// Event Notification
+
+ // NOTE TO SELF - this code could be cut down to nothing if you write a module
+ // called "ObserverManager" to do the work for you
+
+ addSearchObserver: function(aObserver)
+ {
+ this.mObservers.push(aObserver);
+ },
+
+ removeSearchObserver: function(aObserver)
+ {
+ var o;
+ var obs = this.mObservers;
+ for (var i = 0; i < obs.length; i++) {
+ o = obs[i];
+ if (o == aObserver) {
+ obs.splice(i, 1);
+ return;
+ }
+ }
+ },
+
+ notifySearchStart: function()
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchStart(this.mCurrentModule);
+ },
+
+ notifySearchResult: function()
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchResult(this.mCurrentModule);
+ },
+
+ notifySearchEnd: function(aResult)
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchEnd(this.mCurrentModule, aResult);
+ },
+
+ notifySearchError: function(aMsg)
+ {
+ var o = this.mObservers;
+ for (var i = 0; i < o.length; i++)
+ o[i].onSearchError(this.mCurrentModule, aMsg);
+ }
+
+};
+
+////////////////////////////////////////////////////////////////////////////
+//// Event Listeners
+
+function inSearchService_LoadListener(aEvent)
+{
+ inspector.searchRegistry.searchFileLoaded();
+}
+
+function inSearchService_TreeClickListener(aEvent)
+{
+ if (aEvent.detail == 2) {
+ var tree = this._tempTreeYuckyHack;
+ tree._searchService.onTreeDblClick();
+ }
+}
+
+function inSearchService_onCreatePopup(aEvent)
+{
+ // event.target is returning null for this event - I should file a bug
+ // in the mean time I'll just back off this feature for now...
+
+/* var menu = aEvent.target;
+ var svc = menu._searchService;
+ svc.onCreatePopup(menu);
+*/
+}
+
+// This code is from when there was an RDF "search registry"... I might want to bring that back,
+// so I'll keep this code sitting here for a little while...
+
+/*
+function inSearchServiceLoadObserver(aTarget)
+{
+ this.mTarget = aTarget;
+}
+
+inSearchServiceLoadObserver.prototype = {
+ mTarget: null,
+
+ onError: function(aErrorMsg)
+ {
+ this.mTarget.onLoadError(aErrorMsg);
+ },
+
+ onDataSourceReady: function(aDS)
+ {
+ this.mTarget.onLoad(aDS);
+ }
+};
+
+ load: function(aURL, aObserver)
+ {
+ this.mURL = aURL;
+ this.mObserver = aObserver;
+ RDFU.loadDataSource(aURL, new inSearchServiceLoadObserver(this));
+ },
+
+ onLoad: function(aDS)
+ {
+ this.mDS = aDS;
+ this.prepareRegistry();
+ this.mObserver.oninSearchServiceLoad();
+ },
+
+ onLoadError: function(aErrorMsg)
+ {
+ this.mObserver.oninSearchServiceLoadError(aErrorMsg);
+ },
+
+ prepareRegistry: function()
+ {
+ this.mModuleSeq = RDFU.findSeq(this.mDS, "inspector:search");
+
+ var el, uid, fnName, factory;
+ var els = this.mModuleSeq.GetElements();
+ while (els.hasMoreElements()) {
+ el = els.getNext();
+ uid = RDFU.readAttribute(this.mDS, el, kInspectorNSURI+"uid");
+ fnName = RDFU.readAttribute(this.mDS, el, kInspectorNSURI+"factory");
+ factory = eval(fnName);
+ if (factory)
+ this.mFactories[uid] = factory;
+ }
+
+ },
+ */
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/search/inSearchTreeBuilder.js b/mozilla/extensions/inspector/resources/content/search/inSearchTreeBuilder.js
new file mode 100644
index 00000000000..6d7ceb9842a
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/inSearchTreeBuilder.js
@@ -0,0 +1,104 @@
+/***************************************************************
+* inSearchTreeBuilder ------------------------------------------
+* Utility for automatically building an rdf template and xul
+* tree structure from a tabular data set.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/inTreeBuilder.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+//////////// global constants ////////////////////
+
+////////////////////////////////////////////////////////////////////////////
+//// class inSearchTreeBuilder
+
+function inSearchTreeBuilder(aTree, aNameSpace, aArcName)
+{
+ this.mBuilder = new inTreeTableBuilder(aTree, aNameSpace, aArcName);
+ aTree.setAttribute("ref", "inspector:searchResults");
+ this.mBuilder.initialize();
+}
+
+inSearchTreeBuilder.prototype =
+{
+ mCommited: false,
+ mBuilder: null,
+ mModule: null,
+ mCommitted: false,
+
+ get tree() { return this.mBuilder.tree },
+ set tree(aVal) { this.mBuilder.tree = aVal },
+
+ get isIconic() { return this.mBuilder.isIconic },
+ set isIconic(aVal) { this.mBuilder.isIconic = aVal },
+
+ get module() { return this.mModule },
+
+ set module(aModule)
+ {
+ if (aModule != this.mModule) {
+ if (this.mModule) {
+ if (this.mCommitted)
+ this.mBuilder.tree.database.RemoveDataSource(this.mModule.datasource);
+ this.mCommitted = false;
+
+ this.mModule.removeSearchObserver(this);
+ this.mBuilder.reset();
+ }
+
+ this.mModule = aModule;
+
+ if (aModule) {
+ aModule.addSearchObserver(this);
+
+ this.isIconic = aModule.defaultIconURL ? true : false;
+
+ for (var i = 0; i < aModule.columnCount; i++)
+ this.mBuilder.addColumn(aModule.getColumn(i));
+
+ this.mBuilder.build();
+ }
+ }
+ },
+
+ getSelectedSearchIndex: function()
+ {
+ var tItem = this.mSearchTree.selectedItems[0];
+ return this.mSearchTree.getIndexOfItem(tItem);
+ },
+
+ onSearchStart: function(aProcess)
+ {
+ if (this.mCommitted)
+ this.mBuilder.tree.database.RemoveDataSource(this.mModule.datasource);
+ },
+
+ onSearchResult: function(aProcess)
+ {
+ },
+
+ onSearchEnd: function(aProcess, aResult)
+ {
+ this.mBuilder.tree.database.AddDataSource(this.mModule.datasource);
+ this.mBuilder.buildContent();
+ this.mCommitted = true;
+ },
+
+ onSearchError: function(aProcess, aMessage)
+ {
+ },
+
+ reset: function()
+ {
+ this.mBuilder.reset();
+ },
+
+ buildContent: function()
+ {
+ this.mBuilder.buildContent();
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/search/inSearchUtils.js b/mozilla/extensions/inspector/resources/content/search/inSearchUtils.js
new file mode 100644
index 00000000000..f54010b0417
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/inSearchUtils.js
@@ -0,0 +1,69 @@
+/***************************************************************
+* inSearchUtils -------------------------------------------------
+* Utilities for helping search modules accomplish common tasks.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var kSearchLookup = {
+ file: "inIFileSearch",
+ cssvalue: "inICSSValueSearch"
+};
+
+//////////// global constants ////////////////////
+
+const kISMLNSURI = "http://www.mozilla.org/inspector/isml";
+
+const kSearchHelperCIDPrefix = "@mozilla.org/inspector/search;1?type=";
+const kFileSearchCID = "@mozilla.org/inspector/search;1?type=file";
+const kCSSValueSearchCID = "@mozilla.org/inspector/search;1?type=cssvalue";
+const kLocalFileCID = "@mozilla.org/file/local;1";
+const kInMemoryDataSourceCID = "@mozilla.org/rdf/datasource;1?name=in-memory-datasource";
+
+////////////////////////////////////////////////////////////////////////////
+//// class inSearchUtils
+
+var inSearchUtils =
+{
+ // nsISupports
+ createSearchHelper: function(aName)
+ {
+ var cid = kSearchHelperCIDPrefix + aName;
+ var iid = kSearchLookup[aName];
+ return XPCU.createInstance(cid, iid);
+ },
+
+ // nsIFile
+ createLocalFile: function(aPath)
+ {
+ var file = XPCU.createInstance(kLocalFileCID, "nsILocalFile");
+
+ if (aPath) {
+ try {
+ file.initWithPath(aPath);
+ } catch (ex) {
+ debug("Invalid path in nsILocalFile::initWithPath\n" + ex);
+ }
+ }
+
+ return XPCU.QI(file, "nsIFile");
+ },
+
+ // inISearchObserver
+ createSearchObserver: function(aTarget, aLabel)
+ {
+ var observer = {
+ mTarget: aTarget,
+ onSearchStart: new Function("aModule", "this.mTarget.on"+aLabel+"SearchStart(aModule)"),
+ onSearchEnd: new Function("aModule", "aResult", "this.mTarget.on"+aLabel+"SearchEnd(aModule, aResult)"),
+ onSearchError: new Function("aModule", "aMsg", "this.mTarget.on"+aLabel+"SearchError(aModule, aMsg)"),
+ onSearchResult: new Function("aModule", "this.mTarget.on"+aLabel+"SearchResult(aModule)")
+ };
+
+ return observer;
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/commandOverlay.xul b/mozilla/extensions/inspector/resources/content/search/modules/commandOverlay.xul
new file mode 100644
index 00000000000..e1c94ca334c
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/commandOverlay.xul
@@ -0,0 +1,23 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/findFiles/dialog.js b/mozilla/extensions/inspector/resources/content/search/modules/findFiles/dialog.js
new file mode 100644
index 00000000000..8aa217e3ca0
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/findFiles/dialog.js
@@ -0,0 +1,51 @@
+/***************************************************************
+* FindFilesDialog ---------------------------------------
+* Controller for dialog.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var dialog;
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", FindFilesDialog_initialize, false);
+
+function FindFilesDialog_initialize()
+{
+ dialog = new FindFilesDialog();
+ doSetOKCancel(gDoOKFunc);
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class FindFilesDialog
+
+function FindFilesDialog()
+{
+}
+
+FindFilesDialog.prototype =
+{
+ browse: function()
+ {
+ var txf = document.getElementById("txfSearchPath");
+ var defaultPath = txf.getAttribute("value");
+ var file = FilePickerUtils.pickDir("Select Search Path", defaultPath);
+ if (file) {
+ txf.setAttribute("value", file.path);
+ }
+ }
+};
+
+////////////////////////////////////////////////////////////////////////////
+//// dialogOverlay stuff
+
+function gDoOKFunc() {
+ window.close();
+ window.arguments[0].processDialog(window);
+
+ return true;
+}
+
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/findFiles/dialog.xul b/mozilla/extensions/inspector/resources/content/search/modules/findFiles/dialog.xul
new file mode 100644
index 00000000000..e2d0128816f
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/findFiles/dialog.xul
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/findFiles/findFiles.xml b/mozilla/extensions/inspector/resources/content/search/modules/findFiles/findFiles.xml
new file mode 100644
index 00000000000..4fc46214e05
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/findFiles/findFiles.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this.mDirsSearched;
+ if (is)
+ this.mDirsSearched = search;
+
+ return is;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/dialog.js b/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/dialog.js
new file mode 100644
index 00000000000..e1d64d0a10f
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/dialog.js
@@ -0,0 +1,50 @@
+/***************************************************************
+* JunkImgsDialog -------------------------------------------------
+* Controller for dialog.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var dialog;
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", JunkImgsDialog_initialize, false);
+
+function JunkImgsDialog_initialize()
+{
+ dialog = new JunkImgsDialog();
+ doSetOKCancel(gDoOKFunc);
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class JunkImgsDialog
+
+function JunkImgsDialog()
+{
+}
+
+JunkImgsDialog.prototype =
+{
+ browse: function()
+ {
+ var txf = document.getElementById("txfSearchPath");
+ var defaultPath = txf.getAttribute("value");
+ var file = FilePickerUtils.pickDir("Select Search Path", defaultPath);
+ if (file)
+ txf.setAttribute("value", file.path);
+ }
+};
+
+////////////////////////////////////////////////////////////////////////////
+//// dialogOverlay stuff
+
+function gDoOKFunc() {
+ window.close();
+ window.arguments[0].processDialog(window);
+
+ return true;
+}
+
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/dialog.xul b/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/dialog.xul
new file mode 100644
index 00000000000..b708ec7f7f3
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/dialog.xul
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &junkImgsDescription;
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/junkImgs.xml b/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/junkImgs.xml
new file mode 100644
index 00000000000..4be3d2a1eaf
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/junkImgs/junkImgs.xml
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this.mDirsSearched;
+ if (is)
+ this.mDirsSearched = search;
+ return is;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/search/modules/popupOverlay.xul b/mozilla/extensions/inspector/resources/content/search/modules/popupOverlay.xul
new file mode 100644
index 00000000000..4382cf6f4c4
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/search/modules/popupOverlay.xul
@@ -0,0 +1,28 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/sidebar/InspectorSidebar.js b/mozilla/extensions/inspector/resources/content/sidebar/InspectorSidebar.js
new file mode 100644
index 00000000000..cbba6d59c48
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/sidebar/InspectorSidebar.js
@@ -0,0 +1,408 @@
+/***************************************************************
+* InspectorSidebar -------------------------------------------------
+* The primary object that controls the Inspector sidebar.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/ViewerRegistry.js
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/jsutil/rdf/RDFArray.js
+* chrome://inspector/content/jsutil/rdf/RDFU.js
+* chrome://inspector/content/jsutil/xul/FrameExchange.js
+* chrome://inspector/content/jsutil/Flasher.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var inspector;
+
+var kViewerRegURL = "chrome/inspector/viewer-registry.rdf";
+
+//////////// global constants ////////////////////
+
+const kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+const kInstallDirId = "CurProcD";
+
+const kFlasherCID = "@mozilla.org/inspector/flasher;1"
+const kWindowMediatorIID = "@mozilla.org/rdf/datasource;1?name=window-mediator";
+const kObserverServiceIID = "@mozilla.org/observer-service;1";
+const kDirServiceCID = "@mozilla.org/file/directory_service;1"
+
+var gNavigator = window._content;
+const nsIPref = Components.interfaces.nsIPref;
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", InspectorSidebar_initialize, false);
+
+function InspectorSidebar_initialize()
+{
+ inspector = new InspectorSidebar();
+ inspector.initialize();
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class InspectorSidebar
+
+function InspectorSidebar() // implements inIViewerPaneContainer
+{
+ try {
+ this.mInstallURL = this.getSpecialDirectory(kInstallDirId).URL;
+ } catch (ex) { alert(ex); }
+ kViewerRegURL = this.prependBaseURL(kViewerRegURL);
+
+ this.mUFlasher = XPCU.createInstance(kFlasherCID, "inIFlasher");
+}
+
+InspectorSidebar.prototype =
+{
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mShell: null,
+ mViewerReg: null,
+ mPaneCount: 2,
+ mCurrentViewer: null,
+ mCurrentWindow: null,
+ mLoadChecks: 0,
+ mInstallURL: null,
+ mFlashSelected: null,
+ mFlashes: 0,
+
+ get document() { return this.mDocViewerPane.viewer.viewee; },
+
+ initialize: function()
+ {
+ this.loadViewerRegistry();
+ this.installNavObserver();
+
+ this.initPrefs();
+ this.setFlashSelected(PrefUtils.getPref("inspector.blink.on"));
+ },
+
+ initViewerPanes: function()
+ {
+ var elPane = document.getElementById("bxDocPane");
+ this.mDocViewerPane = new ViewerPane();
+ this.mDocViewerPane.initialize("Document", this, elPane, this.mViewerReg);
+
+ elPane = document.getElementById("bxObjectPane");
+ this.mObjViewerPane = new ViewerPane();
+ this.mObjViewerPane.initialize("Object", this, elPane, this.mViewerReg);
+
+ this.setAllViewerCmdAttributes("disabled", "true");
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewerPaneContainer
+
+ get viewerPaneCount() { return this.mPaneCount; },
+
+ onViewerChanged: function(aPane, aOldViewer, aOldEntry, aNewViewer, aNewEntry)
+ {
+ var ids, el, i;
+
+ this.mViewerReg.cacheViewer(aNewViewer, aNewEntry);
+
+ // disable all commands for for the old viewer
+ if (aOldViewer)
+ this.setViewerCmdAttribute(aOldEntry, "disabled", "true");
+
+ // enable all commands for for the new viewer
+ if (aNewViewer)
+ this.setViewerCmdAttribute(aNewEntry, "disabled", "false");
+ },
+
+ onVieweeChanged: function(aPane, aNewObject)
+ {
+ if (aPane == this.mDocViewerPane) {
+ this.mObjViewerPane.viewee = aNewObject;
+ if (this.mFlashSelected)
+ this.flashElement(aNewObject, this.mCurrentWindow);
+ }
+ },
+
+ getViewerPaneAt: function(aIndex)
+ {
+ if (aIndex == 0) {
+ return this.mDocViewerPane;
+ } else if (aIndex == 1) {
+ return this.mObjViewerPane;
+ } else {
+ return null;
+ }
+ },
+
+ setCommandAttribute: function(aCmdId, aAttribute, aValue)
+ {
+ var cmd = document.getElementById(aCmdId);
+ if (cmd)
+ cmd.setAttribute(aAttribute, aValue);
+ },
+
+ getCommandAttribute: function(aCmdId, aAttribute)
+ {
+ var cmd = document.getElementById(aCmdId);
+ if (cmd)
+ return cmd.getAttribute(aAttribute);
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// UI Commands
+
+ toggleFlashSelected: function(aExplicit, aValue)
+ {
+ var val = aExplicit ? aValue : !this.mFlashSelected;
+ PrefUtils.setPref("inspector.blink.on", val);
+ this.setFlashSelected(val);
+ },
+
+ setFlashSelected: function(aValue)
+ {
+ this.mFlashSelected = aValue;
+ var cmd = document.getElementById("cmdFlashSelected");
+ cmd.setAttribute("checked", aValue);
+ },
+
+ exit: function()
+ {
+ window.close()
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Viewer Registry Interaction
+
+ loadViewerRegistry: function()
+ {
+ this.mViewerReg = new ViewerRegistry();
+ this.mViewerReg.load(kViewerRegURL, this);
+ },
+
+ onViewerRegistryLoad: function()
+ {
+ this.initViewerPanes();
+ },
+
+ onViewerRegistryLoadError: function(aStatus, aErrorMsg)
+ {
+ },
+
+ getViewer: function(aUID)
+ {
+ return this.mViewerReg.getViewerByUID(aUID);
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// History Commands
+
+ prepareHistory: function(aDS)
+ {
+ this.mHistory = RDFArray.fromContainer(aDS, "inspector:history", kInspectorNSURI);
+ var mppHistory = document.getElementById("mppHistory");
+ mppHistory.database.AddDataSource(aDS);
+ mppHistory.builder.rebuild();
+ },
+
+ addToHistory: function(aURL)
+ {
+ this.mHistory.add({ URL: aURL});
+ this.mHistory.save();
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Navigation
+
+ setTargetWindow: function(aWindow)
+ {
+ if (aWindow) {
+ this.mCurrentWindow = aWindow;
+ this.setTargetDocument(aWindow.document);
+ } else
+ alert("Unable to switch to window");
+ },
+
+ setTargetDocument: function(aDoc)
+ {
+ this.mDocViewerPane.viewee = aDoc;
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Preferences
+
+ initPrefs: function()
+ {
+ this.mPrefs = XPCU.getService("@mozilla.org/preferences;1", "nsIPref");
+ this.mPrefs.addObserver("inspector", PrefChangeObserver);
+ },
+
+ setPref: function(aName, aValue)
+ {
+ var type = this.mPrefs.GetPrefType(aName);
+ try {
+ if (type == nsIPref.ePrefString) {
+ this.mPrefs.SetUnicharPref(aName, aValue);
+ } else if (type == nsIPref.ePrefBool) {
+ this.mPrefs.SetBoolPref(aName, aValue);
+ } else if (type == nsIPref.ePrefInt) {
+ this.mPrefs.SetIntPref(aName, aValue);
+ }
+ } catch(ex) {
+ debug("ERROR: Unable to write pref \"" + aName + "\".\n");
+ }
+ },
+
+ getPref: function(aName)
+ {
+ var type = this.mPrefs.GetPrefType(aName);
+ try {
+ if (type == nsIPref.ePrefString) {
+ return this.mPrefs.CopyUnicharPref(aName);
+ } else if (type == nsIPref.ePrefBool) {
+ return this.mPrefs.GetBoolPref(aName);
+ } else if (type == nsIPref.ePrefInt) {
+ return this.mPrefs.GetIntPref(aName);
+ }
+ } catch(ex) {
+ debug("ERROR: Unable to read pref \"" + aName + "\".\n");
+ }
+ },
+
+ onPrefChanged: function(aName)
+ {
+ if (aName == "inspector.blink.on")
+ this.setFlashSelected(PrefUtils.getPref("inspector.blink.on"));
+
+ if (this.mFlasher) {
+ if (aName == "inspector.blink.border-color") {
+ this.mFlasher.color = PrefUtils.getPref("inspector.blink.border-color");
+ } else if (aName == "inspector.blink.border-width") {
+ this.mFlasher.thickness = PrefUtils.getPref("inspector.blink.border-width");
+ } else if (aName == "inspector.blink.duration") {
+ this.mFlasher.duration = PrefUtils.getPref("inspector.blink.duration");
+ } else if (aName == "inspector.blink.speed") {
+ this.mFlasher.speed = PrefUtils.getPref("inspector.blink.speed");
+ }
+ }
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Uncategorized
+
+ 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;
+ },
+
+ onTreeItemSelected: function()
+ {
+ var tree = this.mDOMTree;
+ var items = tree.selectedItems;
+ if (items.length > 0) {
+ var node = this.getNodeFromTreeItem(items[0]);
+ this.startViewingNode(node, items[0].id);
+ }
+ },
+
+ ///////////////////////////////////////////////////////////////////////////
+ // The string we get back from shell.getInstallationURL starts with
+ // "file://" and so we need to add an extra slash, or the load fails.
+ //
+ // @param wstring aURL - the url to repair
+ ///////////////////////////////////////////////////////////////////////////
+
+ prependBaseURL: function(aURL)
+ {
+ return "file:///" + this.mInstallURL.substr(7) + aURL;
+ },
+
+ flashElement: function(aElement, aWindow)
+ {
+ // make sure we only try to flash element nodes
+ if (aElement.nodeType == 1) {
+ if (!this.mFlasher)
+ this.mFlasher = new Flasher(this.mUFlasher,
+ PrefUtils.getPref("inspector.blink.border-color"),
+ PrefUtils.getPref("inspector.blink.border-width"),
+ PrefUtils.getPref("inspector.blink.duration"),
+ PrefUtils.getPref("inspector.blink.speed"));
+
+ if (this.mFlasher.flashing)
+ this.mFlasher.stop();
+
+ try {
+ this.mFlasher.element = aElement;
+ this.mFlasher.window = aWindow;
+ this.mFlasher.start();
+ } catch (ex) {
+ }
+ }
+ },
+
+ setViewerCmdAttribute: function(aEntry, aAttr, aValue)
+ {
+ var uid = this.mViewerReg.getEntryProperty(aEntry, "uid");
+ var cmds = document.getElementById("brsGlobalCommands");
+ var els = cmds.getElementsByAttribute("viewer", uid);
+ for (var i = 0; i < els.length; i++) {
+ if (els[i].getAttribute("exclusive") != "false")
+ els[i].setAttribute(aAttr, aValue);
+ }
+ },
+
+ setAllViewerCmdAttributes: function(aAttr, aValue)
+ {
+ var count = this.mViewerReg.getEntryCount();
+ for (var i = 0; i < count; i++) {
+ this.setViewerCmdAttribute(this.mViewerReg.getEntryAt(i), aAttr, aValue);
+ }
+ },
+
+ getSpecialDirectory: function(aName)
+ {
+ var dirService = XPCU.getService(kDirServiceCID, "nsIProperties");
+ return dirService.get(aName, Components.interfaces.nsIFile);
+ },
+
+ installNavObserver: function()
+ {
+ var observerService = XPCU.getService(kObserverServiceIID, "nsIObserverService");
+ observerService.AddObserver(NavLoadObserver, "EndDocumentLoad");
+ }
+};
+
+var gHistoryLoadListener = {
+ onDataSourceReady: function(aDS)
+ {
+ inspector.prepareHistory(aDS);
+ },
+
+ onError: function()
+ {
+ }
+};
+
+var NavLoadObserver = {
+ Observe: function(aWindow)
+ {
+ inspector.setTargetWindow(aWindow);
+ }
+};
+
+var PrefChangeObserver = {
+ Observe: function(aSubject, aTopic, aData)
+ {
+ inspector.onPrefChanged(aData);
+ }
+};
diff --git a/mozilla/extensions/inspector/resources/content/sidebar/sidebar.xul b/mozilla/extensions/inspector/resources/content/sidebar/sidebar.xul
new file mode 100644
index 00000000000..ed2cfcf549f
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/sidebar/sidebar.xul
@@ -0,0 +1,67 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/statusbarOverlay.xul b/mozilla/extensions/inspector/resources/content/statusbarOverlay.xul
new file mode 100644
index 00000000000..d4e98a1cede
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/statusbarOverlay.xul
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/tasksOverlay.xul b/mozilla/extensions/inspector/resources/content/tasksOverlay.xul
new file mode 100644
index 00000000000..339834ddd9d
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/tasksOverlay.xul
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/tests/allskin.xul b/mozilla/extensions/inspector/resources/content/tests/allskin.xul
new file mode 100644
index 00000000000..becf097b670
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/tests/allskin.xul
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/toolboxOverlay.xul b/mozilla/extensions/inspector/resources/content/toolboxOverlay.xul
new file mode 100644
index 00000000000..d108a086b83
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/toolboxOverlay.xul
@@ -0,0 +1,97 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/util.dtd b/mozilla/extensions/inspector/resources/content/util.dtd
new file mode 100644
index 00000000000..471d312edc6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/util.dtd
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/utilWindow.xul b/mozilla/extensions/inspector/resources/content/utilWindow.xul
new file mode 100644
index 00000000000..c8d20013a5e
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/utilWindow.xul
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/utils.js b/mozilla/extensions/inspector/resources/content/utils.js
new file mode 100644
index 00000000000..ab1aa66d2aa
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/utils.js
@@ -0,0 +1,74 @@
+/***************************************************************
+* 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";
+
+var InsUtil = {
+ /******************************************************************************
+ * Convenience function for calling nsIChromeRegistry::convertChromeURL
+ *******************************************************************************/
+ convertChromeURL: function(aURL)
+ {
+ var uri = XPCU.getService("@mozilla.org/network/simple-uri;1", "nsIURI");
+ uri.spec = aURL;
+ 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;
+ }
+
+};
+
+// ::::::: debugging utilities ::::::
+
+function debug(aText)
+{
+ // XX comment out to reduce noise
+ //consoleDump(aText);
+ dump(aText);
+}
+
+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);
+}
+
diff --git a/mozilla/extensions/inspector/resources/content/viewer-registry.rdf b/mozilla/extensions/inspector/resources/content/viewer-registry.rdf
new file mode 100644
index 00000000000..688adce882d
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewer-registry.rdf
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/viewerOverlay.xul b/mozilla/extensions/inspector/resources/content/viewerOverlay.xul
new file mode 100644
index 00000000000..85580df80a8
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewerOverlay.xul
@@ -0,0 +1,12 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/computedStyle/computedStyle.js b/mozilla/extensions/inspector/resources/content/viewers/computedStyle/computedStyle.js
new file mode 100644
index 00000000000..5edb94af2ee
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/computedStyle/computedStyle.js
@@ -0,0 +1,63 @@
+/***************************************************************
+* ComputedStyleViewer --------------------------------------------
+* The viewer for the computed css styles on a DOM element.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+//////////// global constants ////////////////////
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", ComputedStyleViewer_initialize, false);
+
+function ComputedStyleViewer_initialize()
+{
+ viewer = new ComputedStyleViewer();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class ComputedStyleViewer
+
+function ComputedStyleViewer()
+{
+ this.mURL = window.location;
+}
+
+ComputedStyleViewer.prototype =
+{
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mViewee: null,
+ mPane: null,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ get uid() { return "computedStyle" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject)
+ {
+ },
+
+ initialize: function(aPane)
+ {
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+ },
+
+ destroy: function()
+ {
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/computedStyle/computedStyle.xul b/mozilla/extensions/inspector/resources/content/viewers/computedStyle/computedStyle.xul
new file mode 100644
index 00000000000..a90a6be33db
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/computedStyle/computedStyle.xul
@@ -0,0 +1,22 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/FindDialog.js b/mozilla/extensions/inspector/resources/content/viewers/dom/FindDialog.js
new file mode 100644
index 00000000000..708da3adfcf
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/FindDialog.js
@@ -0,0 +1,126 @@
+/***************************************************************
+* FindDialog ---------------------------------------------------
+* Controls the dialog box used for searching the DOM.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/jsutil/rdf/RDFU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var dialog;
+
+//////////// global constants ////////////////////
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", FindDialog_initialize, false);
+
+function FindDialog_initialize()
+{
+ dialog = new FindDialog();
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class FindDialog
+
+function FindDialog()
+{
+ this.toggleType(window.arguments[0]);
+ this.mOpener = window.arguments[1];
+ document.getElementById("tfText1").focus();
+}
+
+FindDialog.prototype =
+{
+ mType: null,
+
+ ////////// Properties
+
+
+ ////////// Methods
+
+ doFind: function()
+ {
+ var el = document.getElementById("tfText1");
+ if (this.mType == "id") {
+ this.mOpener.doFindElementById(el.value);
+ } else if (this.mType == "tag") {
+ this.mOpener.doFindElementsByTagName(el.value);
+ } else if (this.mType == "attr") {
+ var el2 = document.getElementById("tfText2");
+ this.mOpener.doFindElementsByAttr(el.value, el2.value);
+ }
+ this.close();
+ },
+
+ close: function()
+ {
+ window.close();
+ },
+
+ toggleType: function(aType)
+ {
+ this.mType = aType;
+
+ if (aType == "id") {
+ this.showDirection(false);
+ this.setLabel1("Find Id");
+ this.setLabel2(null);
+ } else if (aType == "tag") {
+ this.showDirection(true);
+ this.setLabel1("Find Tag");
+ this.setLabel2(null);
+ } else if (aType == "attr") {
+ this.showDirection(true);
+ this.setLabel1("Attribute");
+ this.setLabel2("Value");
+ }
+
+ var rd = document.getElementById("rdType_"+aType.toLowerCase());
+ if (rd) {
+ var rg = document.getElementById("rgType");
+ rg.selectedItem = rd;
+ }
+
+ },
+
+ setLabel1: function(aVal)
+ {
+ this.setLabel(1, aVal);
+ },
+
+ setLabel2: function(aVal)
+ {
+ this.setLabel(2, aVal);
+ },
+
+ setLabel: function(aIdx, aVal)
+ {
+ var el = document.getElementById("txText"+aIdx);
+ var row = document.getElementById("rwRow"+aIdx);
+ if (aVal) {
+ el.setAttribute("value", aVal + ":");
+ row.setAttribute("hide", "false");
+ } else {
+ row.setAttribute("hide", "true");
+ }
+ },
+
+ setDirection: function(aMode)
+ {
+ var rd = document.getElementById("rdDir_"+aMode.toLowerCase());
+ if (rd) {
+ var rg = document.getElementById("rgDirection");
+ rg.selectedItem = rd;
+ }
+ },
+
+ showDirection: function(aTruth)
+ {
+ //document.getElementById("tbxDirection").setAttribute("hide", !aTruth);
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/columnsDialog.js b/mozilla/extensions/inspector/resources/content/viewers/dom/columnsDialog.js
new file mode 100644
index 00000000000..ba8a9e33339
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/columnsDialog.js
@@ -0,0 +1,214 @@
+/***************************************************************
+* ColumnsDialog --------------------------------------------
+* Dialog box for editing the columns in the DOM Viewer tree.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var dialog;
+
+var gColumnTitles = [
+ "nodeName",
+ "nodeType",
+ "prefix",
+ "localName",
+ "namespaceURI"
+];
+
+//////////// global constants ////////////////////
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", ColumnsDialog_initialize, false);
+window.addEventListener("unload", ColumnsDialog_destroy, false);
+
+function ColumnsDialog_initialize()
+{
+ dialog = new ColumnsDialog();
+ dialog.initialize();
+}
+
+function ColumnsDialog_destroy()
+{
+ dialog.destroy();
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class ColumnsDialog
+
+function ColumnsDialog()
+{
+ this.mViewer = window.arguments[0];
+ this.mColBoxHash = {};
+}
+
+ColumnsDialog.prototype =
+{
+ mBox: null,
+ mDraggingBox: null,
+
+ get box() { return this.mBox },
+
+ initialize: function()
+ {
+ // bug 56270 - dragSession.sourceDocument is null --
+ // causes me to code this very temporary, very nasty hack
+ // to make sure I get notified when a column is dropped
+ opener.viewer.mDOMTree.onClientDrop = ColumnsDialogDragDropOut;
+
+ this.buildContents();
+
+ // notify the dom viewer that we've opened
+ this.mViewer.onColumnsDialogReady(this);
+ },
+
+ destroy: function()
+ {
+ // notify the dom viewer that we're going away
+ this.mViewer.onColumnsDialogClose(this);
+ },
+
+ buildContents: function()
+ {
+ var box = document.getElementById("bxColumns");
+ this.mBox = box;
+
+ // create the special attribute box
+ var item = this.createAttrItem();
+ box.appendChild(item);
+
+ // add all boxes except those that are already
+ // in the viewer
+ for (var i = 0; i < gColumnTitles.length; ++i)
+ if (!this.mViewer.hasColumn(gColumnTitles[i])) {
+ this.addItem(gColumnTitles[i]);
+ }
+ },
+
+ addItem: function(aValue)
+ {
+ if (!aValue || aValue.charAt(0) == "@")
+ return null;
+
+ item = this.createItem(aValue);
+ this.mColBoxHash[aValue] = item;
+ if (item) {
+ this.mBox.appendChild(item);
+ window.sizeToContent();
+ }
+ },
+
+ removeItem: function(aValue)
+ {
+ if (!aValue || aValue.charAt(0) == "@")
+ return null;
+
+ var colBox = this.mColBoxHash[aValue];
+ if (!colBox._isAttrCol) {
+ this.mBox.removeChild(colBox);
+ window.sizeToContent();
+ }
+ },
+
+ createItem: function(aValue)
+ {
+ var text = document.createElementNS(kXULNSURI, "text");
+ text._ColValue = aValue;
+ text._isColBox = true;
+ text._isAttrCol = false;
+ text.setAttribute("class", "column-selector");
+ text.setAttribute("value", aValue);
+
+ return text;
+ },
+
+ createAttrItem: function(aValue)
+ {
+ var box = document.createElementNS(kXULNSURI, "box");
+ box._isColBox = true;
+ box._isAttrCol = true;
+ box.setAttribute("class", "column-selector");
+ box.setAttribute("autostretch", "never");
+
+ var text = document.createElementNS(kXULNSURI, "text");
+ text.setAttribute("value", "Attr");
+ box.appendChild(text);
+
+ var txf = document.createElementNS(kXULNSURI, "textfield");
+ txf.setAttribute("class", "attr-column-selector");
+ txf.setAttribute("flex", 1);
+ box.appendChild(txf);
+
+ return box;
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Drag and Drop
+
+ onDragGesture: function(aEvent)
+ {
+ var box = this.getBoxTarget(aEvent.target);
+ this.setDraggingBox(box);
+ if (!box) return false;
+
+ var column = this.getColumnValue(box);
+ if (!column) return false;
+
+ DNDUtils.invokeSession(aEvent.target, ["TreeTableBuilder/column-add"], [column]);
+
+ return false;
+ },
+
+ onDragDropOut: function()
+ {
+ var box = document.getElementById("bxColumns");
+ var value = this.mDraggingBox._ColValue;
+ this.setDraggingBox(null);
+ this.removeItem(value);
+ },
+
+ onDragDropIn: function(aEvent)
+ {
+ var data = DNDUtils.getData("TreeTableBuilder/column-remove", 0);
+ var string = XPCU.QI(data, "nsISupportsWString");
+ this.addItem(string.data);
+ },
+
+ setDraggingBox: function(aBox)
+ {
+ if (this.mDraggingBox) {
+ this.mDraggingBox.setAttribute("col-dragging", "false");
+ }
+
+ this.mDraggingBox = aBox;
+
+ if (aBox)
+ aBox.setAttribute("col-dragging", "true");
+ },
+
+ getBoxTarget: function(aNode)
+ {
+ var node = aNode;
+ while (node && !node._isColBox)
+ node = node.parentNode;
+ return node;
+ },
+
+ getColumnValue: function(aColBox)
+ {
+ if (aColBox._isAttrCol) {
+ var txf = aColBox.getElementsByTagName("textfield")[0];
+ return "@" + txf.value;
+ } else {
+ return aColBox._ColValue;
+ }
+ }
+
+};
+
+function ColumnsDialogDragDropOut()
+{
+ dialog.onDragDropOut();
+}
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/columnsDialog.xul b/mozilla/extensions/inspector/resources/content/viewers/dom/columnsDialog.xul
new file mode 100644
index 00000000000..369afad6e40
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/columnsDialog.xul
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/commandOverlay.xul b/mozilla/extensions/inspector/resources/content/viewers/dom/commandOverlay.xul
new file mode 100644
index 00000000000..81d04a9dc41
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/commandOverlay.xul
@@ -0,0 +1,30 @@
+
+
+ %dtd1;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/dom.js b/mozilla/extensions/inspector/resources/content/viewers/dom/dom.js
new file mode 100644
index 00000000000..88119e1e4cd
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/dom.js
@@ -0,0 +1,355 @@
+/***************************************************************
+* DOMViewer --------------------------------------------
+* Views all nodes within a document.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/util.js
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/jsutil/rdf/RDFU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+var gColumnExtras = {
+ "Anonymous": "Anonymous",
+ "NodeType": "NodeType"
+};
+
+var gColumnAttrs = {
+ "class": "triDOMView"
+};
+
+//////////// global constants ////////////////////
+
+var kDOMDataSourceIID = "@mozilla.org/rdf/datasource;1?name=Inspector_DOM";
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", DOMViewer_initialize, false);
+
+function DOMViewer_initialize()
+{
+ viewer = new DOMViewer();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class DOMViewer
+
+function DOMViewer() // implements inIViewer
+{
+ this.mDialogs = [];
+
+ this.mDOMTree = document.getElementById("trDOMTree");
+
+ // prepare and attach the DOM DataSource
+ this.mDOMDS = XPCU.createInstance(kDOMDataSourceIID, "nsIInsDOMDataSource");
+ this.mDOMDS.removeFilterByType(2); // hide attribute nodes
+ this.mDOMTree.database.AddDataSource(this.mDOMDS);
+}
+
+DOMViewer.prototype =
+{
+ mViewee: null,
+ mDOMDS: null,
+ // searching stuff
+ mSearchResults: null,
+ mSearchCurrentIdx: null,
+ mSearchDirection: null,
+ mColumns: null,
+ mDialogs: null,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ //// attributes
+
+ get uid() { return "dom" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject) {
+ this.mViewee = aObject;
+ this.mDOMDS.document = aObject;
+ try {
+ this.mTreeBuilder.buildContent();
+ } catch (ex) {
+ debug("ERROR: While rebuilding dom tree\n" + ex);
+ }
+ },
+
+ //// methods
+
+ initialize: function(aPane)
+ {
+ this.initColumns();
+
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+
+ this.toggleAnonContent(true, false);
+ },
+
+ destroy: function()
+ {
+ for (var i = 0; i < this.mDialogs.length; ++i) {
+ this.mDialogs[i].close();
+ this.mDialogs[i] = null;
+ }
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// UI Commands
+
+ showFindDialog: function()
+ {
+ var win = openDialog("chrome://inspector/content/viewers/dom/findDialog.xul", "_blank", "chrome", "id", this);
+ this.mDialogs.push(win);
+ },
+
+ findNext: function()
+ {
+ if (this.mSearchResults) {
+ this.mSearchCurrentIdx++;
+ if (this.mSearchCurrentIdx >= this.mSearchResults.length)
+ this.mSearchCurrentIdx = 0;
+
+ this.selectElementInTree(this.mSearchResults[this.mSearchCurrentIdx]);
+ }
+ },
+
+ toggleAnonContent: function(aExplicit, aValue)
+ {
+ var val = aExplicit ? aValue : !this.mDOMDS.showAnonymousContent;
+ this.mDOMDS.showAnonymousContent = val;
+ this.mPane.setCommandAttribute("cmd:toggleAnon", "checked", val ? "true" : "false");
+ },
+
+ showColumnsDialog: function()
+ {
+ var win = openDialog("chrome://inspector/content/viewers/dom/columnsDialog.xul",
+ "_blank", "chrome,dependent", this);
+ this.mDialogs.push(win);
+ },
+
+ selectByClick: function()
+ {
+ // wait until after user releases the mouse after selecting this command from a UI element
+ window.setTimeout("viewer.startSelectByClick()", 10);
+ },
+
+ startSelectByClick: function()
+ {
+ var doc = this.mDOMDS.document;
+ doc.addEventListener("mousedown", gClickListener, true);
+ },
+
+ doSelectByClick: function(aTarget)
+ {
+ var doc = this.mDOMDS.document;
+ doc.removeEventListener("mousedown", gClickListener, true);
+ this.selectElementInTree(aTarget);
+ },
+
+ onTreeItemSelected: function()
+ {
+ var item = this.mDOMTree.selectedItems[0];
+ this.mPane.onVieweeChanged(this.getNodeFromTreeItem(item));
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Searching Methods
+
+ doFindElementById: function(aValue)
+ {
+ var el = this.mDOMDS.document.getElementById(aValue);
+ if (el) {
+ this.selectElementInTree(el);
+ } else {
+ alert("No elements were found.");
+ }
+ },
+
+ doFindElementsByTagName: function(aValue)
+ {
+ var els = this.mDOMDS.document.getElementsByTagName(aValue);
+ if (els.length == 0) {
+ alert("No elements were found.");
+ } else {
+ this.mSearchResults = els;
+ this.mSearchCurrentIdx = 0;
+ this.selectElementInTree(els[0]);
+ }
+ },
+
+ doFindElementsByAttr: function(aAttr, aValue)
+ {
+ var els = this.mDOMDS.document.getElementsByAttribute(aAttr, aValue);
+ if (els.length == 0) {
+ alert("No elements were found.");
+ } else {
+ this.mSearchResults = els;
+ this.mSearchCurrentIdx = 0;
+ this.selectElementInTree(els[0]);
+ }
+ },
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Takes an element from the document being inspected, finds the treeitem
+ // which represents it in the DOM tree and selects that treeitem.
+ //
+ // @param aEl - element from the document being inspected
+ ///////////////////////////////////////////////////////////////////////////
+
+ selectElementInTree: function(aEl)
+ {
+ var searching = true;
+ var parent = aEl;
+ var line = [];
+ var res, item;
+
+ // Keep searching until a pre-created ancestor is
+ // found, and then open each ancestor until
+ // the found element is created
+ while (searching && parent) {
+ res = this.mDOMDS.getResourceForObject(parent);
+ item = document.getElementById(res.Value);
+ line.push(parent);
+ if (!item) {
+ parent = parent.parentNode;
+ } else {
+ // we've got all the ancestors, now open them
+ // one-by-one from the top on down
+ for (var i = line.length-1; i >= 0; i--) {
+ res = this.mDOMDS.getResourceForObject(line[i]);
+ item = document.getElementById(res.Value);
+ if (!item) return false; // can't find item, so stop trying to descend
+ item.setAttribute("open", "true");
+ }
+ searching = false;
+ this.mDOMTree.selectItem(item);
+ }
+ }
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Columns
+
+ initColumns: function()
+ {
+ var colPref = PrefUtils.getPref("inspector.dom.columns");
+ var cols = colPref.split(",")
+ this.mColumns = cols;
+ this.mColumnHash = {};
+
+ var tb = new inTreeTableBuilder(this.mDOMTree, kInspectorNSURI, "Child");
+ tb.allowDragColumns = true;
+ tb.isRefContainer = false;
+ tb.isContainer = true;
+ tb.itemAttributes = gColumnAttrs;
+ tb.itemFields = gColumnExtras;
+ this.mTreeBuilder = tb;
+
+ tb.initialize();
+
+ for (var i = 0; i < cols.length; i++) {
+ this.mColumnHash[cols[i]] = true;
+ tb.addColumn({
+ name: cols[i],
+ title: cols[i],
+ flex: i == 0 ? 2 : 1,
+ className: "triDOMView"});
+ }
+
+ // start listening for modifications to columns
+ // from drag and drop operations
+ tb.onColumnAdd = gColumnAddListener;
+ tb.onColumnRemove = gColumnRemoveListener;
+
+ tb.build();
+ },
+
+ hasColumn: function(aName)
+ {
+ return this.mColumnHash[aName] == true;
+ },
+
+ //// these add/remove methods depend on names that have already
+ //// been added to the tree builder
+
+ doAddColumn: function(aIndex)
+ {
+ var name = this.mTreeBuilder.getColumnName(aIndex);
+ this.mColumnHash[name] = true;
+ this.mColumns.splice(aIndex, 0, name);
+ this.saveColumns();
+ },
+
+ doRemoveColumn: function(aIndex)
+ {
+ var name = this.mColumns[aIndex];
+ this.mColumnHash[name] = null;
+ this.mColumns.splice(aIndex, 1);
+ this.saveColumns();
+ },
+
+ onColumnAdd: function(aIndex)
+ {
+ this.doAddColumn(aIndex);
+ },
+
+ onColumnRemove: function(aIndex)
+ {
+ this.doRemoveColumn(aIndex);
+ },
+
+ saveColumns: function()
+ {
+ var cols = this.mColumns.join(",");
+ PrefUtils.setPref("inspector.dom.columns", cols);
+ },
+
+ onColumnsDialogReady: function (aDialog)
+ {
+ this.mColumnsDialog = aDialog;
+ this.mTreeBuilder.addColumnDropTarget(aDialog.box);
+ },
+
+ onColumnsDialogClose: function (aDialog)
+ {
+ this.mColumnsDialog = null;
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Uncategorized
+
+ getNodeFromTreeItem: function(aItem)
+ {
+ var res = gRDF.GetResource(aItem.id);
+ res = res.QueryInterface(Components.interfaces.nsIDOMDSResource);
+ return res ? res.object : null;
+ }
+
+};
+
+////////////////////////////////////////////////////////////////////////////
+//// Listener Objects
+
+function gClickListener(aEvent)
+{
+ viewer.doSelectByClick(aEvent.target);
+}
+
+function gColumnAddListener(aIndex)
+{
+ viewer.onColumnAdd(aIndex);
+}
+
+function gColumnRemoveListener(aIndex)
+{
+ viewer.onColumnRemove(aIndex);
+}
+
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/dom.xul b/mozilla/extensions/inspector/resources/content/viewers/dom/dom.xul
new file mode 100644
index 00000000000..b2f9e4bcbc5
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/dom.xul
@@ -0,0 +1,37 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/findDialog.xul b/mozilla/extensions/inspector/resources/content/viewers/dom/findDialog.xul
new file mode 100644
index 00000000000..956136fa474
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/findDialog.xul
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/keysetOverlay.xul b/mozilla/extensions/inspector/resources/content/viewers/dom/keysetOverlay.xul
new file mode 100644
index 00000000000..d734916592c
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/keysetOverlay.xul
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/dom/popupOverlay.xul b/mozilla/extensions/inspector/resources/content/viewers/dom/popupOverlay.xul
new file mode 100644
index 00000000000..fd01a7e6e6a
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/dom/popupOverlay.xul
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/jsObject/jsObject.js b/mozilla/extensions/inspector/resources/content/viewers/jsObject/jsObject.js
new file mode 100644
index 00000000000..67583df49e8
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/jsObject/jsObject.js
@@ -0,0 +1,63 @@
+/***************************************************************
+* JSObjectViewer --------------------------------------------
+* The viewer for all facets of a javascript object.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+//////////// global constants ////////////////////
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", JSObjectViewer_initialize, false);
+
+function JSObjectViewer_initialize()
+{
+ viewer = new JSObjectViewer();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class JSObjectViewer
+
+function JSObjectViewer()
+{
+ this.mURL = window.location;
+}
+
+JSObjectViewer.prototype =
+{
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mViewee: null,
+ mPane: null,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ get uid() { return "computedStyle" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject)
+ {
+ },
+
+ initialize: function(aPane)
+ {
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+ },
+
+ destroy: function()
+ {
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/jsObject/jsObject.xul b/mozilla/extensions/inspector/resources/content/viewers/jsObject/jsObject.xul
new file mode 100644
index 00000000000..8687aef2309
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/jsObject/jsObject.xul
@@ -0,0 +1,22 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/nodeElement/nodeElement.js b/mozilla/extensions/inspector/resources/content/viewers/nodeElement/nodeElement.js
new file mode 100644
index 00000000000..25ab3fc3e69
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/nodeElement/nodeElement.js
@@ -0,0 +1,151 @@
+/***************************************************************
+* NodeElementViewer --------------------------------------------
+* The default viewer for DOM Nodes
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/util.js
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/jsutil/rdf/RDFU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+//////////// global constants ////////////////////
+
+var kDOMDataSourceIID = "@mozilla.org/rdf/datasource;1?name=Inspector_DOM";
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", NodeElementViewer_initialize, false);
+
+function NodeElementViewer_initialize()
+{
+ viewer = new NodeElementViewer();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class NodeElementViewer
+
+function NodeElementViewer() // implements inIViewer
+{
+ this.mURL = window.location;
+ this.mAttrTree = document.getElementById("trAttributes");
+
+ var ds = XPCU.createInstance(kDOMDataSourceIID, "nsIInsDOMDataSource");
+ this.mDS = ds;
+ ds.addFilterByType(2, true);
+ this.mAttrTree.database.AddDataSource(ds);
+}
+
+NodeElementViewer.prototype =
+{
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mDS: null,
+ mViewee: null,
+ mPane: null,
+
+ get selectedAttribute() { return this.mAttrTree.selectedItems[0] },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ //// attributes
+
+ get uid() { return "nodeElement" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject)
+ {
+ if (aObject.ownerDocument != this.mDS.document)
+ this.mDS.document = aObject.ownerDocument;
+ this.mViewee = aObject;
+ this.setTextValue("nodeName", aObject.nodeName);
+ this.setTextValue("nodeType", aObject.nodeType);
+ this.setTextValue("nodeValue", aObject.nodeValue);
+ this.setTextValue("namespace", aObject.namespaceURI);
+
+ var res = this.mDS.getResourceForObject(aObject);
+ try {
+ this.mAttrTree.setAttribute("ref", res.Value);
+ } catch (ex) {
+ debug("ERROR: While rebuilding attribute tree\n" + ex);
+ }
+ },
+
+ // methods
+
+ initialize: function(aPane)
+ {
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+ },
+
+ destroy: function()
+ {
+ this.mAttrTree.database.RemoveDataSource(this.mDS);
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// UI Commands
+
+ cmdNewAttribute: function()
+ {
+ var name = prompt("Enter the attribute name:", "");
+ if (name) {
+ var attr = this.mViewee.getAttributeNode(name);
+ if (!attr)
+ this.mViewee.setAttribute(name, "");
+ var res = this.mDS.getResourceForObject(attr);
+ var kids = this.mAttrTree.getElementsByTagName("treechildren")[1];
+ var item = kids.childNodes[kids.childNodes.length-1];
+ if (item) {
+ var cell = item.getElementsByAttribute("ins-type", "value")[0];
+ this.mAttrTree.selectItem(item);
+ this.mAttrTree.startEdit(cell);
+ }
+ }
+ },
+
+ cmdEditSelectedAttribute: function()
+ {
+ var item = this.mAttrTree.selectedItems[0];
+ var cell = item.getElementsByAttribute("ins-type", "value")[0];
+ this.mAttrTree.startEdit(cell);
+ },
+
+ cmdDeleteSelectedAttribute: function()
+ {
+ var item = this.selectedAttribute;
+ if (item) {
+ var attrname = InsUtil.getDSProperty(this.mDS, item.id, "nodeName");
+ this.mViewee.removeAttribute(attrname);
+ }
+ },
+
+ cmdSetSelectedAttributeValue: function(aItem, aValue)
+ {
+ if (aItem) {
+ var attrname = InsUtil.getDSProperty(this.mDS, aItem.id, "nodeName");
+ this.mViewee.setAttribute(attrname, aValue);
+ }
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Uncategorized
+
+ setTextValue: function(aName, aText)
+ {
+ var field = document.getElementById("tx_"+aName);
+ if (field) {
+ field.setAttribute("value", aText);
+ }
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/nodeElement/nodeElement.xul b/mozilla/extensions/inspector/resources/content/viewers/nodeElement/nodeElement.xul
new file mode 100644
index 00000000000..5121586c27f
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/nodeElement/nodeElement.xul
@@ -0,0 +1,110 @@
+
+
+ %dtd1;
+ %dtd2;
+ %dtd3;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/nodeText/nodeText.js b/mozilla/extensions/inspector/resources/content/viewers/nodeText/nodeText.js
new file mode 100644
index 00000000000..7875bab3434
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/nodeText/nodeText.js
@@ -0,0 +1,75 @@
+/***************************************************************
+* NodeTextViewer --------------------------------------------
+* The viewer for text nodes.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+//////////// global constants ////////////////////
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", NodeTextViewer_initialize, false);
+
+function NodeTextViewer_initialize()
+{
+ viewer = new NodeTextViewer();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class NodeTextViewer
+
+function NodeTextViewer()
+{
+ this.mURL = window.location;
+}
+
+NodeTextViewer.prototype =
+{
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mViewee: null,
+ mPane: null,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ get uid() { return "nodeText" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject)
+ {
+ this.mViewee = aObject;
+ this.setTextValue("NodeValue", aObject.nodeValue);
+ },
+
+ initialize: function(aPane)
+ {
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+ },
+
+ destroy: function()
+ {
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Uncategorized
+
+ setTextValue: function(aName, aText)
+ {
+ var field = document.getElementById("tx"+aName);
+ if (field) {
+ field.setAttribute("value", aText);
+ }
+ }
+
+};
diff --git a/mozilla/extensions/inspector/resources/content/viewers/nodeText/nodeText.xul b/mozilla/extensions/inspector/resources/content/viewers/nodeText/nodeText.xul
new file mode 100644
index 00000000000..123f9ed4536
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/nodeText/nodeText.xul
@@ -0,0 +1,20 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/styleRules/commandOverlay.xul b/mozilla/extensions/inspector/resources/content/viewers/styleRules/commandOverlay.xul
new file mode 100644
index 00000000000..48c9c9e3719
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/styleRules/commandOverlay.xul
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/styleRules/keysetOverlay.xul b/mozilla/extensions/inspector/resources/content/viewers/styleRules/keysetOverlay.xul
new file mode 100644
index 00000000000..d734916592c
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/styleRules/keysetOverlay.xul
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/styleRules/popupOverlay.xul b/mozilla/extensions/inspector/resources/content/viewers/styleRules/popupOverlay.xul
new file mode 100644
index 00000000000..8ecc343874a
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/styleRules/popupOverlay.xul
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/styleRules/styleRules.js b/mozilla/extensions/inspector/resources/content/viewers/styleRules/styleRules.js
new file mode 100644
index 00000000000..7307333dc21
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/styleRules/styleRules.js
@@ -0,0 +1,212 @@
+/***************************************************************
+* StyleRulesViewer --------------------------------------------
+* The viewer for CSS style rules that apply to a DOM element.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/util.js
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+* chrome://inspector/content/jsutil/rdf/RDFU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+//////////// global constants ////////////////////
+
+var kCSSRuleDataSourceIID = "@mozilla.org/rdf/datasource;1?name=Inspector_CSSRules";
+var kCSSDecDataSourceIID = "@mozilla.org/rdf/datasource;1?name=Inspector_CSSDec";
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", StyleRulesViewer_initialize, false);
+
+function StyleRulesViewer_initialize()
+{
+ viewer = new StyleRulesViewer();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class StyleRulesViewer
+
+function StyleRulesViewer() // implements inIViewer
+{
+ this.mURL = window.location;
+ this.mRuleTree = document.getElementById("trStyleRules");
+ this.mDecTree = document.getElementById("trStyleDec");
+
+ // create the rules datasource
+ var ds = XPCU.createInstance(kCSSRuleDataSourceIID, "nsICSSRuleDataSource");
+ this.mRuleDS = ds;
+ this.mRuleTree.database.AddDataSource(ds);
+
+ // create the declaration datasource
+ var ds = XPCU.createInstance(kCSSDecDataSourceIID, "nsICSSDecDataSource");
+ this.mDecDS = ds;
+ this.mDecTree.database.AddDataSource(ds);
+}
+
+StyleRulesViewer.prototype =
+{
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mRuleDS: null,
+ mDecDS: null,
+ mViewee: null,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ get uid() { return "styleRules" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject)
+ {
+ this.mViewee = aObject;
+ this.mRuleDS.element = aObject;
+ this.mRuleTree.builder.rebuild();
+ },
+
+ initialize: function(aPane)
+ {
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+ },
+
+ destroy: function()
+ {
+ this.mRuleTree.database.RemoveDataSource(this.mRuleDS);
+ this.mRuleDS = null;
+
+ this.mDecTree.database.RemoveDataSource(this.mDecDS);
+ this.mDecDS = null;
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// UI Commands
+
+ //////// rule contextual commands
+
+ cmdNewRule: function()
+ {
+ },
+
+ cmdToggleSelectedRule: function()
+ {
+ },
+
+ cmdDeleteSelectedRule: function()
+ {
+ },
+
+ cmdOpenSelectedFileInEditor: function()
+ {
+ var item = this.mRuleTree.selectedItems[0];
+ if (item)
+ {
+ var path = null;
+
+ var url = InsUtil.getDSProperty(this.mRuleDS, item.id, "FileURL");
+ if (url.substr(0, 6) == "chrome") {
+ // This is a tricky situation. Finding the source of a chrome file means knowing where
+ // your build tree is located, and where in the tree the file came from. Since files
+ // from the build tree get copied into chrome:// from unpredictable places, the best way
+ // to find them is manually.
+ //
+ // Solution to implement: Have the user pick the file location the first time it is opened.
+ // After that, keep the result in some sort of registry to look up next time it is opened.
+ // Allow this registry to be edited via preferences.
+ } else if (url.substr(0, 4) == "file") {
+ path = url;
+ }
+
+ if (path) {
+ try {
+ var exe = XPCU.createInstance("@mozilla.org/file/local;1", "nsILocalFile");
+ exe.initWithPath("c:\\windows\\notepad.exe");
+ exe = exe.nsIFile;
+ exe.spawn([url], 1);
+ } catch (ex) {
+ alert("Unable to open editor.");
+ }
+ }
+ }
+ },
+
+ //////// property contextual commands
+
+ cmdNewProperty: function()
+ {
+ var propname = prompt("Enter the property name:", "");
+ var propval = prompt("Enter the property value:", "");
+ if (propname && propval){
+ this.mDecDS.setCSSProperty(propname, propval, "");
+ this.mDecTree.builder.rebuild();
+ }
+ },
+
+ cmdEditSelectedProperty: function()
+ {
+ var item = this.mDecTree.selectedItems[0];
+ var cell = item.getElementsByAttribute("ins-type", "value")[0];
+ this.mDecTree.startEdit(cell);
+ },
+
+ cmdDeleteSelectedProperty: function()
+ {
+ var propname = this.getSelectedPropertyValue("PropertyName");
+ this.mDecDS.removeCSSProperty(propname);
+ this.mDecTree.builder.rebuild();
+ },
+
+ cmdSetSelectedPropertyValue: function(aItem, aNewValue)
+ {
+ // XXX can't depend on selection, use the item object passed into function instead
+ var propname = this.getSelectedPropertyValue("PropertyName");
+ var priority = this.getSelectedPropertyValue("PropertyPriority");
+ this.mDecDS.setCSSProperty(propname, aNewValue, priority);
+ },
+
+ cmdToggleSelectedImportant: function()
+ {
+ var priority = this.getSelectedPropertyValue("PropertyPriority");
+ priority = priority == "!important" ? "!blah" : "!important";
+ var propname = this.getSelectedPropertyValue("PropertyName");
+ var propval = this.getSelectedPropertyValue("PropertyValue");
+
+ // sadly, we must remove it first or it don't work
+ this.mDecDS.removeCSSProperty(propname);
+ this.mDecDS.setCSSProperty(propname, propval, priority);
+ this.mDecTree.builder.rebuild();
+ },
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// Uncategorized
+
+ getSelectedPropertyValue: function(aProperty)
+ {
+ var item = this.mDecTree.selectedItems[0];
+ return InsUtil.getDSProperty(this.mDecDS, item.id, aProperty);
+ },
+
+ onCreateRulePopup: function()
+ {
+ },
+
+ onRuleSelect: function()
+ {
+ var tree = this.mRuleTree;
+ var item = tree.selectedItems[0];
+
+ var res = gRDF.GetResource(item.id);
+ this.mDecDS.refResource = res;
+ tree = this.mDecTree;
+ tree.builder.rebuild();
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/styleRules/styleRules.xul b/mozilla/extensions/inspector/resources/content/viewers/styleRules/styleRules.xul
new file mode 100644
index 00000000000..4baa379c3a0
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/styleRules/styleRules.xul
@@ -0,0 +1,160 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/stylesheets/stylesheets.js b/mozilla/extensions/inspector/resources/content/viewers/stylesheets/stylesheets.js
new file mode 100644
index 00000000000..869dd025110
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/stylesheets/stylesheets.js
@@ -0,0 +1,63 @@
+/***************************************************************
+* StylesheetsViewer --------------------------------------------
+* The viewer for the stylesheets loaded by a document.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+//////////// global constants ////////////////////
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", StylesheetsViewer_initialize, false);
+
+function StylesheetsViewer_initialize()
+{
+ viewer = new StylesheetsViewer();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class StylesheetsViewer
+
+function StylesheetsViewer()
+{
+ this.mURL = window.location;
+}
+
+StylesheetsViewer.prototype =
+{
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mViewee: null,
+ mPane: null,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ get uid() { return "stylesheets" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject)
+ {
+ },
+
+ initialize: function(aPane)
+ {
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+ },
+
+ destroy: function()
+ {
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/stylesheets/stylesheets.xul b/mozilla/extensions/inspector/resources/content/viewers/stylesheets/stylesheets.xul
new file mode 100644
index 00000000000..723c79bd558
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/stylesheets/stylesheets.xul
@@ -0,0 +1,22 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/content/viewers/xblBindings/xblBindings.js b/mozilla/extensions/inspector/resources/content/viewers/xblBindings/xblBindings.js
new file mode 100644
index 00000000000..6c008783004
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/xblBindings/xblBindings.js
@@ -0,0 +1,63 @@
+/***************************************************************
+* XBLBindings --------------------------------------------
+* The viewer for the computed css styles on a DOM element.
+* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+* REQUIRED IMPORTS:
+* chrome://inspector/content/jsutil/xpcom/XPCU.js
+****************************************************************/
+
+//////////// global variables /////////////////////
+
+var viewer;
+
+//////////// global constants ////////////////////
+
+//////////////////////////////////////////////////
+
+window.addEventListener("load", XBLBindings_initialize, false);
+
+function XBLBindings_initialize()
+{
+ viewer = new XBLBindings();
+ viewer.initialize(parent.FrameExchange.receiveData(window));
+}
+
+////////////////////////////////////////////////////////////////////////////
+//// class XBLBindings
+
+function XBLBindings()
+{
+ this.mURL = window.location;
+}
+
+XBLBindings.prototype =
+{
+ ////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ mViewee: null,
+ mPane: null,
+
+ ////////////////////////////////////////////////////////////////////////////
+ //// interface inIViewer
+
+ get uid() { return "computedStyle" },
+ get pane() { return this.mPane },
+
+ get viewee() { return this.mViewee },
+ set viewee(aObject)
+ {
+ },
+
+ initialize: function(aPane)
+ {
+ this.mPane = aPane;
+ aPane.onViewerConstructed(this);
+ },
+
+ destroy: function()
+ {
+ }
+
+};
+
diff --git a/mozilla/extensions/inspector/resources/content/viewers/xblBindings/xblBindings.xul b/mozilla/extensions/inspector/resources/content/viewers/xblBindings/xblBindings.xul
new file mode 100644
index 00000000000..2d3ee87dced
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/content/viewers/xblBindings/xblBindings.xul
@@ -0,0 +1,22 @@
+
+
+ %dtd1;
+ %dtd2;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/locale/Makefile.in b/mozilla/extensions/inspector/resources/locale/Makefile.in
new file mode 100644
index 00000000000..7629e7d8eaf
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/Makefile.in
@@ -0,0 +1,32 @@
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+DEPTH=../../../..
+topsrcdir=@top_srcdir@
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DIRS= en-US
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/Makefile.in b/mozilla/extensions/inspector/resources/locale/en-US/Makefile.in
new file mode 100644
index 00000000000..4936ab8c0ad
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/Makefile.in
@@ -0,0 +1,29 @@
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+DEPTH=../../../../..
+topsrcdir=@top_srcdir@
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/contents.rdf b/mozilla/extensions/inspector/resources/locale/en-US/contents.rdf
new file mode 100644
index 00000000000..e628cac7124
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/contents.rdf
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/inspector.dtd b/mozilla/extensions/inspector/resources/locale/en-US/inspector.dtd
new file mode 100644
index 00000000000..46211d007af
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/inspector.dtd
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/jar.mn b/mozilla/extensions/inspector/resources/locale/en-US/jar.mn
new file mode 100644
index 00000000000..95e8517f267
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/jar.mn
@@ -0,0 +1,11 @@
+inspector.jar:
+ locale/en-US/inspector/contents.rdf
+ locale/en-US/inspector/inspector.dtd
+ locale/en-US/inspector/tasksOverlay.dtd
+ locale/en-US/inspector/prefs.dtd
+ locale/en-US/inspector/search/findFiles.dtd (search/findFiles.dtd)
+ locale/en-US/inspector/search/junkImgs.dtd (search/junkImgs.dtd)
+ locale/en-US/inspector/viewers/dom.dtd (viewers/dom.dtd)
+ locale/en-US/inspector/viewers/nodeElement.dtd (viewers/nodeElement.dtd)
+ locale/en-US/inspector/viewers/styleRules.dtd (viewers/styleRules.dtd)
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/makefile.win b/mozilla/extensions/inspector/resources/locale/en-US/makefile.win
new file mode 100644
index 00000000000..772b5813a62
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/makefile.win
@@ -0,0 +1,24 @@
+#!nmake
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+DEPTH=..\..\..\..\..
+include <$(DEPTH)/config/config.mak>
+include <$(DEPTH)\config\rules.mak>
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/prefs.dtd b/mozilla/extensions/inspector/resources/locale/en-US/prefs.dtd
new file mode 100644
index 00000000000..fa5ef4cd1eb
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/prefs.dtd
@@ -0,0 +1,2 @@
+
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/search/findFiles.dtd b/mozilla/extensions/inspector/resources/locale/en-US/search/findFiles.dtd
new file mode 100644
index 00000000000..aa792075ab2
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/search/findFiles.dtd
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/search/junkImgs.dtd b/mozilla/extensions/inspector/resources/locale/en-US/search/junkImgs.dtd
new file mode 100644
index 00000000000..b53f19b82be
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/search/junkImgs.dtd
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/tasksOverlay.dtd b/mozilla/extensions/inspector/resources/locale/en-US/tasksOverlay.dtd
new file mode 100644
index 00000000000..931316b307e
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/tasksOverlay.dtd
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/viewers/dom.dtd b/mozilla/extensions/inspector/resources/locale/en-US/viewers/dom.dtd
new file mode 100644
index 00000000000..71b7bb3376a
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/viewers/dom.dtd
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/viewers/nodeElement.dtd b/mozilla/extensions/inspector/resources/locale/en-US/viewers/nodeElement.dtd
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/viewers/nodeElement.dtd
@@ -0,0 +1 @@
+
diff --git a/mozilla/extensions/inspector/resources/locale/en-US/viewers/styleRules.dtd b/mozilla/extensions/inspector/resources/locale/en-US/viewers/styleRules.dtd
new file mode 100644
index 00000000000..97161a4ff48
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/en-US/viewers/styleRules.dtd
@@ -0,0 +1,3 @@
+
+
+
diff --git a/mozilla/extensions/inspector/resources/locale/makefile.win b/mozilla/extensions/inspector/resources/locale/makefile.win
new file mode 100644
index 00000000000..0a458a0f5c6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/locale/makefile.win
@@ -0,0 +1,27 @@
+#!nmake
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+DEPTH=..\..\..\..
+include <$(DEPTH)/config/config.mak>
+
+DIRS = en-US
+
+include <$(DEPTH)\config\rules.mak>
diff --git a/mozilla/extensions/inspector/resources/skin/Makefile.in b/mozilla/extensions/inspector/resources/skin/Makefile.in
new file mode 100644
index 00000000000..290c93e05d9
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/Makefile.in
@@ -0,0 +1,32 @@
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+DEPTH=../../../..
+topsrcdir=@top_srcdir@
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DIRS=classic modern
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/mozilla/extensions/inspector/resources/skin/classic/ImageSearchItem.gif b/mozilla/extensions/inspector/resources/skin/classic/ImageSearchItem.gif
new file mode 100644
index 00000000000..f078b634b10
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/classic/ImageSearchItem.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/classic/Makefile.in b/mozilla/extensions/inspector/resources/skin/classic/Makefile.in
new file mode 100644
index 00000000000..589d64f06b8
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/Makefile.in
@@ -0,0 +1,30 @@
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+DEPTH=../../../../..
+topsrcdir=@top_srcdir@
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/mozilla/extensions/inspector/resources/skin/classic/contents.rdf b/mozilla/extensions/inspector/resources/skin/classic/contents.rdf
new file mode 100644
index 00000000000..dcaad6f3630
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/contents.rdf
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/skin/classic/iconImportant.gif b/mozilla/extensions/inspector/resources/skin/classic/iconImportant.gif
new file mode 100644
index 00000000000..b5d34635682
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/classic/iconImportant.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/classic/iconViewerList.gif b/mozilla/extensions/inspector/resources/skin/classic/iconViewerList.gif
new file mode 100644
index 00000000000..c7da37e67ad
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/classic/iconViewerList.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/classic/iconViewerMenu-dis.gif b/mozilla/extensions/inspector/resources/skin/classic/iconViewerMenu-dis.gif
new file mode 100644
index 00000000000..ca8e1133be7
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/classic/iconViewerMenu-dis.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/classic/iconViewerMenu.gif b/mozilla/extensions/inspector/resources/skin/classic/iconViewerMenu.gif
new file mode 100644
index 00000000000..85ad1d6238e
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/classic/iconViewerMenu.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/classic/inspector.css b/mozilla/extensions/inspector/resources/skin/classic/inspector.css
new file mode 100644
index 00000000000..564168dcf81
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/inspector.css
@@ -0,0 +1,12 @@
+
+@import url("chrome://communicator/skin");
+@import url("chrome://inspector/skin/viewerPane.css");
+
+@import url("chrome://inspector/content/inspector.css");
+@import url("chrome://inspector/content/extensions/titledSplitter.css");
+
+@namespace ins url("http://www.mozilla.org/inspector#");
+
+treecol {
+ width: 16px;
+}
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/skin/classic/inspectorWindow.css b/mozilla/extensions/inspector/resources/skin/classic/inspectorWindow.css
new file mode 100644
index 00000000000..9ab4064871f
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/inspectorWindow.css
@@ -0,0 +1,56 @@
+@import url("chrome://inspector/skin");
+
+#mlViewers {
+ min-width: 10em;
+ max-width: 10em;
+}
+
+.toolbar-header1 {
+ margin: 2px;
+ color: #000000;
+ font-size: 14px;
+ font-weight: bold;
+}
+
+#bxURLBar {
+ padding: 3px;
+}
+
+#bxURLBarContainer {
+ margin: 0px 3px 0px 3px;
+ border: 1px inset ThreeDFace;
+ padding: 0px 1px 0px 1px;
+ background-color: -moz-field;
+}
+
+#mbHistory.menubutton-icon {
+ border: 1px outset ThreeDFace;
+ background-color: ThreeDFace;
+ list-style-image: url("chrome://global/skin/scroll-down.gif");
+}
+
+.button-toolbar-3 {
+ margin: 0px !important;
+ border: 0px !important;
+}
+
+#imgURLBarIcon {
+ margin: 1px 1px 0px 1px;
+ list-style-image: url("chrome://communicator/skin/bookmarks/location.gif");
+}
+
+#bxSearch {
+ height: 150px;
+}
+
+#bxStatus {
+ border-top: 1px outset ThreeDFace;
+ padding: 2px;
+ min-width: 1px;
+ background-color: ThreeDFace;
+ font-size: smaller;
+}
+
+#txStatus {
+ margin-left: 5px;
+}
diff --git a/mozilla/extensions/inspector/resources/skin/classic/jar.mn b/mozilla/extensions/inspector/resources/skin/classic/jar.mn
new file mode 100644
index 00000000000..5172efc9eb9
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/jar.mn
@@ -0,0 +1,19 @@
+inspector.jar:
+ skin/classic/inspector/contents.rdf
+ skin/classic/inspector/inspector.css
+ skin/classic/inspector/inspectorWindow.css
+ skin/classic/inspector/viewerPane.css
+ skin/classic/inspector/treeEditable.css
+ skin/classic/inspector/titledSplitter.css
+ skin/classic/inspector/iconImportant.gif
+ skin/classic/inspector/iconViewerList.gif
+ skin/classic/inspector/iconViewerMenu.gif
+ skin/classic/inspector/iconViewerMenu-dis.gif
+ skin/classic/inspector/titledsplitter-close.gif
+ skin/classic/inspector/ImageSearchItem.gif
+ skin/classic/inspector/viewers/dom/dom.css (viewers/dom/dom.css)
+ skin/classic/inspector/viewers/dom/findDialog.css (viewers/dom/findDialog.css)
+ skin/classic/inspector/viewers/dom/columnsDialog.css (viewers/dom/columnsDialog.css)
+ skin/classic/inspector/viewers/nodeElement/nodeElement.css (viewers/nodeElement/nodeElement.css)
+ skin/classic/inspector/viewers/nodeText/nodeText.css (viewers/nodeText/nodeText.css)
+ skin/classic/inspector/viewers/styleRules/styleRules.css (viewers/styleRules/styleRules.css)
diff --git a/mozilla/extensions/inspector/resources/skin/classic/makefile.win b/mozilla/extensions/inspector/resources/skin/classic/makefile.win
new file mode 100644
index 00000000000..81098eb1896
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/makefile.win
@@ -0,0 +1,25 @@
+#!nmake
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+DEPTH=..\..\..\..\..
+include <$(DEPTH)/config/config.mak>
+
+include <$(DEPTH)\config\rules.mak>
diff --git a/mozilla/extensions/inspector/resources/skin/classic/titledSplitter.css b/mozilla/extensions/inspector/resources/skin/classic/titledSplitter.css
new file mode 100644
index 00000000000..50cccf70ce1
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/titledSplitter.css
@@ -0,0 +1,44 @@
+
+.titled-splitter {
+ border-top: 1px outset InactiveCaption;
+ border-bottom: 1px outset InactiveCaption;
+ background-color: InactiveCaption;
+ color: InactiveCaptionText;
+ cursor: default;
+}
+
+box[orient="vertical"] > .titled-splitter {
+ cursor: default;
+}
+
+.titledsplitter-container {
+ padding-bottom: 2px;
+}
+
+.titledsplitter-dragbar {
+ min-height: 2px;
+ cursor: n-resize !important;
+}
+
+.titledsplitter-titlebox {
+ padding: 0px 5px 0px 5px;
+}
+
+.titledsplitter-text {
+ font-weight: bold;
+}
+
+.titledsplitter-closebutton {
+ margin: 1px;
+ border: 1px outset ThreeDFace;
+ padding: 1px;
+ min-width: 14px;
+ min-height: 14px;
+ background: ThreeDFace url("chrome://inspector/skin/titledsplitter-close.gif") no-repeat center center;
+}
+
+.titledsplitter-closebutton:hover:active {
+ border-style: inset;
+}
+
+
diff --git a/mozilla/extensions/inspector/resources/skin/classic/titledsplitter-close.gif b/mozilla/extensions/inspector/resources/skin/classic/titledsplitter-close.gif
new file mode 100644
index 00000000000..a53eddd0591
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/classic/titledsplitter-close.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/classic/treeEditable.css b/mozilla/extensions/inspector/resources/skin/classic/treeEditable.css
new file mode 100644
index 00000000000..fe8dc4c8e1d
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/treeEditable.css
@@ -0,0 +1,13 @@
+.treecell-editor,
+.treecell-editor > box {
+ margin: 0px !important;
+ padding: 0px !important;
+}
+
+.treecell-editor {
+ border: 0px !important;
+}
+
+.treecell-editor {
+ border: 1px solid black;
+}
diff --git a/mozilla/extensions/inspector/resources/skin/classic/viewerPane.css b/mozilla/extensions/inspector/resources/skin/classic/viewerPane.css
new file mode 100644
index 00000000000..69652c6a214
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/viewerPane.css
@@ -0,0 +1,22 @@
+
+.viewer-pane-header {
+ padding: 2px;
+}
+
+.viewer-list {
+ margin: 0px 4px 0px 4px;
+ border: 1px outset threedface;
+ padding: 3px;
+ list-style-image: url("chrome://inspector/skin/iconViewerList.gif");
+}
+
+.viewer-menu {
+ margin: 0px 4px 0px 4px;
+ border: 1px outset threedface;
+ padding: 3px;
+ list-style-image: url("chrome://inspector/skin/iconViewerMenu.gif");
+}
+
+.viewer-menu[disabled="true"] {
+ list-style-image: url("chrome://inspector/skin/iconViewerMenu-dis.gif");
+}
diff --git a/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/columnsDialog.css b/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/columnsDialog.css
new file mode 100644
index 00000000000..0c2edc9dbb0
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/columnsDialog.css
@@ -0,0 +1,23 @@
+
+@import url("chrome://inspector/skin");
+
+#trColumns {
+ background-color: ThreeDFace;
+}
+
+.column-selector {
+ border: 1px outset ThreeDFace;
+ padding: 2px;
+ background-color: ThreeDFace;
+ vertical-align: middle;
+}
+
+.attr-column-selector,
+.attr-column-selector[focused="true"] {
+ margin: none;
+ border: none;
+}
+
+[col-dragging="true"] {
+ border: 1px solid ButtonText;
+}
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/dom.css b/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/dom.css
new file mode 100644
index 00000000000..89b9ec97f24
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/dom.css
@@ -0,0 +1,38 @@
+
+@import url("chrome://inspector/skin");
+
+/* :::::::: node type color coding :::::::: */
+
+treeitem {
+ color: #000000;
+}
+
+treeitem[NodeType="1"] {
+ color: #000000;
+}
+
+treeitem[NodeType="3"] {
+ color: #0000AA;
+}
+
+treeitem[NodeType="8"] {
+ color: #88ff00;
+}
+
+treeitem[NodeType="9"] {
+ color: #ff00ff;
+}
+
+treeitem[Anonymous="true"] {
+ color: #ff0000;
+}
+
+/* :::::::: drag and drop insertion indicators :::::::: */
+
+treecol[dnd-insert-before="true"] {
+ border-left: 2px solid ButtonText;
+}
+
+treecol[dnd-insert-after="true"] {
+ border-right: 2px solid ButtonText;
+}
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/findDialog.css b/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/findDialog.css
new file mode 100644
index 00000000000..5f0a4563ea6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/viewers/dom/findDialog.css
@@ -0,0 +1,2 @@
+
+@import url("chrome://inspector/skin");
diff --git a/mozilla/extensions/inspector/resources/skin/classic/viewers/nodeElement/nodeElement.css b/mozilla/extensions/inspector/resources/skin/classic/viewers/nodeElement/nodeElement.css
new file mode 100644
index 00000000000..3bd3c0c8b8b
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/viewers/nodeElement/nodeElement.css
@@ -0,0 +1,3 @@
+
+@import url("chrome://inspector/skin");
+@import url("chrome://inspector/content/extensions/treeEditable.css");
diff --git a/mozilla/extensions/inspector/resources/skin/classic/viewers/nodeText/nodeText.css b/mozilla/extensions/inspector/resources/skin/classic/viewers/nodeText/nodeText.css
new file mode 100644
index 00000000000..5f0a4563ea6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/viewers/nodeText/nodeText.css
@@ -0,0 +1,2 @@
+
+@import url("chrome://inspector/skin");
diff --git a/mozilla/extensions/inspector/resources/skin/classic/viewers/styleRules/styleRules.css b/mozilla/extensions/inspector/resources/skin/classic/viewers/styleRules/styleRules.css
new file mode 100644
index 00000000000..1fa23724adb
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/classic/viewers/styleRules/styleRules.css
@@ -0,0 +1,9 @@
+
+@import url("chrome://inspector/skin");
+@import url("chrome://inspector/content/extensions/treeEditable.css");
+
+@namespace ins url("http://www.mozilla.org/inspector#");
+
+.treecell-priority[ins|priority="!important"] {
+ list-style-image: url("chrome://inspector/skin/iconImportant.gif");
+}
diff --git a/mozilla/extensions/inspector/resources/skin/makefile.win b/mozilla/extensions/inspector/resources/skin/makefile.win
new file mode 100644
index 00000000000..0e41dda8d3e
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/makefile.win
@@ -0,0 +1,27 @@
+#!nmake
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+DEPTH=..\..\..\..
+include <$(DEPTH)/config/config.mak>
+
+DIRS=classic modern
+
+include <$(DEPTH)\config\rules.mak>
diff --git a/mozilla/extensions/inspector/resources/skin/modern/ImageSearchItem.gif b/mozilla/extensions/inspector/resources/skin/modern/ImageSearchItem.gif
new file mode 100644
index 00000000000..f078b634b10
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/modern/ImageSearchItem.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/modern/Makefile.in b/mozilla/extensions/inspector/resources/skin/modern/Makefile.in
new file mode 100644
index 00000000000..589d64f06b8
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/Makefile.in
@@ -0,0 +1,30 @@
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+DEPTH=../../../../..
+topsrcdir=@top_srcdir@
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/mozilla/extensions/inspector/resources/skin/modern/contents.rdf b/mozilla/extensions/inspector/resources/skin/modern/contents.rdf
new file mode 100644
index 00000000000..229616a5f68
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/contents.rdf
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/extensions/inspector/resources/skin/modern/iconImportant.gif b/mozilla/extensions/inspector/resources/skin/modern/iconImportant.gif
new file mode 100644
index 00000000000..b5d34635682
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/modern/iconImportant.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/modern/iconViewerList.gif b/mozilla/extensions/inspector/resources/skin/modern/iconViewerList.gif
new file mode 100644
index 00000000000..c7da37e67ad
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/modern/iconViewerList.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/modern/iconViewerMenu-dis.gif b/mozilla/extensions/inspector/resources/skin/modern/iconViewerMenu-dis.gif
new file mode 100644
index 00000000000..ca8e1133be7
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/modern/iconViewerMenu-dis.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/modern/iconViewerMenu.gif b/mozilla/extensions/inspector/resources/skin/modern/iconViewerMenu.gif
new file mode 100644
index 00000000000..85ad1d6238e
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/modern/iconViewerMenu.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/modern/inspector.css b/mozilla/extensions/inspector/resources/skin/modern/inspector.css
new file mode 100644
index 00000000000..564168dcf81
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/inspector.css
@@ -0,0 +1,12 @@
+
+@import url("chrome://communicator/skin");
+@import url("chrome://inspector/skin/viewerPane.css");
+
+@import url("chrome://inspector/content/inspector.css");
+@import url("chrome://inspector/content/extensions/titledSplitter.css");
+
+@namespace ins url("http://www.mozilla.org/inspector#");
+
+treecol {
+ width: 16px;
+}
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/skin/modern/inspectorWindow.css b/mozilla/extensions/inspector/resources/skin/modern/inspectorWindow.css
new file mode 100644
index 00000000000..849f1d83165
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/inspectorWindow.css
@@ -0,0 +1,53 @@
+
+@import url("chrome://inspector/skin");
+
+.toolbar-header1 {
+ margin: 2px;
+ color: #ffffff;
+ font-size: 14px;
+ font-weight: bold;
+}
+
+#bxURLBar {
+ padding: 3px;
+}
+
+#bxURLBarContainer {
+ margin: 0px 3px 0px 3px;
+ border: 1px inset #ffffff;
+ padding: 0px 1px 0px 1px;
+ background-color: #ffffff;
+}
+
+#mbHistory.menubutton-icon {
+ border: none;
+ list-style-image: url("chrome://global/skin/menulist-arrow.gif");
+}
+
+.button-toolbar-3 {
+ margin: 0px !important;
+ border: 0px !important;
+}
+
+#imgURLBarIcon {
+ margin: 1px 1px 0px 1px;
+ list-style-image: url("chrome://navigator/skin/location.gif");
+}
+
+#bxSearch {
+ height: 150px;
+}
+
+#bxStatus {
+ border-top: 1px inset #6E89AB;
+ padding: 2px;
+ min-width: 1px;
+ background-color: #6E89AB;
+ color: #D0E7E7;
+ font-size: smaller;
+}
+
+#txStatus {
+ margin-left: 5px;
+}
+
diff --git a/mozilla/extensions/inspector/resources/skin/modern/jar.mn b/mozilla/extensions/inspector/resources/skin/modern/jar.mn
new file mode 100644
index 00000000000..997873363ce
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/jar.mn
@@ -0,0 +1,19 @@
+inspector.jar:
+ skin/modern/inspector/contents.rdf
+ skin/modern/inspector/inspector.css
+ skin/modern/inspector/inspectorWindow.css
+ skin/modern/inspector/viewerPane.css
+ skin/modern/inspector/treeEditable.css
+ skin/modern/inspector/titledSplitter.css
+ skin/modern/inspector/iconImportant.gif
+ skin/modern/inspector/iconViewerList.gif
+ skin/modern/inspector/iconViewerMenu.gif
+ skin/modern/inspector/iconViewerMenu-dis.gif
+ skin/modern/inspector/titledsplitter-close.gif
+ skin/modern/inspector/ImageSearchItem.gif
+ skin/modern/inspector/viewers/dom/dom.css (viewers/dom/dom.css)
+ skin/modern/inspector/viewers/dom/findDialog.css (viewers/dom/findDialog.css)
+ skin/modern/inspector/viewers/dom/columnsDialog.css (viewers/dom/columnsDialog.css)
+ skin/modern/inspector/viewers/nodeElement/nodeElement.css (viewers/nodeElement/nodeElement.css)
+ skin/modern/inspector/viewers/nodeText/nodeText.css (viewers/nodeText/nodeText.css)
+ skin/modern/inspector/viewers/styleRules/styleRules.css (viewers/styleRules/styleRules.css)
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/skin/modern/makefile.win b/mozilla/extensions/inspector/resources/skin/modern/makefile.win
new file mode 100644
index 00000000000..81098eb1896
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/makefile.win
@@ -0,0 +1,25 @@
+#!nmake
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+DEPTH=..\..\..\..\..
+include <$(DEPTH)/config/config.mak>
+
+include <$(DEPTH)\config\rules.mak>
diff --git a/mozilla/extensions/inspector/resources/skin/modern/titledSplitter.css b/mozilla/extensions/inspector/resources/skin/modern/titledSplitter.css
new file mode 100644
index 00000000000..582c83e08e9
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/titledSplitter.css
@@ -0,0 +1,44 @@
+
+.titled-splitter {
+ border: 1px solid #000000;
+ background-color: #5B7693;
+ cursor: default;
+}
+
+box[orient="vertical"] > .titled-splitter {
+ cursor: default;
+}
+
+.titledsplitter-container {
+ padding-bottom: 2px;
+}
+
+.titledsplitter-dragbar {
+ border-top: 1px solid #92ABC9;
+ min-height: 2px;
+ cursor: n-resize;
+}
+
+.titledsplitter-titlebox {
+ padding: 0px 5px 0px 5px;
+}
+
+.titledsplitter-text {
+ font-weight: bold;
+ color: #ffffff;
+}
+
+.titledsplitter-closebutton {
+ margin: 1px;
+ border: 1px outset #D4B3C4;
+ padding: 1px;
+ min-width: 14px;
+ min-height: 14px;
+ background: #D4B3C4 url("chrome://inspector/skin/titledsplitter-close.gif") no-repeat center center;
+}
+
+.titledsplitter-closebutton:hover:active {
+ border-style: inset;
+}
+
+
diff --git a/mozilla/extensions/inspector/resources/skin/modern/titledsplitter-close.gif b/mozilla/extensions/inspector/resources/skin/modern/titledsplitter-close.gif
new file mode 100644
index 00000000000..a53eddd0591
Binary files /dev/null and b/mozilla/extensions/inspector/resources/skin/modern/titledsplitter-close.gif differ
diff --git a/mozilla/extensions/inspector/resources/skin/modern/treeEditable.css b/mozilla/extensions/inspector/resources/skin/modern/treeEditable.css
new file mode 100644
index 00000000000..61c3242d046
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/treeEditable.css
@@ -0,0 +1,14 @@
+
+.treecell-editor,
+.treecell-editor > box {
+ margin: 0px !important;
+ padding: 0px !important;
+}
+
+.treecell-editor {
+ border: 0px !important;
+}
+
+.treecell-editor {
+ border: 1px solid black;
+}
diff --git a/mozilla/extensions/inspector/resources/skin/modern/viewerPane.css b/mozilla/extensions/inspector/resources/skin/modern/viewerPane.css
new file mode 100644
index 00000000000..c46b4f01fa5
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/viewerPane.css
@@ -0,0 +1,15 @@
+
+.viewer-list {
+ border: none;
+ list-style-image: url("chrome://inspector/skin/iconViewerList.gif");
+}
+
+.viewer-menu {
+ border: none;
+ list-style-image: url("chrome://inspector/skin/iconViewerMenu.gif");
+}
+
+.viewer-menu[disabled="true"] {
+ list-style-image: url("chrome://inspector/skin/iconViewerMenu-dis.gif");
+}
+
diff --git a/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/columnsDialog.css b/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/columnsDialog.css
new file mode 100644
index 00000000000..0296aeeed41
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/columnsDialog.css
@@ -0,0 +1,23 @@
+
+@import url("chrome://inspector/skin");
+
+#trColumns {
+ background-color: #C2D0D0;
+}
+
+.column-selector {
+ border: 1px outset #C2D0D0;
+ padding: 2px;
+ background-color: #C2D0D0;
+ vertical-align: middle;
+}
+
+.attr-column-selector,
+.attr-column-selector[focused="true"] {
+ margin: none;
+ border: none;
+}
+
+[col-dragging="true"] {
+ border: 1px solid black;
+}
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/dom.css b/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/dom.css
new file mode 100644
index 00000000000..6e680ec2cdd
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/dom.css
@@ -0,0 +1,38 @@
+
+@import url("chrome://inspector/skin");
+
+/* :::::::: node type color coding :::::::: */
+
+treeitem {
+ color: #000000;
+}
+
+treeitem[NodeType="1"] {
+ color: #000000;
+}
+
+treeitem[NodeType="3"] {
+ color: #0000AA;
+}
+
+treeitem[NodeType="8"] {
+ color: #88ff00;
+}
+
+treeitem[NodeType="9"] {
+ color: #ff00ff;
+}
+
+treeitem[Anonymous="true"] {
+ color: #ff0000;
+}
+
+/* :::::::: drag and drop insertion indicators :::::::: */
+
+treecol[dnd-insert-before="true"] {
+ border-left: 2px solid black;
+}
+
+treecol[dnd-insert-after="true"] {
+ border-right: 2px solid black;
+}
\ No newline at end of file
diff --git a/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/findDialog.css b/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/findDialog.css
new file mode 100644
index 00000000000..5f0a4563ea6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/viewers/dom/findDialog.css
@@ -0,0 +1,2 @@
+
+@import url("chrome://inspector/skin");
diff --git a/mozilla/extensions/inspector/resources/skin/modern/viewers/nodeElement/nodeElement.css b/mozilla/extensions/inspector/resources/skin/modern/viewers/nodeElement/nodeElement.css
new file mode 100644
index 00000000000..3bd3c0c8b8b
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/viewers/nodeElement/nodeElement.css
@@ -0,0 +1,3 @@
+
+@import url("chrome://inspector/skin");
+@import url("chrome://inspector/content/extensions/treeEditable.css");
diff --git a/mozilla/extensions/inspector/resources/skin/modern/viewers/nodeText/nodeText.css b/mozilla/extensions/inspector/resources/skin/modern/viewers/nodeText/nodeText.css
new file mode 100644
index 00000000000..5f0a4563ea6
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/viewers/nodeText/nodeText.css
@@ -0,0 +1,2 @@
+
+@import url("chrome://inspector/skin");
diff --git a/mozilla/extensions/inspector/resources/skin/modern/viewers/styleRules/styleRules.css b/mozilla/extensions/inspector/resources/skin/modern/viewers/styleRules/styleRules.css
new file mode 100644
index 00000000000..1fa23724adb
--- /dev/null
+++ b/mozilla/extensions/inspector/resources/skin/modern/viewers/styleRules/styleRules.css
@@ -0,0 +1,9 @@
+
+@import url("chrome://inspector/skin");
+@import url("chrome://inspector/content/extensions/treeEditable.css");
+
+@namespace ins url("http://www.mozilla.org/inspector#");
+
+.treecell-priority[ins|priority="!important"] {
+ list-style-image: url("chrome://inspector/skin/iconImportant.gif");
+}