Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Append 1.9 trace console

  • Loading branch information...
commit 8577541f650799e517e864540078324bece9afa7 1 parent 17469ef
@janodvarko janodvarko authored
Showing with 36,505 additions and 0 deletions.
  1. +11 −0 trace/.project
  2. +3 −0  trace/FBTrace/ant.properties
  3. +110 −0 trace/FBTrace/build.xml
  4. +22 −0 trace/FBTrace/chrome.manifest
  5. +17 −0 trace/FBTrace/chrome/content/.tmp_traceConsole.html.90068~
  6. +15 −0 trace/FBTrace/chrome/content/.tmp_traceLogFrame.html.59601~
  7. +15 −0 trace/FBTrace/chrome/content/.tmp_traceLogFrame.html.63043~
  8. +27 −0 trace/FBTrace/chrome/content/blocker.xul
  9. +167 −0 trace/FBTrace/chrome/content/firebugExplorer.js
  10. +312 −0 trace/FBTrace/chrome/content/globalTab.js
  11. +48 −0 trace/FBTrace/chrome/content/main.js
  12. +165 −0 trace/FBTrace/chrome/content/serializer.js
  13. +24 −0 trace/FBTrace/chrome/content/trace.js
  14. +229 −0 trace/FBTrace/chrome/content/traceCommandLine.js
  15. +4 −0 trace/FBTrace/chrome/content/traceConsole.css
  16. +18 −0 trace/FBTrace/chrome/content/traceConsole.html
  17. +489 −0 trace/FBTrace/chrome/content/traceConsole.js
  18. +190 −0 trace/FBTrace/chrome/content/traceConsole.xul
  19. +112 −0 trace/FBTrace/chrome/content/traceFirebugOverlay.js
  20. +30 −0 trace/FBTrace/chrome/content/traceFirebugOverlay.xul
  21. +16 −0 trace/FBTrace/chrome/content/traceLogFrame.html
  22. +1,983 −0 trace/FBTrace/chrome/content/traceModule.js
  23. +165 −0 trace/FBTrace/chrome/content/traceObjectInspector.js
  24. +53 −0 trace/FBTrace/chrome/content/unblocker.js
  25. +36 −0 trace/FBTrace/chrome/content/xpcom.js
  26. +1 −0  trace/FBTrace/chrome/firebug/content/.svn/entries
  27. +1 −0  trace/FBTrace/chrome/firebug/content/.svn/format
  28. +95 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/04/0440a62f2023e6757cb4da3ba596591adfdbdb48.svn-base
  29. +380 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/05/057918dd450bba67e3ddea3584d2201012722f6d.svn-base
  30. +508 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/0b/0bbadc1dd968d7a03393e3038242496a348759fc.svn-base
  31. +265 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/0c/0c2602bbe80acd59a3d62f10eef1ea8a9bada40b.svn-base
  32. +103 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/0c/0c8648158a8a37f9c0c477f166ad8cc3af7beda5.svn-base
  33. +67 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/0c/0cff0135a59a8b48cd703c9c9bb7426c6e239a3e.svn-base
  34. +52 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/0d/0d6d4a8f447feb159e89e5d073ae72ed3176a1f5.svn-base
  35. +85 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/0e/0e5295e6b8553d7415259287ff6e25a90acc715c.svn-base
  36. +365 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/10/10dd88e9fe04e0d440bf4d79335eac4b902ec1ce.svn-base
  37. +108 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/14/14a071ae55875628dcf9fff523ef923a7c329180.svn-base
  38. +196 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/15/159e64821758e824e2632d1aec2ea03072658bfa.svn-base
  39. +8 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/15/15edeea8851cfd13cfa5c6627f19f05d46359975.svn-base
  40. +85 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/17/17210f444c1baf9395f3fc87f247729e188083d0.svn-base
  41. +337 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/19/19ebfd09b8a8019be869d4f86c5e0dc6d1e0b3e5.svn-base
  42. +137 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/19/19fda04c4fa7c73bb89434e3c873b11ca705e03e.svn-base
  43. +1,327 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/1b/1b21e752a44905db18ab727547cac957421e2764.svn-base
  44. +55 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/1c/1c54705ed89eebbe3041da2c2e0c55da8a242a53.svn-base
  45. +653 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/1f/1fe16cb802e366a1f6d08044f4eb79dd152d1581.svn-base
  46. +39 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/24/241f0eeb450437cbc00fc18be69f6f3dc985543b.svn-base
  47. +220 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/24/24d22b5e03526b2f74952fc25e291f9b75b89ab1.svn-base
  48. +161 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/24/24e4993aa4c9feb0e7d69212fc327726e18ff456.svn-base
  49. +138 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/26/26e5403dac1bd484f5bffc224ef3d03a707f8dd7.svn-base
  50. +237 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/28/28421d118d2c918473001b5a036394623be1a0d7.svn-base
  51. +605 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/2a/2a65745685720b1385bd509446e5d66e4015db66.svn-base
  52. +35 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/2d/2d4a32e71e1711c6690d3e6220cea9e48af073a2.svn-base
  53. +620 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/2e/2e6533f863cb2118c838440ad3c733b82da25cb9.svn-base
  54. +96 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/2e/2e8c5c5a1f305a19dd9f63437fe27052bc507f73.svn-base
  55. +214 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/30/30d61faa62e69caeca0dd6edf2dec6e6341d71d7.svn-base
  56. +1,925 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/31/315bba3477f3c002660b241f70d66625ffa0629c.svn-base
  57. +2,030 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/32/3262b58a9a8a1c46bc26fc7ef8367e058062b8e6.svn-base
  58. +152 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/33/330f98f709b93c08d4a05013ab9fb522ba0a9435.svn-base
  59. +282 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/34/349111e37c83b90015e555deb95386720e07236a.svn-base
  60. +745 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/35/35c2914660483b5788f4f77c8dbc4ea1fa4538a1.svn-base
  61. +546 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/36/362fa5263ab8f85adcc5dd331e150203e4255397.svn-base
  62. +3,039 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/37/37870f05a7adf7c6fa6f84be52c1fb81b6fcff02.svn-base
  63. +309 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/39/3932a734ad3ccde795787236fc9f31c3b9b522a0.svn-base
  64. +63 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/3a/3ab11b7244c67ac6d96089094607213f5f9c71cd.svn-base
  65. +294 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/42/42a5c880c240d81c96a7feb1d19607b3985225c0.svn-base
  66. +846 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/43/43c94900fc7b41c1b7be444cb5ad716f5e5c4b84.svn-base
  67. +220 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/44/44b6ac2a7b40b7819fb0adb94d18a20365f9a2b7.svn-base
  68. +242 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/45/454fe1ca3decd4285c727877bca38c01c4a19552.svn-base
  69. +424 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/47/4795bc51706aa93a5a2aa33242c20b94d10f46e4.svn-base
  70. +188 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/47/47deedb7202c9101185ca57bbcbdea0fdd13053e.svn-base
  71. +79 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/4b/4b0d5cc5a63cd18d584f3d91871e31226c965881.svn-base
  72. +21 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/4b/4bf677fb6ae3bec8d7a3644aa4434c1b0a58cb88.svn-base
  73. +22 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/4e/4ec0c8c8cffb7a079210d0d30e61daea2e78d549.svn-base
  74. +704 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/50/50870aa01ed37774f288c9ccf1fda3b1d0a93f34.svn-base
  75. +2,959 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/51/51fd2cd17bf787e0a989a483065a54e2abe74762.svn-base
  76. +55 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/54/548deb23741c00e82f93f2d9fab173222b38dfbb.svn-base
  77. +2,056 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/55/559dff22cc3562e7f1788a281cc174be7fecaa3d.svn-base
  78. +68 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/56/56913e30b32552d12921ebf530110b63ae28a622.svn-base
  79. +3,138 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/5c/5ceb6436eb561ca8628f6112b11c03a1bee53c29.svn-base
  80. +2,563 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/5e/5e28f854986183c1c1d724684f6c06ebe29b06fe.svn-base
  81. +129 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/5f/5f66a197202a6e03fe8aec76221dc5f9cb23e330.svn-base
  82. +572 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/60/607904b9b7bb67bd3d9c105c3616f17c36a91ca1.svn-base
  83. +58 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/60/60edf64ac915a36eca1fbe0d3bef45c3405de489.svn-base
  84. +233 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/62/623dd123ddb39a8536f130bc887ff1a1c48f9f5d.svn-base
  85. +33 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/62/626d5ed7b264419a2019de7dee918fced0381233.svn-base
  86. +1,056 −0 trace/FBTrace/chrome/firebug/content/.svn/pristine/64/645dfa485cc039dd308b42481e05fcfb03552d68.svn-base
Sorry, we could not display the entire diff because too many files (591) changed.
View
11 trace/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>(firebug) Firebug Tracing</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
View
3  trace/FBTrace/ant.properties
@@ -0,0 +1,3 @@
+VERSION=1.9
+RELEASE=b4
+GETFIREBUG=../../../../../../getfirebug.com/tags/production
View
110 trace/FBTrace/build.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" ?>
+
+<!-- In order to build the extension run: $ant build (in the extension dir)
+ The final xpi file should be located in a release directory -->
+<project name="tracingConsole" basedir="." default="build">
+
+ <!-- Properties -->
+ <property file="ant.properties"/>
+
+ <!-- Directories -->
+ <property name="build.dir" value="release"/>
+ <property name="deploy-xpi.dir" value="${GETFIREBUG}/releases/fbtrace/${VERSION}"/>
+
+ <available file="${GETFIREBUG}" property="deploy.dir.available"/>
+
+ <!-- Clean -->
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <!-- Build -->
+ <target name="build" depends="clean">
+
+ <!-- Copy defaults directory -->
+ <copy todir="${build.dir}/components">
+ <fileset dir="components">
+ <include name="**/*.js"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy defaults directory -->
+ <copy todir="${build.dir}/defaults">
+ <fileset dir="defaults">
+ <include name="**/*.js"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy chrome directory -->
+ <copy todir="${build.dir}/chrome">
+ <fileset dir="chrome">
+ <include name="**/*.js"/>
+ <include name="**/*.xul"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.html"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.png"/>
+ <include name="**/*.gif"/>
+ <include name="**/*.ico"/>
+ <include name="**/*.manifest"/>
+ <include name="**/*.txt"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy defaults directory -->
+ <copy todir="${build.dir}/icons">
+ <fileset dir="icons">
+ <include name="**/*.ico"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy defaults directory -->
+ <copy todir="${build.dir}/modules">
+ <fileset dir="modules">
+ <include name="**/*.js"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy extension installation files and licence.txt -->
+ <copy file="chrome.manifest" todir="${build.dir}"/>
+ <copy file="install.rdf" todir="${build.dir}"/>
+ <copy file="license.txt" todir="${build.dir}"/>
+ <copy file="update.rdf" todir="${build.dir}"/>
+
+ <!-- Update release version from ant.properties file -->
+ <replace file="${build.dir}/install.rdf" propertyFile="ant.properties">
+ <replacefilter token="@VERSION@" property="VERSION"/>
+ <replacefilter token="@RELEASE@" property="RELEASE"/>
+ </replace>
+
+ <!-- Create final tracingConsole.xpi file -->
+ <zip destfile="${build.dir}/fbTrace-${VERSION}${RELEASE}.xpi"
+ basedir="${build.dir}" update="true" />
+
+ <!-- Generate update.rdf file -->
+ <replace file="${build.dir}/update.rdf" propertyFile="ant.properties">
+ <replacefilter token="@VERSION@" property="VERSION"/>
+ <replacefilter token="@RELEASE@" property="RELEASE"/>
+ </replace>
+
+ <!-- Final build message -->
+ <echo message="FBTrace version: ${VERSION}${RELEASE}"/>
+
+ <!-- Deploy -->
+ <antcall target="deploy" />
+ </target>
+
+ <!-- Deploy if target available -->
+ <target name="deploy" if="deploy.dir.available">
+
+ <!-- Deploy xpi & update.rdf files -->
+ <copy file="${build.dir}/update.rdf" todir="${deploy-xpi.dir}" overwrite="true"/>
+ <copy file="${build.dir}/fbTrace-${VERSION}${RELEASE}.xpi" todir="${deploy-xpi.dir}" overwrite="true"/>
+
+ <!-- Final deploy message -->
+ <echo message="fbTrace-${VERSION}${RELEASE} deployed to: ${deploy-xpi.dir}"/>
+ </target>
+
+</project>
View
22 trace/FBTrace/chrome.manifest
@@ -0,0 +1,22 @@
+content fbtrace chrome/content/
+content fbtrace-firebug chrome/firebug/content/
+
+overlay chrome://firebug/content/firebugOverlay.xul chrome://fbtrace/content/traceFirebugOverlay.xul
+
+resource fbtrace modules/
+resource fbtrace-firebug chrome/firebug/modules/
+resource fbtrace_rjs chrome/
+
+resource moduleLoader chrome/firebug/modules/
+
+skin fbtrace classic/1.0 chrome/skin/classic/
+skin fbtrace-os classic/1.0 chrome/skin/classic/win/
+skin fbtrace-os classic/1.0 chrome/skin/classic/mac/ os=Darwin
+skin fbtrace-firebug classic/1.0 chrome/firebug/skin/classic/
+
+locale fbtrace en-US chrome/locale/en-US/
+locale fbtrace-firebug en-US chrome/firebug/locale/en-US/
+
+component {FBDD01C3-6D09-494c-B086-C5D56F346658} components/commandLine.js
+contract @mozilla.org/commandlinehandler/general-startup;1?type=FBTrace {FBDD01C3-6D09-494c-B086-C5D56F346658}
+category command-line-handler _firebugtracing @mozilla.org/commandlinehandler/general-startup;1?type=FBTrace
View
17 trace/FBTrace/chrome/content/.tmp_traceConsole.html.90068~
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Firebug Trace Console</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/panelbase.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/dom.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/console.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/win/panel.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace/skin/traceConsole.css" type="text/css"/>
+</head>
+<body>
+ <div id="panelNode-traceConsole"/>
+</body>
+</html>
View
15 trace/FBTrace/chrome/content/.tmp_traceLogFrame.html.59601~
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/panelbase.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/dom.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/console.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/win/panel.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace/skin/traceConsole.css" type="text/css"/>
+</head>
+<body>
+ <div id="traceLogContent"/>
+</body>
+</html>
View
15 trace/FBTrace/chrome/content/.tmp_traceLogFrame.html.63043~
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/panelbase.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/dom.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/console.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/win/panel.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace/skin/traceConsole.css" type="text/css"/>
+</head>
+<body>
+ <div id="traceLogContent"/>
+</body>
+</html>
View
27 trace/FBTrace/chrome/content/blocker.xul
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="FBTraceConsole-blocker"
+ windowtype="FBTraceConsole-blocker:ui"
+ title="Block JavaScript"
+ width="600" height="480"
+ persist="screenX,screenY,width,height">
+
+ <script type="application/x-javascript">
+ function armOnLoad(event)
+ {
+ window.releaser = window.arguments[0];
+ window.dump("------------ "+window.location+" load " + window.releaser.prefDomain + "\n");
+ window.releaser.unblock = function()
+ {
+ window.dump("------------ "+window.location+" unblock ---------------\n");
+ window.dump("------------ "+window.releaser.prefDomain+" ---------------\n");
+ window.close();
+ window.dump("------------ "+window.closed+" tracing console unblock done ---------------\n");
+ }
+ }
+ window.addEventListener('load', armOnLoad, false);
+ </script>
+ <vbox>
+ <browser id="content" flex="2" disablehistory="true" src="" />
+ </vbox>
+</window>
View
167 trace/FBTrace/chrome/content/firebugExplorer.js
@@ -0,0 +1,167 @@
+/* See license.txt for terms of usage */
+
+define([], function() {
+
+// ********************************************************************************************* //
+// Constants
+
+// ********************************************************************************************* //
+// Explorer Implementation
+
+TraceConsole.FirebugExplorer =
+{
+ dump: function()
+ {
+ var firebugWindow;
+ FBL.iterateBrowserWindows("navigator:browser", function(win)
+ {
+ if (win.Firebug)
+ {
+ firebugWindow = win;
+ return true;
+ }
+ });
+
+ var contentView = FBL.getContentView(firebugWindow);
+ if (!contentView)
+ {
+ FBTrace.sysout("No Browser with Firebug found!");
+ return;
+ }
+
+ var messageInfo = {
+ obj: this.getObjects(contentView.Firebug),
+ type: "firebug-explorer",
+ scope: null,
+ time: (new Date()).getTime()
+ };
+
+ var message = new Firebug.TraceModule.TraceMessage(
+ messageInfo.type, "Firebug Explorer", messageInfo.obj, messageInfo.scope,
+ messageInfo.time);
+
+ Firebug.TraceModule.dump(message, TraceConsole);
+
+ this.cleanUp(contentView.Firebug);
+ },
+
+ getObjects: function(root)
+ {
+ function insert(root, path, value)
+ {
+ var steps = path.split(".");
+ for (var p in steps)
+ {
+ var label = steps[p];
+ var branch = root[label];
+ if (!branch)
+ branch = root[label] = {};
+ root = branch;
+ }
+ }
+
+ var result = {};
+ var results = [];
+ var iter = new FirebugIterator();
+ iter.iterate(root, "Firebug", function(obj, path)
+ {
+ if (obj.hasOwnProperty("__explored"))
+ return false;
+
+ if (FirebugReps.Arr.isArray(obj))
+ obj.__explored = obj.length;
+ else
+ obj.__explored = true;
+
+ var value = "";
+ try {
+ value = (obj.toString ? obj.toString() : "")
+ } catch (e) {}
+
+ insert(result, path, value);
+
+ //results.push(path);
+ return true;
+ });
+
+ return result;
+ },
+
+ cleanUp: function(root)
+ {
+ var iter = new FirebugIterator();
+ iter.iterate(root, "Firebug", function(obj, path)
+ {
+ if (!obj.hasOwnProperty("__explored"))
+ return false;
+
+ delete obj.__explored;
+
+ return true;
+ });
+ }
+}
+
+// ********************************************************************************************* //
+// Object Iterator
+
+/**
+ * Recursively iterates all children objects.
+ */
+function FirebugIterator()
+{
+}
+
+FirebugIterator.prototype =
+/** @lends FirebugIterator */
+{
+ /**
+ * Recursive iteration over all children of given object
+ * @param {Object} obj The object to iterate
+ * @param {String} path helper path for logging.
+ * @param {Function} callback Callback function executed for each object.
+ */
+ iterate: function(obj, path, callback)
+ {
+ if (!callback.apply(this, [obj, path]))
+ return;
+
+ if (typeof(obj) !== "object")
+ return;
+
+ var names = Object.keys(obj);
+ for (var i=0; i<names.length; i++)
+ {
+ var name = names[i];
+ var child = obj[name];
+
+ // Ignore built-in objects
+ if (FBL.isDOMMember(obj, name) || FBL.isDOMConstant(obj, name))
+ continue;
+
+ if (name == "__explored" || name == "prototype" ||
+ name == "__proto__" || name == "window" || name == "tabBrowser")
+ continue;
+
+ if (typeof(child) == "function")
+ continue;
+
+ try
+ {
+ this.iterate(child, path + "." + name, callback);
+ }
+ catch (exc)
+ {
+ FBTrace.sysout("iterate EXCEPTION " + path + "." + name, exc);
+ break;
+ }
+ }
+ },
+};
+
+// ********************************************************************************************* //
+
+return TraceConsole.FirebugExplorer;
+
+// ********************************************************************************************* //
+});
View
312 trace/FBTrace/chrome/content/globalTab.js
@@ -0,0 +1,312 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/firefox/xpcom",
+ "firebug/lib/domplate"
+],
+function(FBL, XPCOM, Domplate) { with (FBL) { with (Domplate) {
+
+// ********************************************************************************************* //
+// Shorcuts and Services
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+const observerService = XPCOM.CCSV("@mozilla.org/observer-service;1", "nsIObserverService");
+
+Components.utils["import"]("resource://fbtrace/firebug-trace-service.js");
+
+//********************************************************************************************** //
+
+var GlobalTab = domplate(
+{
+ tag:
+ DIV({onclick: "$onClick", role: "list"},
+ FOR("topic", "$topics",
+ BUTTON({"class": "traceOption"},
+ "$topic"
+ )
+ )
+ ),
+
+ render: function(parentNode)
+ {
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("globalTab; render topics " + topics.length, topics);
+
+ var input = {
+ topics: topics,
+ onClick: bind(this.toggleTopic, this)
+ };
+
+ this.tag.replace(input, parentNode);
+ },
+
+ toggleTopic: function(event)
+ {
+ var topicElt = event.target;
+
+ if (!this.isObserved(topicElt))
+ this.addTopic(topicElt)
+ else
+ this.removeTopic(topicElt);
+ },
+
+ forEachTopicElement: function(fn)
+ {
+ var topicDivs = FBL.getElementsByClass(this.panelNode, "traceOption")
+ for (var i=0; i<topicDivs.length; i++)
+ {
+ var topicElt = topicDivs[i];
+ fn(topicElt);
+ }
+ },
+
+ allTopics: function(add)
+ {
+ var self = this;
+ this.forEachTopicElement(function addIfTrue(topicElt)
+ {
+ try
+ {
+ if (add)
+ self.addTopic(topicElt);
+ else
+ self.removeTopic(topicElt);
+
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("AllTopics add: "+add+" isObserved "+self.isObserved(topicElt)+
+ " "+topicElt.innerHTML);
+ }
+ catch(exc)
+ {
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("FBTrace; globalObserver allTopics fails for "+topicElt.innerHTML+" "+exc, exc);
+ }
+ });
+ },
+
+ isObserved: function(topicElt)
+ {
+ var topic = topicElt.innerHTML;
+ var observers = observerService.enumerateObservers(topic);
+ if (!observers)
+ {
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("isObserved no observers of topic "+topic);
+
+ return false;
+ }
+
+ while (observers.hasMoreElements())
+ {
+ var x = observers.getNext();
+ if (x.wrappedJSObject == GlobalObserver)
+ {
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("isObserved found FBTrace.globaleObserver of topic "+topic, x);
+ return true;
+ }
+ }
+
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("isObserved no observers of topic "+topic+" match GlobalObserver");
+
+ return false;
+ },
+
+ addTopic: function(node)
+ {
+ var topic = node.innerHTML;
+ observerService.addObserver(GlobalObserver, topic, false);
+ node.setAttribute("checked", "true");
+
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("FBTrace; GlobalObserver addObserver "+topic);
+ },
+
+ removeTopic: function(node)
+ {
+ var topic = node.innerHTML;
+ observerService.removeObserver(GlobalObserver, topic);
+ node.removeAttribute("checked");
+
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("FBTrace; GlobalObserver removeObserver "+topic);
+ },
+
+ getOptionsMenuItems: function()
+ {
+ var items = [
+ {label: "All On", command: bindFixed(this.allTopics, this, true)},
+ {label: "All Off", command: bindFixed(this.allTopics, this, false)},
+ optionMenu(GlobalObserver.shoutOptionLabel, GlobalObserver.shoutOptionName),
+ ];
+ return items;
+ },
+
+ updateOption: function(name, value)
+ {
+ if (name == GlobalObserver.shoutOptionName)
+ GlobalObserver.shoutOptionValue = (value?true:false); // force to boolean
+ },
+});
+
+//********************************************************************************************** //
+
+var GlobalObserver =
+{
+ observe: function(subject, topic, data)
+ {
+ var localTrace = traceConsoleService.getTracer(TraceConsole.prefDomain);
+
+ // Log info into the Firebug tracing console.
+ var shout = (GlobalObserver.shoutOptionValue ? "globalObserver." : "");
+ localTrace.sysout(shout + "observe: " + topic, {subject:subject, data: data});
+
+ if (topic == 'domwindowopened')
+ {
+ try
+ {
+ if (subject instanceof Ci.nsIDOMWindow)
+ {
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("FBTrace; globalObserver found domwindowopened "+subject.location+"\n");
+ }
+ }
+ catch(exc)
+ {
+ FBTrace.sysout("FBTrace; globalObserver notify console opener FAILED ", exc);
+ }
+ }
+ else if (topic == 'domwindowclosed') // Apparently this event comes before the unload event on the DOMWindow
+ {
+ if (subject instanceof Ci.nsIDOMWindow)
+ {
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("FBTrace; globalObserver found domwindowclosed "+subject.location+getStackDump());
+
+ if (subject.location.toString() == "chrome://fbtrace/content/traceConsole.xul")
+ throw new Error("FBTrace; globalObserver should not find traceConsole.xul");
+ }
+ }
+ else if (topic == 'dom-window-destroyed') // subject appears to be the nsIDOMWindow with a location that is invalid and closed == true; data null
+ {
+ if (FBTrace.DBG_FBTRACE)
+ FBTrace.sysout("FBTrace; globalObserver found dom-window-destroyed subject:", subject);
+ }
+ },
+
+ shoutOptionName: "shoutAboutObserverEvents",
+ shoutOptionLabel: "Shout About Observer Events",
+ shoutOptionValue: true,
+};
+
+GlobalObserver.wrappedJSObject = GlobalObserver; // and eye of newt
+
+//********************************************************************************************** //
+
+var topics = [
+ "Migration:Ended",
+ "Migration:ItemAfterMigrate",
+ "Migration:ItemBeforeMigrate",
+ "Migration:Started",
+ "a11y-init-or-shutdown",
+ "accessible-event",
+ "addons-message-notification",
+ "agent-sheet-added",
+ "agent-sheet-removed",
+ "app-handler-pane-loaded",
+ "browser-search-engine-modified",
+ "browser-ui-startup-complete",
+ "browser:purge-session-history",
+ "cacheservice:empty-cache",
+ "chrome-flush-caches",
+ "chrome-flush-skin-caches",
+ "cookie-changed",
+ "cookie-rejected",
+ "cycle-collector-begin",
+ "dl-cancel",
+ "dl-start",
+ "dom-storage-changed",
+ "dom-storage-warn-quota-exceeded",
+ "domwindowclosed",
+ "domwindowopened",
+ "dom-window-destroyed",
+ "download-manager-remove-download",
+ "dummy-observer-created",
+ "dummy-observer-item-added",
+ "dummy-observer-visited",
+ "earlyformsubmit",
+ "em-action-requested",
+ "final-ui-startup",
+ "formhistory-expire-now",
+ "http-on-examine-cached-response",
+ "http-on-examine-merged-response",
+ "http-on-examine-response",
+ "http-on-modify-request",
+ "idle-daily",
+ "memory-pressure",
+ "net:clear-active-logins",
+ "network:offline-status-changed",
+ "offline-app-removed",
+ "offline-cache-update-added",
+ "offline-cache-update-completed",
+ "offline-requested",
+ "page-info-dialog-loaded",
+ "passwordmgr-found-form",
+ "passwordmgr-found-logins",
+ "passwordmgr-storage-changed",
+ "perm-changed",
+ "places-database-locked",
+ "places-init-complete",
+ "plugins-list-updated",
+ "prefservice:after-app-defaults",
+ "private-browsing",
+ "profile-after-change",
+ "profile-approve-change",
+ "profile-before-change",
+ "profile-change-net-restore",
+ "profile-change-net-teardown",
+ "profile-change-teardown",
+ "profile-do-change",
+ "quit-application",
+ "quit-application-forced",
+ "quit-application-granted",
+ "quit-application-requested",
+ "session-save",
+ "sessionstore-state-write",
+ "sessionstore-windows-restored",
+ "shell:desktop-background-changed",
+ "shutdown-cleanse",
+ "signonChanged",
+ "signonSelectUser",
+ "sleep_notification",
+ "softkb-change",
+ "system-display-dimmed-or-off",
+ "system-display-on",
+ "user-interaction-active",
+ "user-interaction-inactive",
+ "user-sheet-added",
+ "user-sheet-removed",
+ "wake_notification",
+ "xmlparser",
+ "xpcom-category-entry-added",
+ "xpcom-shutdown",
+ "xpcom-shutdown-loaders",
+ "xpcom-shutdown-threads",
+ "xpinstall-download-started",
+ "xpinstall-install-blocked",
+ "xul-overlay-merged",
+ "xul-window-destroyed",
+ "xul-window-registered"
+];
+
+//********************************************************************************************** //
+
+TraceConsole.GlobalTab = GlobalTab;
+return GlobalTab;
+
+//********************************************************************************************** //
+}}});
View
48 trace/FBTrace/chrome/content/main.js
@@ -0,0 +1,48 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+
+var config =
+{
+ baseLoaderUrl: "resource://fbtrace-firebug/",
+ baseUrl: "resource://fbtrace_rjs/",
+ paths: {
+ "arch": "firebug/content/bti/inProcess",
+ "firebug": "firebug/content",
+ "fbtrace": "content"
+ },
+ coreModules: ["lib/options", "lib/xpcom"],
+ xhtml: true,
+};
+
+
+window.dump("FBTrace; main.js begin module loading\n");
+
+require(config,
+[
+ "firebug/chrome/chrome",
+ "firebug/lib/lib",
+ "firebug/chrome/reps",
+ "firebug/lib/domplate",
+ "firebug/firebug",
+ "fbtrace/serializer", // save to file, load from file
+ "fbtrace/firebugExplorer",
+
+ // Overrides the default Firebug.TraceModule implementation that only
+ // collects tracing listeners (customization of logs)
+ "fbtrace/traceModule",
+ "fbtrace/globalTab",
+],
+function(ChromeFactory)
+{
+ if (FBTrace.DBG_INITIALIZE || FBTrace.DBG_MODULES)
+ FBTrace.sysout("FBTrace; main.js require!\n");
+
+ Firebug.Options.initialize("extensions.firebug");
+ Firebug.TraceModule.initialize();
+
+ var chrome = ChromeFactory.createFirebugChrome(window);
+ chrome.initialize();
+});
+
+// ********************************************************************************************* //
View
165 trace/FBTrace/chrome/content/serializer.js
@@ -0,0 +1,165 @@
+/* See license.txt for terms of usage */
+
+define([], function() {
+
+// ********************************************************************************************* //
+// Constants
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+const reEndings = /\r\n|\r|\n/;
+
+// ********************************************************************************************* //
+// Serializer Implementation
+
+TraceConsole.Serializer =
+{
+ onSaveToFile: function(console)
+ {
+ try
+ {
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].getService(nsIFilePicker);
+ fp.init(window, null, nsIFilePicker.modeSave);
+ fp.appendFilter("Firebug Tracing Logs","*.ftl;");
+ fp.appendFilters(nsIFilePicker.filterAll);
+ fp.filterIndex = 1;
+ fp.defaultString = "firebug-tracing-logs.ftl";
+
+ var rv = fp.show();
+ if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace)
+ {
+ var foStream = Cc["@mozilla.org/network/file-output-stream;1"]
+ .createInstance(Ci.nsIFileOutputStream);
+ foStream.init(fp.file, 0x02 | 0x08 | 0x20, 0666, 0); // write, create, truncate
+
+ var appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
+ var currLocale = Firebug.Options.getPref("general.useragent", "locale");
+ var systemInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag);
+
+ var log = { version: "1.0" };
+
+ // Firebug info version
+ log.firebug = Firebug.version;
+ log.app = {
+ name: appInfo.name,
+ version: appInfo.version,
+ platformVersion: appInfo.platformVersion,
+ buildID: appInfo.appBuildID,
+ locale: currLocale
+ };
+ log.os = {
+ name: systemInfo.getProperty("name"),
+ version: systemInfo.getProperty("version")
+ };
+ log.date = (new Date()).toGMTString();
+ log.messages = [];
+
+ // Iterate over all logs and store it into a file.
+ var tbody = console.logs.firstChild;
+ for (var row = tbody.firstChild; row; row = row.nextSibling)
+ this.saveMessage(log, row.repObject);
+
+ var jsonString = JSON.stringify(log, null, " ");
+ foStream.write(jsonString, jsonString.length);
+ foStream.close();
+ }
+ }
+ catch (err)
+ {
+ FBTrace.sysout("FBTrace; onSaveToFile EXCEPTION " + err, err);
+ }
+ },
+
+ onLoadFromFile: function(console)
+ {
+ try
+ {
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].getService(nsIFilePicker);
+ fp.init(window, null, nsIFilePicker.modeOpen);
+ fp.appendFilters(nsIFilePicker.filterAll);
+ fp.appendFilter("Firebug Tracing Logs", "*.ftl;");
+ fp.filterIndex = 1;
+
+ var rv = fp.show();
+ if (rv != nsIFilePicker.returnOK)
+ return;
+
+ var inputStream = Cc["@mozilla.org/network/file-input-stream;1"]
+ .createInstance(Ci.nsIFileInputStream);
+ inputStream.init(fp.file, -1, -1, 0); // read-only
+
+ // Read and parset the content
+ var jsonString = FBL.readFromStream(inputStream)
+ var log = JSON.parse(jsonString);
+ if (!log)
+ {
+ FBTrace.sysout("FBTrace; No log data available.");
+ return;
+ }
+
+ log.filePath = fp.file.path;
+
+ var MessageTemplate = Firebug.TraceModule.MessageTemplate;
+ var TraceModule = Firebug.TraceModule;
+
+ // Create header, dump all logs and create footer.
+ MessageTemplate.dumpSeparator(console, MessageTemplate.importHeaderTag, log);
+ for (var i=0; i<log.messages.length; i++)
+ {
+ var logMsg = log.messages[i];
+ if (!logMsg.type)
+ continue;
+ else if (logMsg.type == "separator")
+ MessageTemplate.dumpSeparator(console);
+ else
+ MessageTemplate.dump(new TraceModule.ImportedMessage(logMsg), console);
+ }
+ MessageTemplate.dumpSeparator(console, MessageTemplate.importFooterTag);
+ }
+ catch (err)
+ {
+ FBTrace.sysout("FBTrace; onLoadFromFile EXCEPTION " + err, err);
+ }
+ },
+
+ saveMessage: function(log, message)
+ {
+ if (!message)
+ return;
+
+ var text = message.text;
+ text = text ? text.replace(reEndings, "") : "---";
+ text = text.replace(/"|'/g, "");
+
+ var msgLog = {
+ index: message.index,
+ text: message.text,
+ type: message.type ? message.type : "",
+ time: message.time,
+ stack: []
+ };
+
+ var stack = message.stack;
+ for (var i=0; stack && i<stack.length; i++)
+ {
+ var frame = stack[i];
+ msgLog.stack.push({
+ fileName: frame.fileName,
+ lineNumber: frame.lineNumber,
+ funcName: frame.funcName,
+ });
+ }
+
+ log.messages.push(msgLog);
+ }
+}
+
+// ********************************************************************************************* //
+
+return TraceConsole.Serializer;
+
+// ********************************************************************************************* //
+});
View
24 trace/FBTrace/chrome/content/trace.js
@@ -0,0 +1,24 @@
+/* See license.txt for terms of usage */
+
+var FBTrace = {};
+
+try
+{
+ Components.utils["import"]("resource://fbtrace/firebug-trace-service.js");
+
+ FBTrace = traceConsoleService.getTracer("extensions.firebug");
+ FBTrace.setScope(window);
+
+ function clearFBTraceScope()
+ {
+ window.removeEventListener('unload', clearFBTraceScope, true);
+ FBTrace.setScope(null);
+ }
+
+ window.addEventListener('unload', clearFBTraceScope, true);
+ FBTrace.time("SCRIPTTAG_TIME");
+}
+catch (err)
+{
+ dump("FBTrace; " + err);
+}
View
229 trace/FBTrace/chrome/content/traceCommandLine.js
@@ -0,0 +1,229 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// Command Line Implementation
+
+try
+{
+ Components.utils["import"]("resource:///modules/source-editor.jsm");
+}
+catch (err)
+{
+ // Inroduced in Firefox 8
+}
+
+// ********************************************************************************************* //
+
+Components.utils.import("resource://fbtrace-firebug/storageService.js");
+
+// ********************************************************************************************* //
+
+var TraceCommandLine =
+{
+ currentWindow: null,
+
+ onLoad: function(event)
+ {
+ if (this.editor)
+ return;
+
+ if (typeof(SourceEditor) == "undefined")
+ return;
+
+ this.editor = new SourceEditor();
+
+ // Load previous command line content.
+ var commandLineIntro = this.loadContent();
+
+ var config =
+ {
+ mode: SourceEditor.MODES.JAVASCRIPT,
+ showLineNumbers: true,
+ placeholderText: commandLineIntro,
+ };
+
+ var editorPlaceholder = document.getElementById("fbTrace-editor");
+
+ // Remove simple textbox used for Firefox version < 8.
+ var scriptBox = document.getElementById("fbTraceScriptBox");
+ editorPlaceholder.removeChild(scriptBox);
+
+ // Initialize Orion editor.
+ this.editor.init(editorPlaceholder, config, this.onEditorLoad.bind(this));
+ },
+
+ onEditorLoad: function()
+ {
+ //this.editor.addEventListener(SourceEditor.EVENTS.CONTEXT_MENU, this.onContextMenu);
+ this.editor.setCaretOffset(this.editor.getCharCount());
+ },
+
+ onUnload: function()
+ {
+ if (this.editor)
+ {
+ // Store command line content
+ this.storeContent(this.editor.getText());
+
+ this.editor.destroy();
+ this.editor = null;
+ }
+ },
+
+ toggleCommandLine: function()
+ {
+ var splitter = document.getElementById("fbTraceSplitter");
+ var commandLine = document.getElementById("fbTraceCommandLine");
+
+ // Toggle visibility of the command line.
+ var shouldShow = FBL.isCollapsed(splitter);
+ FBL.collapse(splitter, !shouldShow);
+ FBL.collapse(commandLine, !shouldShow);
+
+ if (shouldShow && this.editor)
+ this.editor.focus();
+
+ // Update menu item.
+ var showCommandLine = document.getElementById("showCommandLine");
+ showCommandLine.setAttribute("checked", shouldShow);
+
+ // Select the first browser window by default.
+ if (!this.currentWindow)
+ {
+ var self = this;
+ FBL.iterateBrowserWindows("navigator:browser", function(win)
+ {
+ return self.currentWindow = win;
+ });
+ }
+
+ this.updateLabel();
+ },
+
+ onContextMenuShowing: function(popup)
+ {
+ // Collect all browser windows with Firebug.
+ var windows = [];
+ FBL.iterateBrowserWindows("", function(win)
+ {
+ windows.push(win);
+ });
+
+ // Populate the menu with entries.
+ for (var i=0; i<windows.length; ++i)
+ {
+ var win = windows[i];
+ var item = {
+ nol10n: true,
+ label: win.document.title,
+ type: "radio",
+ checked: this.currentWindow == win,
+ command: FBL.bindFixed(this.selectContext, this, win)
+ };
+ FBL.createMenuItem(popup, item);
+ }
+ },
+
+ selectContext: function(win)
+ {
+ this.currentWindow = win;
+ },
+
+ updateLabel: function()
+ {
+ if (!this.currentWindow)
+ return;
+
+ var button = document.getElementById("cmdLineContext");
+ button.setAttribute("label", "in: " + this.currentWindow.document.title + " ");
+ },
+
+ onContextMenuHidden: function(popup)
+ {
+ while (popup.childNodes.length > 0)
+ popup.removeChild(popup.lastChild);
+ },
+
+ evaluate: function()
+ {
+ if (!this.currentWindow)
+ {
+ FBTrace.sysout("ERROR: You need to select target browser window!");
+ return;
+ }
+
+ try
+ {
+ var script;
+ if (this.editor)
+ {
+ script = this.editor.getText();
+ }
+ else
+ {
+ var scriptBox = document.getElementById("fbTraceScriptBox");
+ script = scriptBox.value;
+ }
+
+ var result = this.currentWindow.eval(script);
+ FBTrace.sysout(result, result);
+ }
+ catch (exc)
+ {
+ FBTrace.sysout("EXCEPTION " + exc, exc);
+ }
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Persistence
+
+ loadContent: function()
+ {
+ var file = this.getStorageFile();
+ if (file.exists())
+ {
+ var text = TextService.readText(file, text);
+ if (text)
+ return text;
+ }
+
+ return commandLineIntro;
+ },
+
+ storeContent: function(text)
+ {
+ var file = this.getStorageFile();
+ if (!file.exists())
+ file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
+
+ TextService.writeText(file, text);
+ },
+
+ getStorageFile: function()
+ {
+ var dirService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
+ var file = dirService.get("ProfD", Ci.nsILocalFile);
+ file.append("firebug");
+ file.append("fbtrace");
+ file.append("commandLine.txt");
+ return file;
+ }
+};
+
+// ********************************************************************************************* //
+
+var commandLineIntro =
+"/*\n" +
+" * This is a FBTrace Command Line.\n" +
+" * Enter some JavaScript, then:\n" +
+" * 1. Select target window scope.\n" +
+" * 2. Press Evaluate in the toolbar to evaluate the script (or Ctrl+Enter).\n" +
+" */\n" +
+"\n";
+
+// ********************************************************************************************* //
+
+addEventListener("load", TraceCommandLine.onLoad.bind(TraceCommandLine), false);
+addEventListener("unload", TraceCommandLine.onUnload.bind(TraceCommandLine), false);
+
+// ********************************************************************************************* //
View
4 trace/FBTrace/chrome/content/traceConsole.css
@@ -0,0 +1,4 @@
+/* See license.txt for terms of usage */
+
+@import "chrome://fbtrace/skin/traceConsole.css";
+@import "chrome://fbtrace-os/skin/traceConsole.css";
View
18 trace/FBTrace/chrome/content/traceConsole.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Firebug Trace Console</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/panelbase.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/dom.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/console.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/win/panel.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace/skin/traceConsole.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-os/skin/traceConsole.css" type="text/css"/>
+</head>
+<body>
+ <div id="panelNode-traceConsole"/>
+</body>
+</html>
View
489 trace/FBTrace/chrome/content/traceConsole.js
@@ -0,0 +1,489 @@
+/* See license.txt for terms of usage */
+
+// ************************************************************************************************
+// Shorcuts and Services
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+try
+{
+ Components.utils["import"]("resource://moduleLoader/moduleLoader.js");
+ Components.utils["import"]("resource://fbtrace/firebug-trace-service.js");
+}
+catch (err)
+{
+ dump("TraceConsole; Loading modules EXCEPTION " + err + "\n");
+}
+
+var traceService = traceConsoleService;
+
+const PrefService = Cc["@mozilla.org/preferences-service;1"];
+const prefs = PrefService.getService(Ci.nsIPrefBranch2);
+const prefService = PrefService.getService(Ci.nsIPrefService);
+const directoryService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
+
+var gFindBar;
+
+const reDBG = /extensions\.([^\.]*)\.(DBG_.*)/;
+const reDBG_FBS = /DBG_FBS_(.*)/;
+
+// Cache messages that are fired before the content of the window is loaded.
+var queue = [];
+
+// ************************************************************************************************
+// Trace Window Implementation
+
+var TraceConsole =
+{
+ modules: [],
+
+ initialize: function()
+ {
+ window.dump("FBTrace; TraceConsole.initialize\n");
+
+ var args = window.arguments[0];
+
+ // Get pref domain is used for message filtering. Only logs that belong
+ // to this pref-domain will be displayed. The current domain is displyaed
+ // in window title.
+ this.prefDomain = args.prefDomain;
+ document.title = FBL.$STR("title.Tracing") + ": " + this.prefDomain;
+
+ try
+ {
+ for( var p in args)
+ window.dump("args "+p+"\n");
+
+ // Firebug is already initialized in main.js (where chrome is created).
+ // Firebug.initialize();
+
+ window.dump("FBTrace; Firebug for Tracing Console is initialized\n");
+ this.initializeConsole();
+ }
+ catch (exc)
+ {
+ var msg = exc.toString() +" "+(exc.fileName || exc.sourceName) + "@" + exc.lineNumber;
+ window.dump("FBTrace; Firebug.TraceModule.initialize EXCEPTION " + msg + "\n");
+ window.dump(FBL.getStackDump()+"\n");
+ }
+ },
+
+ initializeConsole: function()
+ {
+ window.dump("FBTrace; initializeConsole, " + this.prefDomain + "\n");
+
+ // Register listeners and observers
+ traceService.addObserver(this, "firebug-trace-on-message", false);
+ prefs.addObserver(this.prefDomain, this, false);
+
+ // Initialize root node of the trace-console window.
+ var consoleFrame = document.getElementById("consoleFrame");
+ consoleFrame.droppedLinkHandler = function()
+ {
+ return false;
+ };
+
+ // Make sure the UI is localized.
+ Firebug.internationalizeUI(window.document);
+
+ if (!Firebug.TraceModule)
+ {
+ window.dump("FBTrace; Firebug.TraceModule == NULL\n");
+ return;
+ }
+
+ this.consoleNode = consoleFrame.contentDocument.getElementById("panelNode-traceConsole");
+
+ Firebug.TraceModule.CommonBaseUI.initializeContent(
+ this.consoleNode, this, this.prefDomain,
+ FBL.bind(this.initializeContent, this));
+
+ gFindBar = document.getElementById("FindToolbar");
+ },
+
+ initializeContent: function(logNode)
+ {
+ try
+ {
+ this.logs = logNode;
+
+ // Notify listeners
+ Firebug.TraceModule.onLoadConsole(window, logNode);
+
+ this.updateTimeInfo();
+
+ // If the opener is closed the console must be also closed.
+ // (this console uses shared object from the opener (e.g. Firebug)
+ window.opener.addEventListener("close", this.onCloseOpener, true);
+ this.addedOnCloseOpener = true;
+
+ // Flush any cached messages (those that came since the firbug-trace-observer
+ // has been registered and now.
+ this.flushCachedMessages();
+
+ FBTrace.sysout("Tracing console initialized for: " + this.prefDomain + "\n");
+
+ if (this.releaser) {
+ dump("TraceConsole releasing application thread.\n");
+ this.releaser.unblock.apply(this.releaser, []);
+ }
+ }
+ catch (err)
+ {
+ FBTrace.sysout("initializeContent; EXCEPTION " + err, err);
+ }
+ },
+
+ createLoader: function(prefDomain, baseUrl)
+ {
+ try
+ {
+ // Require JS configuration
+ var config = {};
+ config.prefDomain = prefDomain;
+ config.baseUrl = baseUrl;
+ config.paths = {"arch": "inProcess"};
+
+ config.onDebug = function()
+ {
+ window.dump("FBTrace; onDebug: ");
+ for(var i = 0; i < arguments.length; i++)
+ window.dump(arguments[i] + ",");
+ window.dump(".\n");
+ //Components.utils.reportError(arguments[0]);
+ }
+
+ config.onError = function()
+ {
+ FBTrace.sysout("FBTrace; onError: " + arguments + "\n");
+ window.dump("FBTrace; onError: ");
+ for(var i = 0; i < arguments.length; i++)
+ window.dump(arguments[i] + ",");
+ window.dump(".\n");
+ Components.utils.reportError(arguments[0]);
+ }
+
+ // Defalt globals for all modules loaded using this loader.
+ var firebugScope =
+ {
+ window : window,
+ Firebug: Firebug,
+ FBL: FBL,
+ FBTrace: FBTrace,
+ FirebugReps: FirebugReps,
+ domplate: domplate,
+ TraceConsole: this,
+ };
+
+ Firebug.loadConfiguration = config;
+
+ // Create loader and load tracing module.
+ return new ModuleLoader(firebugScope, config);
+ }
+ catch (err)
+ {
+ FBTrace.sysout("FBTrace; EXCEPTION " + err + "\n");
+ }
+ },
+
+ updateTimeInfo: function()
+ {
+ var showTime = Firebug.Options.get("trace.showTime");
+ if (showTime)
+ FBL.setClass(this.logs.firstChild, "showTime");
+ else
+ FBL.removeClass(this.logs.firstChild, "showTime");
+ },
+
+ shutdown: function()
+ {
+ traceService.removeObserver(this, "firebug-trace-on-message");
+ prefs.removeObserver(this.prefDomain, this, false);
+
+ Firebug.TraceModule.onUnloadConsole(window);
+
+ // Unregister from the opener
+ if (this.addedOnCloseOpener)
+ {
+ window.opener.removeEventListener("close", this.onCloseOpener, true);
+ delete this.addedOnCloseOpener;
+ }
+ },
+
+ onCloseOpener: function()
+ {
+ if (FBTrace.DBG_INITIALIZE)
+ FBTrace.sysout("traceConsole.onCloseOpener closing window "+window.location);
+
+ window.close();
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Asynchronous display
+
+ initLayoutTimer: function()
+ {
+ var layoutTimeout = Firebug.Options.getPref(this.prefDomain, "fbtrace.layoutTimeout");
+ if (typeof(layoutTimeout) == "undefined")
+ return;
+
+ if (layoutTimeout <= 0)
+ return;
+
+ if (this.layoutTimeout)
+ clearTimeout(this.layoutTimeout);
+
+ var handler = FBL.bindFixed(this.flushCachedMessages, this);
+ this.layoutTimeout = setTimeout(handler, layoutTimeout);
+ },
+
+ flushCachedMessages: function()
+ {
+ if (!this.logs || !queue.length)
+ return;
+
+ // Fetch all cached messages.
+ for (var i=0; i<queue.length; i++)
+ this.dump(queue[i]);
+
+ queue = [];
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // nsIObserver
+
+ observe: function(subject, topic, data)
+ {
+ if (topic == "firebug-trace-on-message")
+ {
+ // Display messages only with "firebug.extensions" type.
+ var messageInfo = subject.wrappedJSObject;
+
+ // If the message type isn't specified, use Firebug's pref domain as the default.
+ if (!messageInfo.type)
+ messageInfo.type = "extensions.firebug";
+
+ if (messageInfo.type != this.prefDomain)
+ return;
+
+ var message = new Firebug.TraceModule.TraceMessage(
+ messageInfo.type, data, messageInfo.obj, messageInfo.scope,
+ messageInfo.time);
+
+ this.initLayoutTimer();
+
+ // If the content isn't loaded yet, remember all messages and insert them later.
+ if (this.logs && !this.layoutTimeout)
+ this.dump(message);
+ else
+ queue.push(message);
+
+ return true;
+ }
+ else if (topic == "nsPref:changed")
+ {
+ if (data == this.prefDomain + ".trace.showTime")
+ this.updateTimeInfo();
+ }
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Interface to the output nodes, going by the name outputNodes
+
+ getScrollingNode: function()
+ {
+ //window.dump(FBL.getStackDump());
+ //window.dump("traceConsole getScrollingNode this.scrollingNode "+this.scrollingNode+"\n");
+
+ return this.scrollingNode;
+ },
+
+ setScrollingNode: function(node)
+ {
+ this.scrollingNode = node;
+ },
+
+ getTargetNode: function()
+ {
+ //window.dump(FBL.getStackDump());
+ //window.dump("traceConsole getTargetgNode this.scrollingNode "+this.logs.firstChild+"\n");
+
+ return this.logs.firstChild;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Message dump
+
+ dump: function(message)
+ {
+ Firebug.TraceModule.dump(message, this);
+ },
+
+ dumpSeparator: function()
+ {
+ Firebug.TraceModule.MessageTemplate.dumpSeparator(this);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Trace console toolbar commands
+
+ onClearConsole: function()
+ {
+ FBL.clearNode(this.logs.firstChild);
+ },
+
+ onSeparateConsole: function()
+ {
+ Firebug.TraceModule.MessageTemplate.dumpSeparator(this);
+ },
+
+ onSaveToFile: function()
+ {
+ TraceConsole.Serializer.onSaveToFile(this);
+ },
+
+ onLoadFromFile: function()
+ {
+ TraceConsole.Serializer.onLoadFromFile(this);
+ },
+
+ onRestartFirefox: function()
+ {
+ prefService.savePrefFile(null);
+
+ Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup).
+ quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
+ },
+
+ onExitFirefox: function()
+ {
+ prefService.savePrefFile(null);
+
+ goQuitApplication();
+ },
+
+ onClearCache: function()
+ {
+ try
+ {
+ var cache = Cc["@mozilla.org/network/cache-service;1"].getService(Ci.nsICacheService);
+ cache.evictEntries(Ci.nsICache.STORE_ON_DISK);
+ cache.evictEntries(Ci.nsICache.STORE_IN_MEMORY);
+ }
+ catch(exc)
+ {
+ if (FBTrace.DBG_ERRORS)
+ FBTrace.sysout("traceConsole.onClearCache EXCEPTION " + exc, exc);
+ }
+ },
+
+ onForceGC: function()
+ {
+ try
+ {
+ FBL.jsd.GC();
+ }
+ catch(exc)
+ {
+ if (FBTrace.DBG_ERRORS)
+ FBTrace.sysout("traceConsole.onForceGC EXCEPTION " + exc, exc);
+ }
+ },
+
+ openProfileDir: function(context)
+ {
+ var profileFolder = directoryService.get("ProfD", Ci.nsIFile);
+ var path = profileFolder.QueryInterface(Ci.nsILocalFile).path;
+ var fileLocal = Cc["@mozilla.org/file/local;1"].getService(Ci.nsILocalFile);
+ fileLocal.initWithPath(path);
+ fileLocal.launch();
+ },
+
+ openFirefox: function(context)
+ {
+ var handler = Components.classes["@mozilla.org/browser/clh;1"]
+ .getService(Components.interfaces.nsIBrowserHandler);
+ var defaultArgs = handler.defaultArgs;
+
+ window.openDialog("chrome://browser/content/", "_blank",
+ "chrome,all,dialog=no", defaultArgs);
+ },
+
+ toggleFirebug: function(on, topWin)
+ {
+ if (!topWin)
+ {
+ if (!TraceCommandLine.currentWindow)
+ TraceCommandLine.toggleCommandLine();
+
+ topWin = TraceCommandLine.currentWindow;
+ }
+
+ if (topWin.Firebug && !topWin.Firebug.isShutdown)
+ topWin.Firebug.shutdown();
+
+ var doc = topWin.document;
+
+ // Remove all Firebug global includes (in browser.xul scope).
+ var scriptList = Array.slice(doc.querySelectorAll("script[src*='firebug/content/']"));
+ for each(var s in scriptList)
+ s.parentNode.removeChild(s);
+
+ // Remove Firebug panel
+ var splitter = doc.getElementById("fbContentSplitter");
+ var mainFrame = doc.getElementById("fbMainFrame");
+
+ if (mainFrame)
+ mainFrame.parentNode.removeChild(mainFrame);
+
+ if (splitter)
+ splitter.parentNode.removeChild(splitter);
+
+ topWin.Firebug = null;
+
+ if (!on)
+ return;
+
+ doc.addEventListener("FirebugLoaded", function onLoad()
+ {
+ doc.removeEventListener("FirebugLoaded", onLoad, false)
+ setTimeout(function(){topWin.Firebug.toggleBar(true)}, 200)
+ }, false);
+
+ // In order to load Firebug, dynamically apply its main overlay.
+ doc.loadOverlay("chrome://firebug/content/firefox/browserOverlayWithFrame.xul",
+ {observe: function(){}});
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Options
+
+ onOptionsShowing: function(popup)
+ {
+ for (var child = popup.firstChild; child; child = child.nextSibling)
+ {
+ if (child.localName == "menuitem")
+ {
+ var option = child.getAttribute("option");
+ if (option)
+ {
+ var checked = Firebug.Options.get(option);
+ child.setAttribute("checked", checked);
+ }
+ }
+ }
+ },
+
+ onToggleOption: function(target)
+ {
+ var option = target.getAttribute("option");
+ if (!option)
+ return;
+
+ var value = Firebug.Options.get(option);
+ Firebug.Options.set(option, !value);
+ }
+};
+
+// ************************************************************************************************
View
190 trace/FBTrace/chrome/content/traceConsole.xul
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+
+<?xml-stylesheet href="chrome://global/skin/global.css"?>
+<?xml-stylesheet href="chrome://global/skin/findBar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://fbtrace/content/traceConsole.css"?>
+<?xml-stylesheet href="chrome://fbtrace/skin/commandLine.css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ id="TraceConsole"
+ windowtype="FBTraceConsole"
+ title="Firebug Trace Console"
+ width="640" height="480"
+ screenX="10" screenY="10"
+ persist="screenX screenY width height sizemode"
+ onload="TraceConsole.initialize()"
+ onunload="TraceConsole.shutdown()">
+
+ <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
+ <script type="application/x-javascript" src="chrome://global/content/findBar.js"/>
+
+ <!-- Embedded Firebug Files -->
+ <script type="application/x-javascript" src="trace.js"/>
+ <script type="application/x-javascript" src="chrome://fbtrace-firebug/content/legacy.js"/>
+ <script type="application/x-javascript" src="resource://fbtrace-firebug/require.js"/>
+
+ <!-- Trace Console Application -->
+ <script type="application/x-javascript" src="traceConsole.js"/>
+ <script type="application/x-javascript" src="traceCommandLine.js"/>
+ <script type="application/x-javascript" src="main.js"/>
+ <script type="application/x-javascript" src="unblocker.js"/>
+ <script type="application/x-javascript" src="traceObjectInspector.js"/>
+
+ <!-- String Bundles -->
+ <stringbundle id="bundle_findBar" src="chrome://global/locale/findbar.properties"/>
+ <stringbundle id="strings_firebug" src="chrome://fbtrace-firebug/locale/firebug.properties"/>
+
+ <commandset id="mainCommandSet">
+ <command id="cmd_clearConsole" oncommand="TraceConsole.onClearConsole()"/>
+ <command id="cmd_find" oncommand="gFindBar.onFindCommand();"/>
+ <command id="cmd_findAgain" oncommand="gFindBar.onFindAgainCmd();"/>
+ <command id="cmd_findPrevious" oncommand="gFindBar.onFindPreviousCmd();"/>
+ <command id="cmd_separateConsole" oncommand="TraceConsole.onSeparateConsole();"/>
+ <command id="cmd_saveToFile" oncommand="TraceConsole.onSaveToFile();"/>
+ <command id="cmd_loadFromFile" oncommand="TraceConsole.onLoadFromFile();"/>
+ <command id="cmd_exitFirefox" oncommand="TraceConsole.onExitFirefox();"/>
+ <command id="cmd_restartFirefox" oncommand="TraceConsole.onRestartFirefox();"/>
+ <command id="cmd_copy" oncommand="goDoCommand('cmd_copy')" disabled="true"/>
+ <command id="cmd_clearCache" oncommand="TraceConsole.onClearCache()"/>
+ <command id="cmd_forceGC" oncommand="TraceConsole.onForceGC()"/>
+ <command id="cmd_openProfileDir" oncommand="TraceConsole.openProfileDir()"/>
+ <command id="cmd_openFirefox" oncommand="TraceConsole.openFirefox()"/>
+ <command id="cmd_turnOffFirebug" oncommand="TraceConsole.toggleFirebug(false)"/>
+ <command id="cmd_reloadFirebug" oncommand="TraceConsole.toggleFirebug(true)"/>
+ <command id="cmd_showCommandLine" oncommand="TraceCommandLine.toggleCommandLine()"/>
+ <command id="cmd_lineEvaluate" oncommand="TraceCommandLine.evaluate()"/>
+ <command id="cmd_traceObjectInspector" oncommand="TraceObjectInspector.inspect()"/>
+ <command id="cmd_alwaysOpenTraceConsole" oncommand="TraceConsole.onToggleOption(this)" option="alwaysOpenTraceConsole"/>
+ </commandset>
+
+ <keyset id="mainKeyset">
+ <key id="key_find" key="f" command="cmd_find" modifiers="accel"/>
+ <key id="key_separateConsole" key="b" command="cmd_separateConsole" modifiers="accel"/>
+ <key id="key_saveToFile" key="s" command="cmd_saveToFile" modifiers="accel"/>
+ <key id="key_loadFromFile" key="o" command="cmd_loadFromFile" modifiers="accel"/>
+ <key id="key_clearConsole" key="l" command="cmd_clearConsole" modifiers="accel"/>
+ <key id="key_lineEvaluate" keycode="VK_F5" command="cmd_lineEvaluate" modifiers="accel"/>
+ <key id="key_lineEvaluate" keycode="VK_RETURN" command="cmd_lineEvaluate" modifiers="accel"/>
+ </keyset>
+
+ <!-- Trace Console Toolbar -->
+ <toolbox id="consoleToolbox">
+ <toolbar id="consoleToolbar" align="center">
+ <toolbarbutton id="clearConsole"
+ label="tracing.cmd.Clear" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Clear"
+ command="cmd_clearConsole"/>
+ <toolbarbutton id="findConsole"
+ label="tracing.cmd.Find" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Find"
+ command="cmd_find"/>
+ <toolbarbutton id="separateConsole"
+ label="tracing.cmd.Bookmark" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Bookmark"
+ command="cmd_separateConsole"/>
+ <toolbarbutton id="traceToolsMenu"
+ class="toolbar-image-button fbmenubutton fbInternational"
+ label="tracing.cmd.Tools"
+ command="cmd_showCommandLine"
+ tooltiptext="tracing.cmd.tip.Tools"
+ type="menu-button">
+ <menupopup onpopupshowing="TraceConsole.onOptionsShowing(this)">
+ <menuitem id="saveToFile"
+ label="tracing.cmd.Save" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Save"
+ command="cmd_saveToFile"/>
+ <menuitem id="loadFromFile"
+ label="tracing.cmd.Load" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Load"
+ command="cmd_loadFromFile"/>
+ <menuseparator />
+ <menuitem id="showCommandLine" type="checkbox"
+ label="tracing.cmd.Show Command Line" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Show Command Line"
+ command="cmd_showCommandLine"/>
+ <menuitem id="turnOffFirebug"
+ label="tracing.cmd.Turn Off Firebug" class="toolbar-image-button fbInternational"
+ command="cmd_turnOffFirebug"/>
+ <menuitem id="reloadFirebug"
+ label="tracing.cmd.Reload Firebug" class="toolbar-image-button fbInternational"
+ command="cmd_reloadFirebug"/>
+ <menuseparator />
+ <menuitem id="clearCache"
+ label="tracing.cmd.Clear Browser Cache" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Clear Browser Cache"
+ command="cmd_clearCache"/>
+ <menuitem id="forceGC"
+ label="tracing.cmd.Force Garbage Collector" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Force Garbage Collector"
+ command="cmd_forceGC"/>
+ <menuitem id="openProfileDir"
+ label="tracing.cmd.Open Profile Directory" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Open Profile Directory"
+ command="cmd_openProfileDir"/>
+ <menuitem id="openFirefox"
+ label="tracing.cmd.Open Firefox" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Open Firefox"
+ command="cmd_openFirefox"/>
+ <menuseparator />
+ <menuitem id="traceObjectInspector"
+ label="tracing.cmd.Inspector" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Inspector"
+ command="cmd_traceObjectInspector"/>
+ <menuseparator />
+ <menuitem id="alwaysOpenTraceConsole"
+ type="checkbox" label="Always_Open"
+ command="cmd_alwaysOpenTraceConsole"
+ class="fbInternational" option="alwaysOpenTraceConsole"/>
+ </menupopup>
+ </toolbarbutton>
+ <toolbarseparator flex="1"/>
+ <toolbarbutton id="restartFirefox"
+ label="tracing.cmd.Restart" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Restart"
+ command="cmd_restartFirefox"/>
+ <toolbarbutton id="closeFirefox"
+ label="tracing.cmd.Exit" class="toolbar-image-button fbInternational"
+ tooltiptext="tracing.cmd.tip.Exit"
+ command="cmd_exitFirefox"/>
+ </toolbar>
+ </toolbox>
+
+ <popupset id="mainPopupSet">
+ <menupopup id="fbContextMenu" onpopupshowing="return Firebug.chrome.onContextShowing(event);" />
+ <tooltip id="fbTooltip" class="fbURLMenuItem" onpopupshowing="return Firebug.chrome.onTooltipShowing(event);"/>
+ </popupset>
+
+ <vbox flex="1">
+
+ <!-- Content -->
+ <browser id="consoleFrame" type="content-primary"
+ src="traceConsole.html" flex="1"
+ disablehistory="true" contextmenu="fbContextMenu"
+ tooltip="fbTooltip"/>
+
+ <splitter id="fbTraceSplitter" collapsed="true"/>
+
+ <!-- Command line -->
+ <vbox id="fbTraceCommandLine" collapsed="true" persist="height">
+ <toolbar id="commandLineToolbar" align="center">
+ <toolbarbutton id="cmdLineEvaluate" label="tracing.cmd.Evaluate"
+ tooltiptext="tracing.cmd.tip.Evaluate"
+ command="cmd_lineEvaluate" class="fbInternational">
+ </toolbarbutton>
+ <toolbarbutton id="cmdLineContext" label="Context" type="menu">
+ <menupopup onpopupshowing="return TraceCommandLine.onContextMenuShowing(this);"
+ onpopuphidden="TraceCommandLine.onContextMenuHidden(this)"/>
+ </toolbarbutton>
+ </toolbar>
+
+ <hbox id="fbTrace-editor" flex="1">
+ <textbox id="fbTraceScriptBox" multiline="true" flex="1"/>
+ </hbox>
+
+ </vbox>
+
+ <!-- Search bar -->
+ <findbar id="FindToolbar" browserid="consoleFrame"/>
+ </vbox>
+</window>
View
112 trace/FBTrace/chrome/content/traceFirebugOverlay.js
@@ -0,0 +1,112 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// Tracing Console Overlay Implementation
+
+/**
+ * This overlay is intended to append a new menu-item into the Firebug's icon menu.
+ * This menu is used to open the Tracing Console.
+ */
+var FBTraceFirebugOverlay = {};
+
+// traceFirebugOverlay.xul is applied on firebugOverlay.xul, which is living in an IFrame
+// (firebugFrame.xul). FBTrace is creating a new option 'FirebugMenu_Options_alwaysOpenTraceConsole'
+// that is inserted into 'fbFirebugMenuPopup'. This menu is used within the firebug's iframe
+// scope (Firebug icon menu) as well as in the global Firefox scope (browser.xul). In order to make
+// the global menu working, we need to expose 'FBTraceFirebugOverlay' to it.
+top.FBTraceFirebugOverlay = FBTraceFirebugOverlay;
+
+// ********************************************************************************************* //
+
+(function() {
+
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+
+this.initialize = function()
+{
+ window.removeEventListener("load", FBTraceFirebugOverlay.initialize, false);
+};
+
+this.onToggleOption = function(target)
+{
+ Firebug.chrome.onToggleOption(target);
+
+ // Open automatically if set to "always open", close otherwise.
+ if (Firebug.Options.getPref(Firebug.prefDomain, "alwaysOpenTraceConsole"))
+ this.openConsole();
+ else
+ this.closeConsole();
+};
+
+this.openConsole = function(prefDomain, windowURL)
+{
+ if (!prefDomain)
+ prefDomain = "extensions.firebug";
+
+ var self = this;
+ FBL.iterateBrowserWindows("FBTraceConsole", function(win) {
+ if (win.TraceConsole && win.TraceConsole.prefDomain == prefDomain) {
+ self.consoleWindow = win;
+ return true;
+ }
+ });
+
+ // Try to connect an existing trace-console window first.
+ if (this.consoleWindow && this.consoleWindow.TraceConsole) {
+ this.consoleWindow.focus();
+ return;
+ }
+
+ if (!windowURL)
+ windowURL = this.getTraceConsoleURL();
+
+ if (FBTrace.DBG_OPTIONS)
+ FBTrace.sysout("traceModule.openConsole, prefDomain: " + prefDomain);
+
+ var self = this;
+ var args = {
+ prefDomain: prefDomain,
+ };
+
+ if (FBTrace.DBG_OPTIONS) {
+ for (var p in args)
+ FBTrace.sysout("tracePanel.openConsole prefDomain:" +
+ prefDomain +" args["+p+"]= "+ args[p]+"\n");
+ }
+
+ this.consoleWindow = window.openDialog(
+ windowURL,
+ "FBTraceConsole." + prefDomain,
+ "chrome,resizable,scrollbars=auto,minimizable,dialog=no",
+ args);
+},
+
+this.closeConsole = function(prefDomain)
+{
+ if (!prefDomain)
+ prefDomain = this.prefDomain;
+
+ var consoleWindow = null;
+ FBL.iterateBrowserWindows("FBTraceConsole", function(win) {
+ if (win.TraceConsole && win.TraceConsole.prefDomain == prefDomain) {
+ consoleWindow = win;
+ return true;
+ }
+ });
+
+ if (consoleWindow)
+ consoleWindow.close();
+},
+
+this.getTraceConsoleURL = function()
+{
+ return "chrome://fbtrace/content/traceConsole.xul";
+}
+
+// Register load listener for command line arguments handling.
+window.addEventListener("load", FBTraceFirebugOverlay.initialize, false);
+
+}).apply(FBTraceFirebugOverlay);
+
+// ********************************************************************************************* //
View
30 trace/FBTrace/chrome/content/traceFirebugOverlay.xul
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/x-javascript" src="chrome://fbtrace/content/traceFirebugOverlay.js"/>
+
+ <commandset id="mainCommandSet">
+ <command id="cmd_openTraceConsole" oncommand="FBTraceFirebugOverlay.openConsole()"/>
+ </commandset>
+
+ <keyset id="mainKeyset">
+ <key id="key_openTraceConsole" key="r" modifiers="shift" command="cmd_openTraceConsole" class="fbOnlyKey"/>
+ </keyset>
+
+ <!-- Overlay for Firebug menu -->
+ <menupopup id="fbFirebugMenuPopup">
+ <menuitem id="menu_openTraceConsole" label="Open_Firebug_Tracing"
+ command="cmd_openTraceConsole" insertbefore="menu_aboutSeparator"
+ class="fbInternational" key="key_openTraceConsole"/>
+
+ <menu id="FirebugMenu_Options">
+ <menupopup id="FirebugMenu_OptionsPopup">
+ <menuitem id="FirebugMenu_Options_alwaysOpenTraceConsole"
+ insertbefore="menu_optionsSeparator"
+ type="checkbox" label="Always_Open_Firebug_Tracing"
+ oncommand="FBTraceFirebugOverlay.onToggleOption(this)"
+ class="fbInternational" option="alwaysOpenTraceConsole"/>
+ </menupopup>
+ </menu>
+ </menupopup>
+
+</overlay>
View
16 trace/FBTrace/chrome/content/traceLogFrame.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/panelbase.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/dom.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/console.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-firebug/skin/win/panel.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace/skin/traceConsole.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://fbtrace-os/skin/traceConsole.css" type="text/css"/>
+</head>
+<body>
+ <div id="traceLogContent"/>
+</body>
+</html>
View
1,983 trace/FBTrace/chrome/content/traceModule.js
@@ -0,0 +1,1983 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/firebug",
+ "firebug/firefox/xpcom",
+ "firebug/chrome/reps",
+],
+function(FBL, Firebug, XPCOM, FirebugReps) { with (FBL) {
+
+// ************************************************************************************************
+// Shortcuts and Services
+
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+
+var clipboard = XPCOM.CCSV("@mozilla.org/widget/clipboard;1", "nsIClipboard");
+var wm = XPCOM.CCSV("@mozilla.org/appshell/window-mediator;1", "nsIWindowMediator");
+
+var PrefService = Cc["@mozilla.org/preferences-service;1"];
+var prefs = PrefService.getService(Ci.nsIPrefBranch2);
+var prefService = PrefService.getService(Ci.nsIPrefService);
+
+var reDBG = /extensions\.([^\.]*)\.(DBG_.*)/;
+var reDBG_FBS = /DBG_FBS_(.*)/;
+
+var EOF = "<br/>";
+
+// Register locale file with strings for the Tracing Console window.
+Firebug.registerStringBundle("chrome://fbtrace/locale/firebug-tracing.properties");
+
+// ************************************************************************************************
+// The controller for the prefDomain Model.
+// getOptionsMenuItems to create View, onPrefChangeHandler for View update
+// base for trace viewers like tracePanel and traceConsole
+// binds to the branch 'prefDomain' of prefs
+
+Firebug.TraceOptionsController = function(prefDomain, onPrefChangeHandler)
+{
+ this.prefDomain = prefDomain;
+
+ Components.utils["import"]("resource://fbtrace/firebug-trace-service.js");
+ this.traceService = traceConsoleService;
+
+ this.addObserver = function()
+ {
+ prefs.setBoolPref("browser.dom.window.dump.enabled", true);
+ this.observer = { observe: bind(this.observe, this) };
+ prefs.addObserver(prefDomain, this.observer, false);
+ };
+
+ this.removeObserver = function()
+ {
+ prefs.removeObserver( prefDomain, this.observer, false);
+ };
+
+ // nsIObserver
+ this.observe = function(subject, topic, data)
+ {
+ if (topic == "nsPref:changed")
+ {
+ var m = reDBG.exec(data);
+ if (m)
+ {
+ var changedPrefDomain = "extensions." + m[1];
+ if (changedPrefDomain == prefDomain)
+ {
+ var optionName = data.substr(prefDomain.length+1); // skip dot
+ var optionValue = Firebug.Options.getPref(prefDomain, m[2]);
+ if (this.prefEventToUserEvent)
+ this.prefEventToUserEvent(optionName, optionValue);
+ }
+ }
+ else
+ {
+ if (typeof(FBTrace) != "undefined" && FBTrace.DBG_OPTIONS)
+ FBTrace.sysout("traceModule.observe : "+data+"\n");
+ }
+ }
+ };
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ // UI
+
+ this.getOptionsMenuItems = function() // Firebug menu items from option map
+ {
+ var optionMap = this.traceService.getTracer(prefDomain);
+ var items = [];
+ for (var p in optionMap)
+ {
+ var m = p.indexOf("DBG_");
+ if (m != 0)
+ continue;
+
+ try
+ {
+ var prefValue = Firebug.Options.getPref(this.prefDomain, p);
+ var label = p.substr(4);
+ items.push({