Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Append 1.9 test files

  • Loading branch information...
commit 17469efae1b5c2f5ea38dbcac1484a0ed48cc510 1 parent c7accdc
Jan Odvarko janodvarko authored
Showing with 41,415 additions and 0 deletions.
  1. +11 −0 tests/.project
  2. +11 −0 tests/FBTest/.project
  3. +159 −0 tests/FBTest/build.xml
  4. +25 −0 tests/FBTest/chrome.manifest
  5. +109 −0 tests/FBTest/components/commandLine.js
  6. +202 −0 tests/FBTest/components/testHistory.js
  7. +25 −0 tests/FBTest/content/.tmp_testFrame.html.15234~
  8. +18 −0 tests/FBTest/content/.tmp_testFrame.html.37785~
  9. +18 −0 tests/FBTest/content/.tmp_testFrame.html.92027~
  10. +18 −0 tests/FBTest/content/.tmp_testFrame.html.99625~
  11. +8 −0 tests/FBTest/content/.tmp_testListFrame.html.97168~
  12. +43 −0 tests/FBTest/content/.tmp_wrapAJSFile.html.18470~
  13. +43 −0 tests/FBTest/content/.tmp_wrapAJSFile.html.21520~
  14. +43 −0 tests/FBTest/content/.tmp_wrapAJSFile.html.48334~
  15. +43 −0 tests/FBTest/content/.tmp_wrapAJSFile.html.7314~
  16. +43 −0 tests/FBTest/content/.tmp_wrapAJSFile.html.75914~
  17. +43 −0 tests/FBTest/content/.tmp_wrapAJSFile.html.81520~
  18. +64 −0 tests/FBTest/content/FBTest.js
  19. +2,610 −0 tests/FBTest/content/FBTestFirebug.js
  20. +390 −0 tests/FBTest/content/FBTestMutation.js
  21. +36 −0 tests/FBTest/content/FBTestSelection.js
  22. +13 −0 tests/FBTest/content/bindings.css
  23. +78 −0 tests/FBTest/content/bindings.xml
  24. +3 −0  tests/FBTest/content/fbtest.properties
  25. +121 −0 tests/FBTest/content/haltOnFailedTest.js
  26. +21 −0 tests/FBTest/content/haltOnFailedTest.xul
  27. +163 −0 tests/FBTest/content/jsdiff.js
  28. +31 −0 tests/FBTest/content/main.js
  29. +30 −0 tests/FBTest/content/notify.js
  30. +148 −0 tests/FBTest/content/overlayFirebug.js
  31. +40 −0 tests/FBTest/content/overlayFirebug.xul
  32. +194 −0 tests/FBTest/content/propTree.js
  33. +932 −0 tests/FBTest/content/testConsole.js
  34. +200 −0 tests/FBTest/content/testConsole.xul
  35. +87 −0 tests/FBTest/content/testCore.js
  36. +335 −0 tests/FBTest/content/testCouchUploader.js
  37. +18 −0 tests/FBTest/content/testFrame.html
  38. +8 −0 tests/FBTest/content/testListFrame.html
  39. +326 −0 tests/FBTest/content/testListLoader.js
  40. +714 −0 tests/FBTest/content/testListRep.js
  41. +197 −0 tests/FBTest/content/testLogger.js
  42. +711 −0 tests/FBTest/content/testResultRep.js
  43. +814 −0 tests/FBTest/content/testRunner.js
  44. +43 −0 tests/FBTest/content/wrapAJSFile.html
  45. +32 −0 tests/FBTest/defaults/preferences/prefs.js
  46. +33 −0 tests/FBTest/install.rdf
  47. +30 −0 tests/FBTest/license.txt
  48. +65 −0 tests/FBTest/locale/en-US/fbtest.properties
  49. +825 −0 tests/FBTest/modules/EventUtils.js
  50. +13 −0 tests/FBTest/modules/FBTestIntegrate.js
  51. BIN  tests/FBTest/skin/classic/Throbber-small.png
  52. +6 −0 tests/FBTest/skin/classic/base.css
  53. BIN  tests/FBTest/skin/classic/buttons.png
  54. BIN  tests/FBTest/skin/classic/clear.png
  55. BIN  tests/FBTest/skin/classic/downloadButtons-aero.png
  56. BIN  tests/FBTest/skin/classic/restart.png
  57. BIN  tests/FBTest/skin/classic/runAll.png
  58. BIN  tests/FBTest/skin/classic/runAll2.png
  59. +74 −0 tests/FBTest/skin/classic/tabView.css
  60. +99 −0 tests/FBTest/skin/classic/testConsole.css
  61. +233 −0 tests/FBTest/skin/classic/testList.css
  62. +218 −0 tests/FBTest/skin/classic/testResult.css
  63. +5 −0 tests/FBTest/skin/classic/traceConsole.css
  64. +23 −0 tests/FBTest/update.rdf
  65. +24 −0 tests/content/bti/browser/getContext.js
  66. +27 −0 tests/content/bti/browser/getContexts.js
  67. +29 −0 tests/content/bti/browser/getFocusContext.js
  68. +18 −0 tests/content/bti/browser/isConnected.js
  69. +4 −0 tests/content/bti/browser/missing-tests.txt
  70. +21 −0 tests/content/bti/browser/onContextCreated.js
  71. +21 −0 tests/content/bti/browser/onContextLoaded.js
  72. +17 −0 tests/content/bti/browser/onDisconnect.js
  73. +23 −0 tests/content/bti/browser/onScriptEmbedded.js
  74. +24 −0 tests/content/bti/browser/onScriptExternal.js
  75. +1 −0  tests/content/bti/browser/simpleExternal.js
  76. +19 −0 tests/content/bti/browser/testExternalScript.html
  77. +20 −0 tests/content/bti/browser/testGetContexts.html
  78. +25 −0 tests/content/bti/browsercontext/exists.js
  79. +22 −0 tests/content/bti/browsercontext/getBrowser.js
  80. +38 −0 tests/content/bti/browsercontext/getCompilationUnits.js
  81. +22 −0 tests/content/bti/browsercontext/getJavaScriptContext.js
  82. +28 −0 tests/content/bti/browsercontext/isLoaded.js
  83. +1 −0  tests/content/bti/browsercontext/simpleExternal.js
  84. +23 −0 tests/content/bti/browsercontext/testScripts.html
  85. +33 −0 tests/content/bti/compilationunit/getExternalSource.js
  86. +42 −0 tests/content/bti/compilationunit/setBreakpoint.js
  87. +2 −0  tests/content/bti/compilationunit/simpleExternal.js
  88. +23 −0 tests/content/bti/compilationunit/testScripts.html
  89. +9 −0 tests/content/chrome/1883/issue1883.html
  90. +54 −0 tests/content/chrome/1883/issue1883.js
  91. +27 −0 tests/content/commandLine/2934/issue2934.html
  92. +116 −0 tests/content/commandLine/2934/issue2934.js
  93. +110 −0 tests/content/commandLine/3363/issue3363.html
  94. +81 −0 tests/content/commandLine/3363/issue3363.js
  95. +31 −0 tests/content/commandLine/3599/issue3599.html
  96. +34 −0 tests/content/commandLine/3599/issue3599.js
  97. +29 −0 tests/content/commandLine/3703/issue3703.html
  98. +21 −0 tests/content/commandLine/3703/issue3703.js
  99. +46 −0 tests/content/commandLine/3709/issue3709.htm
  100. +24 −0 tests/content/commandLine/3709/issue3709.js
  101. +31 −0 tests/content/commandLine/4087/issue4087.html
  102. +62 −0 tests/content/commandLine/4087/issue4087.js
  103. +29 −0 tests/content/commandLine/4209/issue4209.html
  104. +23 −0 tests/content/commandLine/4209/issue4209.js
  105. +34 −0 tests/content/commandLine/4217/issue4217.html
  106. +45 −0 tests/content/commandLine/4217/issue4217.js
  107. +37 −0 tests/content/commandLine/4218/issue4218.html
  108. +37 −0 tests/content/commandLine/4218/issue4218.js
  109. +29 −0 tests/content/commandLine/4234/issue4234.html
  110. +23 −0 tests/content/commandLine/4234/issue4234.js
  111. +60 −0 tests/content/commandLine/4391/issue4391.html
  112. +63 −0 tests/content/commandLine/4391/issue4391.js
  113. +8,865 −0 tests/content/commandLine/4391/jquery-latest.js
  114. +49 −0 tests/content/commandLine/4434/issue4434.html
  115. +63 −0 tests/content/commandLine/4434/issue4434.js
  116. +25 −0 tests/content/commandLine/4453/issue4453.html
  117. +32 −0 tests/content/commandLine/4453/issue4453.js
  118. +29 −0 tests/content/commandLine/5042/issue5042.html
  119. +33 −0 tests/content/commandLine/5042/issue5042.js
  120. +57 −0 tests/content/commandLine/api.html
  121. +92 −0 tests/content/commandLine/api.js
  122. +36 −0 tests/content/commandLine/cd.html
  123. +29 −0 tests/content/commandLine/cd.js
  124. +10 −0 tests/content/commandLine/cdFrame.html
  125. +34 −0 tests/content/commandLine/debug.html
  126. +51 −0 tests/content/commandLine/debug.js
  127. +53 −0 tests/content/commandLine/dom.html
  128. +94 −0 tests/content/commandLine/dom.js
  129. +28 −0 tests/content/commandLine/monitorEvents.html
  130. +50 −0 tests/content/commandLine/monitorEvents.js
  131. +23 −0 tests/content/commandLine/objects.html
  132. +17 −0 tests/content/commandLine/objects.js
  133. +34 −0 tests/content/commandLine/profile.html
  134. +20 −0 tests/content/commandLine/profile.js
  135. +239 −0 tests/content/console/1495/fx.js
  136. +61 −0 tests/content/console/1495/issue1495.html
  137. +69 −0 tests/content/console/1495/issue1495.js
  138. +272 −0 tests/content/console/1495/parser.js
  139. +43 −0 tests/content/console/1495/sniff.js
  140. +127 −0 tests/content/console/1495/stamp.js
  141. +51 −0 tests/content/console/1601/consoleLogErrorObject.html
  142. +28 −0 tests/content/console/1601/consoleLogErrorObject.js
  143. +59 −0 tests/content/console/1693/issue1693.html
  144. +66 −0 tests/content/console/1693/issue1693.js
  145. +10 −0 tests/content/console/1693/issue1693.php
  146. +62 −0 tests/content/console/2122/issue2122.html
  147. +113 −0 tests/content/console/2122/issue2122.js
  148. +37 −0 tests/content/console/2160/issue2160.html
  149. +86 −0 tests/content/console/2160/issue2160.js
  150. +48 −0 tests/content/console/2271/issue2271.html
  151. +42 −0 tests/content/console/2271/issue2271.js
  152. +1 −0  tests/content/console/2271/issue2271.php
  153. +44 −0 tests/content/console/2328/issue2328.html
  154. +42 −0 tests/content/console/2328/issue2328.js
  155. +11 −0 tests/content/console/2328/issue2328.php
  156. +31 −0 tests/content/console/2659/issue2659.html
  157. +46 −0 tests/content/console/2659/issue2659.js
  158. +24 −0 tests/content/console/2694/issue2694.html
  159. +44 −0 tests/content/console/2694/issue2694.js
  160. +16 −0 tests/content/console/2914/issue2914-innerFrame.html
  161. +37 −0 tests/content/console/2914/issue2914.html
  162. +37 −0 tests/content/console/2914/issue2914.js
  163. +9 −0 tests/content/console/2948/issue2948-popup.html
  164. +67 −0 tests/content/console/2948/issue2948.html
  165. +57 −0 tests/content/console/2948/issue2948.js
  166. +4 −0 tests/content/console/2948/issue2948.php
  167. +39 −0 tests/content/console/3029/issue3029.html
  168. +40 −0 tests/content/console/3029/issue3029.js
  169. +27 −0 tests/content/console/3078/issue3078.html
  170. +26 −0 tests/content/console/3078/issue3078.js
  171. +87 −0 tests/content/console/3204/issue3204.html
  172. +42 −0 tests/content/console/3204/issue3204.js
  173. +12 −0 tests/content/console/3292/issue3292-innerFrame.html
  174. +38 −0 tests/content/console/3292/issue3292.html
  175. +66 −0 tests/content/console/3292/issue3292.js
  176. +1 −0  tests/content/console/3292/js/issue3292-included.js
  177. +43 −0 tests/content/console/3408/issue3408.html
  178. +49 −0 tests/content/console/3408/issue3408.js
  179. +74 −0 tests/content/console/3980/issue3980.html
  180. +95 −0 tests/content/console/3980/issue3980.js
  181. +33 −0 tests/content/console/4322/issue4322.html
  182. +30 −0 tests/content/console/4322/issue4322.js
  183. +28 −0 tests/content/console/4384/issue4384.html
  184. +20 −0 tests/content/console/4384/issue4384.js
  185. +30 −0 tests/content/console/4493/issue4493.html
  186. +42 −0 tests/content/console/4658/issue4658.html
  187. +21 −0 tests/content/console/4658/issue4658.js
  188. +11,363 −0 tests/content/console/4658/js/wsdojo/dojo/dojo.js.uncompressed.js
  189. +9 −0 tests/content/console/4658/js/wsdojo/ws/monitor/FirebugBug.js
  190. +39 −0 tests/content/console/5026/issue5026.html
  191. +34 −0 tests/content/console/5026/issue5026.js
  192. +44 −0 tests/content/console/5033/issue5033.html
  193. +48 −0 tests/content/console/5033/issue5033.js
  194. +42 −0 tests/content/console/766/issue766.html
  195. +52 −0 tests/content/console/766/issue766.js
  196. +45 −0 tests/content/console/872/872.js
  197. +12 −0 tests/content/console/872/iframe.html
  198. +30 −0 tests/content/console/872/main.html
  199. +3 −0  tests/content/console/882/external.js
  200. +35 −0 tests/content/console/882/issue882.html
  201. +58 −0 tests/content/console/882/issue882.js
  202. +48 −0 tests/content/console/api/assert.html
  203. +72 −0 tests/content/console/api/assert.js
  204. +36 −0 tests/content/console/api/clear.html
  205. +20 −0 tests/content/console/api/clear.js
  206. +39 −0 tests/content/console/api/count.html
  207. +36 −0 tests/content/console/api/count.js
  208. +35 −0 tests/content/console/api/debug.html
  209. +21 −0 tests/content/console/api/debug.js
  210. +43 −0 tests/content/console/api/dir.html
  211. +97 −0 tests/content/console/api/dir.js
  212. +48 −0 tests/content/console/api/dirxml.html
  213. +21 −0 tests/content/console/api/dirxml.js
  214. +36 −0 tests/content/console/api/error.html
  215. +34 −0 tests/content/console/api/error.js
  216. +44 −0 tests/content/console/api/exception.html
  217. +21 −0 tests/content/console/api/exception.js
  218. +53 −0 tests/content/console/api/group.html
  219. +72 −0 tests/content/console/api/group.js
  220. +35 −0 tests/content/console/api/info.html
  221. +21 −0 tests/content/console/api/info.js
  222. +38 −0 tests/content/console/api/log-xpathresult.html
  223. +27 −0 tests/content/console/api/log-xpathresult.js
  224. +32 −0 tests/content/console/api/log.html
  225. +21 −0 tests/content/console/api/log.js
  226. +39 −0 tests/content/console/api/memoryProfile.html
  227. +35 −0 tests/content/console/api/memoryProfile.js
  228. +45 −0 tests/content/console/api/profile.html
  229. +55 −0 tests/content/console/api/profile.js
  230. +267 −0 tests/content/console/api/table.html
  231. +124 −0 tests/content/console/api/table.js
  232. +42 −0 tests/content/console/api/time.html
  233. +30 −0 tests/content/console/api/time.js
  234. +39 −0 tests/content/console/api/trace.html
  235. +34 −0 tests/content/console/api/trace.js
  236. +35 −0 tests/content/console/api/warn.html
  237. +21 −0 tests/content/console/api/warn.js
  238. +32 −0 tests/content/console/breakOnError/breakOnError.html
  239. +34 −0 tests/content/console/breakOnError/breakOnError.js
  240. +23 −0 tests/content/console/completion/3394/issue3394.html
  241. +22 −0 tests/content/console/completion/3394/issue3394.js
  242. +52 −0 tests/content/console/completion/3421/issue3421.html
  243. +59 −0 tests/content/console/completion/3421/issue3421.js
  244. +23 −0 tests/content/console/completion/3466/issue3466.html
  245. +22 −0 tests/content/console/completion/3466/issue3466.js
  246. +104 −0 tests/content/console/completion/4233/issue4233.html
  247. +108 −0 tests/content/console/completion/4233/issue4233.js
  248. +36 −0 tests/content/console/completion/4931/issue4931.html
  249. +38 −0 tests/content/console/completion/4931/issue4931.js
  250. +41 −0 tests/content/console/completion/5006/issue5006.html
  251. +76 −0 tests/content/console/completion/5006/issue5006.js
  252. +68 −0 tests/content/console/completion/index/index.html
  253. +73 −0 tests/content/console/completion/index/index.js
  254. +20 −0 tests/content/console/consoleOnOtherPanels.html
  255. +76 −0 tests/content/console/consoleOnOtherPanels.js
  256. +23 −0 tests/content/console/issue1591.html
  257. +41 −0 tests/content/console/issue1591.js
  258. +25 −0 tests/content/console/onreadystatechange.html
  259. +23 −0 tests/content/console/onreadystatechange.js
  260. +26 −0 tests/content/console/panelContentAfterDisable.js
  261. +30 −0 tests/content/console/panelContentAfterDisable1.6.js
  262. +23 −0 tests/content/console/panelContentAfterReopen.html
  263. +36 −0 tests/content/console/panelContentAfterReopen.js
  264. +148 −0 tests/content/console/reps/console_array.html
  265. +62 −0 tests/content/console/reps/console_array.js
  266. +65 −0 tests/content/console/spy/2285/.tmp_issue2285.html.2687~
  267. +65 −0 tests/content/console/spy/2285/issue2285.html
  268. +49 −0 tests/content/console/spy/2285/issue2285.js
  269. +14 −0 tests/content/console/spy/2285/issue2285.php
  270. +1 −0  tests/content/console/spy/2462/Issue2462.php
  271. +37 −0 tests/content/console/spy/2462/issue2462.html
  272. +22 −0 tests/content/console/spy/2462/issue2462.js
  273. +42 −0 tests/content/console/spy/2712/issue2712.html
  274. +23 −0 tests/content/console/spy/2712/issue2712.js
  275. +1 −0  tests/content/console/spy/2712/issue2712.php
  276. +45 −0 tests/content/console/spy/2868/issue2868.html
  277. +31 −0 tests/content/console/spy/2868/issue2868.js
  278. +4 −0 tests/content/console/spy/2868/issue2868.php
  279. +152 −0 tests/content/console/spy/2868/jquery.js
  280. +43 −0 tests/content/console/spy/4085/issue4085.html
  281. +25 −0 tests/content/console/spy/4085/issue4085.js
  282. +49 −0 tests/content/console/spy/4738/issue4738.html
  283. +37 −0 tests/content/console/spy/4738/issue4738.js
  284. +92 −0 tests/content/console/testErrors.html
  285. +118 −0 tests/content/console/testErrors.js
  286. +75 −0 tests/content/console/testErrors1.4.js
  287. +72 −0 tests/content/css/1189/issue1189.html
  288. +68 −0 tests/content/css/1189/issue1189.js
  289. +65 −0 tests/content/css/1338/issue1338.html
  290. +46 −0 tests/content/css/1338/issue1338.js
  291. +32 −0 tests/content/css/2440/issue2440-iframe.html
  292. +7 −0 tests/content/css/2440/issue2440.css
  293. +65 −0 tests/content/css/2440/issue2440.html
  294. +82 −0 tests/content/css/2440/issue2440.js
  295. +43 −0 tests/content/css/2976/issue2976.html
  296. +31 −0 tests/content/css/2976/issue2976.js
  297. +31 −0 tests/content/css/2978/issue2978.html
  298. +40 −0 tests/content/css/2978/issue2978.js
  299. +46 −0 tests/content/css/3207/issue3207.html
  300. +66 −0 tests/content/css/3207/issue3207.js
Sorry, we could not display the entire diff because too many files (733) changed.
11 tests/.project
View
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>(firebug) Firebug Tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
11 tests/FBTest/.project
View
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>(firebug) FBTest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
159 tests/FBTest/build.xml
View
@@ -0,0 +1,159 @@
+<?xml version="1.0" ?>
+
+<!-- In order to build FBTest extension run: $ant build
+ The final xpi file should be located in a release directory -->
+<project name="fbtest" basedir="." default="build">
+
+ <!-- Properties -->
+ <property file="content/fbtest.properties"/>
+
+ <!-- Directories -->
+ <property name="build.dir" value="release"/>
+ <property name="release.dir" value="./release"/>
+ <property name="deploy-xpi.dir" value="${GETFIREBUG}/releases/fbtest/${VERSION}"/>
+ <property name="deploy-jsdoc.dir" value="${GETFIREBUG}/developer/api/fbtest${VERSION}"/>
+
+ <available file="${GETFIREBUG}" property="deploy.dir.available"/>
+
+ <!-- echo -->
+ <target name="echo">
+ <echo message="Build directory: ${build.dir}"/>
+ <echo message="Deploy directory ${GETFIREBUG} available: ${deploy.dir.available}"/>
+ </target>
+
+ <!-- Clean -->
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <!-- Build -->
+ <target name="build" depends="clean">
+
+ <!-- Copy components directory -->
+ <copy todir="${build.dir}/components">
+ <fileset dir="components">
+ <include name="*.js"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy content directory -->
+ <copy todir="${build.dir}/content">
+ <fileset dir="content">
+ <include name="*.js"/>
+ <include name="*.css"/>
+ <include name="*.xml"/>
+ <include name="*.xul"/>
+ <include name="*.html"/>
+ <include name="*.properties"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy defaults directory -->
+ <copy todir="${build.dir}/defaults">
+ <fileset dir="defaults">
+ <include name="**/*.js"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy locale directory -->
+ <copy todir="${build.dir}/locale">
+ <fileset dir="locale">
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy skin directory -->
+ <copy todir="${build.dir}/skin">
+ <fileset dir="skin">
+ <include name="**/*.css"/>
+ <include name="**/*.png"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy modules 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 fbtest.properties file -->
+ <replace file="${build.dir}/install.rdf" propertyFile="content/fbtest.properties">
+ <replacefilter token="@VERSION@" property="VERSION"/>
+ <replacefilter token="@RELEASE@" property="RELEASE"/>
+ </replace>
+
+ <!-- Create final fbTest.xpi file -->
+ <zip destfile="${build.dir}/fbTest-${VERSION}${RELEASE}.xpi"
+ basedir="${build.dir}" update="true" />
+
+ <!-- Generate update.rdf file -->
+ <replace file="${build.dir}/update.rdf" propertyFile="content/fbtest.properties">
+ <replacefilter token="@VERSION@" property="VERSION"/>
+ <replacefilter token="@RELEASE@" property="RELEASE"/>
+ </replace>
+
+ <!-- Final version message -->
+ <echo message="FBTest 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}/fbTest-${VERSION}${RELEASE}.xpi" todir="${deploy-xpi.dir}" overwrite="true"/>
+ <echo message="XPI deployed to: ${VERSION}${RELEASE} to ${deploy-xpi.dir}"/>
+ </target>
+
+ <!-- Deploy if target available -->
+ <target name="deploy-jsdoc" if="deploy.dir.available">
+
+ <!-- Deploy jsdoc -->
+ <copy todir="${deploy-jsdoc.dir}">
+ <fileset dir="${release.dir}/jsdoc"/>
+ </copy>
+
+ <echo message="JSDoc deployed to: ${VERSION}${RELEASE} to ${deploy-xpi.dir}"/>
+ </target>
+
+ <!-- Support for generating docs from source code comments using js-doc-toolkit -->
+ <target name="jsdoc" description="Generate documentation">
+
+ <property name="jsdoc.dir" value="../../../jsdoc/"/>
+ <property name="jsdoc-toolkit.dir" value="${jsdoc.dir}/jsdoc-toolkit-2.3.0/"/>
+ <property name="jsdoc-output.dir" value="${release.dir}/jsdoc/"/>
+
+ <path id="jsdoctoolkit">
+ <!-- Rhino js.jar 1.7.R2 must be used with jsdoctoolkit-ant-task-1.0.1.jar -->
+ <fileset dir="${jsdoc.dir}" includes="*.jar"/>
+ </path>
+
+ <taskdef name="jsdoctoolkit"
+ classpathref="jsdoctoolkit"
+ classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"/>
+
+ <echo message="Generate doc from FBTest source ($svn/jsdoc/out/)."/>
+
+ <!-- Clean the output direcotory -->
+ <delete dir="${jsdoc-output.dir}"/>
+
+ <!-- Parse all source files -->
+ <jsdoctoolkit jsdochome="${jsdoc-toolkit.dir}"
+ template="firebug"
+ outputdir="${jsdoc-output.dir}"
+ inputdir="." />
+
+ <!-- Deploy -->
+ <antcall target="deploy-jsdoc" />
+ </target>
+</project>
25 tests/FBTest/chrome.manifest
View
@@ -0,0 +1,25 @@
+content fbtest content/
+skin fbtest classic/1.0 skin/classic/
+locale fbtest en-US locale/en-US/
+
+# Maps resource://fbtest/* to files in modules/*
+resource fbtest modules/
+
+
+overlay chrome://firebug/content/firebugOverlay.xul chrome://fbtest/content/overlayFirebug.xul
+overlay chrome://firebug/content/firefox/browserOverlayWithFrame.xul chrome://fbtest/content/overlayFirebug.xul
+overlay chrome://fbtest/content/testConsole.xul chrome://fbtest/content/haltOnFailedTest.xul
+
+component {F483275E-ECC6-4028-B375-92498C0AD76F} components/commandLine.js
+contract @mozilla.org/commandlinehandler/general-startup;1?type=FBTest {F483275E-ECC6-4028-B375-92498C0AD76F}
+category command-line-handler m-FBTest @mozilla.org/commandlinehandler/general-startup;1?type=FBTest
+
+component {3008FA55-C12F-4992-9930-B9D52F0CF037} components/testHistory.js
+contract @mozilla.org/autocomplete/search;1?name=FBTestHistory {3008FA55-C12F-4992-9930-B9D52F0CF037}
+
+component {B37D6564-77D9-4613-B088-324389E1A8F3} components/testHistory.js
+contract @mozilla.org/autocomplete/search;1?name=FBTestCaseHistory {B37D6564-77D9-4613-B088-324389E1A8F3}
+
+component {3882FC1B-D32A-4722-B935-FA82142808A5} components/testHistory.js
+contract @mozilla.org/autocomplete/search;1?name=FBTestDriverHistory {3882FC1B-D32A-4722-B935-FA82142808A5}
+
109 tests/FBTest/components/commandLine.js
View
@@ -0,0 +1,109 @@
+/* See license.txt for terms of usage */
+
+// ************************************************************************************************
+// Constants
+
+const CLASS_ID = Components.ID("{F483275E-ECC6-4028-B375-92498C0AD76F}");
+const CLASS_NAME = "FBTest Command Line Handler";
+const CONTRACT_ID = "@mozilla.org/commandlinehandler/general-startup;1?type=FBTest";
+const CLD_CATEGORY = "m-FBTest";
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cr = Components.results;
+
+const categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
+const appShellService = Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci.nsIAppShellService);
+
+const CMDLINE_FLAG = "runFBTests";
+
+Components.utils["import"]("resource://gre/modules/XPCOMUtils.jsm");
+
+// ************************************************************************************************
+// Command Line Handler
+
+function CommandLineHandler()
+{
+ this.wrappedJSObject = this;
+};
+
+CommandLineHandler.prototype =
+{
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ // XPCOM
+
+ classID: CLASS_ID,
+ classDescription: CLASS_NAME,
+ contractID: CONTRACT_ID,
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsISupports,
+ Ci.nsICommandLineHandler
+ ]),
+
+ _xpcom_categories: [{
+ category: "command-line-handler",
+ entry: CLD_CATEGORY,
+ }],
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ // nsICommandLineHandler
+
+ runFBTests: false,
+ testListURI: null,
+
+ handle: function(cmdLine)
+ {
+ window = appShellService.hiddenDOMWindow;
+
+ if (cmdLine.findFlag(CMDLINE_FLAG, false) < 0)
+ return;
+
+ try
+ {
+ // Handle flag with test URI specified. This throws an exception
+ // if the parameter isn't specified.
+ var testListURI = cmdLine.handleFlagWithParam(CMDLINE_FLAG, false);
+ this.startOnStartup(testListURI);
+ }
+ catch (e)
+ {
+ // So, the parameter isn't probably there. Try to handle at least the flag.
+ // The default test list URI will be used.
+ if (cmdLine.handleFlag(CMDLINE_FLAG, false))
+ this.startOnStartup(null);
+ }
+ },
+
+ startOnStartup: function(testListURI)
+ {
+ if (!testListURI)
+ window.dump("FBTest; No test list URI specified.");
+
+ // This info will be used by FBTest overlay as soon as the browser window is loaded.
+ this.runFBTests = true;
+ this.testListURI = testListURI;
+
+ window.dump("FBTest; FBTests will be executed as soon as Firefox is ready.\n");
+ window.dump("FBTest; Test List URI: " + testListURI + "\n");
+ },
+
+ // The text should have embedded newlines which wrap at 76 columns, and should include
+ // a newline at the end. By convention, the right column which contains flag descriptions
+ // begins at the 24th character.
+ // xxxHonza: weird is that if I run Firefox with -help parameter the second column
+ // begins on 33th character.
+ helpInfo: " -" + CMDLINE_FLAG + " <test-list-uri> Automatically run all Firebug tests \n" +
+ " https://getfirebug.com/tests/content/testlists/firebug1.6.html\n",
+};
+
+// ************************************************************************************************
+
+/**
+* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
+* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
+*/
+if (XPCOMUtils.generateNSGetFactory)
+ var NSGetFactory = XPCOMUtils.generateNSGetFactory([CommandLineHandler]);
+else
+ var NSGetModule = XPCOMUtils.generateNSGetModule([CommandLineHandler]);
202 tests/FBTest/components/testHistory.js
View
@@ -0,0 +1,202 @@
+/* See license.txt for terms of usage */
+
+// ************************************************************************************************
+// Constants
+
+// Test list history
+const TEST_CLASS_ID = Components.ID("{3008FA55-C12F-4992-9930-B9D52F0CF037}");
+const TEST_CLASS_NAME = "FBTest: Test List History";
+const TEST_CONTRACT_ID = "@mozilla.org/autocomplete/search;1?name=FBTestHistory";
+
+// Test case history
+const CASE_CLASS_ID = Components.ID("{B37D6564-77D9-4613-B088-324389E1A8F3}");
+const CASE_CLASS_NAME = "FBTest: Source Server History";
+const CASE_CONTRACT_ID = "@mozilla.org/autocomplete/search;1?name=FBTestCaseHistory";
+
+// Test driver history
+const DRIVER_CLASS_ID = Components.ID("{3882FC1B-D32A-4722-B935-FA82142808A5}");
+const DRIVER_CLASS_NAME = "FBTest: Test Driver URL History";
+const DRIVER_CONTRACT_ID = "@mozilla.org/autocomplete/search;1?name=FBTestDriverHistory";
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cr = Components.results;
+
+const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch2);
+
+Components.utils["import"]("resource://gre/modules/XPCOMUtils.jsm");
+
+// ************************************************************************************************
+// Test URL History, nsIAutoCompleteSearch
+
+function History() {}
+History.prototype =
+{
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ // XPCOM
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsISupports,
+ Ci.nsIAutoCompleteSearch
+ ]),
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ // nsIAutoCompleteSearch
+
+ startSearch: function(searchString, searchParam, previousResult, listener)
+ {
+ // Get all test-lists from preferences.
+ var history = prefs.getCharPref(this.pref);
+ var arr = history.split(",");
+
+ var map = {};
+ var results = [];
+ for (var i=0; i<arr.length; i++)
+ {
+ var url = trimSpaces(arr[i]);
+ if (url && !map[url] && (!searchString || url.indexOf(searchString) > 0))
+ {
+ map[url] = true;
+ results.push(url);
+ }
+ }
+
+ listener.onSearchResult(this, new SearchResult(searchString,
+ Ci.nsIAutoCompleteResult.RESULT_SUCCESS,
+ 0, results));
+ },
+
+ stopSearch: function()
+ {
+ }
+};
+
+function trimSpaces(text)
+{
+ return text.replace(/^\s*|\s*$/g,"");
+}
+
+// ************************************************************************************************
+// Implements nsIAutoCompleteResult
+
+function SearchResult(searchString, searchResult, defaultIndex, results)
+{
+ this.searchString = searchString;
+ this.searchResult = searchResult;
+ this.defaultIndex = defaultIndex;
+ this.results = results;
+}
+
+SearchResult.prototype =
+{
+ searchString: "",
+ searchResult: 0,
+ defaultIndex: 0,
+ results: [],
+ errorDescription: "",
+
+ get matchCount() {
+ return this.results.length;
+ },
+
+ getValueAt: function(index) {
+ return this.results[index];
+ },
+
+ getCommentAt: function(index) {
+ return "";
+ },
+
+ getStyleAt: function(index) {
+ return null;
+ },
+
+ getImageAt: function (index) {
+ return "";
+ },
+
+ removeValueAt: function(index, removeFromDb) {
+ this.results.splice(index, 1);
+ },
+
+ getLabelAt: function(index) {
+ return this.results[index];
+ },
+
+ QueryInterface: function(aIID)
+ {
+ if (!aIID.equals(Ci.nsIAutoCompleteResult) &&
+ !aIID.equals(Ci.nsISupports))
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+
+ return this;
+ }
+};
+
+// ************************************************************************************************
+// Helper
+
+function extend(l, r)
+{
+ var newOb = {};
+ for (var n in l)
+ newOb[n] = l[n];
+ for (var n in r)
+ newOb[n] = r[n];
+ return newOb;
+};
+
+// ************************************************************************************************
+// Registration
+
+function TestHistory()
+{
+ this.pref = "extensions.fbtest.history";
+ this.wrappedJSObject = this;
+}
+
+TestHistory.prototype = extend(History.prototype,
+{
+ classID: TEST_CLASS_ID,
+ classDescription: TEST_CLASS_NAME,
+ contractID: TEST_CONTRACT_ID,
+});
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+function TestCaseHistory()
+{
+ this.pref = "extensions.fbtest.testCaseHistory";
+ this.wrappedJSObject = this;
+}
+
+TestCaseHistory.prototype = extend(History.prototype,
+{
+ classID: CASE_CLASS_ID,
+ classDescription: CASE_CLASS_NAME,
+ contractID: CASE_CONTRACT_ID,
+});
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+function TestDriverHistory()
+{
+ this.pref = "extensions.fbtest.testDriverHistory";
+ this.wrappedJSObject = this;
+}
+
+TestDriverHistory.prototype = extend(History.prototype,
+{
+ classID: DRIVER_CLASS_ID,
+ classDescription: DRIVER_CLASS_NAME,
+ contractID: DRIVER_CONTRACT_ID,
+});
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+var components = [TestHistory, TestCaseHistory, TestDriverHistory];
+
+if (XPCOMUtils.generateNSGetFactory)
+ var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+else
+ var NSGetModule = XPCOMUtils.generateNSGetModule(components);
25 tests/FBTest/content/.tmp_testFrame.html.15234~
View
@@ -0,0 +1,25 @@
+<!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>
+<style>
+body {
+ background-color: white;
+ }
+</style>
+
+</head>
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+
+<script>
+window.__defineGetter__("TestFrameHtmlXXX", function testFrameHtmlXXX()
+{
+ return "test";
+});
+</script>
+</body>
+
+</html>
18 tests/FBTest/content/.tmp_testFrame.html.37785~
View
@@ -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>
+<style>
+body {
+ background-color: white;
+ }
+</style>
+
+</head>
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
18 tests/FBTest/content/.tmp_testFrame.html.92027~
View
@@ -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>
+<style>
+body {
+ background-color: white;
+ }
+</style>
+
+</head>
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
18 tests/FBTest/content/.tmp_testFrame.html.99625~
View
@@ -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>
+<style>
+body {
+ background-color: white;
+ }
+</style>
+
+</head>
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
8 tests/FBTest/content/.tmp_testListFrame.html.97168~
View
@@ -0,0 +1,8 @@
+<!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></head>
+<body>
+<div id="tests"></div>
+</body>
+</html>
43 tests/FBTest/content/.tmp_wrapAJSFile.html.18470~
View
@@ -0,0 +1,43 @@
+<html>
+<head>
+<title>Firebug Test Page HTML Wrapper</title>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestFirebug.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestMutation.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestSelection.js"></script>
+<script type="application/x-javascript">
+// XPCOM
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+
+// Backward compatibility
+FBTest.Firebug = FBTest;
+FBTestFirebug = FBTest;
+
+try
+{
+ // Helper shortcuts
+ window.FW = FBTest.FirebugWindow; // Set by test harness
+ window.basePath = FBTest.getHTTPURLBase();
+ window.baseLocalPath = FBTest.getLocalURLBase();
+}
+catch (e)
+{
+ FBTrace.sysout("FBTest; EXCEPTION " + e, e);
+}
+</script>
+__TestIncludeURLs__
+<script type="application/x-javascript" src="__TestDriverURL__"></script>
+<style>
+body {
+ background-color: white;
+}
+</style>
+</head>
+
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
43 tests/FBTest/content/.tmp_wrapAJSFile.html.21520~
View
@@ -0,0 +1,43 @@
+<html>
+<head>
+<title>Firebug Test Page HTML Wrapper</title>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestFirebug.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestMutation.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestSelection.js"></script>
+<script type="application/x-javascript">
+// XPCOM
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+
+// Backward compatibility
+FBTest.Firebug = FBTest;
+FBTestFirebug = FBTest;
+
+try
+{
+ // Helper shortcuts
+ window.FW = FBTest.FirebugWindow; // Set by test harness
+ window.basePath = FBTest.getHTTPURLBase();
+ window.baseLocalPath = FBTest.getLocalURLBase();
+}
+catch (e)
+{
+ FBTrace.sysout("FBTest; EXCEPTION " + e, e);
+}
+</script>
+__TestIncludeURLs__
+<script type="application/x-javascript" src="__TestDriverURL__"></script>
+<style>
+body {
+ background-color: white;
+}
+</style>
+</head>
+
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
43 tests/FBTest/content/.tmp_wrapAJSFile.html.48334~
View
@@ -0,0 +1,43 @@
+<html>
+<head>
+<title>Firebug Test Page HTML Wrapper</title>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestFirebug.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestMutation.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestSelection.js"></script>
+<script type="application/x-javascript">
+// XPCOM
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+
+// Backward compatibility
+FBTest.Firebug = FBTest;
+FBTestFirebug = FBTest;
+
+try
+{
+ // Helper shortcuts
+ window.FW = FBTest.FirebugWindow; // Set by test harness
+ window.basePath = FBTest.getHTTPURLBase();
+ window.baseLocalPath = FBTest.getLocalURLBase();
+}
+catch (e)
+{
+ FBTrace.sysout("FBTest; EXCEPTION " + e, e);
+}
+</script>
+__TestIncludeURLs__
+<script type="application/x-javascript" src="__TestDriverURL__"></script>
+<style>
+body {
+ background-color: white;
+}
+</style>
+</head>
+
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
43 tests/FBTest/content/.tmp_wrapAJSFile.html.7314~
View
@@ -0,0 +1,43 @@
+<html>
+<head>
+<title>Firebug Test Page HTML Wrapper</title>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestFirebug.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestMutation.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestSelection.js"></script>
+<script type="application/x-javascript">
+// XPCOM
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+
+// Backward compatibility
+FBTest.Firebug = FBTest;
+FBTestFirebug = FBTest;
+
+try
+{
+ // Helper shortcuts
+ window.FW = FBTest.FirebugWindow; // Set by test harness
+ window.basePath = FBTest.getHTTPURLBase();
+ window.baseLocalPath = FBTest.getLocalURLBase();
+}
+catch (e)
+{
+ FBTrace.sysout("FBTest; EXCEPTION " + e, e);
+}
+</script>
+__TestIncludeURLs__
+<script type="application/x-javascript" src="__TestDriverURL__"></script>
+<style>
+body {
+ background-color: white;
+}
+</style>
+</head>
+
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
43 tests/FBTest/content/.tmp_wrapAJSFile.html.75914~
View
@@ -0,0 +1,43 @@
+<html>
+<head>
+<title>Firebug Test Page HTML Wrapper</title>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestFirebug.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestMutation.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestSelection.js"></script>
+<script type="application/x-javascript">
+// XPCOM
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+
+// Backward compatibility
+FBTest.Firebug = FBTest;
+FBTestFirebug = FBTest;
+
+try
+{
+ // Helper shortcuts
+ window.FW = FBTest.FirebugWindow; // Set by test harness
+ window.basePath = FBTest.getHTTPURLBase();
+ window.baseLocalPath = FBTest.getLocalURLBase();
+}
+catch (e)
+{
+ FBTrace.sysout("FBTest; EXCEPTION " + e, e);
+}
+</script>
+__TestIncludeURLs__
+<script type="application/x-javascript" src="__TestDriverURL__"></script>
+<style>
+body {
+ background-color: white;
+}
+</style>
+</head>
+
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
43 tests/FBTest/content/.tmp_wrapAJSFile.html.81520~
View
@@ -0,0 +1,43 @@
+<html>
+<head>
+<title>Firebug Test Page HTML Wrapper</title>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestFirebug.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestMutation.js"></script>
+<script type="application/x-javascript" src="chrome://fbtest/content/FBTestSelection.js"></script>
+<script type="application/x-javascript">
+// XPCOM
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+
+// Backward compatibility
+FBTest.Firebug = FBTest;
+FBTestFirebug = FBTest;
+
+try
+{
+ // Helper shortcuts
+ window.FW = FBTest.FirebugWindow; // Set by test harness
+ window.basePath = FBTest.getHTTPURLBase();
+ window.baseLocalPath = FBTest.getLocalURLBase();
+}
+catch (e)
+{
+ FBTrace.sysout("FBTest; EXCEPTION " + e, e);
+}
+</script>
+__TestIncludeURLs__
+<script type="application/x-javascript" src="__TestDriverURL__"></script>
+<style>
+body {
+ background-color: white;
+}
+</style>
+</head>
+
+<body>
+<h1 id="testTitle">Test Driver Code Loads Here</h1>
+<span id="firebugTestElement"></span>
+</body>
+
+</html>
64 tests/FBTest/content/FBTest.js
View
@@ -0,0 +1,64 @@
+/* See license.txt for terms of usage */
+
+/**
+ * The FBTest object is injected into this scope by Firebug test harness.
+ *
+ * Note that this file is directly loaded into a test frame together with a test driver file,
+ * just before the driver file is parsed/executed by the test harness (testRunner.js) and the
+ * runTest method called.
+ */
+
+// ************************************************************************************************
+// Constants
+
+// XPCOM
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+
+// ************************************************************************************************
+// Initialization
+
+(function() {
+
+// Test APIs initialization
+function initialize()
+{
+ var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
+
+ // Load all test APIs
+ // xxxHonza: should be extendable from Firebug extensions.
+ loader.loadSubScript(chromeToUrl("chrome://fbtest/content/FBTestFirebug.js"), this);
+ loader.loadSubScript(chromeToUrl("chrome://fbtest/content/FBTestMutation.js"), this);
+ loader.loadSubScript(chromeToUrl("chrome://fbtest/content/FBTestSelection.js"), this);
+
+ FBTest.sysout("FBTest; Test API initialized");
+}
+
+function chromeToUrl(path)
+{
+ var chromeRegistry = Cc['@mozilla.org/chrome/chrome-registry;1'].getService(Ci.nsIChromeRegistry);
+ var ios = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService);
+ var uri = ios.newURI(path, "UTF-8", null);
+ return chromeRegistry.convertChromeURL(uri).spec;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+try
+{
+ initialize();
+
+ // Helper shortcuts
+ window.FW = FBTest.FirebugWindow; // Set by test harness
+ window.basePath = FBTest.getHTTPURLBase();
+ window.baseLocalPath = FBTest.getLocalURLBase();
+}
+catch (e)
+{
+ FBTrace.sysout("FBTest; EXCEPTION " + e, e);
+}
+
+})();
+
+// ************************************************************************************************
2,610 tests/FBTest/content/FBTestFirebug.js
View
@@ -0,0 +1,2610 @@
+/* See license.txt for terms of usage */
+
+// ********************************************************************************************* //
+// Test APIs
+
+/**
+ * This file defines all APIs for test driver. The FBTest object is injected
+ * into this scope by the Firebug test harness.
+ */
+
+// Namespace for Test APIs
+/** @namespace @name FBTest */
+
+( /** @scope _FBTestFirebug_ @this FBTest */ function() {
+
+Components.utils["import"]("resource://fbtest/EventUtils.js");
+
+// ********************************************************************************************* //
+// Core test APIs (direct access to FBTestApp)
+
+/**
+ * Verification method, prints result of a test. If the first "pass" parameter is "true"
+ * the test passes, otherwise fails.
+ *
+ * @param {Boolean} pass Result of a test.
+ * @param {String} msg A message to be displayed as a test results under the current test
+ * within the test console.
+ */
+this.ok = function(pass, msg)
+{
+ if (!pass)
+ FBTest.sysout("FBTest **** FAILS **** " + msg);
+ else
+ FBTest.sysout("FBTest ok " + msg);
+
+ FBTestApp.TestRunner.appendResult(new FBTestApp.TestResult(window, pass, msg));
+
+ if (!pass)
+ this.onFailure(msg);
+ else
+ FBTest.resetTimeout();
+
+ return pass;
+};
+
+/**
+ * Verification method. Compares expected and actuall string (typially from the Firebug UI).
+ * If "actuall" and "expected" parameters are equal the test passes, otherwise fails.
+ *
+ * @param {String} expected Expected value
+ * @param {String} actual Actual value
+ * @param {String} msg A message to be displayed as a test result under the current test
+ * within the test console.
+ */
+this.compare = function(expected, actual, msg)
+{
+ var result;
+ if (expected instanceof RegExp)
+ {
+ result = actual ? actual.match(expected) : null;
+ expected = expected ? expected.toString() : null;
+ }
+ else
+ {
+ // xxxHonza: TODO: lib/textSearch doesn't like '==='
+ result = (expected == actual);
+ }
+
+ FBTest.sysout("compare "+(result?"passes":"**** FAILS ****")+" "+msg, {expected: expected, actual: actual});
+
+ FBTestApp.TestRunner.appendResult(new FBTestApp.TestResult(window,
+ result, msg, expected, actual));
+
+ if (result)
+ FBTest.resetTimeout();
+ else
+ FBTest.onFailure(msg);
+
+ return result;
+};
+
+/**
+ * Logs an exception under the current test within the test console.
+ *
+ * @param {String} msg A message to be displayed under the current test within the test console.
+ * @param {Exception} err An exception object.
+ */
+this.exception = function(msg, err)
+{
+ FBTestApp.TestRunner.appendResult(new FBTestApp.TestException(window, msg, err));
+};
+
+/**
+ * Prints a message into test resutls (displayed under a test within test console).
+ *
+ * @param {String} msg A message to be displayed under the current test within the test console.
+ */
+this.progress = function(msg)
+{
+ FBTestApp.TestRunner.appendResult(new FBTestApp.TestResult(window, true, "progress: "+msg));
+ FBTestApp.TestSummary.setMessage(msg);
+ FBTest.sysout("FBTest progress: ------------- "+msg+" -------------");
+ FBTest.resetTimeout();
+};
+
+/**
+ * Finishes current test and prints info message (if any) to the status bar.
+ *
+ * All test tabs are removed from the browser.
+ */
+this.testDone = function(message)
+{
+ FBTest.sysout("FBTestFirebug.testDone; start test done timeout");
+
+ var self = this;
+ var test = FBTestApp.TestRunner.currentTest;
+ setTimeout(function cleanUpLater()
+ {
+ self.closeFirebug();
+ self.cleanUpTestTabs();
+
+ FBTest.sysout("FBTestFirebug.testDone; after timeout");
+
+ if (message)
+ FBTest.progress(message);
+
+ FBTestApp.TestRunner.testDone(false, test);
+ });
+};
+
+/**
+ * Returns URL of a directory with test cases (HTML pages with a manual test implementation)
+ */
+this.getHTTPURLBase = function()
+{
+ // xxxHonza: should be set as a global in this scope.
+ return FBTestApp.TestConsole.getHTTPURLBase();
+};
+
+/**
+ * Returns URL of a directory with test driver files.
+ */
+this.getLocalURLBase = function()
+{
+ // xxxHonza: should be set as a global in this scope.
+ if (/file:/.test(FBTestApp.TestRunner.currentTest.driverBaseURI))
+ return FBTestApp.TestRunner.currentTest.driverBaseURI;
+
+ return FBTestApp.TestConsole.chromeToUrl(FBTestApp.TestRunner.currentTest.driverBaseURI, true);
+};
+
+/**
+ * Basic logging into the Firebug tracing console. All logs made through this function
+ * appears only if 'TESTCASE' options is set.
+ *
+ * @param {String} text A message to log.
+ * @param {Object} obj An object to log.
+ */
+this.sysout = function(text, obj)
+{
+ if (FBTrace.DBG_TESTCASE)
+ FBTrace.sysout(text, obj);
+};
+
+/**
+ * In some cases the test can take longer time to execute than it's expected (e.g. due to a slow
+ * test server connection).
+ *
+ * Instead of changing the default timeout to another (bigger) - but still fixed value, the test
+ * can regularly reset the timeout.
+ *
+ * This way the runner knows that the test is not frozen and is still doing something.
+ */
+this.resetTimeout = function()
+{
+ FBTestApp.TestRunner.setTestTimeout(window);
+};
+
+// ********************************************************************************************* //
+// APIs used by test harness (direct access to FBTestApp)
+
+/**
+ * Called by the test harness framework in case of a failing test. If *Fail Halt* option
+ * is set and *Chromebug* extension installed, the debugger will halt the test execution.
+ *
+ * @param {String} msg A message to be displayed under the current test within the test console.
+ */
+this.onFailure = function(msg)
+{
+ FBTestApp.TestConsole.notifyObservers(this, "fbtest", "onFailure");
+};
+
+/**
+ * This function is automatically called before every test sequence.
+ */
+this.setToKnownState = function()
+{
+ FBTest.sysout("FBTestFirebug setToKnownState");
+
+ var Firebug = FBTest.FirebugWindow.Firebug;
+ if (Firebug.PanelActivation)
+ {
+ Firebug.PanelActivation.toggleAll("off"); // These should be done with button presses not API calls.
+ Firebug.PanelActivation.toggleAll("none");
+ Firebug.PanelActivation.clearAnnotations();
+ }
+ else // obsolete, remove
+ {
+ Firebug.Activation.toggleAll("off");
+ Firebug.Activation.toggleAll("none");
+ Firebug.Activation.clearAnnotations();
+ }
+
+ if (Firebug.isDetached())
+ Firebug.toggleDetachBar();
+
+ // First clear all breakpoints and consequently the reset all options that
+ // clears the breakpoints storage.
+ Firebug.Debugger.clearAllBreakpoints(null);
+ Firebug.resetAllOptions(false);
+
+ // Console preview is hiden by default
+ if (this.isConsolePreviewVisible())
+ this.clickConsolePreviewButton();
+
+ // Use default Firebug height.
+ this.setFirebugBarHeight(270);
+
+ this.clearSearchField();
+
+ // xxxHonza: xxxJJB how clear the persisted panel state?
+};
+
+// ********************************************************************************************* //
+// Manual verification (direct access to FBTestApp). These APIs should not be used in automated
+// test-suites
+
+function manualTest(verifyMsg, instructions, cleanupHandler)
+{
+ FBTestApp.TestRunner.manualVerify(verifyMsg, instructions, cleanupHandler);
+}
+
+this.manualVerify = function(verifyMsg, instructions)
+{
+ var self = this;
+ manualTest(
+ verifyMsg, instructions,
+ function(passes)
+ {
+ FBTest.ok(passes, "Manual verification");
+ self.closeFirebug();
+ self.cleanUpTestTabs();
+ FBTestApp.TestRunner.testDone(false);
+ });
+};
+
+// ********************************************************************************************* //
+// Event automation
+
+this.click = function(node)
+{
+ this.sendMouseEvent({type: "click"}, node);
+};
+
+this.dblclick = function(node)
+{
+ this.sendMouseEvent({type: "click", detail: 2}, node);
+};
+
+this.rightClick = function(node)
+{
+ this.sendMouseEvent({type: "click", button: 2}, node);
+};
+
+this.mouseDown = function(node)
+{
+ this.sendMouseEvent({type: "mousedown"}, node);
+};
+
+this.mouseUp = function(node)
+{
+ this.sendMouseEvent({type: "mouseup"}, node);
+};
+
+this.mouseOver = function(node)
+{
+ var doc = node.ownerDocument;
+ var event = doc.createEvent("MouseEvents");
+ event.initMouseEvent("mouseover", true, true, doc.defaultView, 0, 0, 0, 0, 0,
+ false, false, false, false, 0, null);
+ this.synthesizeMouse(node, 0, 0, event);
+};
+
+this.sendMouseEvent = function(event, target, win)
+{
+ if (!target)
+ FBTrace.sysout("sendMouseEvent target is null");
+
+ var targetIsString = typeof target == "string";
+
+ if (!win)
+ {
+ win = targetIsString ?
+ // if the target is a string, we cannot know which window that target
+ // belongs to, so we are assuming it to be the global window
+ window :
+ // if the target is not a string, thus it is assumed to be an Element,
+ // then we are assuming the window is the one in which that target lives
+ target.ownerDocument.defaultView;
+ }
+
+ if (targetIsString)
+ target = win.document.getElementById(target);
+
+ sendMouseEvent(event, target, win);
+};
+
+/**
+ * Send the char aChar to the node with id aTarget. This method handles casing
+ * of chars (sends the right charcode, and sends a shift key for uppercase chars).
+ * No other modifiers are handled at this point.
+ *
+ * For now this method only works for English letters (lower and upper case)
+ * and the digits 0-9.
+ *
+ * Returns true if the keypress event was accepted (no calls to preventDefault
+ * or anything like that), false otherwise.
+ */
+this.sendChar = function(aChar, aTarget)
+{
+ aTarget = _getEventTarget(aTarget);
+ return sendChar(aChar, aTarget);
+};
+
+/**
+ * Send the string aStr to the node with id aTarget.
+ *
+ * For now this method only works for English letters (lower and upper case)
+ * and the digits 0-9.
+ */
+this.sendString = function(aStr, aTarget)
+{
+ for (var i = 0; i < aStr.length; ++i)
+ this.sendChar(aStr.charAt(i), aTarget);
+};
+
+/**
+ * Send the non-character key aKey to the node with id aTarget.
+ * The name of the key should be a lowercase
+ * version of the part that comes after "DOM_VK_" in the KeyEvent constant
+ * name for this key. No modifiers are handled at this point.
+ *
+ * Returns true if the keypress event was accepted (no calls to preventDefault
+ * or anything like that), false otherwise.
+ */
+this.sendKey = function(aKey, aTarget)
+{
+ aTarget = _getEventTarget(aTarget);
+ return sendKey(aKey, aTarget, aTarget.ownerDocument.defaultView);
+};
+
+function _getEventTarget(aTarget)
+{
+ //var loc = FW.Firebug.currentContext ? FW.FBL.getFileName(FW.Firebug.currentContext.window.location.href) : "NULL";
+ //if (aTarget && !(aTarget instanceof Node))
+ // FBTrace.sysout("[" + aTarget + " | " + loc + "]~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- OOOPS ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-");
+
+ // FIXME xxxpedro
+ if (aTarget && aTarget instanceof Node)
+ aTarget = aTarget;
+ else if (aTarget)
+ aTarget = FW.Firebug.chrome.$(aTarget);
+ else
+ aTarget = FW.Firebug.chrome.window.document.documentElement;
+
+ var doc = aTarget.ownerDocument;
+
+ // Properly focus before typing. First the parent window and then the target itself.
+ doc.defaultView.focus();
+ FBTest.focus(aTarget);
+
+ return aTarget;
+}
+
+this.synthesizeMouse = function(node, offsetX, offsetY, event, win)
+{
+ win = win || node.ownerDocument.defaultView;
+
+ event = event || {};
+
+ var rectCollection = node.getClientRects();
+
+ // Use the first client rect for clicking (e.g. SPAN can have more).
+ var rect = rectCollection[0]; //node.getBoundingClientRect();
+ var frameOffset = getFrameOffset(node);
+
+ FBTest.sysout("frameOffset " + frameOffset);
+
+ // Hit the middle of the button
+ // (Clicks to hidden parts of the element doesn't open the context menu).
+ offsetX = offsetX || 0.5 * Math.max(1, rect.width);
+ offsetY = offsetY || 0.5 * Math.max(1, rect.height);
+
+ // include frame offset
+ offsetX += frameOffset.left;
+ offsetY += frameOffset.top;
+
+ synthesizeMouse(node, offsetX, offsetY, event, win);
+};
+
+function getFrameOffset(win)
+{
+ var top = 0;
+ var left = 0;
+ // FIXME xxxpedro
+ var frameElement;
+ while(frameElement = win.frameElement)
+ {
+ // xxxpedro shouldn't it be frameElement.top?
+ top += win.frameElement.top;
+ left += win.frameElement.left;
+ }
+ return {left: left, top: top};
+}
+
+/**
+ * Synthesize a key event. It is targeted at whatever would be targeted by an
+ * actual keypress by the user, typically the focused element.
+ *
+ * aKey should be either a character or a keycode starting with VK_ such as
+ * VK_ENTER. See list of all possible key-codes here:
+ * [[http://www.w3.org/TR/2000/WD-DOM-Level-3-Events-20000901/events.html]]
+ *
+ * aEvent is an object which may contain the properties:
+ * shiftKey, ctrlKey, altKey, metaKey, accessKey, type
+ *
+ * If the type is specified, a key event of that type is fired. Otherwise,
+ * a keydown, a keypress and then a keyup event are fired in sequence.
+ *
+ * aWindow is optional, and defaults to the current window object.
+ */
+this.synthesizeKey = function(aKey, aEvent, aWindow)
+{
+ aEvent = aEvent || {};
+
+ synthesizeKey(aKey, aEvent, aWindow);
+};
+
+this.focus = function(node)
+{
+ // If the focus() method is available apply it, but don't return.
+ // Sometimes the event needs to be applied too (e.g. the command line).
+ if (node.focus)
+ node.focus();
+
+ // DOMFocusIn doesn't seem to work with the command line.
+ var doc = node.ownerDocument, event = doc.createEvent("UIEvents");
+ event.initUIEvent("focus", true, true, doc.defaultView, 1);
+ node.dispatchEvent(event);
+};
+
+// TODO: xxxpedro remove this function
+this.pressKey = function(keyCode, target)
+{
+ function getKeyName(keyCode)
+ {
+ for (var name in KeyEvent)
+ {
+ if (KeyEvent[name] == keyCode)
+ return name.replace("DOM_VK_", "");
+ }
+
+ return null;
+ }
+
+ FBTrace.sysout("DEPRECATE WARNING: FBTest.pressKey() should not be used. Use FBTest.sendKey() instead.");
+ return this.sendKey(getKeyName(keyCode), target);
+};
+
+// ********************************************************************************************* //
+// Firebug UI
+
+/**
+ * Open/close Firebug UI. If forceOpen is true, Firebug is only opened if closed.
+ * @param {Boolean} forceOpen Set to true if Firebug should stay opened.
+ */
+this.pressToggleFirebug = function(forceOpen)
+{
+ // Don't close if it's open and should stay open.
+ if (forceOpen && this.isFirebugOpen())
+ return;
+
+ FBTest.sendKey("F12"); // F12
+};
+
+/**
+ * Open Firebug UI. If it's already opened, it stays opened.
+ */
+this.openFirebug = function()
+{
+ this.pressToggleFirebug(true);
+};
+
+/**
+ * Closes Firebug UI. if the UI is closed, it stays closed.
+ */
+this.closeFirebug = function()
+{
+ if (this.isFirebugOpen())
+ this.pressToggleFirebug();
+};
+
+this.shutdownFirebug = function()
+{
+ // TODO: deactivate Firebug
+};
+
+/**
+ * Returns true if Firebug is currently opened; false otherwise.
+ */
+this.isFirebugOpen = function()
+{
+ var collapsedFirebug = FW.Firebug.chrome.isOpen();
+ FBTest.sysout("isFirebugOpen collapsedFirebug " + collapsedFirebug);
+ return collapsedFirebug;
+};
+
+this.getFirebugPlacement = function()
+{
+ return FW.Firebug.getPlacement();
+};
+
+this.isFirebugActive = function()
+{
+ var suspension = FW.Firebug.getSuspended();
+ return (suspension == "suspended") ? false : true;
+};
+
+this.setFirebugBarHeight = function(height)
+{
+ var mainFrame = FW.Firebug.Firefox.getElementById("fbMainFrame");
+ mainFrame.setAttribute("height", height);
+};
+
+// ********************************************************************************************* //
+
+this.isDetached = function()
+{
+ return FW.Firebug.isDetached();
+};
+
+/**
+ * Detach Firebug into a new separate window.
+ */
+this.detachFirebug = function()
+{
+ if (FW.Firebug.isDetached())
+ return null;
+
+ this.openFirebug();
+ return FW.Firebug.detachBar(FW.Firebug.currentContext);
+};
+
+/**
+ * Close detached Firebug window.
+ */
+this.closeDetachedFirebug = function()
+{
+ if (!FW.Firebug.isDetached())
+ return false;
+
+ // Better would be to look according to the window type, but it's not set in firebug.xul
+ var result = FW.FBL.iterateBrowserWindows("", function(win)
+ {
+ if (win.location.href == "chrome://firebug/content/firebug.xul")
+ {
+ win.close();
+ return true;
+ }
+ });
+
+ return result;
+};
+
+this.getBrowser = function()
+{
+ return FW.Firebug.Firefox.getTabBrowser();
+};
+
+// ********************************************************************************************* //
+// URLs
+
+/**
+ * Opens specific URL in a new tab and calls the callback as soon as the tab is ready.
+ * @param {String} url URL to be opened in the new tab.
+ * @param {Function} callback Callback handler that is called as soon as the page is loaded.
+ */
+this.openNewTab = function(url, callback)
+{
+ var tabbrowser = FBTestFirebug.getBrowser();
+
+ // Open new tab and mark as 'test' so it can be closed automatically.
+ var newTab = tabbrowser.addTab(url);
+ newTab.setAttribute("firebug", "test");
+ tabbrowser.selectedTab = newTab;
+
+ // Wait till the new window is loaded.
+ var browser = tabbrowser.getBrowserForTab(newTab);
+ waitForWindowLoad(browser, callback);
+
+ return newTab;
+};
+
+/**
+ * Opens specific URL in the current tab and calls the callback as soon as the tab is ready.
+ * @param {String} url URL to be opened.
+ * @param {Function} callback Callback handler that is called as soon as the page is loaded.
+ */
+this.openURL = function(url, callback)
+{
+ var tabbrowser = FBTestFirebug.getBrowser();
+ var currTab = tabbrowser.selectedTab;
+
+ // Get the current tab and wait till the new URL is loaded.
+ var browser = tabbrowser.getBrowserForTab(currTab);
+ waitForWindowLoad(browser, callback);
+
+ // Reload content of the selected tab.
+ tabbrowser.selectedBrowser.contentDocument.defaultView.location.href = url;
+
+ return currTab;
+};
+
+/**
+ * Refres the current tab.
+ * @param {Function} callback Callback handler that is called as soon as the page is reloaded.
+ */
+this.reload = function(callback)
+{
+ var tabbrowser = FBTestFirebug.getBrowser();
+ var currTab = tabbrowser.selectedTab;
+
+ // Get the current tab and wait till it's reloaded.
+ var browser = tabbrowser.getBrowserForTab(currTab);
+ waitForWindowLoad(browser, callback);
+
+ // Reload content of the selected tab.
+ tabbrowser.selectedBrowser.contentDocument.defaultView.location.reload();
+
+ return currTab;
+};
+
+/**
+ * Helper method for wait till a window is *really* loaded.
+ * @param {Object} browser Window's parent browser.
+ * @param {Window} callback Executed when the window is loaded. The window is passed in
+ * as the parameter.
+ */
+function waitForWindowLoad(browser, callback)
+{
+ // If the callback isn't specified don't watch the window load at all.
+ if (!callback)
+ return;
+
+ var loaded = false;
+ var painted = false;
+
+ // All expected events have been fired, execute the callback.
+ function executeCallback()
+ {
+ try
+ {
+ var win = browser.contentWindow;
+
+ // This is a workaround for missing wrappedJSObject property,
+ // if the test case comes from http (and not from chrome)
+ // xxxHonza: this is rather a hack, it should be removed if possible.
+ //if (!win.wrappedJSObject)
+ // win.wrappedJSObject = win;
+
+ //xxxHonza: I have seen win == null once
+ FBTest.sysout("callback <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "+win.location);
+ // The window is loaded, execute the callback now.
+ callback(win);
+ }
+ catch (exc)
+ {
+ FBTest.exception("waitForWindowLoad", exc);
+ FBTest.sysout("runTest FAILS " + exc, exc);
+ }
+ }
+
+ // Wait for all event that must be fired before the window is loaded.
+ // Any event is missing?
+ // xxxHonza: In case of Firefox 3.7 the new 'content-document-global-created'
+ // (bug549539) could be utilized.
+ function waitForEvents(event)
+ {
+ if (event.type == "load")
+ {
+ browser.removeEventListener("load", waitForEvents, true);
+ loaded = true;
+ }
+ else if (event.type == "MozAfterPaint")
+ {
+ browser.removeEventListener("MozAfterPaint", waitForEvents, true);
+ painted = true;
+ }
+
+ // Execute callback after 100ms timout (the inspector tests need it for now),
+ // but this shoud be set to 0.
+ if (loaded && painted)
+ setTimeout(executeCallback, 100);
+ }
+
+ FBTest.sysout("adding event listener <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
+ browser.addEventListener("load", waitForEvents, true);
+ browser.addEventListener("MozAfterPaint", waitForEvents, true);
+}
+
+/**
+ * Closes all Firefox tabs that were opened because of test purposes.
+ */
+this.cleanUpTestTabs = function()
+{
+ //FBTest.progress("clean up tabs");
+
+ FBTestFirebug.cleanUpListeners();
+
+ var tabbrowser = FBTestFirebug.getBrowser();
+ var removeThese = [];
+ for (var i = 0; i < tabbrowser.mTabs.length; i++)
+ {
+ var tab = tabbrowser.mTabs[i];
+
+ var firebugAttr = tab.getAttribute("firebug");
+
+ FBTest.sysout(i+"/"+tabbrowser.mTabs.length+" cleanUpTestTabs on tab "+tab+" firebug: "+firebugAttr);
+
+ if (firebugAttr == "test")
+ removeThese.push(tab);
+ }
+
+ if (!tabbrowser._removingTabs)
+ tabbrowser._removingTabs = [];
+
+ for (var i = 0; i < removeThese.length; i++)
+ tabbrowser.removeTab(removeThese[i]);
+};
+
+
+/**
+ * Closes Firebug on all tabs
+ */
+this.closeFirebugOnAllTabs = function()
+{
+ FBTest.progress("closeFirebugOnAllTabs");
+
+ var tabbrowser = FBTestFirebug.getBrowser();
+ for (var i = 0; i < tabbrowser.mTabs.length; i++)
+ {
+ var tab = tabbrowser.mTabs[i];
+ FBTest.sysout("closeFirebugOnAllTabs on tab "+tab);
+ tabbrowser.selectedTab = tab;
+ this.closeFirebug();
+ }
+};
+
+/**
+ * Clears Firefox cache.
+ */
+this.clearCache = 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)
+ {
+ FBTest.sysout("clearCache FAILS "+exc, exc);
+ }
+};
+
+// ********************************************************************************************* //
+// Firebug Panel Enablement.
+
+this.getPanelTypeByName = function(panelName, doc)
+{
+ if (!doc)
+ doc = FW.Firebug.chrome.window.document;
+
+ var panelTabs = doc.getElementById("fbPanelBar1-panelTabs");
+ for (var child = panelTabs.firstChild; child; child = child.nextSibling)
+ {
+ var label = child.getAttribute("label");
+ FBTest.sysout("getPanelTypeByName trying '"+label+"'");
+ var role = child.getAttribute("role");
+ if (role == "tab" && label == panelName)
+ return child.panelType.prototype.name;
+ }
+
+ return null;
+};
+
+this.setPanelState = function(model, panelName, callbackTriggersReload, enable)
+{
+ // Open Firebug UI
+ this.pressToggleFirebug(true);
+
+ // Enable specified panel.
+ var panelType = FW.Firebug.getPanelType(panelName);
+ FW.Firebug.PanelActivation.setPanelState(panelType, enable);
+
+ // Clear cache and reload.
+ this.clearCache();
+ if (callbackTriggersReload)
+ this.reload(callbackTriggersReload);
+};
+
+/**
+ * Disables the Net panel and reloads if a callback is specified.
+ * @param {Function} callback A handler that is called as soon as the page is reloaded.
+ */
+this.disableNetPanel = function(callback)
+{
+ this.setPanelState(FW.Firebug.NetMonitor, "net", callback, false);
+};
+
+/**
+ * Enables the Net panel and reloads if a callback is specified.
+ * @param {Function} callback A handler that is called as soon as the page is reloaded.
+ */
+this.enableNetPanel = function(callback)
+{
+ this.setPanelState(FW.Firebug.NetMonitor, "net", callback, true);
+};
+
+/**
+ * Disables the Script panel and reloads if a callback is specified.
+ * @param {Function} callback A handler that is called as soon as the page is reloaded.
+ */
+this.disableScriptPanel = function(callback)
+{
+ this.setPanelState(FW.Firebug.Debugger, "script", callback, false);
+};
+
+/**
+ * Enables the Script panel and reloads if a callback is specified.
+ * @param {Function} callback A handler that is called as soon as the page is reloaded.
+ */
+this.enableScriptPanel = function(callback)
+{
+ this.setPanelState(FW.Firebug.Debugger, "script", callback, true);
+};
+
+/**
+ * Disables the Console panel and reloads if a callback is specified.
+ * @param {Function} callback A handler that is called as soon as the page is reloaded.
+ */
+this.disableConsolePanel = function(callback)
+{
+ this.setPanelState(FW.Firebug.Console, "console", callback, false);
+};
+
+/**
+ * Enables the Script panel and reloads if a callback is specified.
+ * @param {Function} callback A handler that is called as soon as the page is reloaded.
+ */
+this.enableConsolePanel = function(callback)
+{
+ this.setPanelState(FW.Firebug.Console, "console", callback, true);
+};
+
+/**
+ * Disables all activable panels.
+ */
+this.disableAllPanels = function()
+{
+ FW.FBL.$("cmd_disablePanels").doCommand();
+};
+
+/**
+ * Enables all activable panels.
+ */
+this.enableAllPanels = function()
+{
+ FW.FBL.$("cmd_enablePanels").doCommand();
+};
+
+/**
+ * Select specific panel in the UI.
+ * @param {Object} panelName Name of the panel (e.g. <i>console</i>, <i>dom</i>, <i>script</i>,
+ * <i>net</i>, <i>css</i>).
+ * @param {Object} chrome Firebug chrome object.
+ */
+this.selectPanel = function(panelName, chrome)
+{
+ if (!chrome)
+ chrome = FW.Firebug.chrome;
+
+ var panelType = FW.Firebug.getPanelType(panelName);
+ if (panelType.prototype.parentPanel)
+ return chrome.selectSidePanel(panelName);
+
+ return chrome.selectPanel(panelName);
+};
+
+this.selectSidePanel = function(panelName, chrome)
+{
+ if (!chrome)
+ chrome = FW.Firebug.chrome;
+
+ return chrome.selectSidePanel(panelName);
+};
+
+/* select a panel tab */
+this.selectPanelTab = function(name, doc)
+{
+ if (!doc)
+ doc = FW.Firebug.chrome.window.document;
+
+ var panelTabs = doc.getElementById("fbPanelBar1-panelTabs");
+ for (var child = panelTabs.firstChild; child; child = child.nextSibling)
+ {
+ var label = child.getAttribute("label");
+ FBTest.sysout("selectPanelTab trying "+label);
+ var role = child.getAttribute("role");
+ if (role == "tab" && label == name)
+ {
+ var panelBar = panelTabs;
+ while (panelBar && (panelBar.tagName != "panelBar") )
+ panelBar = panelBar.parentNode;
+
+ panelBar.selectTab(child);
+ return true;
+ }
+ }
+ return false;
+};
+
+this.getSelectedPanelTab = function(doc)
+{
+ if (!doc)
+ doc = FW.Firebug.chrome.window.document;
+
+ var panelTabs = doc.getElementById("fbPanelBar1-panelTabs");
+ for (var child = panelTabs.firstChild; child; child = child.nextSibling)
+ {
+ if (child.getAttribute("selected") == "true")
+ return child;
+ }
+ return null;
+};
+
+/* selected panel on UI (not via context) */
+this.getSelectedPanel = function()
+{
+ var panelBar1 = FW.Firebug.chrome.$("fbPanelBar1");
+ return panelBar1.selectedPanel; // may be null
+};
+
+/**
+ * Returns document object of Main Firebug content UI (content of all panels is presented
+ * in this document).
+ */
+this.getPanelDocument = function()
+{
+ var panelBar1 = FW.Firebug.chrome.$("fbPanelBar1");
+ return panelBar1.browser.contentDocument;
+};
+
+this.getSidePanelDocument = function()
+{
+ var panelBar1 = FW.Firebug.chrome.$("fbPanelBar2");
+ return panelBar1.browser.contentDocument;
+};
+
+/* user sees panel tab disabled? */
+this.isPanelTabDisabled = function(name)
+{
+ var panelBar1 = FW.Firebug.chrome.$("fbPanelBar1-panelTabs");
+ for (var child = panelBar1.firstChild; child; child = child.nextSibling)
+ {
+ var label = child.getAttribute("label");
+ FBTest.sysout("isPanelTabDisabled trying '"+label+"'");
+ var role = child.getAttribute("role");
+ if (role == "tab" && label == name)
+ {
+ FBTest.sysout("isPanelTablDisabled found role tab and label '"+label+"' has "+child.getAttribute("aria-disabled"));
+ return child.getAttribute("aria-disabled"); // "true" or "false"
+ }
+ }
+ return null;
+};
+
+/**
+ * Returns panel object that represents a specified panel. In order to get root element of
+ * panels's content use <i>panel.panelNode</i>, where <i>panel</i> is the returned value.
+ * @param {Object} name Name of the panel to be returned (e.g. <i>net</i>).
+ */
+this.getPanel = function(name)
+{
+ return FW.Firebug.currentContext.getPanel(name);
+};
+
+this.listenerCleanups = [];
+this.cleanUpListeners = function()
+{
+ var c = FBTestFirebug.listenerCleanups;
+ FBTest.sysout("ccccccccccccccccccccccccc cleaning listeners ccccccccccccccccccccccccccccccc");
+ while(c.length)
+ c.shift().call();
+};
+
+this.UntilHandler = function(eventTarget, eventName, isMyEvent, onEvent, capturing)
+{
+ var removed = false;
+ function fn (event)
+ {
+ if (isMyEvent(event))
+ {
+ eventTarget.removeEventListener(eventName, fn, capturing);
+ removed = true;
+ FBTest.sysout("UntilHandler activated for event "+eventName);
+ onEvent(event);
+ }
+ else
+ {
+ FBTest.sysout("UntilHandler skipping event "+eventName, event);
+ }
+ }
+ eventTarget.addEventListener(eventName, fn, capturing);
+
+ FBTestFirebug.listenerCleanups.push( function cleanUpListener()
+ {
+ if (!removed)
+ eventTarget.removeEventListener(eventName, fn, capturing);
+ });
+};
+
+this.OneShotHandler = function(eventTarget, eventName, onEvent, capturing)
+{
+ function isTrue(event) {return true;}
+ FBTestFirebug.UntilHandler(eventTarget, eventName, isTrue, onEvent, capturing);
+};
+
+// ********************************************************************************************* //
+// Firebug preferences
+
+/**
+ * Sets Firebug preference.
+ * @param {Object} pref Name of the preference without <i>extensions.firebug</i> prefix.
+ * For instance: <i>activateSameOrigin</i>. Always use this method for seting a preference.
+ * Notice that FBTest automatically resets all preferences before every single test is executed.
+ * @param {Object} value New value of the preference.
+ */
+this.setPref = function(pref, value)
+{
+ FW.Firebug.setPref(FW.Firebug.prefDomain, pref, value);
+};
+
+/**
+ * Returns value of specified Firebug preference.
+ * @param {Object} pref Name of the preference without <i>extensions.firebug</i> prefix.
+ * For instance: <i>showXMLHttpRequests</i>. Notice that FBTest automatically resets all
+ * preferences before every single test is executed.
+ */
+this.getPref = function(pref)
+{
+ return FW.Firebug.getPref(FW.Firebug.prefDomain, pref);
+};
+
+// ********************************************************************************************* //
+// Command Line
+
+this.executeCommand = function(expr, chrome, useCommandEditor)
+{
+ this.clearAndTypeCommand(expr, useCommandEditor);
+
+ if (useCommandEditor)
+ FBTest.clickToolbarButton(chrome, "fbCmdLineRunButton");
+ else
+ FBTest.sendKey("RETURN", "fbCommandLine");
+};
+
+this.clearCommand = function(useCommandEditor)
+{
+ var doc = FW.Firebug.chrome.window.document;
+ var cmdLine = doc.getElementById(useCommandEditor ? "fbCommandEditor": "fbCommandLine");