distil 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (552) hide show
  1. data/Rakefile +28 -0
  2. data/VERSION +1 -0
  3. data/bin/distil +45 -0
  4. data/distil.gemspec +586 -0
  5. data/lib/bootstrap-template.js +56 -0
  6. data/lib/configurable.rb +125 -0
  7. data/lib/file-set.rb +42 -0
  8. data/lib/file-types/css-file.rb +75 -0
  9. data/lib/file-types/html-file.rb +11 -0
  10. data/lib/file-types/javascript-file.rb +98 -0
  11. data/lib/file-types/json-file.rb +14 -0
  12. data/lib/file-types/nib-file.rb +9 -0
  13. data/lib/jsdoc.conf +18 -0
  14. data/lib/jsl.conf +121 -0
  15. data/lib/project.rb +96 -0
  16. data/lib/source-file.rb +181 -0
  17. data/lib/target.rb +96 -0
  18. data/lib/task.rb +239 -0
  19. data/lib/tasks/copy-task.rb +21 -0
  20. data/lib/tasks/css-task.rb +18 -0
  21. data/lib/tasks/javascript-task.rb +125 -0
  22. data/lib/tasks/multiple-output-task.rb +134 -0
  23. data/lib/tasks/nib-task.rb +83 -0
  24. data/lib/tasks/output-task.rb +73 -0
  25. data/lib/tasks/single-output-task.rb +83 -0
  26. data/lib/tasks/test-task.rb +280 -0
  27. data/lib/test/HtmlTestReporter.js +127 -0
  28. data/lib/test/Test.js +248 -0
  29. data/lib/test/TestReporter.js +79 -0
  30. data/lib/test/TestRunner.js +132 -0
  31. data/lib/test/browser.rb +97 -0
  32. data/lib/test/scriptwrapper.html +10 -0
  33. data/lib/test/unittest.html +127 -0
  34. data/vendor/Makefile +35 -0
  35. data/vendor/extconf.rb +3 -0
  36. data/vendor/jsdoc-extras/plugins/distil-plugin.js +142 -0
  37. data/vendor/jsdoc-extras/plugins/interface-plugin.js +36 -0
  38. data/vendor/jsdoc-extras/templates/coherent/allclasses.tmpl +17 -0
  39. data/vendor/jsdoc-extras/templates/coherent/allfiles.tmpl +53 -0
  40. data/vendor/jsdoc-extras/templates/coherent/class.tmpl +803 -0
  41. data/vendor/jsdoc-extras/templates/coherent/index.tmpl +37 -0
  42. data/vendor/jsdoc-extras/templates/coherent/publish.js +242 -0
  43. data/vendor/jsdoc-extras/templates/coherent/showdown.js +421 -0
  44. data/vendor/jsdoc-extras/templates/coherent/static/code-footer.html +3 -0
  45. data/vendor/jsdoc-extras/templates/coherent/static/code-header.html +7 -0
  46. data/vendor/jsdoc-extras/templates/coherent/static/default.css +297 -0
  47. data/vendor/jsdoc-extras/templates/coherent/static/header.html +2 -0
  48. data/vendor/jsdoc-extras/templates/coherent/static/index.html +19 -0
  49. data/vendor/jsdoc-extras/templates/coherent/symbol.tmpl +35 -0
  50. data/vendor/jsdoc-toolkit/README.txt +183 -0
  51. data/vendor/jsdoc-toolkit/app/frame/Chain.js +102 -0
  52. data/vendor/jsdoc-toolkit/app/frame/Dumper.js +144 -0
  53. data/vendor/jsdoc-toolkit/app/frame/Hash.js +84 -0
  54. data/vendor/jsdoc-toolkit/app/frame/Link.js +171 -0
  55. data/vendor/jsdoc-toolkit/app/frame/Namespace.js +10 -0
  56. data/vendor/jsdoc-toolkit/app/frame/Opt.js +134 -0
  57. data/vendor/jsdoc-toolkit/app/frame/Reflection.js +26 -0
  58. data/vendor/jsdoc-toolkit/app/frame/String.js +93 -0
  59. data/vendor/jsdoc-toolkit/app/frame/Testrun.js +129 -0
  60. data/vendor/jsdoc-toolkit/app/frame.js +33 -0
  61. data/vendor/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
  62. data/vendor/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
  63. data/vendor/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
  64. data/vendor/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
  65. data/vendor/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
  66. data/vendor/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +204 -0
  67. data/vendor/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +300 -0
  68. data/vendor/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
  69. data/vendor/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
  70. data/vendor/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
  71. data/vendor/jsdoc-toolkit/app/lib/JSDOC/Parser.js +144 -0
  72. data/vendor/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
  73. data/vendor/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +644 -0
  74. data/vendor/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +241 -0
  75. data/vendor/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
  76. data/vendor/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
  77. data/vendor/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
  78. data/vendor/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
  79. data/vendor/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
  80. data/vendor/jsdoc-toolkit/app/lib/JSDOC/Walker.js +499 -0
  81. data/vendor/jsdoc-toolkit/app/lib/JSDOC.js +106 -0
  82. data/vendor/jsdoc-toolkit/app/main.js +129 -0
  83. data/vendor/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
  84. data/vendor/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
  85. data/vendor/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
  86. data/vendor/jsdoc-toolkit/app/plugins/publishSrcHilite.js +54 -0
  87. data/vendor/jsdoc-toolkit/app/plugins/symbolLink.js +10 -0
  88. data/vendor/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
  89. data/vendor/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
  90. data/vendor/jsdoc-toolkit/app/run.js +348 -0
  91. data/vendor/jsdoc-toolkit/app/t/TestDoc.js +144 -0
  92. data/vendor/jsdoc-toolkit/app/t/runner.js +13 -0
  93. data/vendor/jsdoc-toolkit/app/test/addon.js +24 -0
  94. data/vendor/jsdoc-toolkit/app/test/anon_inner.js +14 -0
  95. data/vendor/jsdoc-toolkit/app/test/augments.js +31 -0
  96. data/vendor/jsdoc-toolkit/app/test/augments2.js +26 -0
  97. data/vendor/jsdoc-toolkit/app/test/borrows.js +46 -0
  98. data/vendor/jsdoc-toolkit/app/test/borrows2.js +23 -0
  99. data/vendor/jsdoc-toolkit/app/test/config.js +22 -0
  100. data/vendor/jsdoc-toolkit/app/test/constructs.js +18 -0
  101. data/vendor/jsdoc-toolkit/app/test/encoding.js +10 -0
  102. data/vendor/jsdoc-toolkit/app/test/encoding_other.js +12 -0
  103. data/vendor/jsdoc-toolkit/app/test/event.js +54 -0
  104. data/vendor/jsdoc-toolkit/app/test/exports.js +14 -0
  105. data/vendor/jsdoc-toolkit/app/test/functions_anon.js +39 -0
  106. data/vendor/jsdoc-toolkit/app/test/functions_nested.js +33 -0
  107. data/vendor/jsdoc-toolkit/app/test/global.js +13 -0
  108. data/vendor/jsdoc-toolkit/app/test/globals.js +25 -0
  109. data/vendor/jsdoc-toolkit/app/test/ignore.js +10 -0
  110. data/vendor/jsdoc-toolkit/app/test/inner.js +16 -0
  111. data/vendor/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
  112. data/vendor/jsdoc-toolkit/app/test/lend.js +33 -0
  113. data/vendor/jsdoc-toolkit/app/test/memberof.js +19 -0
  114. data/vendor/jsdoc-toolkit/app/test/memberof2.js +38 -0
  115. data/vendor/jsdoc-toolkit/app/test/memberof3.js +33 -0
  116. data/vendor/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
  117. data/vendor/jsdoc-toolkit/app/test/module.js +17 -0
  118. data/vendor/jsdoc-toolkit/app/test/name.js +19 -0
  119. data/vendor/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
  120. data/vendor/jsdoc-toolkit/app/test/nocode.js +13 -0
  121. data/vendor/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
  122. data/vendor/jsdoc-toolkit/app/test/overview.js +20 -0
  123. data/vendor/jsdoc-toolkit/app/test/param_inline.js +37 -0
  124. data/vendor/jsdoc-toolkit/app/test/params_optional.js +8 -0
  125. data/vendor/jsdoc-toolkit/app/test/prototype.js +17 -0
  126. data/vendor/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
  127. data/vendor/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
  128. data/vendor/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
  129. data/vendor/jsdoc-toolkit/app/test/public.js +10 -0
  130. data/vendor/jsdoc-toolkit/app/test/scripts/code.js +5 -0
  131. data/vendor/jsdoc-toolkit/app/test/scripts/notcode.txt +5 -0
  132. data/vendor/jsdoc-toolkit/app/test/shared.js +42 -0
  133. data/vendor/jsdoc-toolkit/app/test/shared2.js +2 -0
  134. data/vendor/jsdoc-toolkit/app/test/shortcuts.js +22 -0
  135. data/vendor/jsdoc-toolkit/app/test/static_this.js +13 -0
  136. data/vendor/jsdoc-toolkit/app/test/synonyms.js +31 -0
  137. data/vendor/jsdoc-toolkit/app/test/tosource.js +23 -0
  138. data/vendor/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
  139. data/vendor/jsdoc-toolkit/app/test.js +342 -0
  140. data/vendor/jsdoc-toolkit/changes.txt +116 -0
  141. data/vendor/jsdoc-toolkit/conf/sample.conf +31 -0
  142. data/vendor/jsdoc-toolkit/java/build.xml +36 -0
  143. data/vendor/jsdoc-toolkit/java/build_1.4.xml +36 -0
  144. data/vendor/jsdoc-toolkit/java/classes/js.jar +0 -0
  145. data/vendor/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
  146. data/vendor/jsdoc-toolkit/java/src/JsRun.java +21 -0
  147. data/vendor/jsdoc-toolkit/jsdebug.jar +0 -0
  148. data/vendor/jsdoc-toolkit/jsrun.jar +0 -0
  149. data/vendor/jsdoc-toolkit/jsrun.sh +53 -0
  150. data/vendor/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
  151. data/vendor/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
  152. data/vendor/jsdoc-toolkit/templates/jsdoc/class.tmpl +649 -0
  153. data/vendor/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
  154. data/vendor/jsdoc-toolkit/templates/jsdoc/publish.js +201 -0
  155. data/vendor/jsdoc-toolkit/templates/jsdoc/static/code-footer.html +3 -0
  156. data/vendor/jsdoc-toolkit/templates/jsdoc/static/code-header.html +14 -0
  157. data/vendor/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
  158. data/vendor/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
  159. data/vendor/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
  160. data/vendor/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
  161. data/vendor/jsl-0.3.0/src/JavaScriptLintAPI.cpp +333 -0
  162. data/vendor/jsl-0.3.0/src/JavaScriptLintAPI.h +86 -0
  163. data/vendor/jsl-0.3.0/src/Makefile.in +375 -0
  164. data/vendor/jsl-0.3.0/src/Makefile.ref +372 -0
  165. data/vendor/jsl-0.3.0/src/README.html +826 -0
  166. data/vendor/jsl-0.3.0/src/SpiderMonkey.rsp +12 -0
  167. data/vendor/jsl-0.3.0/src/_jsl_online.php +223 -0
  168. data/vendor/jsl-0.3.0/src/config/AIX4.1.mk +65 -0
  169. data/vendor/jsl-0.3.0/src/config/AIX4.2.mk +64 -0
  170. data/vendor/jsl-0.3.0/src/config/AIX4.3.mk +65 -0
  171. data/vendor/jsl-0.3.0/src/config/Darwin.mk +81 -0
  172. data/vendor/jsl-0.3.0/src/config/Darwin1.3.mk +81 -0
  173. data/vendor/jsl-0.3.0/src/config/Darwin1.4.mk +41 -0
  174. data/vendor/jsl-0.3.0/src/config/Darwin5.2.mk +81 -0
  175. data/vendor/jsl-0.3.0/src/config/Darwin5.3.mk +81 -0
  176. data/vendor/jsl-0.3.0/src/config/HP-UXB.10.10.mk +77 -0
  177. data/vendor/jsl-0.3.0/src/config/HP-UXB.10.20.mk +77 -0
  178. data/vendor/jsl-0.3.0/src/config/HP-UXB.11.00.mk +80 -0
  179. data/vendor/jsl-0.3.0/src/config/IRIX.mk +87 -0
  180. data/vendor/jsl-0.3.0/src/config/IRIX5.3.mk +44 -0
  181. data/vendor/jsl-0.3.0/src/config/IRIX6.1.mk +44 -0
  182. data/vendor/jsl-0.3.0/src/config/IRIX6.2.mk +44 -0
  183. data/vendor/jsl-0.3.0/src/config/IRIX6.3.mk +44 -0
  184. data/vendor/jsl-0.3.0/src/config/IRIX6.5.mk +44 -0
  185. data/vendor/jsl-0.3.0/src/config/Linux_All.mk +103 -0
  186. data/vendor/jsl-0.3.0/src/config/Mac_OS10.0.mk +82 -0
  187. data/vendor/jsl-0.3.0/src/config/OSF1V4.0.mk +72 -0
  188. data/vendor/jsl-0.3.0/src/config/OSF1V5.0.mk +69 -0
  189. data/vendor/jsl-0.3.0/src/config/SunOS4.1.4.mk +101 -0
  190. data/vendor/jsl-0.3.0/src/config/SunOS5.3.mk +91 -0
  191. data/vendor/jsl-0.3.0/src/config/SunOS5.4.mk +92 -0
  192. data/vendor/jsl-0.3.0/src/config/SunOS5.5.1.mk +44 -0
  193. data/vendor/jsl-0.3.0/src/config/SunOS5.5.mk +87 -0
  194. data/vendor/jsl-0.3.0/src/config/SunOS5.6.mk +89 -0
  195. data/vendor/jsl-0.3.0/src/config/SunOS5.7.mk +44 -0
  196. data/vendor/jsl-0.3.0/src/config/SunOS5.8.mk +44 -0
  197. data/vendor/jsl-0.3.0/src/config/SunOS5.9.mk +44 -0
  198. data/vendor/jsl-0.3.0/src/config/WINNT4.0.mk +112 -0
  199. data/vendor/jsl-0.3.0/src/config/WINNT5.0.mk +112 -0
  200. data/vendor/jsl-0.3.0/src/config/WINNT5.1.mk +112 -0
  201. data/vendor/jsl-0.3.0/src/config/WINNT5.2.mk +112 -0
  202. data/vendor/jsl-0.3.0/src/config/dgux.mk +64 -0
  203. data/vendor/jsl-0.3.0/src/config.mk +166 -0
  204. data/vendor/jsl-0.3.0/src/editline/Makefile.ref +144 -0
  205. data/vendor/jsl-0.3.0/src/editline/README +83 -0
  206. data/vendor/jsl-0.3.0/src/editline/editline.3 +175 -0
  207. data/vendor/jsl-0.3.0/src/editline/editline.c +1369 -0
  208. data/vendor/jsl-0.3.0/src/editline/editline.h +135 -0
  209. data/vendor/jsl-0.3.0/src/editline/sysunix.c +182 -0
  210. data/vendor/jsl-0.3.0/src/editline/unix.h +82 -0
  211. data/vendor/jsl-0.3.0/src/fdlibm/Makefile.in +127 -0
  212. data/vendor/jsl-0.3.0/src/fdlibm/Makefile.ref +192 -0
  213. data/vendor/jsl-0.3.0/src/fdlibm/e_acos.c +147 -0
  214. data/vendor/jsl-0.3.0/src/fdlibm/e_acosh.c +105 -0
  215. data/vendor/jsl-0.3.0/src/fdlibm/e_asin.c +156 -0
  216. data/vendor/jsl-0.3.0/src/fdlibm/e_atan2.c +165 -0
  217. data/vendor/jsl-0.3.0/src/fdlibm/e_atanh.c +110 -0
  218. data/vendor/jsl-0.3.0/src/fdlibm/e_cosh.c +133 -0
  219. data/vendor/jsl-0.3.0/src/fdlibm/e_exp.c +202 -0
  220. data/vendor/jsl-0.3.0/src/fdlibm/e_fmod.c +184 -0
  221. data/vendor/jsl-0.3.0/src/fdlibm/e_gamma.c +71 -0
  222. data/vendor/jsl-0.3.0/src/fdlibm/e_gamma_r.c +70 -0
  223. data/vendor/jsl-0.3.0/src/fdlibm/e_hypot.c +173 -0
  224. data/vendor/jsl-0.3.0/src/fdlibm/e_j0.c +524 -0
  225. data/vendor/jsl-0.3.0/src/fdlibm/e_j1.c +523 -0
  226. data/vendor/jsl-0.3.0/src/fdlibm/e_jn.c +315 -0
  227. data/vendor/jsl-0.3.0/src/fdlibm/e_lgamma.c +71 -0
  228. data/vendor/jsl-0.3.0/src/fdlibm/e_lgamma_r.c +347 -0
  229. data/vendor/jsl-0.3.0/src/fdlibm/e_log.c +184 -0
  230. data/vendor/jsl-0.3.0/src/fdlibm/e_log10.c +134 -0
  231. data/vendor/jsl-0.3.0/src/fdlibm/e_pow.c +386 -0
  232. data/vendor/jsl-0.3.0/src/fdlibm/e_rem_pio2.c +221 -0
  233. data/vendor/jsl-0.3.0/src/fdlibm/e_remainder.c +120 -0
  234. data/vendor/jsl-0.3.0/src/fdlibm/e_scalb.c +89 -0
  235. data/vendor/jsl-0.3.0/src/fdlibm/e_sinh.c +122 -0
  236. data/vendor/jsl-0.3.0/src/fdlibm/e_sqrt.c +497 -0
  237. data/vendor/jsl-0.3.0/src/fdlibm/fdlibm.dsp +160 -0
  238. data/vendor/jsl-0.3.0/src/fdlibm/fdlibm.h +273 -0
  239. data/vendor/jsl-0.3.0/src/fdlibm/fdlibm.mak +1453 -0
  240. data/vendor/jsl-0.3.0/src/fdlibm/fdlibm.mdp +0 -0
  241. data/vendor/jsl-0.3.0/src/fdlibm/k_cos.c +134 -0
  242. data/vendor/jsl-0.3.0/src/fdlibm/k_rem_pio2.c +354 -0
  243. data/vendor/jsl-0.3.0/src/fdlibm/k_sin.c +114 -0
  244. data/vendor/jsl-0.3.0/src/fdlibm/k_standard.c +785 -0
  245. data/vendor/jsl-0.3.0/src/fdlibm/k_tan.c +170 -0
  246. data/vendor/jsl-0.3.0/src/fdlibm/s_asinh.c +101 -0
  247. data/vendor/jsl-0.3.0/src/fdlibm/s_atan.c +175 -0
  248. data/vendor/jsl-0.3.0/src/fdlibm/s_cbrt.c +133 -0
  249. data/vendor/jsl-0.3.0/src/fdlibm/s_ceil.c +120 -0
  250. data/vendor/jsl-0.3.0/src/fdlibm/s_copysign.c +72 -0
  251. data/vendor/jsl-0.3.0/src/fdlibm/s_cos.c +118 -0
  252. data/vendor/jsl-0.3.0/src/fdlibm/s_erf.c +356 -0
  253. data/vendor/jsl-0.3.0/src/fdlibm/s_expm1.c +267 -0
  254. data/vendor/jsl-0.3.0/src/fdlibm/s_fabs.c +70 -0
  255. data/vendor/jsl-0.3.0/src/fdlibm/s_finite.c +71 -0
  256. data/vendor/jsl-0.3.0/src/fdlibm/s_floor.c +121 -0
  257. data/vendor/jsl-0.3.0/src/fdlibm/s_frexp.c +99 -0
  258. data/vendor/jsl-0.3.0/src/fdlibm/s_ilogb.c +85 -0
  259. data/vendor/jsl-0.3.0/src/fdlibm/s_isnan.c +74 -0
  260. data/vendor/jsl-0.3.0/src/fdlibm/s_ldexp.c +66 -0
  261. data/vendor/jsl-0.3.0/src/fdlibm/s_lib_version.c +73 -0
  262. data/vendor/jsl-0.3.0/src/fdlibm/s_log1p.c +211 -0
  263. data/vendor/jsl-0.3.0/src/fdlibm/s_logb.c +79 -0
  264. data/vendor/jsl-0.3.0/src/fdlibm/s_matherr.c +64 -0
  265. data/vendor/jsl-0.3.0/src/fdlibm/s_modf.c +132 -0
  266. data/vendor/jsl-0.3.0/src/fdlibm/s_nextafter.c +124 -0
  267. data/vendor/jsl-0.3.0/src/fdlibm/s_rint.c +131 -0
  268. data/vendor/jsl-0.3.0/src/fdlibm/s_scalbn.c +107 -0
  269. data/vendor/jsl-0.3.0/src/fdlibm/s_signgam.c +40 -0
  270. data/vendor/jsl-0.3.0/src/fdlibm/s_significand.c +68 -0
  271. data/vendor/jsl-0.3.0/src/fdlibm/s_sin.c +118 -0
  272. data/vendor/jsl-0.3.0/src/fdlibm/s_tan.c +112 -0
  273. data/vendor/jsl-0.3.0/src/fdlibm/s_tanh.c +122 -0
  274. data/vendor/jsl-0.3.0/src/fdlibm/w_acos.c +78 -0
  275. data/vendor/jsl-0.3.0/src/fdlibm/w_acosh.c +78 -0
  276. data/vendor/jsl-0.3.0/src/fdlibm/w_asin.c +80 -0
  277. data/vendor/jsl-0.3.0/src/fdlibm/w_atan2.c +79 -0
  278. data/vendor/jsl-0.3.0/src/fdlibm/w_atanh.c +81 -0
  279. data/vendor/jsl-0.3.0/src/fdlibm/w_cosh.c +77 -0
  280. data/vendor/jsl-0.3.0/src/fdlibm/w_exp.c +88 -0
  281. data/vendor/jsl-0.3.0/src/fdlibm/w_fmod.c +78 -0
  282. data/vendor/jsl-0.3.0/src/fdlibm/w_gamma.c +85 -0
  283. data/vendor/jsl-0.3.0/src/fdlibm/w_gamma_r.c +81 -0
  284. data/vendor/jsl-0.3.0/src/fdlibm/w_hypot.c +78 -0
  285. data/vendor/jsl-0.3.0/src/fdlibm/w_j0.c +105 -0
  286. data/vendor/jsl-0.3.0/src/fdlibm/w_j1.c +106 -0
  287. data/vendor/jsl-0.3.0/src/fdlibm/w_jn.c +128 -0
  288. data/vendor/jsl-0.3.0/src/fdlibm/w_lgamma.c +85 -0
  289. data/vendor/jsl-0.3.0/src/fdlibm/w_lgamma_r.c +81 -0
  290. data/vendor/jsl-0.3.0/src/fdlibm/w_log.c +78 -0
  291. data/vendor/jsl-0.3.0/src/fdlibm/w_log10.c +81 -0
  292. data/vendor/jsl-0.3.0/src/fdlibm/w_pow.c +99 -0
  293. data/vendor/jsl-0.3.0/src/fdlibm/w_remainder.c +77 -0
  294. data/vendor/jsl-0.3.0/src/fdlibm/w_scalb.c +95 -0
  295. data/vendor/jsl-0.3.0/src/fdlibm/w_sinh.c +77 -0
  296. data/vendor/jsl-0.3.0/src/fdlibm/w_sqrt.c +77 -0
  297. data/vendor/jsl-0.3.0/src/js.c +2447 -0
  298. data/vendor/jsl-0.3.0/src/js.dsp +420 -0
  299. data/vendor/jsl-0.3.0/src/js.mak +4025 -0
  300. data/vendor/jsl-0.3.0/src/js.mdp +0 -0
  301. data/vendor/jsl-0.3.0/src/js.msg +291 -0
  302. data/vendor/jsl-0.3.0/src/js.pkg +2 -0
  303. data/vendor/jsl-0.3.0/src/js3240.rc +79 -0
  304. data/vendor/jsl-0.3.0/src/jsOS240.def +654 -0
  305. data/vendor/jsl-0.3.0/src/jsapi.c +4405 -0
  306. data/vendor/jsl-0.3.0/src/jsapi.h +1856 -0
  307. data/vendor/jsl-0.3.0/src/jsarena.c +567 -0
  308. data/vendor/jsl-0.3.0/src/jsarena.h +302 -0
  309. data/vendor/jsl-0.3.0/src/jsarray.c +1428 -0
  310. data/vendor/jsl-0.3.0/src/jsarray.h +77 -0
  311. data/vendor/jsl-0.3.0/src/jsatom.c +927 -0
  312. data/vendor/jsl-0.3.0/src/jsatom.h +426 -0
  313. data/vendor/jsl-0.3.0/src/jsbit.h +113 -0
  314. data/vendor/jsl-0.3.0/src/jsbool.c +220 -0
  315. data/vendor/jsl-0.3.0/src/jsbool.h +62 -0
  316. data/vendor/jsl-0.3.0/src/jsclist.h +139 -0
  317. data/vendor/jsl-0.3.0/src/jscntxt.c +1036 -0
  318. data/vendor/jsl-0.3.0/src/jscntxt.h +608 -0
  319. data/vendor/jsl-0.3.0/src/jscompat.h +57 -0
  320. data/vendor/jsl-0.3.0/src/jsconfig.h +489 -0
  321. data/vendor/jsl-0.3.0/src/jsconfig.mk +181 -0
  322. data/vendor/jsl-0.3.0/src/jscpucfg.c +377 -0
  323. data/vendor/jsl-0.3.0/src/jscpucfg.h +204 -0
  324. data/vendor/jsl-0.3.0/src/jsdate.c +2238 -0
  325. data/vendor/jsl-0.3.0/src/jsdate.h +118 -0
  326. data/vendor/jsl-0.3.0/src/jsdbgapi.c +1260 -0
  327. data/vendor/jsl-0.3.0/src/jsdbgapi.h +345 -0
  328. data/vendor/jsl-0.3.0/src/jsdhash.c +763 -0
  329. data/vendor/jsl-0.3.0/src/jsdhash.h +579 -0
  330. data/vendor/jsl-0.3.0/src/jsdtoa.c +3135 -0
  331. data/vendor/jsl-0.3.0/src/jsdtoa.h +130 -0
  332. data/vendor/jsl-0.3.0/src/jsemit.c +4851 -0
  333. data/vendor/jsl-0.3.0/src/jsemit.h +576 -0
  334. data/vendor/jsl-0.3.0/src/jsexn.c +1084 -0
  335. data/vendor/jsl-0.3.0/src/jsexn.h +102 -0
  336. data/vendor/jsl-0.3.0/src/jsfile.c +2610 -0
  337. data/vendor/jsl-0.3.0/src/jsfile.h +50 -0
  338. data/vendor/jsl-0.3.0/src/jsfile.msg +89 -0
  339. data/vendor/jsl-0.3.0/src/jsfun.c +2015 -0
  340. data/vendor/jsl-0.3.0/src/jsfun.h +158 -0
  341. data/vendor/jsl-0.3.0/src/jsgc.c +1441 -0
  342. data/vendor/jsl-0.3.0/src/jsgc.h +230 -0
  343. data/vendor/jsl-0.3.0/src/jshash.c +471 -0
  344. data/vendor/jsl-0.3.0/src/jshash.h +152 -0
  345. data/vendor/jsl-0.3.0/src/jsify.pl +485 -0
  346. data/vendor/jsl-0.3.0/src/jsinterp.c +4797 -0
  347. data/vendor/jsl-0.3.0/src/jsinterp.h +302 -0
  348. data/vendor/jsl-0.3.0/src/jsl-test.js +28 -0
  349. data/vendor/jsl-0.3.0/src/jsl.c +2371 -0
  350. data/vendor/jsl-0.3.0/src/jsl.conf +127 -0
  351. data/vendor/jsl-0.3.0/src/jsl.conf.old +124 -0
  352. data/vendor/jsl-0.3.0/src/jsl.dsp +242 -0
  353. data/vendor/jsl-0.3.0/src/jsl.dsw +59 -0
  354. data/vendor/jsl-0.3.0/src/jslibmath.h +290 -0
  355. data/vendor/jsl-0.3.0/src/jslock.c +1261 -0
  356. data/vendor/jsl-0.3.0/src/jslock.h +289 -0
  357. data/vendor/jsl-0.3.0/src/jslocko.asm +59 -0
  358. data/vendor/jsl-0.3.0/src/jslog2.c +83 -0
  359. data/vendor/jsl-0.3.0/src/jslong.c +281 -0
  360. data/vendor/jsl-0.3.0/src/jslong.h +437 -0
  361. data/vendor/jsl-0.3.0/src/jsmath.c +477 -0
  362. data/vendor/jsl-0.3.0/src/jsmath.h +55 -0
  363. data/vendor/jsl-0.3.0/src/jsnum.c +1148 -0
  364. data/vendor/jsl-0.3.0/src/jsnum.h +257 -0
  365. data/vendor/jsl-0.3.0/src/jsobj.c +4066 -0
  366. data/vendor/jsl-0.3.0/src/jsobj.h +475 -0
  367. data/vendor/jsl-0.3.0/src/jsopcode.c +2730 -0
  368. data/vendor/jsl-0.3.0/src/jsopcode.h +275 -0
  369. data/vendor/jsl-0.3.0/src/jsopcode.tbl +344 -0
  370. data/vendor/jsl-0.3.0/src/jsosdep.h +127 -0
  371. data/vendor/jsl-0.3.0/src/jsotypes.h +211 -0
  372. data/vendor/jsl-0.3.0/src/jsparse.c +4438 -0
  373. data/vendor/jsl-0.3.0/src/jsparse.h +345 -0
  374. data/vendor/jsl-0.3.0/src/jsprf.c +1212 -0
  375. data/vendor/jsl-0.3.0/src/jsprf.h +148 -0
  376. data/vendor/jsl-0.3.0/src/jsprvtd.h +174 -0
  377. data/vendor/jsl-0.3.0/src/jspubtd.h +586 -0
  378. data/vendor/jsl-0.3.0/src/jsregexp.c +3831 -0
  379. data/vendor/jsl-0.3.0/src/jsregexp.h +180 -0
  380. data/vendor/jsl-0.3.0/src/jsscan.c +1814 -0
  381. data/vendor/jsl-0.3.0/src/jsscan.h +267 -0
  382. data/vendor/jsl-0.3.0/src/jsscope.c +1639 -0
  383. data/vendor/jsl-0.3.0/src/jsscope.h +389 -0
  384. data/vendor/jsl-0.3.0/src/jsscript.c +1284 -0
  385. data/vendor/jsl-0.3.0/src/jsscript.h +179 -0
  386. data/vendor/jsl-0.3.0/src/jsshell.msg +50 -0
  387. data/vendor/jsl-0.3.0/src/jsstddef.h +83 -0
  388. data/vendor/jsl-0.3.0/src/jsstr.c +4502 -0
  389. data/vendor/jsl-0.3.0/src/jsstr.h +448 -0
  390. data/vendor/jsl-0.3.0/src/jstypes.h +391 -0
  391. data/vendor/jsl-0.3.0/src/jsutil.c +157 -0
  392. data/vendor/jsl-0.3.0/src/jsutil.h +75 -0
  393. data/vendor/jsl-0.3.0/src/jsxdrapi.c +686 -0
  394. data/vendor/jsl-0.3.0/src/jsxdrapi.h +193 -0
  395. data/vendor/jsl-0.3.0/src/liveconnect/LiveConnect.dsp +157 -0
  396. data/vendor/jsl-0.3.0/src/liveconnect/LiveConnectShell.dsp +120 -0
  397. data/vendor/jsl-0.3.0/src/liveconnect/LiveConnectShell.dsw +44 -0
  398. data/vendor/jsl-0.3.0/src/liveconnect/Makefile.in +106 -0
  399. data/vendor/jsl-0.3.0/src/liveconnect/Makefile.ref +169 -0
  400. data/vendor/jsl-0.3.0/src/liveconnect/README.html +719 -0
  401. data/vendor/jsl-0.3.0/src/liveconnect/_jni/netscape_javascript_JSException.h +14 -0
  402. data/vendor/jsl-0.3.0/src/liveconnect/_jni/netscape_javascript_JSObject.h +155 -0
  403. data/vendor/jsl-0.3.0/src/liveconnect/classes/Makefile.in +89 -0
  404. data/vendor/jsl-0.3.0/src/liveconnect/classes/Makefile.ref +57 -0
  405. data/vendor/jsl-0.3.0/src/liveconnect/classes/netscape/Makefile.ref +47 -0
  406. data/vendor/jsl-0.3.0/src/liveconnect/classes/netscape/javascript/JSException.java +140 -0
  407. data/vendor/jsl-0.3.0/src/liveconnect/classes/netscape/javascript/JSObject.java +183 -0
  408. data/vendor/jsl-0.3.0/src/liveconnect/classes/netscape/javascript/JSProxy.java +58 -0
  409. data/vendor/jsl-0.3.0/src/liveconnect/classes/netscape/javascript/JSRunnable.java +70 -0
  410. data/vendor/jsl-0.3.0/src/liveconnect/classes/netscape/javascript/JSUtil.java +59 -0
  411. data/vendor/jsl-0.3.0/src/liveconnect/classes/netscape/javascript/Makefile.ref +53 -0
  412. data/vendor/jsl-0.3.0/src/liveconnect/config/AIX4.1.mk +45 -0
  413. data/vendor/jsl-0.3.0/src/liveconnect/config/AIX4.2.mk +45 -0
  414. data/vendor/jsl-0.3.0/src/liveconnect/config/AIX4.3.mk +50 -0
  415. data/vendor/jsl-0.3.0/src/liveconnect/config/HP-UXB.10.10.mk +43 -0
  416. data/vendor/jsl-0.3.0/src/liveconnect/config/HP-UXB.10.20.mk +43 -0
  417. data/vendor/jsl-0.3.0/src/liveconnect/config/HP-UXB.11.00.mk +43 -0
  418. data/vendor/jsl-0.3.0/src/liveconnect/config/IRIX6.2.mk +43 -0
  419. data/vendor/jsl-0.3.0/src/liveconnect/config/IRIX6.3.mk +43 -0
  420. data/vendor/jsl-0.3.0/src/liveconnect/config/IRIX6.5.mk +43 -0
  421. data/vendor/jsl-0.3.0/src/liveconnect/config/Linux_All.mk +73 -0
  422. data/vendor/jsl-0.3.0/src/liveconnect/config/OSF1V4.0.mk +65 -0
  423. data/vendor/jsl-0.3.0/src/liveconnect/config/OSF1V5.0.mk +62 -0
  424. data/vendor/jsl-0.3.0/src/liveconnect/config/SunOS5.5.1.mk +55 -0
  425. data/vendor/jsl-0.3.0/src/liveconnect/config/SunOS5.6.mk +39 -0
  426. data/vendor/jsl-0.3.0/src/liveconnect/config/SunOS5.7.mk +39 -0
  427. data/vendor/jsl-0.3.0/src/liveconnect/config/SunOS5.8.mk +39 -0
  428. data/vendor/jsl-0.3.0/src/liveconnect/config/WINNT4.0.mk +53 -0
  429. data/vendor/jsl-0.3.0/src/liveconnect/jsj.c +884 -0
  430. data/vendor/jsl-0.3.0/src/liveconnect/jsj.msg +98 -0
  431. data/vendor/jsl-0.3.0/src/liveconnect/jsj_JSObject.c +1379 -0
  432. data/vendor/jsl-0.3.0/src/liveconnect/jsj_JavaArray.c +481 -0
  433. data/vendor/jsl-0.3.0/src/liveconnect/jsj_JavaClass.c +749 -0
  434. data/vendor/jsl-0.3.0/src/liveconnect/jsj_JavaMember.c +186 -0
  435. data/vendor/jsl-0.3.0/src/liveconnect/jsj_JavaObject.c +1099 -0
  436. data/vendor/jsl-0.3.0/src/liveconnect/jsj_JavaPackage.c +548 -0
  437. data/vendor/jsl-0.3.0/src/liveconnect/jsj_array.c +207 -0
  438. data/vendor/jsl-0.3.0/src/liveconnect/jsj_class.c +765 -0
  439. data/vendor/jsl-0.3.0/src/liveconnect/jsj_convert.c +954 -0
  440. data/vendor/jsl-0.3.0/src/liveconnect/jsj_field.c +421 -0
  441. data/vendor/jsl-0.3.0/src/liveconnect/jsj_hash.c +504 -0
  442. data/vendor/jsl-0.3.0/src/liveconnect/jsj_hash.h +161 -0
  443. data/vendor/jsl-0.3.0/src/liveconnect/jsj_method.c +1823 -0
  444. data/vendor/jsl-0.3.0/src/liveconnect/jsj_nodl.c +1 -0
  445. data/vendor/jsl-0.3.0/src/liveconnect/jsj_private.h +689 -0
  446. data/vendor/jsl-0.3.0/src/liveconnect/jsj_simpleapi.c +219 -0
  447. data/vendor/jsl-0.3.0/src/liveconnect/jsj_utils.c +513 -0
  448. data/vendor/jsl-0.3.0/src/liveconnect/jsjava.h +313 -0
  449. data/vendor/jsl-0.3.0/src/liveconnect/liveconnect.pkg +3 -0
  450. data/vendor/jsl-0.3.0/src/liveconnect/netscape_javascript_JSObject.h +155 -0
  451. data/vendor/jsl-0.3.0/src/liveconnect/nsCLiveconnect.cpp +785 -0
  452. data/vendor/jsl-0.3.0/src/liveconnect/nsCLiveconnect.h +197 -0
  453. data/vendor/jsl-0.3.0/src/liveconnect/nsCLiveconnectFactory.cpp +163 -0
  454. data/vendor/jsl-0.3.0/src/liveconnect/nsCLiveconnectFactory.h +76 -0
  455. data/vendor/jsl-0.3.0/src/liveconnect/nsILiveconnect.h +195 -0
  456. data/vendor/jsl-0.3.0/src/liveconnect/nsISecureLiveconnect.h +84 -0
  457. data/vendor/jsl-0.3.0/src/liveconnect/nsISecurityContext.h +135 -0
  458. data/vendor/jsl-0.3.0/src/liveconnect/win32.order +6 -0
  459. data/vendor/jsl-0.3.0/src/lock_SunOS.s +114 -0
  460. data/vendor/jsl-0.3.0/src/perfect.js +39 -0
  461. data/vendor/jsl-0.3.0/src/perlconnect/JS.def +6 -0
  462. data/vendor/jsl-0.3.0/src/perlconnect/JS.dsp +107 -0
  463. data/vendor/jsl-0.3.0/src/perlconnect/JS.pm +318 -0
  464. data/vendor/jsl-0.3.0/src/perlconnect/JS.xs +1050 -0
  465. data/vendor/jsl-0.3.0/src/perlconnect/Makefile.PL +67 -0
  466. data/vendor/jsl-0.3.0/src/perlconnect/Makefile.ref +152 -0
  467. data/vendor/jsl-0.3.0/src/perlconnect/PerlConnect.dsp +103 -0
  468. data/vendor/jsl-0.3.0/src/perlconnect/PerlConnect.dsw +59 -0
  469. data/vendor/jsl-0.3.0/src/perlconnect/PerlConnect.pm +126 -0
  470. data/vendor/jsl-0.3.0/src/perlconnect/PerlConnectShell.dsp +89 -0
  471. data/vendor/jsl-0.3.0/src/perlconnect/README.html +345 -0
  472. data/vendor/jsl-0.3.0/src/perlconnect/bg.jpg +0 -0
  473. data/vendor/jsl-0.3.0/src/perlconnect/jsperl.c +1100 -0
  474. data/vendor/jsl-0.3.0/src/perlconnect/jsperl.h +52 -0
  475. data/vendor/jsl-0.3.0/src/perlconnect/jsperlbuild.pl +81 -0
  476. data/vendor/jsl-0.3.0/src/perlconnect/jsperlpvt.h +57 -0
  477. data/vendor/jsl-0.3.0/src/perlconnect/test.js +73 -0
  478. data/vendor/jsl-0.3.0/src/perlconnect/test.pl +244 -0
  479. data/vendor/jsl-0.3.0/src/perlconnect/typemap +121 -0
  480. data/vendor/jsl-0.3.0/src/plify_jsdhash.sed +31 -0
  481. data/vendor/jsl-0.3.0/src/prmjtime.c +646 -0
  482. data/vendor/jsl-0.3.0/src/prmjtime.h +95 -0
  483. data/vendor/jsl-0.3.0/src/resource.h +15 -0
  484. data/vendor/jsl-0.3.0/src/rules.mk +193 -0
  485. data/vendor/jsl-0.3.0/src/win32.order +391 -0
  486. data/vendor/jsl-0.3.0/tests/conf/always_use_option_explicit.js +4 -0
  487. data/vendor/jsl-0.3.0/tests/conf/define.js +8 -0
  488. data/vendor/jsl-0.3.0/tests/conf/jscript_function_extensions-1.js +7 -0
  489. data/vendor/jsl-0.3.0/tests/conf/jscript_function_extensions-2.js +8 -0
  490. data/vendor/jsl-0.3.0/tests/conf/jscript_function_extensions-3.js +27 -0
  491. data/vendor/jsl-0.3.0/tests/conf/jscript_function_extensions-4.js +4 -0
  492. data/vendor/jsl-0.3.0/tests/conf/lambda_assign_requires_semicolon.js +24 -0
  493. data/vendor/jsl-0.3.0/tests/conf/legacy_control_comments.js +8 -0
  494. data/vendor/jsl-0.3.0/tests/control_comments/control_comments.js +33 -0
  495. data/vendor/jsl-0.3.0/tests/control_comments/declare.js +26 -0
  496. data/vendor/jsl-0.3.0/tests/control_comments/import-overflow.js +9 -0
  497. data/vendor/jsl-0.3.0/tests/control_comments/import.js +5 -0
  498. data/vendor/jsl-0.3.0/tests/control_comments/import2.js +2 -0
  499. data/vendor/jsl-0.3.0/tests/control_comments/invalid_fallthru.js +13 -0
  500. data/vendor/jsl-0.3.0/tests/control_comments/option_explicit-with.js +12 -0
  501. data/vendor/jsl-0.3.0/tests/control_comments/option_explicit.js +64 -0
  502. data/vendor/jsl-0.3.0/tests/errors/unterminated_comment.js +8 -0
  503. data/vendor/jsl-0.3.0/tests/html/script_tag_in_js_literal.html +14 -0
  504. data/vendor/jsl-0.3.0/tests/run_tests.pl +71 -0
  505. data/vendor/jsl-0.3.0/tests/warnings/ambiguous_else_stmt.js +21 -0
  506. data/vendor/jsl-0.3.0/tests/warnings/ambiguous_nested_stmt.js +66 -0
  507. data/vendor/jsl-0.3.0/tests/warnings/ambiguous_newline.js +261 -0
  508. data/vendor/jsl-0.3.0/tests/warnings/anon_no_return_value.js +26 -0
  509. data/vendor/jsl-0.3.0/tests/warnings/assign_to_function_call.js +16 -0
  510. data/vendor/jsl-0.3.0/tests/warnings/block_without_braces.js +13 -0
  511. data/vendor/jsl-0.3.0/tests/warnings/comma_separated_stmts.js +17 -0
  512. data/vendor/jsl-0.3.0/tests/warnings/comparison_type_conv.js +44 -0
  513. data/vendor/jsl-0.3.0/tests/warnings/default_not_at_end.js +15 -0
  514. data/vendor/jsl-0.3.0/tests/warnings/dup_option_explicit.js +5 -0
  515. data/vendor/jsl-0.3.0/tests/warnings/duplicate_case_in_switch.js +62 -0
  516. data/vendor/jsl-0.3.0/tests/warnings/duplicate_formal.js +5 -0
  517. data/vendor/jsl-0.3.0/tests/warnings/empty_statement.js +29 -0
  518. data/vendor/jsl-0.3.0/tests/warnings/equal_as_assign.js +7 -0
  519. data/vendor/jsl-0.3.0/tests/warnings/inc_dec_within_stmt-ignore.js +21 -0
  520. data/vendor/jsl-0.3.0/tests/warnings/inc_dec_within_stmt.js +63 -0
  521. data/vendor/jsl-0.3.0/tests/warnings/jsl_cc_not_understood.js +5 -0
  522. data/vendor/jsl-0.3.0/tests/warnings/leading_decimal_point.js +7 -0
  523. data/vendor/jsl-0.3.0/tests/warnings/legacy_cc_not_understood.js +9 -0
  524. data/vendor/jsl-0.3.0/tests/warnings/meaningless_block.js +12 -0
  525. data/vendor/jsl-0.3.0/tests/warnings/misplaced_regex.js +20 -0
  526. data/vendor/jsl-0.3.0/tests/warnings/missing_break.js +87 -0
  527. data/vendor/jsl-0.3.0/tests/warnings/missing_break_for_last_case.js +19 -0
  528. data/vendor/jsl-0.3.0/tests/warnings/missing_default_case.js +51 -0
  529. data/vendor/jsl-0.3.0/tests/warnings/missing_option_explicit.js +5 -0
  530. data/vendor/jsl-0.3.0/tests/warnings/missing_semicolon.js +19 -0
  531. data/vendor/jsl-0.3.0/tests/warnings/multiple_plus_minus.js +10 -0
  532. data/vendor/jsl-0.3.0/tests/warnings/nested_comment.js +6 -0
  533. data/vendor/jsl-0.3.0/tests/warnings/no_return_value.js +25 -0
  534. data/vendor/jsl-0.3.0/tests/warnings/octal_number.js +5 -0
  535. data/vendor/jsl-0.3.0/tests/warnings/parseint_missing_radix.js +15 -0
  536. data/vendor/jsl-0.3.0/tests/warnings/partial_option_explicit.js +5 -0
  537. data/vendor/jsl-0.3.0/tests/warnings/redeclared_var.js +10 -0
  538. data/vendor/jsl-0.3.0/tests/warnings/spidermonkey/bad_backref.js +5 -0
  539. data/vendor/jsl-0.3.0/tests/warnings/spidermonkey/deprecated_usage.js +11 -0
  540. data/vendor/jsl-0.3.0/tests/warnings/spidermonkey/invalid_backref.js +5 -0
  541. data/vendor/jsl-0.3.0/tests/warnings/spidermonkey/trailing_comma.js +5 -0
  542. data/vendor/jsl-0.3.0/tests/warnings/trailing_comma_in_array.js +8 -0
  543. data/vendor/jsl-0.3.0/tests/warnings/trailing_decimal_point.js +7 -0
  544. data/vendor/jsl-0.3.0/tests/warnings/unreachable_code.js +29 -0
  545. data/vendor/jsl-0.3.0/tests/warnings/use_of_label.js +19 -0
  546. data/vendor/jsl-0.3.0/tests/warnings/useless_assign.js +20 -0
  547. data/vendor/jsl-0.3.0/tests/warnings/useless_comparison.js +55 -0
  548. data/vendor/jsl-0.3.0/tests/warnings/useless_void.js +6 -0
  549. data/vendor/jsl-0.3.0/tests/warnings/var_hides_arg.js +4 -0
  550. data/vendor/jsl-0.3.0/tests/warnings/with_statement.js +7 -0
  551. data/vendor/yuicompressor-2.4.2.jar +0 -0
  552. metadata +605 -0
@@ -0,0 +1,1084 @@
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
+ *
3
+ * ***** BEGIN LICENSE BLOCK *****
4
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
+ *
6
+ * The contents of this file are subject to the Mozilla Public License Version
7
+ * 1.1 (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ * http://www.mozilla.org/MPL/
10
+ *
11
+ * Software distributed under the License is distributed on an "AS IS" basis,
12
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
+ * for the specific language governing rights and limitations under the
14
+ * License.
15
+ *
16
+ * The Original Code is Mozilla Communicator client code, released
17
+ * March 31, 1998.
18
+ *
19
+ * The Initial Developer of the Original Code is
20
+ * Netscape Communications Corporation.
21
+ * Portions created by the Initial Developer are Copyright (C) 1998
22
+ * the Initial Developer. All Rights Reserved.
23
+ *
24
+ * Contributor(s):
25
+ *
26
+ * Alternatively, the contents of this file may be used under the terms of
27
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
28
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
+ * in which case the provisions of the GPL or the LGPL are applicable instead
30
+ * of those above. If you wish to allow use of your version of this file only
31
+ * under the terms of either the GPL or the LGPL, and not to allow others to
32
+ * use your version of this file under the terms of the MPL, indicate your
33
+ * decision by deleting the provisions above and replace them with the notice
34
+ * and other provisions required by the GPL or the LGPL. If you do not delete
35
+ * the provisions above, a recipient may use your version of this file under
36
+ * the terms of any one of the MPL, the GPL or the LGPL.
37
+ *
38
+ * ***** END LICENSE BLOCK ***** */
39
+
40
+ /*
41
+ * JS standard exception implementation.
42
+ */
43
+
44
+ #include "jsstddef.h"
45
+ #include <stdlib.h>
46
+ #include <string.h>
47
+ #include "jstypes.h"
48
+ #include "jsbit.h"
49
+ #include "jsutil.h" /* Added by JSIFY */
50
+ #include "jsprf.h"
51
+ #include "jsapi.h"
52
+ #include "jscntxt.h"
53
+ #include "jsconfig.h"
54
+ #include "jsexn.h"
55
+ #include "jsfun.h"
56
+ #include "jsinterp.h"
57
+ #include "jsopcode.h"
58
+ #include "jsnum.h"
59
+ #include "jsscript.h"
60
+
61
+ #if JS_HAS_ERROR_EXCEPTIONS
62
+ #if !JS_HAS_EXCEPTIONS
63
+ # error "JS_HAS_EXCEPTIONS must be defined to use JS_HAS_ERROR_EXCEPTIONS"
64
+ #endif
65
+
66
+ /* XXX consider adding rt->atomState.messageAtom */
67
+ static char js_message_str[] = "message";
68
+ static char js_filename_str[] = "fileName";
69
+ static char js_lineno_str[] = "lineNumber";
70
+ static char js_stack_str[] = "stack";
71
+
72
+ /* Forward declarations for ExceptionClass's initializer. */
73
+ static JSBool
74
+ Exception(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
75
+
76
+ static void
77
+ exn_finalize(JSContext *cx, JSObject *obj);
78
+
79
+ static JSClass ExceptionClass = {
80
+ "Error",
81
+ JSCLASS_HAS_PRIVATE,
82
+ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
83
+ JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize,
84
+ NULL, NULL, NULL, Exception,
85
+ NULL, NULL, NULL, 0
86
+ };
87
+
88
+ /*
89
+ * A copy of the JSErrorReport originally generated.
90
+ */
91
+ typedef struct JSExnPrivate {
92
+ JSErrorReport *errorReport;
93
+ } JSExnPrivate;
94
+
95
+ /*
96
+ * Undo all the damage done by exn_newPrivate.
97
+ */
98
+ static void
99
+ exn_destroyPrivate(JSContext *cx, JSExnPrivate *privateData)
100
+ {
101
+ JSErrorReport *report;
102
+ const jschar **args;
103
+
104
+ if (!privateData)
105
+ return;
106
+ report = privateData->errorReport;
107
+ if (report) {
108
+ if (report->uclinebuf)
109
+ JS_free(cx, (void *)report->uclinebuf);
110
+ if (report->filename)
111
+ JS_free(cx, (void *)report->filename);
112
+ if (report->ucmessage)
113
+ JS_free(cx, (void *)report->ucmessage);
114
+ if (report->messageArgs) {
115
+ args = report->messageArgs;
116
+ while (*args != NULL)
117
+ JS_free(cx, (void *)*args++);
118
+ JS_free(cx, (void *)report->messageArgs);
119
+ }
120
+ JS_free(cx, report);
121
+ }
122
+ JS_free(cx, privateData);
123
+ }
124
+
125
+ /*
126
+ * Copy everything interesting about an error into allocated memory.
127
+ */
128
+ static JSExnPrivate *
129
+ exn_newPrivate(JSContext *cx, JSErrorReport *report)
130
+ {
131
+ intN i;
132
+ JSExnPrivate *newPrivate;
133
+ JSErrorReport *newReport;
134
+ size_t capacity;
135
+
136
+ newPrivate = (JSExnPrivate *)JS_malloc(cx, sizeof (JSExnPrivate));
137
+ if (!newPrivate)
138
+ return NULL;
139
+ memset(newPrivate, 0, sizeof (JSExnPrivate));
140
+
141
+ /* Copy the error report */
142
+ newReport = (JSErrorReport *)JS_malloc(cx, sizeof (JSErrorReport));
143
+ if (!newReport)
144
+ goto error;
145
+ memset(newReport, 0, sizeof (JSErrorReport));
146
+ newPrivate->errorReport = newReport;
147
+
148
+ if (report->filename != NULL) {
149
+ newReport->filename = JS_strdup(cx, report->filename);
150
+ if (!newReport->filename)
151
+ goto error;
152
+ } else {
153
+ newReport->filename = NULL;
154
+ }
155
+
156
+ newReport->lineno = report->lineno;
157
+
158
+ /*
159
+ * We don't need to copy linebuf and tokenptr, because they
160
+ * point into the deflated string cache. (currently?)
161
+ */
162
+ newReport->linebuf = report->linebuf;
163
+ newReport->tokenptr = report->tokenptr;
164
+
165
+ /*
166
+ * But we do need to copy uclinebuf, uctokenptr, because they're
167
+ * pointers into internal tokenstream structs, and may go away.
168
+ */
169
+ if (report->uclinebuf != NULL) {
170
+ capacity = js_strlen(report->uclinebuf) + 1;
171
+ newReport->uclinebuf =
172
+ (const jschar *)JS_malloc(cx, capacity * sizeof(jschar));
173
+ if (!newReport->uclinebuf)
174
+ goto error;
175
+ js_strncpy((jschar *)newReport->uclinebuf, report->uclinebuf, capacity);
176
+ newReport->uctokenptr = newReport->uclinebuf + (report->uctokenptr -
177
+ report->uclinebuf);
178
+ } else {
179
+ newReport->uclinebuf = newReport->uctokenptr = NULL;
180
+ }
181
+
182
+ if (report->ucmessage != NULL) {
183
+ capacity = js_strlen(report->ucmessage) + 1;
184
+ newReport->ucmessage = (const jschar *)
185
+ JS_malloc(cx, capacity * sizeof(jschar));
186
+ if (!newReport->ucmessage)
187
+ goto error;
188
+ js_strncpy((jschar *)newReport->ucmessage, report->ucmessage, capacity);
189
+
190
+ if (report->messageArgs) {
191
+ for (i = 0; report->messageArgs[i] != NULL; i++)
192
+ continue;
193
+ JS_ASSERT(i);
194
+ newReport->messageArgs =
195
+ (const jschar **)JS_malloc(cx, (i + 1) * sizeof(jschar *));
196
+ if (!newReport->messageArgs)
197
+ goto error;
198
+ for (i = 0; report->messageArgs[i] != NULL; i++) {
199
+ capacity = js_strlen(report->messageArgs[i]) + 1;
200
+ newReport->messageArgs[i] =
201
+ (const jschar *)JS_malloc(cx, capacity * sizeof(jschar));
202
+ if (!newReport->messageArgs[i])
203
+ goto error;
204
+ js_strncpy((jschar *)(newReport->messageArgs[i]),
205
+ report->messageArgs[i], capacity);
206
+ }
207
+ newReport->messageArgs[i] = NULL;
208
+ } else {
209
+ newReport->messageArgs = NULL;
210
+ }
211
+ } else {
212
+ newReport->ucmessage = NULL;
213
+ newReport->messageArgs = NULL;
214
+ }
215
+ newReport->errorNumber = report->errorNumber;
216
+
217
+ /* Note that this is before it gets flagged with JSREPORT_EXCEPTION */
218
+ newReport->flags = report->flags;
219
+
220
+ return newPrivate;
221
+ error:
222
+ exn_destroyPrivate(cx, newPrivate);
223
+ return NULL;
224
+ }
225
+
226
+ static void
227
+ exn_finalize(JSContext *cx, JSObject *obj)
228
+ {
229
+ JSExnPrivate *privateData;
230
+ jsval privateValue;
231
+
232
+ privateValue = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
233
+
234
+ if (!JSVAL_IS_VOID(privateValue)) {
235
+ privateData = (JSExnPrivate*) JSVAL_TO_PRIVATE(privateValue);
236
+ if (privateData)
237
+ exn_destroyPrivate(cx, privateData);
238
+ }
239
+ }
240
+
241
+ JSErrorReport *
242
+ js_ErrorFromException(JSContext *cx, jsval exn)
243
+ {
244
+ JSObject *obj;
245
+ JSExnPrivate *privateData;
246
+ jsval privateValue;
247
+
248
+ if (JSVAL_IS_PRIMITIVE(exn))
249
+ return NULL;
250
+ obj = JSVAL_TO_OBJECT(exn);
251
+ if (OBJ_GET_CLASS(cx, obj) != &ExceptionClass)
252
+ return NULL;
253
+ privateValue = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
254
+ if (JSVAL_IS_VOID(privateValue))
255
+ return NULL;
256
+ privateData = (JSExnPrivate*) JSVAL_TO_PRIVATE(privateValue);
257
+ if (!privateData)
258
+ return NULL;
259
+
260
+ JS_ASSERT(privateData->errorReport);
261
+ return privateData->errorReport;
262
+ }
263
+
264
+ /*
265
+ * This must be kept in synch with the exceptions array below.
266
+ * XXX use a jsexn.tbl file a la jsopcode.tbl
267
+ */
268
+ typedef enum JSExnType {
269
+ JSEXN_NONE = -1,
270
+ JSEXN_ERR,
271
+ JSEXN_INTERNALERR,
272
+ JSEXN_EVALERR,
273
+ JSEXN_RANGEERR,
274
+ JSEXN_REFERENCEERR,
275
+ JSEXN_SYNTAXERR,
276
+ JSEXN_TYPEERR,
277
+ JSEXN_URIERR,
278
+ JSEXN_LIMIT
279
+ } JSExnType;
280
+
281
+ struct JSExnSpec {
282
+ int protoIndex;
283
+ const char *name;
284
+ JSNative native;
285
+ };
286
+
287
+ /*
288
+ * All *Error constructors share the same JSClass, ExceptionClass. But each
289
+ * constructor function for an *Error class must have a distinct native 'call'
290
+ * function pointer, in order for instanceof to work properly across multiple
291
+ * standard class sets. See jsfun.c:fun_hasInstance.
292
+ */
293
+ #define MAKE_EXCEPTION_CTOR(name) \
294
+ const char js_##name##_str[] = #name; \
295
+ static JSBool \
296
+ name(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) \
297
+ { \
298
+ return Exception(cx, obj, argc, argv, rval); \
299
+ }
300
+
301
+ MAKE_EXCEPTION_CTOR(Error)
302
+ MAKE_EXCEPTION_CTOR(InternalError)
303
+ MAKE_EXCEPTION_CTOR(EvalError)
304
+ MAKE_EXCEPTION_CTOR(RangeError)
305
+ MAKE_EXCEPTION_CTOR(ReferenceError)
306
+ MAKE_EXCEPTION_CTOR(SyntaxError)
307
+ MAKE_EXCEPTION_CTOR(TypeError)
308
+ MAKE_EXCEPTION_CTOR(URIError)
309
+
310
+ #undef MAKE_EXCEPTION_CTOR
311
+
312
+ static struct JSExnSpec exceptions[] = {
313
+ { JSEXN_NONE, js_Error_str, Error },
314
+ { JSEXN_ERR, js_InternalError_str, InternalError },
315
+ { JSEXN_ERR, js_EvalError_str, EvalError },
316
+ { JSEXN_ERR, js_RangeError_str, RangeError },
317
+ { JSEXN_ERR, js_ReferenceError_str, ReferenceError },
318
+ { JSEXN_ERR, js_SyntaxError_str, SyntaxError },
319
+ { JSEXN_ERR, js_TypeError_str, TypeError },
320
+ { JSEXN_ERR, js_URIError_str, URIError },
321
+ {0,NULL,NULL}
322
+ };
323
+
324
+ static JSBool
325
+ InitExceptionObject(JSContext *cx, JSObject *obj, JSString *message,
326
+ JSString *filename, uintN lineno)
327
+ {
328
+ JSCheckAccessOp checkAccess;
329
+ JSErrorReporter older;
330
+ JSExceptionState *state;
331
+ jschar *stackbuf;
332
+ size_t stacklen, stackmax;
333
+ JSStackFrame *fp;
334
+ jsval callerid, v;
335
+ JSBool ok;
336
+ JSString *argsrc, *stack;
337
+ uintN i, ulineno;
338
+ const char *cp;
339
+ char ulnbuf[11];
340
+
341
+ if (!JS_DefineProperty(cx, obj, js_message_str, STRING_TO_JSVAL(message),
342
+ NULL, NULL, JSPROP_ENUMERATE)) {
343
+ return JS_FALSE;
344
+ }
345
+
346
+ if (!JS_DefineProperty(cx, obj, js_filename_str,
347
+ STRING_TO_JSVAL(filename),
348
+ NULL, NULL, JSPROP_ENUMERATE)) {
349
+ return JS_FALSE;
350
+ }
351
+
352
+ if (!JS_DefineProperty(cx, obj, js_lineno_str,
353
+ INT_TO_JSVAL(lineno),
354
+ NULL, NULL, JSPROP_ENUMERATE)) {
355
+ return JS_FALSE;
356
+ }
357
+
358
+ /*
359
+ * Set the 'stack' property.
360
+ *
361
+ * First, set aside any error reporter for cx and save its exception state
362
+ * so we can suppress any checkAccess failures. Such failures should stop
363
+ * the backtrace procedure, not result in a failure of this constructor.
364
+ */
365
+ checkAccess = cx->runtime->checkObjectAccess;
366
+ if (checkAccess) {
367
+ older = JS_SetErrorReporter(cx, NULL);
368
+ state = JS_SaveExceptionState(cx);
369
+ }
370
+ #ifdef __GNUC__ /* suppress bogus gcc warnings */
371
+ else {
372
+ older = NULL;
373
+ state = NULL;
374
+ }
375
+ #endif
376
+ callerid = ATOM_KEY(cx->runtime->atomState.callerAtom);
377
+
378
+ /*
379
+ * Prepare to allocate a jschar buffer at stackbuf, where stacklen indexes
380
+ * the next free jschar slot, and with room for at most stackmax non-null
381
+ * jschars. If stackbuf is non-null, it always contains an extra slot for
382
+ * the null terminator we'll store at the end, as a backstop.
383
+ *
384
+ * All early returns must goto done after this point, till the after-loop
385
+ * cleanup code has run!
386
+ */
387
+ stackbuf = NULL;
388
+ stacklen = stackmax = 0;
389
+ ok = JS_TRUE;
390
+
391
+ #define APPEND_CHAR_TO_STACK(c) \
392
+ JS_BEGIN_MACRO \
393
+ if (stacklen == stackmax) { \
394
+ void *ptr_; \
395
+ stackmax = stackmax ? 2 * stackmax : 64; \
396
+ ptr_ = JS_realloc(cx, stackbuf, (stackmax+1) * sizeof(jschar)); \
397
+ if (!ptr_) { \
398
+ ok = JS_FALSE; \
399
+ goto done; \
400
+ } \
401
+ stackbuf = ptr_; \
402
+ } \
403
+ stackbuf[stacklen++] = (c); \
404
+ JS_END_MACRO
405
+
406
+ #define APPEND_STRING_TO_STACK(str) \
407
+ JS_BEGIN_MACRO \
408
+ JSString *str_ = str; \
409
+ size_t length_ = JSSTRING_LENGTH(str_); \
410
+ if (stacklen + length_ > stackmax) { \
411
+ void *ptr_; \
412
+ stackmax = JS_BIT(JS_CeilingLog2(stacklen + length_)); \
413
+ ptr_ = JS_realloc(cx, stackbuf, (stackmax+1) * sizeof(jschar)); \
414
+ if (!ptr_) { \
415
+ ok = JS_FALSE; \
416
+ goto done; \
417
+ } \
418
+ stackbuf = ptr_; \
419
+ } \
420
+ js_strncpy(stackbuf + stacklen, JSSTRING_CHARS(str_), length_); \
421
+ stacklen += length_; \
422
+ JS_END_MACRO
423
+
424
+ for (fp = cx->fp; fp; fp = fp->down) {
425
+ if (checkAccess) {
426
+ v = (fp->fun && fp->argv) ? fp->argv[-2] : JSVAL_NULL;
427
+ if (!JSVAL_IS_PRIMITIVE(v)) {
428
+ ok = checkAccess(cx, fp->fun->object, callerid, JSACC_READ, &v);
429
+ if (!ok) {
430
+ ok = JS_TRUE;
431
+ break;
432
+ }
433
+ }
434
+ }
435
+
436
+ if (fp->fun) {
437
+ if (fp->fun->atom)
438
+ APPEND_STRING_TO_STACK(ATOM_TO_STRING(fp->fun->atom));
439
+
440
+ APPEND_CHAR_TO_STACK('(');
441
+ for (i = 0; i < fp->argc; i++) {
442
+ /* Avoid toSource bloat and fallibility for object types. */
443
+ v = fp->argv[i];
444
+ if (JSVAL_IS_PRIMITIVE(v)) {
445
+ argsrc = js_ValueToSource(cx, v);
446
+ } else if (JSVAL_IS_FUNCTION(cx, v)) {
447
+ /* XXX Avoid function decompilation bloat for now. */
448
+ argsrc = JS_GetFunctionId(JS_ValueToFunction(cx, v));
449
+ if (!argsrc)
450
+ argsrc = js_ValueToSource(cx, v);
451
+ } else {
452
+ /* XXX Avoid toString on objects, it takes too long and
453
+ uses too much memory, for too many classes (see
454
+ Mozilla bug 166743). */
455
+ char buf[100];
456
+ JS_snprintf(buf, sizeof buf, "[object %s]",
457
+ OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(v))->name);
458
+ argsrc = JS_NewStringCopyZ(cx, buf);
459
+ }
460
+ if (!argsrc) {
461
+ ok = JS_FALSE;
462
+ goto done;
463
+ }
464
+ if (i > 0)
465
+ APPEND_CHAR_TO_STACK(',');
466
+ APPEND_STRING_TO_STACK(argsrc);
467
+ }
468
+ APPEND_CHAR_TO_STACK(')');
469
+ }
470
+
471
+ APPEND_CHAR_TO_STACK('@');
472
+ if (fp->script && fp->script->filename) {
473
+ for (cp = fp->script->filename; *cp; cp++)
474
+ APPEND_CHAR_TO_STACK(*cp);
475
+ }
476
+ APPEND_CHAR_TO_STACK(':');
477
+ if (fp->script && fp->pc) {
478
+ ulineno = js_PCToLineNumber(cx, fp->script, fp->pc);
479
+ JS_snprintf(ulnbuf, sizeof ulnbuf, "%u", ulineno);
480
+ for (cp = ulnbuf; *cp; cp++)
481
+ APPEND_CHAR_TO_STACK(*cp);
482
+ } else {
483
+ APPEND_CHAR_TO_STACK('0');
484
+ }
485
+ APPEND_CHAR_TO_STACK('\n');
486
+ }
487
+
488
+ #undef APPEND_CHAR_TO_STACK
489
+ #undef APPEND_STRING_TO_STACK
490
+
491
+ done:
492
+ if (checkAccess) {
493
+ if (ok)
494
+ JS_RestoreExceptionState(cx, state);
495
+ else
496
+ JS_DropExceptionState(cx, state);
497
+ JS_SetErrorReporter(cx, older);
498
+ }
499
+ if (!ok) {
500
+ JS_free(cx, stackbuf);
501
+ return JS_FALSE;
502
+ }
503
+
504
+ if (!stackbuf) {
505
+ stack = cx->runtime->emptyString;
506
+ } else {
507
+ /* NB: if stackbuf was allocated, it has room for the terminator. */
508
+ JS_ASSERT(stacklen <= stackmax);
509
+ if (stacklen < stackmax) {
510
+ /*
511
+ * Realloc can fail when shrinking on some FreeBSD versions, so
512
+ * don't use JS_realloc here; simply let the oversized allocation
513
+ * be owned by the string in that rare case.
514
+ */
515
+ void *shrunk = realloc(stackbuf, (stacklen+1) * sizeof(jschar));
516
+ if (shrunk)
517
+ stackbuf = shrunk;
518
+ }
519
+ stackbuf[stacklen] = 0;
520
+ stack = js_NewString(cx, stackbuf, stacklen, 0);
521
+ if (!stack) {
522
+ JS_free(cx, stackbuf);
523
+ return JS_FALSE;
524
+ }
525
+ }
526
+ return JS_DefineProperty(cx, obj, js_stack_str,
527
+ STRING_TO_JSVAL(stack),
528
+ NULL, NULL, JSPROP_ENUMERATE);
529
+ }
530
+
531
+ static JSBool
532
+ Exception(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
533
+ {
534
+ JSBool ok;
535
+ jsval pval;
536
+ int32 lineno;
537
+ JSString *message, *filename;
538
+
539
+ if (cx->creatingException)
540
+ return JS_FALSE;
541
+ cx->creatingException = JS_TRUE;
542
+
543
+ if (!(cx->fp->flags & JSFRAME_CONSTRUCTING)) {
544
+ /*
545
+ * ECMA ed. 3, 15.11.1 requires Error, etc., to construct even when
546
+ * called as functions, without operator new. But as we do not give
547
+ * each constructor a distinct JSClass, whose .name member is used by
548
+ * js_NewObject to find the class prototype, we must get the class
549
+ * prototype ourselves.
550
+ */
551
+ ok = OBJ_GET_PROPERTY(cx, JSVAL_TO_OBJECT(argv[-2]),
552
+ (jsid)cx->runtime->atomState.classPrototypeAtom,
553
+ &pval);
554
+ if (!ok)
555
+ goto out;
556
+ obj = js_NewObject(cx, &ExceptionClass, JSVAL_TO_OBJECT(pval), NULL);
557
+ if (!obj) {
558
+ ok = JS_FALSE;
559
+ goto out;
560
+ }
561
+ *rval = OBJECT_TO_JSVAL(obj);
562
+ }
563
+
564
+ /*
565
+ * If it's a new object of class Exception, then null out the private
566
+ * data so that the finalizer doesn't attempt to free it.
567
+ */
568
+ if (OBJ_GET_CLASS(cx, obj) == &ExceptionClass)
569
+ OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, JSVAL_VOID);
570
+
571
+ /* Set the 'message' property. */
572
+ if (argc != 0) {
573
+ message = js_ValueToString(cx, argv[0]);
574
+ if (!message) {
575
+ ok = JS_FALSE;
576
+ goto out;
577
+ }
578
+ argv[0] = STRING_TO_JSVAL(message);
579
+ } else {
580
+ message = cx->runtime->emptyString;
581
+ }
582
+
583
+ /* Set the 'fileName' property. */
584
+ if (argc > 1) {
585
+ filename = js_ValueToString(cx, argv[1]);
586
+ if (!filename) {
587
+ ok = JS_FALSE;
588
+ goto out;
589
+ }
590
+ argv[1] = STRING_TO_JSVAL(filename);
591
+ } else {
592
+ filename = cx->runtime->emptyString;
593
+ }
594
+
595
+ /* Set the 'lineNumber' property. */
596
+ if (argc > 2) {
597
+ ok = js_ValueToInt32(cx, argv[2], &lineno);
598
+ if (!ok)
599
+ goto out;
600
+ } else {
601
+ lineno = 0;
602
+ }
603
+
604
+ ok = InitExceptionObject(cx, obj, message, filename, lineno);
605
+
606
+ out:
607
+ cx->creatingException = JS_FALSE;
608
+ return ok;
609
+ }
610
+
611
+ /*
612
+ * Convert to string.
613
+ *
614
+ * This method only uses JavaScript-modifiable properties name, message. It
615
+ * is left to the host to check for private data and report filename and line
616
+ * number information along with this message.
617
+ */
618
+ static JSBool
619
+ exn_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
620
+ {
621
+ jsval v;
622
+ JSString *name, *message, *result;
623
+ jschar *chars, *cp;
624
+ size_t name_length, message_length, length;
625
+
626
+ if (!OBJ_GET_PROPERTY(cx, obj, (jsid)cx->runtime->atomState.nameAtom, &v))
627
+ return JS_FALSE;
628
+ name = JSVAL_IS_STRING(v) ? JSVAL_TO_STRING(v) : cx->runtime->emptyString;
629
+
630
+ if (!JS_GetProperty(cx, obj, js_message_str, &v))
631
+ return JS_FALSE;
632
+ message = JSVAL_IS_STRING(v) ? JSVAL_TO_STRING(v)
633
+ : cx->runtime->emptyString;
634
+
635
+ if (JSSTRING_LENGTH(message) != 0) {
636
+ name_length = JSSTRING_LENGTH(name);
637
+ message_length = JSSTRING_LENGTH(message);
638
+ length = (name_length ? name_length + 2 : 0) + message_length;
639
+ cp = chars = (jschar*) JS_malloc(cx, (length + 1) * sizeof(jschar));
640
+ if (!chars)
641
+ return JS_FALSE;
642
+
643
+ if (name_length) {
644
+ js_strncpy(cp, JSSTRING_CHARS(name), name_length);
645
+ cp += name_length;
646
+ *cp++ = ':'; *cp++ = ' ';
647
+ }
648
+ js_strncpy(cp, JSSTRING_CHARS(message), message_length);
649
+ cp += message_length;
650
+ *cp = 0;
651
+
652
+ result = js_NewString(cx, chars, length, 0);
653
+ if (!result) {
654
+ JS_free(cx, chars);
655
+ return JS_FALSE;
656
+ }
657
+ } else {
658
+ result = name;
659
+ }
660
+
661
+ *rval = STRING_TO_JSVAL(result);
662
+ return JS_TRUE;
663
+ }
664
+
665
+ #if JS_HAS_TOSOURCE
666
+ /*
667
+ * Return a string that may eval to something similar to the original object.
668
+ */
669
+ static JSBool
670
+ exn_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
671
+ {
672
+ jsval v;
673
+ JSString *name, *message, *filename, *lineno_as_str, *result;
674
+ int32 lineno;
675
+ size_t lineno_length, name_length, message_length, filename_length, length;
676
+ jschar *chars, *cp;
677
+
678
+ if (!OBJ_GET_PROPERTY(cx, obj, (jsid)cx->runtime->atomState.nameAtom, &v))
679
+ return JS_FALSE;
680
+ name = js_ValueToString(cx, v);
681
+ if (!name)
682
+ return JS_FALSE;
683
+
684
+ if (!JS_GetProperty(cx, obj, js_message_str, &v) ||
685
+ !(message = js_ValueToSource(cx, v))) {
686
+ return JS_FALSE;
687
+ }
688
+
689
+ if (!JS_GetProperty(cx, obj, js_filename_str, &v) ||
690
+ !(filename = js_ValueToSource(cx, v))) {
691
+ return JS_FALSE;
692
+ }
693
+
694
+ if (!JS_GetProperty(cx, obj, js_lineno_str, &v) ||
695
+ !js_ValueToInt32 (cx, v, &lineno)) {
696
+ return JS_FALSE;
697
+ }
698
+
699
+ if (lineno != 0) {
700
+ if (!(lineno_as_str = js_ValueToString(cx, v))) {
701
+ return JS_FALSE;
702
+ }
703
+ lineno_length = JSSTRING_LENGTH(lineno_as_str);
704
+ } else {
705
+ lineno_as_str = NULL;
706
+ lineno_length = 0;
707
+ }
708
+
709
+ /* Magic 8, for the characters in ``(new ())''. */
710
+ name_length = JSSTRING_LENGTH(name);
711
+ message_length = JSSTRING_LENGTH(message);
712
+ length = 8 + name_length + message_length;
713
+
714
+ filename_length = JSSTRING_LENGTH(filename);
715
+ if (filename_length != 0) {
716
+ /* append filename as ``, {filename}'' */
717
+ length += 2 + filename_length;
718
+ if (lineno_as_str) {
719
+ /* append lineno as ``, {lineno_as_str}'' */
720
+ length += 2 + lineno_length;
721
+ }
722
+ } else {
723
+ if (lineno_as_str) {
724
+ /*
725
+ * no filename, but have line number,
726
+ * need to append ``, "", {lineno_as_str}''
727
+ */
728
+ length += 6 + lineno_length;
729
+ }
730
+ }
731
+
732
+ cp = chars = (jschar*) JS_malloc(cx, (length + 1) * sizeof(jschar));
733
+ if (!chars)
734
+ return JS_FALSE;
735
+
736
+ *cp++ = '('; *cp++ = 'n'; *cp++ = 'e'; *cp++ = 'w'; *cp++ = ' ';
737
+ js_strncpy(cp, JSSTRING_CHARS(name), name_length);
738
+ cp += name_length;
739
+ *cp++ = '(';
740
+ if (message_length != 0) {
741
+ js_strncpy(cp, JSSTRING_CHARS(message), message_length);
742
+ cp += message_length;
743
+ }
744
+
745
+ if (filename_length != 0) {
746
+ /* append filename as ``, {filename}'' */
747
+ *cp++ = ','; *cp++ = ' ';
748
+ js_strncpy(cp, JSSTRING_CHARS(filename), filename_length);
749
+ cp += filename_length;
750
+ } else {
751
+ if (lineno_as_str) {
752
+ /*
753
+ * no filename, but have line number,
754
+ * need to append ``, "", {lineno_as_str}''
755
+ */
756
+ *cp++ = ','; *cp++ = ' '; *cp++ = '"'; *cp++ = '"';
757
+ }
758
+ }
759
+ if (lineno_as_str) {
760
+ /* append lineno as ``, {lineno_as_str}'' */
761
+ *cp++ = ','; *cp++ = ' ';
762
+ js_strncpy(cp, JSSTRING_CHARS(lineno_as_str), lineno_length);
763
+ cp += lineno_length;
764
+ }
765
+
766
+ *cp++ = ')'; *cp++ = ')'; *cp = 0;
767
+
768
+ result = js_NewString(cx, chars, length, 0);
769
+ if (!result) {
770
+ JS_free(cx, chars);
771
+ return JS_FALSE;
772
+ }
773
+ *rval = STRING_TO_JSVAL(result);
774
+ return JS_TRUE;
775
+ }
776
+ #endif
777
+
778
+ static JSFunctionSpec exception_methods[] = {
779
+ #if JS_HAS_TOSOURCE
780
+ {js_toSource_str, exn_toSource, 0,0,0},
781
+ #endif
782
+ {js_toString_str, exn_toString, 0,0,0},
783
+ {0,0,0,0,0}
784
+ };
785
+
786
+ JSObject *
787
+ js_InitExceptionClasses(JSContext *cx, JSObject *obj)
788
+ {
789
+ int i;
790
+ JSObject *protos[JSEXN_LIMIT];
791
+
792
+ /* Initialize the prototypes first. */
793
+ for (i = 0; exceptions[i].name != 0; i++) {
794
+ JSAtom *atom;
795
+ JSFunction *fun;
796
+ JSString *nameString;
797
+ int protoIndex = exceptions[i].protoIndex;
798
+
799
+ /* Make the prototype for the current constructor name. */
800
+ protos[i] = js_NewObject(cx, &ExceptionClass,
801
+ (protoIndex != JSEXN_NONE)
802
+ ? protos[protoIndex]
803
+ : NULL,
804
+ obj);
805
+ if (!protos[i])
806
+ return NULL;
807
+
808
+ /* So exn_finalize knows whether to destroy private data. */
809
+ OBJ_SET_SLOT(cx, protos[i], JSSLOT_PRIVATE, JSVAL_VOID);
810
+
811
+ atom = js_Atomize(cx, exceptions[i].name, strlen(exceptions[i].name), 0);
812
+ if (!atom)
813
+ return NULL;
814
+
815
+ /* Make a constructor function for the current name. */
816
+ fun = js_DefineFunction(cx, obj, atom, exceptions[i].native, 3, 0);
817
+ if (!fun)
818
+ return NULL;
819
+
820
+ /* Make this constructor make objects of class Exception. */
821
+ fun->clasp = &ExceptionClass;
822
+
823
+ /* Make the prototype and constructor links. */
824
+ if (!js_SetClassPrototype(cx, fun->object, protos[i],
825
+ JSPROP_READONLY | JSPROP_PERMANENT)) {
826
+ return NULL;
827
+ }
828
+
829
+ /* proto bootstrap bit from JS_InitClass omitted. */
830
+ nameString = JS_NewStringCopyZ(cx, exceptions[i].name);
831
+ if (!nameString)
832
+ return NULL;
833
+
834
+ /* Add the name property to the prototype. */
835
+ if (!JS_DefineProperty(cx, protos[i], js_name_str,
836
+ STRING_TO_JSVAL(nameString),
837
+ NULL, NULL,
838
+ JSPROP_ENUMERATE)) {
839
+ return NULL;
840
+ }
841
+ }
842
+
843
+ /*
844
+ * Add an empty message property. (To Exception.prototype only,
845
+ * because this property will be the same for all the exception
846
+ * protos.)
847
+ */
848
+ if (!JS_DefineProperty(cx, protos[0], js_message_str,
849
+ STRING_TO_JSVAL(cx->runtime->emptyString),
850
+ NULL, NULL, JSPROP_ENUMERATE)) {
851
+ return NULL;
852
+ }
853
+ if (!JS_DefineProperty(cx, protos[0], js_filename_str,
854
+ STRING_TO_JSVAL(cx->runtime->emptyString),
855
+ NULL, NULL, JSPROP_ENUMERATE)) {
856
+ return NULL;
857
+ }
858
+ if (!JS_DefineProperty(cx, protos[0], js_lineno_str,
859
+ INT_TO_JSVAL(0),
860
+ NULL, NULL, JSPROP_ENUMERATE)) {
861
+ return NULL;
862
+ }
863
+
864
+ /*
865
+ * Add methods only to Exception.prototype, because ostensibly all
866
+ * exception types delegate to that.
867
+ */
868
+ if (!JS_DefineFunctions(cx, protos[0], exception_methods))
869
+ return NULL;
870
+
871
+ return protos[0];
872
+ }
873
+
874
+ static JSExnType errorToExceptionNum[] = {
875
+ #define MSG_DEF(name, number, count, exception, format) \
876
+ exception,
877
+ #include "js.msg"
878
+ #undef MSG_DEF
879
+ };
880
+
881
+ #if defined ( DEBUG_mccabe ) && defined ( PRINTNAMES )
882
+ /* For use below... get character strings for error name and exception name */
883
+ static struct exnname { char *name; char *exception; } errortoexnname[] = {
884
+ #define MSG_DEF(name, number, count, exception, format) \
885
+ {#name, #exception},
886
+ #include "js.msg"
887
+ #undef MSG_DEF
888
+ };
889
+ #endif /* DEBUG */
890
+
891
+ JSBool
892
+ js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp)
893
+ {
894
+ JSErrNum errorNumber;
895
+ JSExnType exn;
896
+ JSBool ok;
897
+ JSObject *errProto, *errObject;
898
+ JSString *messageStr, *filenameStr;
899
+ uintN lineno;
900
+ JSExnPrivate *privateData;
901
+
902
+ /*
903
+ * Tell our caller to report immediately if cx has no active frames, or if
904
+ * this report is just a warning.
905
+ */
906
+ JS_ASSERT(reportp);
907
+ if (!cx->fp || JSREPORT_IS_WARNING(reportp->flags))
908
+ return JS_FALSE;
909
+
910
+ /* Find the exception index associated with this error. */
911
+ errorNumber = (JSErrNum) reportp->errorNumber;
912
+ exn = errorToExceptionNum[errorNumber];
913
+ JS_ASSERT(exn < JSEXN_LIMIT);
914
+
915
+ #if defined( DEBUG_mccabe ) && defined ( PRINTNAMES )
916
+ /* Print the error name and the associated exception name to stderr */
917
+ fprintf(stderr, "%s\t%s\n",
918
+ errortoexnname[errorNumber].name,
919
+ errortoexnname[errorNumber].exception);
920
+ #endif
921
+
922
+ /*
923
+ * Return false (no exception raised) if no exception is associated
924
+ * with the given error number.
925
+ */
926
+ if (exn == JSEXN_NONE)
927
+ return JS_FALSE;
928
+
929
+ /*
930
+ * Prevent runaway recursion, just as the Exception native constructor
931
+ * must do, via cx->creatingException. If an out-of-memory error occurs,
932
+ * no exception object will be created, but we don't assume that OOM is
933
+ * the only kind of error that subroutines of this function called below
934
+ * might raise.
935
+ */
936
+ if (cx->creatingException)
937
+ return JS_FALSE;
938
+ cx->creatingException = JS_TRUE;
939
+
940
+ /*
941
+ * Try to get an appropriate prototype by looking up the corresponding
942
+ * exception constructor name in the scope chain of the current context's
943
+ * top stack frame, or in the global object if no frame is active.
944
+ *
945
+ * XXXbe hack around JSCLASS_NEW_RESOLVE code in js_LookupProperty that
946
+ * checks cx->fp, cx->fp->pc, and js_CodeSpec[*cx->fp->pc] in order
947
+ * to compute resolve flags such as JSRESOLVE_ASSIGNING. The bug
948
+ * is that this "internal" js_GetClassPrototype call may trigger a
949
+ * resolve of exceptions[exn].name if the global object uses a lazy
950
+ * standard class resolver (see JS_ResolveStandardClass), but the
951
+ * current frame and bytecode end up affecting the resolve flags.
952
+ */
953
+ {
954
+ JSStackFrame *fp = cx->fp;
955
+ jsbytecode *pc = NULL;
956
+
957
+ if (fp) {
958
+ pc = fp->pc;
959
+ fp->pc = NULL;
960
+ }
961
+ ok = js_GetClassPrototype(cx, exceptions[exn].name, &errProto);
962
+ if (pc)
963
+ fp->pc = pc;
964
+ if (!ok)
965
+ goto out;
966
+ }
967
+
968
+ errObject = js_NewObject(cx, &ExceptionClass, errProto, NULL);
969
+ if (!errObject) {
970
+ ok = JS_FALSE;
971
+ goto out;
972
+ }
973
+
974
+ /*
975
+ * Set the generated Exception object early, so it won't be GC'd by a last
976
+ * ditch attempt to collect garbage, or a GC that otherwise nests or races
977
+ * under any of the following calls. If one of the following calls fails,
978
+ * it will overwrite this exception object with one of its own (except in
979
+ * case of OOM errors, of course).
980
+ */
981
+ JS_SetPendingException(cx, OBJECT_TO_JSVAL(errObject));
982
+
983
+ messageStr = JS_NewStringCopyZ(cx, message);
984
+ if (!messageStr) {
985
+ ok = JS_FALSE;
986
+ goto out;
987
+ }
988
+
989
+ if (reportp) {
990
+ filenameStr = JS_NewStringCopyZ(cx, reportp->filename);
991
+ if (!filenameStr) {
992
+ ok = JS_FALSE;
993
+ goto out;
994
+ }
995
+ lineno = reportp->lineno;
996
+ } else {
997
+ filenameStr = cx->runtime->emptyString;
998
+ lineno = 0;
999
+ }
1000
+ ok = InitExceptionObject(cx, errObject, messageStr, filenameStr, lineno);
1001
+ if (!ok)
1002
+ goto out;
1003
+
1004
+ /*
1005
+ * Construct a new copy of the error report struct, and store it in the
1006
+ * exception object's private data. We can't use the error report struct
1007
+ * that was passed in, because it's stack-allocated, and also because it
1008
+ * may point to transient data in the JSTokenStream.
1009
+ */
1010
+ privateData = exn_newPrivate(cx, reportp);
1011
+ if (!privateData) {
1012
+ ok = JS_FALSE;
1013
+ goto out;
1014
+ }
1015
+ OBJ_SET_SLOT(cx, errObject, JSSLOT_PRIVATE, PRIVATE_TO_JSVAL(privateData));
1016
+
1017
+ /* Flag the error report passed in to indicate an exception was raised. */
1018
+ reportp->flags |= JSREPORT_EXCEPTION;
1019
+
1020
+ out:
1021
+ cx->creatingException = JS_FALSE;
1022
+ return ok;
1023
+ }
1024
+ #endif /* JS_HAS_ERROR_EXCEPTIONS */
1025
+
1026
+ #if JS_HAS_EXCEPTIONS
1027
+
1028
+ JSBool
1029
+ js_ReportUncaughtException(JSContext *cx)
1030
+ {
1031
+ JSObject *exnObject;
1032
+ JSString *str;
1033
+ jsval exn;
1034
+ JSErrorReport *reportp;
1035
+ const char *bytes;
1036
+
1037
+ if (!JS_IsExceptionPending(cx))
1038
+ return JS_TRUE;
1039
+
1040
+ if (!JS_GetPendingException(cx, &exn))
1041
+ return JS_FALSE;
1042
+
1043
+ /*
1044
+ * Because js_ValueToString below could error and an exception object
1045
+ * could become unrooted, we must root exnObject.
1046
+ */
1047
+ if (JSVAL_IS_PRIMITIVE(exn)) {
1048
+ exnObject = NULL;
1049
+ } else {
1050
+ exnObject = JSVAL_TO_OBJECT(exn);
1051
+ if (!js_AddRoot(cx, &exnObject, "exn.report.root"))
1052
+ return JS_FALSE;
1053
+ }
1054
+
1055
+ #if JS_HAS_ERROR_EXCEPTIONS
1056
+ reportp = js_ErrorFromException(cx, exn);
1057
+ #else
1058
+ reportp = NULL;
1059
+ #endif
1060
+
1061
+ str = js_ValueToString(cx, exn);
1062
+ bytes = str ? js_GetStringBytes(str) : "null";
1063
+
1064
+ if (reportp == NULL) {
1065
+ /*
1066
+ * XXXmccabe todo: Instead of doing this, synthesize an error report
1067
+ * struct that includes the filename, lineno where the exception was
1068
+ * originally thrown.
1069
+ */
1070
+ JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
1071
+ JSMSG_UNCAUGHT_EXCEPTION, bytes);
1072
+ } else {
1073
+ /* Flag the error as an exception. */
1074
+ reportp->flags |= JSREPORT_EXCEPTION;
1075
+ js_ReportErrorAgain(cx, bytes, reportp);
1076
+ }
1077
+
1078
+ if (exnObject != NULL)
1079
+ js_RemoveRoot(cx->runtime, &exnObject);
1080
+ JS_ClearPendingException(cx);
1081
+ return JS_TRUE;
1082
+ }
1083
+
1084
+ #endif /* JS_HAS_EXCEPTIONS */