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,1856 @@
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
+ #ifndef jsapi_h___
41
+ #define jsapi_h___
42
+ /*
43
+ * JavaScript API.
44
+ */
45
+ #include <stddef.h>
46
+ #include <stdio.h>
47
+ #include "jspubtd.h"
48
+
49
+ JS_BEGIN_EXTERN_C
50
+
51
+ /*
52
+ * Type tags stored in the low bits of a jsval.
53
+ */
54
+ #define JSVAL_OBJECT 0x0 /* untagged reference to object */
55
+ #define JSVAL_INT 0x1 /* tagged 31-bit integer value */
56
+ #define JSVAL_DOUBLE 0x2 /* tagged reference to double */
57
+ #define JSVAL_STRING 0x4 /* tagged reference to string */
58
+ #define JSVAL_BOOLEAN 0x6 /* tagged boolean value */
59
+
60
+ /* Type tag bitfield length and derived macros. */
61
+ #define JSVAL_TAGBITS 3
62
+ #define JSVAL_TAGMASK JS_BITMASK(JSVAL_TAGBITS)
63
+ #define JSVAL_TAG(v) ((v) & JSVAL_TAGMASK)
64
+ #define JSVAL_SETTAG(v,t) ((v) | (t))
65
+ #define JSVAL_CLRTAG(v) ((v) & ~(jsval)JSVAL_TAGMASK)
66
+ #define JSVAL_ALIGN JS_BIT(JSVAL_TAGBITS)
67
+
68
+ /* Predicates for type testing. */
69
+ #define JSVAL_IS_OBJECT(v) (JSVAL_TAG(v) == JSVAL_OBJECT)
70
+ #define JSVAL_IS_NUMBER(v) (JSVAL_IS_INT(v) || JSVAL_IS_DOUBLE(v))
71
+ #define JSVAL_IS_INT(v) (((v) & JSVAL_INT) && (v) != JSVAL_VOID)
72
+ #define JSVAL_IS_DOUBLE(v) (JSVAL_TAG(v) == JSVAL_DOUBLE)
73
+ #define JSVAL_IS_STRING(v) (JSVAL_TAG(v) == JSVAL_STRING)
74
+ #define JSVAL_IS_BOOLEAN(v) (JSVAL_TAG(v) == JSVAL_BOOLEAN)
75
+ #define JSVAL_IS_NULL(v) ((v) == JSVAL_NULL)
76
+ #define JSVAL_IS_VOID(v) ((v) == JSVAL_VOID)
77
+ #define JSVAL_IS_PRIMITIVE(v) (!JSVAL_IS_OBJECT(v) || JSVAL_IS_NULL(v))
78
+
79
+ /* Objects, strings, and doubles are GC'ed. */
80
+ #define JSVAL_IS_GCTHING(v) (!((v) & JSVAL_INT) && !JSVAL_IS_BOOLEAN(v))
81
+ #define JSVAL_TO_GCTHING(v) ((void *)JSVAL_CLRTAG(v))
82
+ #define JSVAL_TO_OBJECT(v) ((JSObject *)JSVAL_TO_GCTHING(v))
83
+ #define JSVAL_TO_DOUBLE(v) ((jsdouble *)JSVAL_TO_GCTHING(v))
84
+ #define JSVAL_TO_STRING(v) ((JSString *)JSVAL_TO_GCTHING(v))
85
+ #define OBJECT_TO_JSVAL(obj) ((jsval)(obj))
86
+ #define DOUBLE_TO_JSVAL(dp) JSVAL_SETTAG((jsval)(dp), JSVAL_DOUBLE)
87
+ #define STRING_TO_JSVAL(str) JSVAL_SETTAG((jsval)(str), JSVAL_STRING)
88
+
89
+ /* Lock and unlock the GC thing held by a jsval. */
90
+ #define JSVAL_LOCK(cx,v) (JSVAL_IS_GCTHING(v) \
91
+ ? JS_LockGCThing(cx, JSVAL_TO_GCTHING(v)) \
92
+ : JS_TRUE)
93
+ #define JSVAL_UNLOCK(cx,v) (JSVAL_IS_GCTHING(v) \
94
+ ? JS_UnlockGCThing(cx, JSVAL_TO_GCTHING(v)) \
95
+ : JS_TRUE)
96
+
97
+ /* Domain limits for the jsval int type. */
98
+ #define JSVAL_INT_BITS 31
99
+ #define JSVAL_INT_POW2(n) ((jsval)1 << (n))
100
+ #define JSVAL_INT_MIN ((jsval)1 - JSVAL_INT_POW2(30))
101
+ #define JSVAL_INT_MAX (JSVAL_INT_POW2(30) - 1)
102
+ #define INT_FITS_IN_JSVAL(i) ((jsuint)((i)+JSVAL_INT_MAX) <= 2*JSVAL_INT_MAX)
103
+ #define JSVAL_TO_INT(v) ((jsint)(v) >> 1)
104
+ #define INT_TO_JSVAL(i) (((jsval)(i) << 1) | JSVAL_INT)
105
+
106
+ /* Convert between boolean and jsval. */
107
+ #define JSVAL_TO_BOOLEAN(v) ((JSBool)((v) >> JSVAL_TAGBITS))
108
+ #define BOOLEAN_TO_JSVAL(b) JSVAL_SETTAG((jsval)(b) << JSVAL_TAGBITS, \
109
+ JSVAL_BOOLEAN)
110
+
111
+ /* A private data pointer (2-byte-aligned) can be stored as an int jsval. */
112
+ #define JSVAL_TO_PRIVATE(v) ((void *)((v) & ~JSVAL_INT))
113
+ #define PRIVATE_TO_JSVAL(p) ((jsval)(p) | JSVAL_INT)
114
+
115
+ /* Property attributes, set in JSPropertySpec and passed to API functions. */
116
+ #define JSPROP_ENUMERATE 0x01 /* property is visible to for/in loop */
117
+ #define JSPROP_READONLY 0x02 /* not settable: assignment is no-op */
118
+ #define JSPROP_PERMANENT 0x04 /* property cannot be deleted */
119
+ #define JSPROP_EXPORTED 0x08 /* property is exported from object */
120
+ #define JSPROP_GETTER 0x10 /* property holds getter function */
121
+ #define JSPROP_SETTER 0x20 /* property holds setter function */
122
+ #define JSPROP_SHARED 0x40 /* don't allocate a value slot for this
123
+ property; don't copy the property on
124
+ set of the same-named property in an
125
+ object that delegates to a prototype
126
+ containing this property */
127
+ #define JSPROP_INDEX 0x80 /* name is actually (jsint) index */
128
+ #define JSPROP_LINT_IGNORE 0x100 /* should ignore per control comment */
129
+ #define JSPROP_LINT_DECLARED 0x200 /* name is declared */
130
+
131
+ /* Function flags, set in JSFunctionSpec and passed to JS_NewFunction etc. */
132
+ #define JSFUN_LAMBDA 0x08 /* expressed, not declared, function */
133
+ #define JSFUN_GETTER JSPROP_GETTER
134
+ #define JSFUN_SETTER JSPROP_SETTER
135
+ #define JSFUN_BOUND_METHOD 0x40 /* bind this to fun->object's parent */
136
+ #define JSFUN_HEAVYWEIGHT 0x80 /* activation requires a Call object */
137
+ #define JSFUN_FLAGS_MASK 0xf8 /* overlay JSFUN_* attributes */
138
+
139
+ /*
140
+ * Well-known JS values. The extern'd variables are initialized when the
141
+ * first JSContext is created by JS_NewContext (see below).
142
+ */
143
+ #define JSVAL_VOID INT_TO_JSVAL(0 - JSVAL_INT_POW2(30))
144
+ #define JSVAL_NULL OBJECT_TO_JSVAL(0)
145
+ #define JSVAL_ZERO INT_TO_JSVAL(0)
146
+ #define JSVAL_ONE INT_TO_JSVAL(1)
147
+ #define JSVAL_FALSE BOOLEAN_TO_JSVAL(JS_FALSE)
148
+ #define JSVAL_TRUE BOOLEAN_TO_JSVAL(JS_TRUE)
149
+
150
+ /*
151
+ * Microseconds since the epoch, midnight, January 1, 1970 UTC. See the
152
+ * comment in jstypes.h regarding safe int64 usage.
153
+ */
154
+ extern JS_PUBLIC_API(int64)
155
+ JS_Now();
156
+
157
+ /* Don't want to export data, so provide accessors for non-inline jsvals. */
158
+ extern JS_PUBLIC_API(jsval)
159
+ JS_GetNaNValue(JSContext *cx);
160
+
161
+ extern JS_PUBLIC_API(jsval)
162
+ JS_GetNegativeInfinityValue(JSContext *cx);
163
+
164
+ extern JS_PUBLIC_API(jsval)
165
+ JS_GetPositiveInfinityValue(JSContext *cx);
166
+
167
+ extern JS_PUBLIC_API(jsval)
168
+ JS_GetEmptyStringValue(JSContext *cx);
169
+
170
+ /*
171
+ * Format is a string of the following characters (spaces are insignificant),
172
+ * specifying the tabulated type conversions:
173
+ *
174
+ * b JSBool Boolean
175
+ * c uint16/jschar ECMA uint16, Unicode char
176
+ * i int32 ECMA int32
177
+ * u uint32 ECMA uint32
178
+ * j int32 Rounded int32 (coordinate)
179
+ * d jsdouble IEEE double
180
+ * I jsdouble Integral IEEE double
181
+ * s char * C string
182
+ * S JSString * Unicode string, accessed by a JSString pointer
183
+ * W jschar * Unicode character vector, 0-terminated (W for wide)
184
+ * o JSObject * Object reference
185
+ * f JSFunction * Function private
186
+ * v jsval Argument value (no conversion)
187
+ * * N/A Skip this argument (no vararg)
188
+ * / N/A End of required arguments
189
+ *
190
+ * The variable argument list after format must consist of &b, &c, &s, e.g.,
191
+ * where those variables have the types given above. For the pointer types
192
+ * char *, JSString *, and JSObject *, the pointed-at memory returned belongs
193
+ * to the JS runtime, not to the calling native code. The runtime promises
194
+ * to keep this memory valid so long as argv refers to allocated stack space
195
+ * (so long as the native function is active).
196
+ *
197
+ * Fewer arguments than format specifies may be passed only if there is a /
198
+ * in format after the last required argument specifier and argc is at least
199
+ * the number of required arguments. More arguments than format specifies
200
+ * may be passed without error; it is up to the caller to deal with trailing
201
+ * unconverted arguments.
202
+ */
203
+ extern JS_PUBLIC_API(JSBool)
204
+ JS_ConvertArguments(JSContext *cx, uintN argc, jsval *argv, const char *format,
205
+ ...);
206
+
207
+ #ifdef va_start
208
+ extern JS_PUBLIC_API(JSBool)
209
+ JS_ConvertArgumentsVA(JSContext *cx, uintN argc, jsval *argv,
210
+ const char *format, va_list ap);
211
+ #endif
212
+
213
+ /*
214
+ * Inverse of JS_ConvertArguments: scan format and convert trailing arguments
215
+ * into jsvals, GC-rooted if necessary by the JS stack. Return null on error,
216
+ * and a pointer to the new argument vector on success. Also return a stack
217
+ * mark on success via *markp, in which case the caller must eventually clean
218
+ * up by calling JS_PopArguments.
219
+ *
220
+ * Note that the number of actual arguments supplied is specified exclusively
221
+ * by format, so there is no argc parameter.
222
+ */
223
+ extern JS_PUBLIC_API(jsval *)
224
+ JS_PushArguments(JSContext *cx, void **markp, const char *format, ...);
225
+
226
+ #ifdef va_start
227
+ extern JS_PUBLIC_API(jsval *)
228
+ JS_PushArgumentsVA(JSContext *cx, void **markp, const char *format, va_list ap);
229
+ #endif
230
+
231
+ extern JS_PUBLIC_API(void)
232
+ JS_PopArguments(JSContext *cx, void *mark);
233
+
234
+ #ifdef JS_ARGUMENT_FORMATTER_DEFINED
235
+
236
+ /*
237
+ * Add and remove a format string handler for JS_{Convert,Push}Arguments{,VA}.
238
+ * The handler function has this signature (see jspubtd.h):
239
+ *
240
+ * JSBool MyArgumentFormatter(JSContext *cx, const char *format,
241
+ * JSBool fromJS, jsval **vpp, va_list *app);
242
+ *
243
+ * It should return true on success, and return false after reporting an error
244
+ * or detecting an already-reported error.
245
+ *
246
+ * For a given format string, for example "AA", the formatter is called from
247
+ * JS_ConvertArgumentsVA like so:
248
+ *
249
+ * formatter(cx, "AA...", JS_TRUE, &sp, &ap);
250
+ *
251
+ * sp points into the arguments array on the JS stack, while ap points into
252
+ * the stdarg.h va_list on the C stack. The JS_TRUE passed for fromJS tells
253
+ * the formatter to convert zero or more jsvals at sp to zero or more C values
254
+ * accessed via pointers-to-values at ap, updating both sp (via *vpp) and ap
255
+ * (via *app) to point past the converted arguments and their result pointers
256
+ * on the C stack.
257
+ *
258
+ * When called from JS_PushArgumentsVA, the formatter is invoked thus:
259
+ *
260
+ * formatter(cx, "AA...", JS_FALSE, &sp, &ap);
261
+ *
262
+ * where JS_FALSE for fromJS means to wrap the C values at ap according to the
263
+ * format specifier and store them at sp, updating ap and sp appropriately.
264
+ *
265
+ * The "..." after "AA" is the rest of the format string that was passed into
266
+ * JS_{Convert,Push}Arguments{,VA}. The actual format trailing substring used
267
+ * in each Convert or PushArguments call is passed to the formatter, so that
268
+ * one such function may implement several formats, in order to share code.
269
+ *
270
+ * Remove just forgets about any handler associated with format. Add does not
271
+ * copy format, it points at the string storage allocated by the caller, which
272
+ * is typically a string constant. If format is in dynamic storage, it is up
273
+ * to the caller to keep the string alive until Remove is called.
274
+ */
275
+ extern JS_PUBLIC_API(JSBool)
276
+ JS_AddArgumentFormatter(JSContext *cx, const char *format,
277
+ JSArgumentFormatter formatter);
278
+
279
+ extern JS_PUBLIC_API(void)
280
+ JS_RemoveArgumentFormatter(JSContext *cx, const char *format);
281
+
282
+ #endif /* JS_ARGUMENT_FORMATTER_DEFINED */
283
+
284
+ extern JS_PUBLIC_API(JSBool)
285
+ JS_ConvertValue(JSContext *cx, jsval v, JSType type, jsval *vp);
286
+
287
+ extern JS_PUBLIC_API(JSBool)
288
+ JS_ValueToObject(JSContext *cx, jsval v, JSObject **objp);
289
+
290
+ extern JS_PUBLIC_API(JSFunction *)
291
+ JS_ValueToFunction(JSContext *cx, jsval v);
292
+
293
+ extern JS_PUBLIC_API(JSFunction *)
294
+ JS_ValueToConstructor(JSContext *cx, jsval v);
295
+
296
+ extern JS_PUBLIC_API(JSString *)
297
+ JS_ValueToString(JSContext *cx, jsval v);
298
+
299
+ extern JS_PUBLIC_API(JSBool)
300
+ JS_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp);
301
+
302
+ /*
303
+ * Convert a value to a number, then to an int32, according to the ECMA rules
304
+ * for ToInt32.
305
+ */
306
+ extern JS_PUBLIC_API(JSBool)
307
+ JS_ValueToECMAInt32(JSContext *cx, jsval v, int32 *ip);
308
+
309
+ /*
310
+ * Convert a value to a number, then to a uint32, according to the ECMA rules
311
+ * for ToUint32.
312
+ */
313
+ extern JS_PUBLIC_API(JSBool)
314
+ JS_ValueToECMAUint32(JSContext *cx, jsval v, uint32 *ip);
315
+
316
+ /*
317
+ * Convert a value to a number, then to an int32 if it fits by rounding to
318
+ * nearest; but failing with an error report if the double is out of range
319
+ * or unordered.
320
+ */
321
+ extern JS_PUBLIC_API(JSBool)
322
+ JS_ValueToInt32(JSContext *cx, jsval v, int32 *ip);
323
+
324
+ /*
325
+ * ECMA ToUint16, for mapping a jsval to a Unicode point.
326
+ */
327
+ extern JS_PUBLIC_API(JSBool)
328
+ JS_ValueToUint16(JSContext *cx, jsval v, uint16 *ip);
329
+
330
+ extern JS_PUBLIC_API(JSBool)
331
+ JS_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp);
332
+
333
+ extern JS_PUBLIC_API(JSType)
334
+ JS_TypeOfValue(JSContext *cx, jsval v);
335
+
336
+ extern JS_PUBLIC_API(const char *)
337
+ JS_GetTypeName(JSContext *cx, JSType type);
338
+
339
+ /************************************************************************/
340
+
341
+ /*
342
+ * Initialization, locking, contexts, and memory allocation.
343
+ */
344
+ #define JS_NewRuntime JS_Init
345
+ #define JS_DestroyRuntime JS_Finish
346
+ #define JS_LockRuntime JS_Lock
347
+ #define JS_UnlockRuntime JS_Unlock
348
+
349
+ extern JS_PUBLIC_API(JSRuntime *)
350
+ JS_NewRuntime(uint32 maxbytes);
351
+
352
+ extern JS_PUBLIC_API(void)
353
+ JS_DestroyRuntime(JSRuntime *rt);
354
+
355
+ extern JS_PUBLIC_API(void)
356
+ JS_ShutDown(void);
357
+
358
+ JS_PUBLIC_API(void *)
359
+ JS_GetRuntimePrivate(JSRuntime *rt);
360
+
361
+ JS_PUBLIC_API(void)
362
+ JS_SetRuntimePrivate(JSRuntime *rt, void *data);
363
+
364
+ #ifdef JS_THREADSAFE
365
+
366
+ extern JS_PUBLIC_API(void)
367
+ JS_BeginRequest(JSContext *cx);
368
+
369
+ extern JS_PUBLIC_API(void)
370
+ JS_EndRequest(JSContext *cx);
371
+
372
+ /* Yield to pending GC operations, regardless of request depth */
373
+ extern JS_PUBLIC_API(void)
374
+ JS_YieldRequest(JSContext *cx);
375
+
376
+ extern JS_PUBLIC_API(jsrefcount)
377
+ JS_SuspendRequest(JSContext *cx);
378
+
379
+ extern JS_PUBLIC_API(void)
380
+ JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth);
381
+
382
+ #endif /* JS_THREADSAFE */
383
+
384
+ extern JS_PUBLIC_API(void)
385
+ JS_Lock(JSRuntime *rt);
386
+
387
+ extern JS_PUBLIC_API(void)
388
+ JS_Unlock(JSRuntime *rt);
389
+
390
+ extern JS_PUBLIC_API(JSContext *)
391
+ JS_NewContext(JSRuntime *rt, size_t stackChunkSize);
392
+
393
+ extern JS_PUBLIC_API(void)
394
+ JS_DestroyContext(JSContext *cx);
395
+
396
+ extern JS_PUBLIC_API(void)
397
+ JS_DestroyContextNoGC(JSContext *cx);
398
+
399
+ extern JS_PUBLIC_API(void)
400
+ JS_DestroyContextMaybeGC(JSContext *cx);
401
+
402
+ extern JS_PUBLIC_API(void *)
403
+ JS_GetContextPrivate(JSContext *cx);
404
+
405
+ extern JS_PUBLIC_API(void)
406
+ JS_SetContextPrivate(JSContext *cx, void *data);
407
+
408
+ extern JS_PUBLIC_API(JSRuntime *)
409
+ JS_GetRuntime(JSContext *cx);
410
+
411
+ extern JS_PUBLIC_API(JSContext *)
412
+ JS_ContextIterator(JSRuntime *rt, JSContext **iterp);
413
+
414
+ extern JS_PUBLIC_API(JSVersion)
415
+ JS_GetVersion(JSContext *cx);
416
+
417
+ extern JS_PUBLIC_API(JSVersion)
418
+ JS_SetVersion(JSContext *cx, JSVersion version);
419
+
420
+ extern JS_PUBLIC_API(const char *)
421
+ JS_VersionToString(JSVersion version);
422
+
423
+ extern JS_PUBLIC_API(JSVersion)
424
+ JS_StringToVersion(const char *string);
425
+
426
+ /*
427
+ * JS options are orthogonal to version, and may be freely composed with one
428
+ * another as well as with version.
429
+ *
430
+ * JSOPTION_VAROBJFIX is recommended -- see the comments associated with the
431
+ * prototypes for JS_ExecuteScript, JS_EvaluateScript, etc.
432
+ */
433
+ #define JSOPTION_STRICT JS_BIT(0) /* warn on dubious practice */
434
+ #define JSOPTION_WERROR JS_BIT(1) /* convert warning to error */
435
+ #define JSOPTION_VAROBJFIX JS_BIT(2) /* make JS_EvaluateScript use
436
+ the last object on its 'obj'
437
+ param's scope chain as the
438
+ ECMA 'variables object' */
439
+ #define JSOPTION_PRIVATE_IS_NSISUPPORTS \
440
+ JS_BIT(3) /* context private data points
441
+ to an nsISupports subclass */
442
+ #define JSOPTION_COMPILE_N_GO JS_BIT(4) /* caller of JS_Compile*Script
443
+ promises to execute compiled
444
+ script once only; enables
445
+ compile-time scope chain
446
+ resolution of consts. */
447
+ #define JSOPTION_ATLINE JS_BIT(5) /* //@line number ["filename"]
448
+ option supported for the
449
+ XUL preprocessor and kindred
450
+ beasts. */
451
+
452
+ extern JS_PUBLIC_API(uint32)
453
+ JS_GetOptions(JSContext *cx);
454
+
455
+ extern JS_PUBLIC_API(uint32)
456
+ JS_SetOptions(JSContext *cx, uint32 options);
457
+
458
+ extern JS_PUBLIC_API(uint32)
459
+ JS_ToggleOptions(JSContext *cx, uint32 options);
460
+
461
+ extern JS_PUBLIC_API(const char *)
462
+ JS_GetImplementationVersion(void);
463
+
464
+ extern JS_PUBLIC_API(JSObject *)
465
+ JS_GetGlobalObject(JSContext *cx);
466
+
467
+ extern JS_PUBLIC_API(void)
468
+ JS_SetGlobalObject(JSContext *cx, JSObject *obj);
469
+
470
+ extern JS_PUBLIC_API(JSBool)
471
+ JS_IsValidIdentifier(const char *identifier);
472
+
473
+ extern JS_PUBLIC_API(JSBool)
474
+ JS_PushLintIdentifers(JSContext *cx, JSObject *curScriptIdentifiers, JSLObjectList *dependencyIdentifiers,
475
+ JSBool alwaysUseOptionExplicit, JSBool lambdaAssignRequiresSemicolon,
476
+ JSBool enableLegacyControlComments, JSBool enableJScriptFunctionExtensions,
477
+ JSLImportCallback importCallback, void *parms);
478
+
479
+ extern JS_PUBLIC_API(void)
480
+ JS_PopLintIdentifers(JSContext *cx);
481
+
482
+ /*
483
+ * Initialize standard JS class constructors, prototypes, and any top-level
484
+ * functions and constants associated with the standard classes (e.g. isNaN
485
+ * for Number).
486
+ *
487
+ * NB: This sets cx's global object to obj if it was null.
488
+ */
489
+ extern JS_PUBLIC_API(JSBool)
490
+ JS_InitStandardClasses(JSContext *cx, JSObject *obj);
491
+
492
+ /*
493
+ * Resolve id, which must contain either a string or an int, to a standard
494
+ * class name in obj if possible, defining the class's constructor and/or
495
+ * prototype and storing true in *resolved. If id does not name a standard
496
+ * class or a top-level property induced by initializing a standard class,
497
+ * store false in *resolved and just return true. Return false on error,
498
+ * as usual for JSBool result-typed API entry points.
499
+ *
500
+ * This API can be called directly from a global object class's resolve op,
501
+ * to define standard classes lazily. The class's enumerate op should call
502
+ * JS_EnumerateStandardClasses(cx, obj), to define eagerly during for..in
503
+ * loops any classes not yet resolved lazily.
504
+ */
505
+ extern JS_PUBLIC_API(JSBool)
506
+ JS_ResolveStandardClass(JSContext *cx, JSObject *obj, jsval id,
507
+ JSBool *resolved);
508
+
509
+ extern JS_PUBLIC_API(JSBool)
510
+ JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj);
511
+
512
+ extern JS_PUBLIC_API(JSObject *)
513
+ JS_GetScopeChain(JSContext *cx);
514
+
515
+ extern JS_PUBLIC_API(void *)
516
+ JS_malloc(JSContext *cx, size_t nbytes);
517
+
518
+ extern JS_PUBLIC_API(void *)
519
+ JS_realloc(JSContext *cx, void *p, size_t nbytes);
520
+
521
+ extern JS_PUBLIC_API(void)
522
+ JS_free(JSContext *cx, void *p);
523
+
524
+ extern JS_PUBLIC_API(char *)
525
+ JS_strdup(JSContext *cx, const char *s);
526
+
527
+ extern JS_PUBLIC_API(jsdouble *)
528
+ JS_NewDouble(JSContext *cx, jsdouble d);
529
+
530
+ extern JS_PUBLIC_API(JSBool)
531
+ JS_NewDoubleValue(JSContext *cx, jsdouble d, jsval *rval);
532
+
533
+ extern JS_PUBLIC_API(JSBool)
534
+ JS_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval);
535
+
536
+ /*
537
+ * A JS GC root is a pointer to a JSObject *, JSString *, or jsdouble * that
538
+ * itself points into the GC heap (more recently, we support this extension:
539
+ * a root may be a pointer to a jsval v for which JSVAL_IS_GCTHING(v) is true).
540
+ *
541
+ * Therefore, you never pass JSObject *obj to JS_AddRoot(cx, obj). You always
542
+ * call JS_AddRoot(cx, &obj), passing obj by reference. And later, before obj
543
+ * or the structure it is embedded within goes out of scope or is freed, you
544
+ * must call JS_RemoveRoot(cx, &obj).
545
+ *
546
+ * Also, use JS_AddNamedRoot(cx, &structPtr->memberObj, "structPtr->memberObj")
547
+ * in preference to JS_AddRoot(cx, &structPtr->memberObj), in order to identify
548
+ * roots by their source callsites. This way, you can find the callsite while
549
+ * debugging if you should fail to do JS_RemoveRoot(cx, &structPtr->memberObj)
550
+ * before freeing structPtr's memory.
551
+ */
552
+ extern JS_PUBLIC_API(JSBool)
553
+ JS_AddRoot(JSContext *cx, void *rp);
554
+
555
+ #ifdef NAME_ALL_GC_ROOTS
556
+ #define JS_DEFINE_TO_TOKEN(def) #def
557
+ #define JS_DEFINE_TO_STRING(def) JS_DEFINE_TO_TOKEN(def)
558
+ #define JS_AddRoot(cx,rp) JS_AddNamedRoot((cx), (rp), (__FILE__ ":" JS_TOKEN_TO_STRING(__LINE__))
559
+ #endif
560
+
561
+ extern JS_PUBLIC_API(JSBool)
562
+ JS_AddNamedRoot(JSContext *cx, void *rp, const char *name);
563
+
564
+ extern JS_PUBLIC_API(JSBool)
565
+ JS_AddNamedRootRT(JSRuntime *rt, void *rp, const char *name);
566
+
567
+ extern JS_PUBLIC_API(JSBool)
568
+ JS_RemoveRoot(JSContext *cx, void *rp);
569
+
570
+ extern JS_PUBLIC_API(JSBool)
571
+ JS_RemoveRootRT(JSRuntime *rt, void *rp);
572
+
573
+ /*
574
+ * The last GC thing of each type (object, string, double, external string
575
+ * types) created on a given context is kept alive until another thing of the
576
+ * same type is created, using a newborn root in the context. These newborn
577
+ * roots help native code protect newly-created GC-things from GC invocations
578
+ * activated before those things can be rooted using local or global roots.
579
+ *
580
+ * However, the newborn roots can also entrain great gobs of garbage, so the
581
+ * JS_GC entry point clears them for the context on which GC is being forced.
582
+ * Embeddings may need to do likewise for all contexts.
583
+ *
584
+ * See the scoped local root API immediately below for a better way to manage
585
+ * newborns in cases where native hooks (functions, getters, setters, etc.)
586
+ * create many GC-things, potentially without connecting them to predefined
587
+ * local roots such as *rval or argv[i] in an active native function. Using
588
+ * JS_EnterLocalRootScope disables updating of the context's per-gc-thing-type
589
+ * newborn roots, until control flow unwinds and leaves the outermost nesting
590
+ * local root scope.
591
+ */
592
+ extern JS_PUBLIC_API(void)
593
+ JS_ClearNewbornRoots(JSContext *cx);
594
+
595
+ /*
596
+ * Scoped local root management allows native functions, getter/setters, etc.
597
+ * to avoid worrying about the newborn root pigeon-holes, overloading local
598
+ * roots allocated in argv and *rval, or ending up having to call JS_Add*Root
599
+ * and JS_RemoveRoot to manage global roots temporarily.
600
+ *
601
+ * Instead, calling JS_EnterLocalRootScope and JS_LeaveLocalRootScope around
602
+ * the body of the native hook causes the engine to allocate a local root for
603
+ * each newborn created in between the two API calls, using a local root stack
604
+ * associated with cx. For example:
605
+ *
606
+ * JSBool
607
+ * my_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
608
+ * {
609
+ * JSBool ok;
610
+ *
611
+ * if (!JS_EnterLocalRootScope(cx))
612
+ * return JS_FALSE;
613
+ * ok = my_GetPropertyBody(cx, obj, id, vp);
614
+ * JS_LeaveLocalRootScope(cx);
615
+ * return ok;
616
+ * }
617
+ *
618
+ * NB: JS_LeaveLocalRootScope must be called once for every prior successful
619
+ * call to JS_EnterLocalRootScope. If JS_EnterLocalRootScope fails, you must
620
+ * not make the matching JS_LeaveLocalRootScope call.
621
+ *
622
+ * In case a native hook allocates many objects or other GC-things, but the
623
+ * native protects some of those GC-things by storing them as property values
624
+ * in an object that is itself protected, the hook can call JS_ForgetLocalRoot
625
+ * to free the local root automatically pushed for the now-protected GC-thing.
626
+ *
627
+ * JS_ForgetLocalRoot works on any GC-thing allocated in the current local
628
+ * root scope, but it's more time-efficient when called on references to more
629
+ * recently created GC-things. Calling it successively on other than the most
630
+ * recently allocated GC-thing will tend to average the time inefficiency, and
631
+ * may risk O(n^2) growth rate, but in any event, you shouldn't allocate too
632
+ * many local roots if you can root as you go (build a tree of objects from
633
+ * the top down, forgetting each latest-allocated GC-thing immediately upon
634
+ * linking it to its parent).
635
+ */
636
+ extern JS_PUBLIC_API(JSBool)
637
+ JS_EnterLocalRootScope(JSContext *cx);
638
+
639
+ extern JS_PUBLIC_API(void)
640
+ JS_LeaveLocalRootScope(JSContext *cx);
641
+
642
+ extern JS_PUBLIC_API(void)
643
+ JS_ForgetLocalRoot(JSContext *cx, void *thing);
644
+
645
+ #ifdef DEBUG
646
+ extern JS_PUBLIC_API(void)
647
+ JS_DumpNamedRoots(JSRuntime *rt,
648
+ void (*dump)(const char *name, void *rp, void *data),
649
+ void *data);
650
+ #endif
651
+
652
+ /*
653
+ * Call JS_MapGCRoots to map the GC's roots table using map(rp, name, data).
654
+ * The root is pointed at by rp; if the root is unnamed, name is null; data is
655
+ * supplied from the third parameter to JS_MapGCRoots.
656
+ *
657
+ * The map function should return JS_MAP_GCROOT_REMOVE to cause the currently
658
+ * enumerated root to be removed. To stop enumeration, set JS_MAP_GCROOT_STOP
659
+ * in the return value. To keep on mapping, return JS_MAP_GCROOT_NEXT. These
660
+ * constants are flags; you can OR them together.
661
+ *
662
+ * This function acquires and releases rt's GC lock around the mapping of the
663
+ * roots table, so the map function should run to completion in as few cycles
664
+ * as possible. Of course, map cannot call JS_GC, JS_MaybeGC, JS_BeginRequest,
665
+ * or any JS API entry point that acquires locks, without double-tripping or
666
+ * deadlocking on the GC lock.
667
+ *
668
+ * JS_MapGCRoots returns the count of roots that were successfully mapped.
669
+ */
670
+ #define JS_MAP_GCROOT_NEXT 0 /* continue mapping entries */
671
+ #define JS_MAP_GCROOT_STOP 1 /* stop mapping entries */
672
+ #define JS_MAP_GCROOT_REMOVE 2 /* remove and free the current entry */
673
+
674
+ typedef intN
675
+ (* JS_DLL_CALLBACK JSGCRootMapFun)(void *rp, const char *name, void *data);
676
+
677
+ extern JS_PUBLIC_API(uint32)
678
+ JS_MapGCRoots(JSRuntime *rt, JSGCRootMapFun map, void *data);
679
+
680
+ extern JS_PUBLIC_API(JSBool)
681
+ JS_LockGCThing(JSContext *cx, void *thing);
682
+
683
+ extern JS_PUBLIC_API(JSBool)
684
+ JS_LockGCThingRT(JSRuntime *rt, void *thing);
685
+
686
+ extern JS_PUBLIC_API(JSBool)
687
+ JS_UnlockGCThing(JSContext *cx, void *thing);
688
+
689
+ extern JS_PUBLIC_API(JSBool)
690
+ JS_UnlockGCThingRT(JSRuntime *rt, void *thing);
691
+
692
+ /*
693
+ * For implementors of JSObjectOps.mark, to mark a GC-thing reachable via a
694
+ * property or other strong ref identified for debugging purposes by name.
695
+ * The name argument's storage needs to live only as long as the call to
696
+ * this routine.
697
+ *
698
+ * The final arg is used by GC_MARK_DEBUG code to build a ref path through
699
+ * the GC's live thing graph. Implementors of JSObjectOps.mark should pass
700
+ * its final arg through to this function when marking all GC-things that are
701
+ * directly reachable from the object being marked.
702
+ *
703
+ * See the JSMarkOp typedef in jspubtd.h, and the JSObjectOps struct below.
704
+ */
705
+ extern JS_PUBLIC_API(void)
706
+ JS_MarkGCThing(JSContext *cx, void *thing, const char *name, void *arg);
707
+
708
+ extern JS_PUBLIC_API(void)
709
+ JS_GC(JSContext *cx);
710
+
711
+ extern JS_PUBLIC_API(void)
712
+ JS_MaybeGC(JSContext *cx);
713
+
714
+ extern JS_PUBLIC_API(JSGCCallback)
715
+ JS_SetGCCallback(JSContext *cx, JSGCCallback cb);
716
+
717
+ extern JS_PUBLIC_API(JSGCCallback)
718
+ JS_SetGCCallbackRT(JSRuntime *rt, JSGCCallback cb);
719
+
720
+ extern JS_PUBLIC_API(JSBool)
721
+ JS_IsAboutToBeFinalized(JSContext *cx, void *thing);
722
+
723
+ /*
724
+ * Add an external string finalizer, one created by JS_NewExternalString (see
725
+ * below) using a type-code returned from this function, and that understands
726
+ * how to free or release the memory pointed at by JS_GetStringChars(str).
727
+ *
728
+ * Return a nonnegative type index if there is room for finalizer in the
729
+ * global GC finalizers table, else return -1. If the engine is compiled
730
+ * JS_THREADSAFE and used in a multi-threaded environment, this function must
731
+ * be invoked on the primordial thread only, at startup -- or else the entire
732
+ * program must single-thread itself while loading a module that calls this
733
+ * function.
734
+ */
735
+ extern JS_PUBLIC_API(intN)
736
+ JS_AddExternalStringFinalizer(JSStringFinalizeOp finalizer);
737
+
738
+ /*
739
+ * Remove finalizer from the global GC finalizers table, returning its type
740
+ * code if found, -1 if not found.
741
+ *
742
+ * As with JS_AddExternalStringFinalizer, there is a threading restriction
743
+ * if you compile the engine JS_THREADSAFE: this function may be called for a
744
+ * given finalizer pointer on only one thread; different threads may call to
745
+ * remove distinct finalizers safely.
746
+ *
747
+ * You must ensure that all strings with finalizer's type have been collected
748
+ * before calling this function. Otherwise, string data will be leaked by the
749
+ * GC, for want of a finalizer to call.
750
+ */
751
+ extern JS_PUBLIC_API(intN)
752
+ JS_RemoveExternalStringFinalizer(JSStringFinalizeOp finalizer);
753
+
754
+ /*
755
+ * Create a new JSString whose chars member refers to external memory, i.e.,
756
+ * memory requiring special, type-specific finalization. The type code must
757
+ * be a nonnegative return value from JS_AddExternalStringFinalizer.
758
+ */
759
+ extern JS_PUBLIC_API(JSString *)
760
+ JS_NewExternalString(JSContext *cx, jschar *chars, size_t length, intN type);
761
+
762
+ /*
763
+ * Returns the external-string finalizer index for this string, or -1 if it is
764
+ * an "internal" (native to JS engine) string.
765
+ */
766
+ extern JS_PUBLIC_API(intN)
767
+ JS_GetExternalStringGCType(JSRuntime *rt, JSString *str);
768
+
769
+ /*
770
+ * Sets maximum (if stack grows upward) or minimum (downward) legal stack byte
771
+ * address in limitAddr for the thread or process stack used by cx. To disable
772
+ * stack size checking, pass 0 for limitAddr.
773
+ */
774
+ extern JS_PUBLIC_API(void)
775
+ JS_SetThreadStackLimit(JSContext *cx, jsuword limitAddr);
776
+
777
+ /************************************************************************/
778
+
779
+ /*
780
+ * Classes, objects, and properties.
781
+ */
782
+
783
+ /* For detailed comments on the function pointer types, see jspubtd.h. */
784
+ struct JSClass {
785
+ const char *name;
786
+ uint32 flags;
787
+
788
+ /* Mandatory non-null function pointer members. */
789
+ JSPropertyOp addProperty;
790
+ JSPropertyOp delProperty;
791
+ JSPropertyOp getProperty;
792
+ JSPropertyOp setProperty;
793
+ JSEnumerateOp enumerate;
794
+ JSResolveOp resolve;
795
+ JSConvertOp convert;
796
+ JSFinalizeOp finalize;
797
+
798
+ /* Optionally non-null members start here. */
799
+ JSGetObjectOps getObjectOps;
800
+ JSCheckAccessOp checkAccess;
801
+ JSNative call;
802
+ JSNative construct;
803
+ JSXDRObjectOp xdrObject;
804
+ JSHasInstanceOp hasInstance;
805
+ JSMarkOp mark;
806
+ JSReserveSlotsOp reserveSlots;
807
+ };
808
+
809
+ #define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slot */
810
+ #define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hook */
811
+ #define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */
812
+ #define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) /* private is (nsISupports *) */
813
+ #define JSCLASS_SHARE_ALL_PROPERTIES (1<<4) /* all properties are SHARED */
814
+ #define JSCLASS_NEW_RESOLVE_GETS_START (1<<5) /* JSNewResolveOp gets starting
815
+ object in prototype chain
816
+ passed in via *objp in/out
817
+ parameter */
818
+
819
+ /*
820
+ * To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise-or
821
+ * JSCLASS_HAS_RESERVED_SLOTS(n) into the initializer for JSClass.flags, where
822
+ * n is a constant in [1, 255]. Reserved slots are indexed from 0 to n-1.
823
+ */
824
+ #define JSCLASS_RESERVED_SLOTS_SHIFT 8 /* room for 8 flags below */
825
+ #define JSCLASS_RESERVED_SLOTS_WIDTH 8 /* and 16 above this field */
826
+ #define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_WIDTH)
827
+ #define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \
828
+ << JSCLASS_RESERVED_SLOTS_SHIFT)
829
+ #define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \
830
+ >> JSCLASS_RESERVED_SLOTS_SHIFT) \
831
+ & JSCLASS_RESERVED_SLOTS_MASK)
832
+
833
+ /* Initializer for unused members of statically initialized JSClass structs. */
834
+ #define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,0,0,0
835
+
836
+ /* For detailed comments on these function pointer types, see jspubtd.h. */
837
+ struct JSObjectOps {
838
+ /* Mandatory non-null function pointer members. */
839
+ JSNewObjectMapOp newObjectMap;
840
+ JSObjectMapOp destroyObjectMap;
841
+ JSLookupPropOp lookupProperty;
842
+ JSDefinePropOp defineProperty;
843
+ JSPropertyIdOp getProperty;
844
+ JSPropertyIdOp setProperty;
845
+ JSAttributesOp getAttributes;
846
+ JSAttributesOp setAttributes;
847
+ JSPropertyIdOp deleteProperty;
848
+ JSConvertOp defaultValue;
849
+ JSNewEnumerateOp enumerate;
850
+ JSCheckAccessIdOp checkAccess;
851
+
852
+ /* Optionally non-null members start here. */
853
+ JSObjectOp thisObject;
854
+ JSPropertyRefOp dropProperty;
855
+ JSNative call;
856
+ JSNative construct;
857
+ JSXDRObjectOp xdrObject;
858
+ JSHasInstanceOp hasInstance;
859
+ JSSetObjectSlotOp setProto;
860
+ JSSetObjectSlotOp setParent;
861
+ JSMarkOp mark;
862
+ JSFinalizeOp clear;
863
+ JSGetRequiredSlotOp getRequiredSlot;
864
+ JSSetRequiredSlotOp setRequiredSlot;
865
+ };
866
+
867
+ /*
868
+ * Classes that expose JSObjectOps via a non-null getObjectOps class hook may
869
+ * derive a property structure from this struct, return a pointer to it from
870
+ * lookupProperty and defineProperty, and use the pointer to avoid rehashing
871
+ * in getAttributes and setAttributes.
872
+ *
873
+ * The jsid type contains either an int jsval (see JSVAL_IS_INT above), or an
874
+ * internal pointer that is opaque to users of this API, but which users may
875
+ * convert from and to a jsval using JS_ValueToId and JS_IdToValue.
876
+ */
877
+ struct JSProperty {
878
+ jsid id;
879
+ };
880
+
881
+ struct JSIdArray {
882
+ jsint length;
883
+ jsid vector[1]; /* actually, length jsid words */
884
+ };
885
+
886
+ extern JS_PUBLIC_API(void)
887
+ JS_DestroyIdArray(JSContext *cx, JSIdArray *ida);
888
+
889
+ extern JS_PUBLIC_API(JSBool)
890
+ JS_ValueToId(JSContext *cx, jsval v, jsid *idp);
891
+
892
+ extern JS_PUBLIC_API(JSBool)
893
+ JS_IdToValue(JSContext *cx, jsid id, jsval *vp);
894
+
895
+ #define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */
896
+ #define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignment */
897
+ #define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:...' */
898
+ #define JSRESOLVE_DECLARING 0x08 /* var, const, or function prolog op */
899
+ #define JSRESOLVE_CLASSNAME 0x10 /* class name used when constructing */
900
+
901
+ extern JS_PUBLIC_API(JSBool)
902
+ JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
903
+
904
+ extern JS_PUBLIC_API(JSBool)
905
+ JS_EnumerateStub(JSContext *cx, JSObject *obj);
906
+
907
+ extern JS_PUBLIC_API(JSBool)
908
+ JS_ResolveStub(JSContext *cx, JSObject *obj, jsval id);
909
+
910
+ extern JS_PUBLIC_API(JSBool)
911
+ JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
912
+
913
+ extern JS_PUBLIC_API(void)
914
+ JS_FinalizeStub(JSContext *cx, JSObject *obj);
915
+
916
+ struct JSConstDoubleSpec {
917
+ jsdouble dval;
918
+ const char *name;
919
+ uint8 flags;
920
+ uint8 spare[3];
921
+ };
922
+
923
+ /*
924
+ * To define an array element rather than a named property member, cast the
925
+ * element's index to (const char *) and initialize name with it, and set the
926
+ * JSPROP_INDEX bit in flags.
927
+ */
928
+ struct JSPropertySpec {
929
+ const char *name;
930
+ int8 tinyid;
931
+ uint8 flags;
932
+ JSPropertyOp getter;
933
+ JSPropertyOp setter;
934
+ };
935
+
936
+ struct JSFunctionSpec {
937
+ const char *name;
938
+ JSNative call;
939
+ uint8 nargs;
940
+ uint8 flags;
941
+ uint16 extra; /* number of arg slots for local GC roots */
942
+ };
943
+
944
+ extern JS_PUBLIC_API(JSObject *)
945
+ JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
946
+ JSClass *clasp, JSNative constructor, uintN nargs,
947
+ JSPropertySpec *ps, JSFunctionSpec *fs,
948
+ JSPropertySpec *static_ps, JSFunctionSpec *static_fs);
949
+
950
+ #ifdef JS_THREADSAFE
951
+ extern JS_PUBLIC_API(JSClass *)
952
+ JS_GetClass(JSContext *cx, JSObject *obj);
953
+
954
+ #define JS_GET_CLASS(cx,obj) JS_GetClass(cx, obj)
955
+ #else
956
+ extern JS_PUBLIC_API(JSClass *)
957
+ JS_GetClass(JSObject *obj);
958
+
959
+ #define JS_GET_CLASS(cx,obj) JS_GetClass(obj)
960
+ #endif
961
+
962
+ extern JS_PUBLIC_API(JSBool)
963
+ JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv);
964
+
965
+ extern JS_PUBLIC_API(void *)
966
+ JS_GetPrivate(JSContext *cx, JSObject *obj);
967
+
968
+ extern JS_PUBLIC_API(JSBool)
969
+ JS_SetPrivate(JSContext *cx, JSObject *obj, void *data);
970
+
971
+ extern JS_PUBLIC_API(void *)
972
+ JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp,
973
+ jsval *argv);
974
+
975
+ extern JS_PUBLIC_API(JSObject *)
976
+ JS_GetPrototype(JSContext *cx, JSObject *obj);
977
+
978
+ extern JS_PUBLIC_API(JSBool)
979
+ JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto);
980
+
981
+ extern JS_PUBLIC_API(JSObject *)
982
+ JS_GetParent(JSContext *cx, JSObject *obj);
983
+
984
+ extern JS_PUBLIC_API(JSBool)
985
+ JS_SetParent(JSContext *cx, JSObject *obj, JSObject *parent);
986
+
987
+ extern JS_PUBLIC_API(JSObject *)
988
+ JS_GetConstructor(JSContext *cx, JSObject *proto);
989
+
990
+ /*
991
+ * Get a unique identifier for obj, good for the lifetime of obj (even if it
992
+ * is moved by a copying GC). Return false on failure (likely out of memory),
993
+ * and true with *idp containing the unique id on success.
994
+ */
995
+ extern JS_PUBLIC_API(JSBool)
996
+ JS_GetObjectId(JSContext *cx, JSObject *obj, jsid *idp);
997
+
998
+ extern JS_PUBLIC_API(JSObject *)
999
+ JS_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
1000
+
1001
+ extern JS_PUBLIC_API(JSBool)
1002
+ JS_SealObject(JSContext *cx, JSObject *obj, JSBool deep);
1003
+
1004
+ extern JS_PUBLIC_API(JSObject *)
1005
+ JS_ConstructObject(JSContext *cx, JSClass *clasp, JSObject *proto,
1006
+ JSObject *parent);
1007
+
1008
+ extern JS_PUBLIC_API(JSObject *)
1009
+ JS_ConstructObjectWithArguments(JSContext *cx, JSClass *clasp, JSObject *proto,
1010
+ JSObject *parent, uintN argc, jsval *argv);
1011
+
1012
+ extern JS_PUBLIC_API(JSObject *)
1013
+ JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *clasp,
1014
+ JSObject *proto, uintN attrs);
1015
+
1016
+ extern JS_PUBLIC_API(JSBool)
1017
+ JS_DefineConstDoubles(JSContext *cx, JSObject *obj, JSConstDoubleSpec *cds);
1018
+
1019
+ extern JS_PUBLIC_API(JSBool)
1020
+ JS_DefineProperties(JSContext *cx, JSObject *obj, JSPropertySpec *ps);
1021
+
1022
+ extern JS_PUBLIC_API(JSBool)
1023
+ JS_DefineProperty(JSContext *cx, JSObject *obj, const char *name, jsval value,
1024
+ JSPropertyOp getter, JSPropertyOp setter, uintN attrs);
1025
+
1026
+ /*
1027
+ * Determine the attributes (JSPROP_* flags) of a property on a given object.
1028
+ *
1029
+ * If the object does not have a property by that name, *foundp will be
1030
+ * JS_FALSE and the value of *attrsp is undefined.
1031
+ */
1032
+ extern JS_PUBLIC_API(JSBool)
1033
+ JS_GetPropertyAttributes(JSContext *cx, JSObject *obj, const char *name,
1034
+ uintN *attrsp, JSBool *foundp);
1035
+
1036
+ /*
1037
+ * Set the attributes of a property on a given object.
1038
+ *
1039
+ * If the object does not have a property by that name, *foundp will be
1040
+ * JS_FALSE and nothing will be altered.
1041
+ */
1042
+ extern JS_PUBLIC_API(JSBool)
1043
+ JS_SetPropertyAttributes(JSContext *cx, JSObject *obj, const char *name,
1044
+ uintN attrs, JSBool *foundp);
1045
+
1046
+ extern JS_PUBLIC_API(JSBool)
1047
+ JS_DefinePropertyWithTinyId(JSContext *cx, JSObject *obj, const char *name,
1048
+ int8 tinyid, jsval value,
1049
+ JSPropertyOp getter, JSPropertyOp setter,
1050
+ uintN attrs);
1051
+
1052
+ extern JS_PUBLIC_API(JSBool)
1053
+ JS_AliasProperty(JSContext *cx, JSObject *obj, const char *name,
1054
+ const char *alias);
1055
+
1056
+ extern JS_PUBLIC_API(JSBool)
1057
+ JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, JSBool *foundp);
1058
+
1059
+ extern JS_PUBLIC_API(JSBool)
1060
+ JS_LookupProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);
1061
+
1062
+ extern JS_PUBLIC_API(JSBool)
1063
+ JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name,
1064
+ uintN flags, jsval *vp);
1065
+
1066
+ extern JS_PUBLIC_API(JSBool)
1067
+ JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);
1068
+
1069
+ extern JS_PUBLIC_API(JSBool)
1070
+ JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);
1071
+
1072
+ extern JS_PUBLIC_API(JSBool)
1073
+ JS_DeleteProperty(JSContext *cx, JSObject *obj, const char *name);
1074
+
1075
+ extern JS_PUBLIC_API(JSBool)
1076
+ JS_DeleteProperty2(JSContext *cx, JSObject *obj, const char *name,
1077
+ jsval *rval);
1078
+
1079
+ extern JS_PUBLIC_API(JSBool)
1080
+ JS_DefineUCProperty(JSContext *cx, JSObject *obj,
1081
+ const jschar *name, size_t namelen, jsval value,
1082
+ JSPropertyOp getter, JSPropertyOp setter,
1083
+ uintN attrs);
1084
+
1085
+ /*
1086
+ * Determine the attributes (JSPROP_* flags) of a property on a given object.
1087
+ *
1088
+ * If the object does not have a property by that name, *foundp will be
1089
+ * JS_FALSE and the value of *attrsp is undefined.
1090
+ */
1091
+ extern JS_PUBLIC_API(JSBool)
1092
+ JS_GetUCPropertyAttributes(JSContext *cx, JSObject *obj,
1093
+ const jschar *name, size_t namelen,
1094
+ uintN *attrsp, JSBool *foundp);
1095
+
1096
+ /*
1097
+ * Set the attributes of a property on a given object.
1098
+ *
1099
+ * If the object does not have a property by that name, *foundp will be
1100
+ * JS_FALSE and nothing will be altered.
1101
+ */
1102
+ extern JS_PUBLIC_API(JSBool)
1103
+ JS_SetUCPropertyAttributes(JSContext *cx, JSObject *obj,
1104
+ const jschar *name, size_t namelen,
1105
+ uintN attrs, JSBool *foundp);
1106
+
1107
+
1108
+ extern JS_PUBLIC_API(JSBool)
1109
+ JS_DefineUCPropertyWithTinyId(JSContext *cx, JSObject *obj,
1110
+ const jschar *name, size_t namelen,
1111
+ int8 tinyid, jsval value,
1112
+ JSPropertyOp getter, JSPropertyOp setter,
1113
+ uintN attrs);
1114
+
1115
+ extern JS_PUBLIC_API(JSBool)
1116
+ JS_HasUCProperty(JSContext *cx, JSObject *obj,
1117
+ const jschar *name, size_t namelen,
1118
+ JSBool *vp);
1119
+
1120
+ extern JS_PUBLIC_API(JSBool)
1121
+ JS_LookupUCProperty(JSContext *cx, JSObject *obj,
1122
+ const jschar *name, size_t namelen,
1123
+ jsval *vp);
1124
+
1125
+ extern JS_PUBLIC_API(JSBool)
1126
+ JS_GetUCProperty(JSContext *cx, JSObject *obj,
1127
+ const jschar *name, size_t namelen,
1128
+ jsval *vp);
1129
+
1130
+ extern JS_PUBLIC_API(JSBool)
1131
+ JS_SetUCProperty(JSContext *cx, JSObject *obj,
1132
+ const jschar *name, size_t namelen,
1133
+ jsval *vp);
1134
+
1135
+ extern JS_PUBLIC_API(JSBool)
1136
+ JS_DeleteUCProperty2(JSContext *cx, JSObject *obj,
1137
+ const jschar *name, size_t namelen,
1138
+ jsval *rval);
1139
+
1140
+ extern JS_PUBLIC_API(JSObject *)
1141
+ JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector);
1142
+
1143
+ extern JS_PUBLIC_API(JSBool)
1144
+ JS_IsArrayObject(JSContext *cx, JSObject *obj);
1145
+
1146
+ extern JS_PUBLIC_API(JSBool)
1147
+ JS_GetArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp);
1148
+
1149
+ extern JS_PUBLIC_API(JSBool)
1150
+ JS_SetArrayLength(JSContext *cx, JSObject *obj, jsuint length);
1151
+
1152
+ extern JS_PUBLIC_API(JSBool)
1153
+ JS_HasArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp);
1154
+
1155
+ extern JS_PUBLIC_API(JSBool)
1156
+ JS_DefineElement(JSContext *cx, JSObject *obj, jsint index, jsval value,
1157
+ JSPropertyOp getter, JSPropertyOp setter, uintN attrs);
1158
+
1159
+ extern JS_PUBLIC_API(JSBool)
1160
+ JS_AliasElement(JSContext *cx, JSObject *obj, const char *name, jsint alias);
1161
+
1162
+ extern JS_PUBLIC_API(JSBool)
1163
+ JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp);
1164
+
1165
+ extern JS_PUBLIC_API(JSBool)
1166
+ JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);
1167
+
1168
+ extern JS_PUBLIC_API(JSBool)
1169
+ JS_GetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);
1170
+
1171
+ extern JS_PUBLIC_API(JSBool)
1172
+ JS_SetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);
1173
+
1174
+ extern JS_PUBLIC_API(JSBool)
1175
+ JS_DeleteElement(JSContext *cx, JSObject *obj, jsint index);
1176
+
1177
+ extern JS_PUBLIC_API(JSBool)
1178
+ JS_DeleteElement2(JSContext *cx, JSObject *obj, jsint index, jsval *rval);
1179
+
1180
+ extern JS_PUBLIC_API(void)
1181
+ JS_ClearScope(JSContext *cx, JSObject *obj);
1182
+
1183
+ extern JS_PUBLIC_API(JSIdArray *)
1184
+ JS_Enumerate(JSContext *cx, JSObject *obj);
1185
+
1186
+ extern JS_PUBLIC_API(JSBool)
1187
+ JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
1188
+ jsval *vp, uintN *attrsp);
1189
+
1190
+ extern JS_PUBLIC_API(JSCheckAccessOp)
1191
+ JS_SetCheckObjectAccessCallback(JSRuntime *rt, JSCheckAccessOp acb);
1192
+
1193
+ extern JS_PUBLIC_API(JSBool)
1194
+ JS_GetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval *vp);
1195
+
1196
+ extern JS_PUBLIC_API(JSBool)
1197
+ JS_SetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval v);
1198
+
1199
+ /************************************************************************/
1200
+
1201
+ /*
1202
+ * Security protocol.
1203
+ */
1204
+ struct JSPrincipals {
1205
+ char *codebase;
1206
+ void * (* JS_DLL_CALLBACK getPrincipalArray)(JSContext *cx, JSPrincipals *);
1207
+ JSBool (* JS_DLL_CALLBACK globalPrivilegesEnabled)(JSContext *cx, JSPrincipals *);
1208
+
1209
+ /* Don't call "destroy"; use reference counting macros below. */
1210
+ jsrefcount refcount;
1211
+ void (* JS_DLL_CALLBACK destroy)(JSContext *cx, struct JSPrincipals *);
1212
+ };
1213
+
1214
+ #ifdef JS_THREADSAFE
1215
+ #define JSPRINCIPALS_HOLD(cx, principals) JS_HoldPrincipals(cx,principals)
1216
+ #define JSPRINCIPALS_DROP(cx, principals) JS_DropPrincipals(cx,principals)
1217
+
1218
+ extern JS_PUBLIC_API(jsrefcount)
1219
+ JS_HoldPrincipals(JSContext *cx, JSPrincipals *principals);
1220
+
1221
+ extern JS_PUBLIC_API(jsrefcount)
1222
+ JS_DropPrincipals(JSContext *cx, JSPrincipals *principals);
1223
+
1224
+ #else
1225
+ #define JSPRINCIPALS_HOLD(cx, principals) (++(principals)->refcount)
1226
+ #define JSPRINCIPALS_DROP(cx, principals) \
1227
+ ((--(principals)->refcount == 0) \
1228
+ ? ((*(principals)->destroy)((cx), (principals)), 0) \
1229
+ : (principals)->refcount)
1230
+ #endif
1231
+
1232
+ extern JS_PUBLIC_API(JSPrincipalsTranscoder)
1233
+ JS_SetPrincipalsTranscoder(JSRuntime *rt, JSPrincipalsTranscoder px);
1234
+
1235
+ extern JS_PUBLIC_API(JSObjectPrincipalsFinder)
1236
+ JS_SetObjectPrincipalsFinder(JSContext *cx, JSObjectPrincipalsFinder fop);
1237
+
1238
+ /************************************************************************/
1239
+
1240
+ /*
1241
+ * Functions and scripts.
1242
+ */
1243
+ extern JS_PUBLIC_API(JSFunction *)
1244
+ JS_NewFunction(JSContext *cx, JSNative call, uintN nargs, uintN flags,
1245
+ JSObject *parent, const char *name);
1246
+
1247
+ extern JS_PUBLIC_API(JSObject *)
1248
+ JS_GetFunctionObject(JSFunction *fun);
1249
+
1250
+ /*
1251
+ * Deprecated, useful only for diagnostics. Use JS_GetFunctionId instead for
1252
+ * anonymous vs. "anonymous" disambiguation and Unicode fidelity.
1253
+ */
1254
+ extern JS_PUBLIC_API(const char *)
1255
+ JS_GetFunctionName(JSFunction *fun);
1256
+
1257
+ /*
1258
+ * Return the function's identifier as a JSString, or null if fun is unnamed.
1259
+ * The returned string lives as long as fun, so you don't need to root a saved
1260
+ * reference to it if fun is well-connected or rooted, and provided you bound
1261
+ * the use of the saved reference by fun's lifetime.
1262
+ *
1263
+ * Prefer JS_GetFunctionId over JS_GetFunctionName because it returns null for
1264
+ * truly anonymous functions, and because it doesn't chop to ISO-Latin-1 chars
1265
+ * from UTF-16-ish jschars.
1266
+ */
1267
+ extern JS_PUBLIC_API(JSString *)
1268
+ JS_GetFunctionId(JSFunction *fun);
1269
+
1270
+ /*
1271
+ * Return JSFUN_* flags for fun.
1272
+ */
1273
+ extern JS_PUBLIC_API(uintN)
1274
+ JS_GetFunctionFlags(JSFunction *fun);
1275
+
1276
+ /*
1277
+ * Infallible predicate to test whether obj is a function object (faster than
1278
+ * comparing obj's class name to "Function", but equivalent unless someone has
1279
+ * overwritten the "Function" identifier with a different constructor and then
1280
+ * created instances using that constructor that might be passed in as obj).
1281
+ */
1282
+ extern JS_PUBLIC_API(JSBool)
1283
+ JS_ObjectIsFunction(JSContext *cx, JSObject *obj);
1284
+
1285
+ extern JS_PUBLIC_API(JSBool)
1286
+ JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs);
1287
+
1288
+ extern JS_PUBLIC_API(JSFunction *)
1289
+ JS_DefineFunction(JSContext *cx, JSObject *obj, const char *name, JSNative call,
1290
+ uintN nargs, uintN attrs);
1291
+
1292
+ extern JS_PUBLIC_API(JSFunction *)
1293
+ JS_DefineUCFunction(JSContext *cx, JSObject *obj,
1294
+ const jschar *name, size_t namelen, JSNative call,
1295
+ uintN nargs, uintN attrs);
1296
+
1297
+ extern JS_PUBLIC_API(JSObject *)
1298
+ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent);
1299
+
1300
+ /*
1301
+ * Given a buffer, return JS_FALSE if the buffer might become a valid
1302
+ * javascript statement with the addition of more lines. Otherwise return
1303
+ * JS_TRUE. The intent is to support interactive compilation - accumulate
1304
+ * lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to
1305
+ * the compiler.
1306
+ */
1307
+ extern JS_PUBLIC_API(JSBool)
1308
+ JS_BufferIsCompilableUnit(JSContext *cx, JSObject *obj,
1309
+ const char *bytes, size_t length);
1310
+
1311
+ /*
1312
+ * The JSScript objects returned by the following functions refer to string and
1313
+ * other kinds of literals, including doubles and RegExp objects. These
1314
+ * literals are vulnerable to garbage collection; to root script objects and
1315
+ * prevent literals from being collected, create a rootable object using
1316
+ * JS_NewScriptObject, and root the resulting object using JS_Add[Named]Root.
1317
+ */
1318
+ extern JS_PUBLIC_API(JSScript *)
1319
+ JS_CompileScript(JSContext *cx, JSObject *obj,
1320
+ const char *bytes, size_t length,
1321
+ const char *filename, uintN lineno);
1322
+
1323
+ extern JS_PUBLIC_API(JSScript *)
1324
+ JS_CompileScriptForPrincipals(JSContext *cx, JSObject *obj,
1325
+ JSPrincipals *principals,
1326
+ const char *bytes, size_t length,
1327
+ const char *filename, uintN lineno);
1328
+
1329
+ extern JS_PUBLIC_API(JSScript *)
1330
+ JS_CompileUCScript(JSContext *cx, JSObject *obj,
1331
+ const jschar *chars, size_t length,
1332
+ const char *filename, uintN lineno);
1333
+
1334
+ extern JS_PUBLIC_API(JSScript *)
1335
+ JS_CompileUCScriptForPrincipals(JSContext *cx, JSObject *obj,
1336
+ JSPrincipals *principals,
1337
+ const jschar *chars, size_t length,
1338
+ const char *filename, uintN lineno);
1339
+
1340
+ extern JS_PUBLIC_API(JSScript *)
1341
+ JS_CompileFile(JSContext *cx, JSObject *obj, const char *filename);
1342
+
1343
+ extern JS_PUBLIC_API(JSScript *)
1344
+ JS_CompileFileHandle(JSContext *cx, JSObject *obj, const char *filename,
1345
+ FILE *fh);
1346
+
1347
+ extern JS_PUBLIC_API(JSScript *)
1348
+ JS_CompileFileHandleForPrincipals(JSContext *cx, JSObject *obj,
1349
+ const char *filename, FILE *fh,
1350
+ JSPrincipals *principals);
1351
+
1352
+ /*
1353
+ * NB: you must use JS_NewScriptObject and root a pointer to its return value
1354
+ * in order to keep a JSScript and its atoms safe from garbage collection after
1355
+ * creating the script via JS_Compile* and before a JS_ExecuteScript* call.
1356
+ * E.g., and without error checks:
1357
+ *
1358
+ * JSScript *script = JS_CompileFile(cx, global, filename);
1359
+ * JSObject *scrobj = JS_NewScriptObject(cx, script);
1360
+ * JS_AddNamedRoot(cx, &scrobj, "scrobj");
1361
+ * do {
1362
+ * jsval result;
1363
+ * JS_ExecuteScript(cx, global, script, &result);
1364
+ * JS_GC();
1365
+ * } while (!JSVAL_IS_BOOLEAN(result) || JSVAL_TO_BOOLEAN(result));
1366
+ * JS_RemoveRoot(cx, &scrobj);
1367
+ */
1368
+ extern JS_PUBLIC_API(JSObject *)
1369
+ JS_NewScriptObject(JSContext *cx, JSScript *script);
1370
+
1371
+ /*
1372
+ * Infallible getter for a script's object. If JS_NewScriptObject has not been
1373
+ * called on script yet, the return value will be null.
1374
+ */
1375
+ extern JS_PUBLIC_API(JSObject *)
1376
+ JS_GetScriptObject(JSScript *script);
1377
+
1378
+ extern JS_PUBLIC_API(void)
1379
+ JS_DestroyScript(JSContext *cx, JSScript *script);
1380
+
1381
+ extern JS_PUBLIC_API(JSFunction *)
1382
+ JS_CompileFunction(JSContext *cx, JSObject *obj, const char *name,
1383
+ uintN nargs, const char **argnames,
1384
+ const char *bytes, size_t length,
1385
+ const char *filename, uintN lineno);
1386
+
1387
+ extern JS_PUBLIC_API(JSFunction *)
1388
+ JS_CompileFunctionForPrincipals(JSContext *cx, JSObject *obj,
1389
+ JSPrincipals *principals, const char *name,
1390
+ uintN nargs, const char **argnames,
1391
+ const char *bytes, size_t length,
1392
+ const char *filename, uintN lineno);
1393
+
1394
+ extern JS_PUBLIC_API(JSFunction *)
1395
+ JS_CompileUCFunction(JSContext *cx, JSObject *obj, const char *name,
1396
+ uintN nargs, const char **argnames,
1397
+ const jschar *chars, size_t length,
1398
+ const char *filename, uintN lineno);
1399
+
1400
+ extern JS_PUBLIC_API(JSFunction *)
1401
+ JS_CompileUCFunctionForPrincipals(JSContext *cx, JSObject *obj,
1402
+ JSPrincipals *principals, const char *name,
1403
+ uintN nargs, const char **argnames,
1404
+ const jschar *chars, size_t length,
1405
+ const char *filename, uintN lineno);
1406
+
1407
+ extern JS_PUBLIC_API(JSString *)
1408
+ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name,
1409
+ uintN indent);
1410
+
1411
+ /*
1412
+ * API extension: OR this into indent to avoid pretty-printing the decompiled
1413
+ * source resulting from JS_DecompileFunction{,Body}.
1414
+ */
1415
+ #define JS_DONT_PRETTY_PRINT ((uintN)0x8000)
1416
+
1417
+ extern JS_PUBLIC_API(JSString *)
1418
+ JS_DecompileFunction(JSContext *cx, JSFunction *fun, uintN indent);
1419
+
1420
+ extern JS_PUBLIC_API(JSString *)
1421
+ JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent);
1422
+
1423
+ /*
1424
+ * NB: JS_ExecuteScript, JS_ExecuteScriptPart, and the JS_Evaluate*Script*
1425
+ * quadruplets all use the obj parameter as the initial scope chain header,
1426
+ * the 'this' keyword value, and the variables object (ECMA parlance for where
1427
+ * 'var' and 'function' bind names) of the execution context for script.
1428
+ *
1429
+ * Using obj as the variables object is problematic if obj's parent (which is
1430
+ * the scope chain link; see JS_SetParent and JS_NewObject) is not null: in
1431
+ * this case, variables created by 'var x = 0', e.g., go in obj, but variables
1432
+ * created by assignment to an unbound id, 'x = 0', go in the last object on
1433
+ * the scope chain linked by parent.
1434
+ *
1435
+ * ECMA calls that last scoping object the "global object", but note that many
1436
+ * embeddings have several such objects. ECMA requires that "global code" be
1437
+ * executed with the variables object equal to this global object. But these
1438
+ * JS API entry points provide freedom to execute code against a "sub-global",
1439
+ * i.e., a parented or scoped object, in which case the variables object will
1440
+ * differ from the last object on the scope chain, resulting in confusing and
1441
+ * non-ECMA explicit vs. implicit variable creation.
1442
+ *
1443
+ * Caveat embedders: unless you already depend on this buggy variables object
1444
+ * binding behavior, you should call JS_SetOptions(cx, JSOPTION_VAROBJFIX) or
1445
+ * JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_VAROBJFIX) -- the latter if
1446
+ * someone may have set other options on cx already -- for each context in the
1447
+ * application, if you pass parented objects as the obj parameter, or may ever
1448
+ * pass such objects in the future.
1449
+ *
1450
+ * Why a runtime option? The alternative is to add six or so new API entry
1451
+ * points with signatures matching the following six, and that doesn't seem
1452
+ * worth the code bloat cost. Such new entry points would probably have less
1453
+ * obvious names, too, so would not tend to be used. The JS_SetOption call,
1454
+ * OTOH, can be more easily hacked into existing code that does not depend on
1455
+ * the bug; such code can continue to use the familiar JS_EvaluateScript,
1456
+ * etc., entry points.
1457
+ */
1458
+ extern JS_PUBLIC_API(JSBool)
1459
+ JS_ExecuteScript(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval);
1460
+
1461
+ /*
1462
+ * Execute either the function-defining prolog of a script, or the script's
1463
+ * main body, but not both.
1464
+ */
1465
+ typedef enum JSExecPart { JSEXEC_PROLOG, JSEXEC_MAIN } JSExecPart;
1466
+
1467
+ extern JS_PUBLIC_API(JSBool)
1468
+ JS_ExecuteScriptPart(JSContext *cx, JSObject *obj, JSScript *script,
1469
+ JSExecPart part, jsval *rval);
1470
+
1471
+ extern JS_PUBLIC_API(JSBool)
1472
+ JS_EvaluateScript(JSContext *cx, JSObject *obj,
1473
+ const char *bytes, uintN length,
1474
+ const char *filename, uintN lineno,
1475
+ jsval *rval);
1476
+
1477
+ extern JS_PUBLIC_API(JSBool)
1478
+ JS_EvaluateScriptForPrincipals(JSContext *cx, JSObject *obj,
1479
+ JSPrincipals *principals,
1480
+ const char *bytes, uintN length,
1481
+ const char *filename, uintN lineno,
1482
+ jsval *rval);
1483
+
1484
+ extern JS_PUBLIC_API(JSBool)
1485
+ JS_EvaluateUCScript(JSContext *cx, JSObject *obj,
1486
+ const jschar *chars, uintN length,
1487
+ const char *filename, uintN lineno,
1488
+ jsval *rval);
1489
+
1490
+ extern JS_PUBLIC_API(JSBool)
1491
+ JS_EvaluateUCScriptForPrincipals(JSContext *cx, JSObject *obj,
1492
+ JSPrincipals *principals,
1493
+ const jschar *chars, uintN length,
1494
+ const char *filename, uintN lineno,
1495
+ jsval *rval);
1496
+
1497
+ extern JS_PUBLIC_API(JSBool)
1498
+ JS_CallFunction(JSContext *cx, JSObject *obj, JSFunction *fun, uintN argc,
1499
+ jsval *argv, jsval *rval);
1500
+
1501
+ extern JS_PUBLIC_API(JSBool)
1502
+ JS_CallFunctionName(JSContext *cx, JSObject *obj, const char *name, uintN argc,
1503
+ jsval *argv, jsval *rval);
1504
+
1505
+ extern JS_PUBLIC_API(JSBool)
1506
+ JS_CallFunctionValue(JSContext *cx, JSObject *obj, jsval fval, uintN argc,
1507
+ jsval *argv, jsval *rval);
1508
+
1509
+ extern JS_PUBLIC_API(JSBranchCallback)
1510
+ JS_SetBranchCallback(JSContext *cx, JSBranchCallback cb);
1511
+
1512
+ extern JS_PUBLIC_API(JSBool)
1513
+ JS_IsRunning(JSContext *cx);
1514
+
1515
+ extern JS_PUBLIC_API(JSBool)
1516
+ JS_IsConstructing(JSContext *cx);
1517
+
1518
+ /*
1519
+ * Returns true if a script is executing and its current bytecode is a set
1520
+ * (assignment) operation, even if there are native (no script) stack frames
1521
+ * between the script and the caller to JS_IsAssigning.
1522
+ */
1523
+ extern JS_FRIEND_API(JSBool)
1524
+ JS_IsAssigning(JSContext *cx);
1525
+
1526
+ /*
1527
+ * Set the second return value, which should be a string or int jsval that
1528
+ * identifies a property in the returned object, to form an ECMA reference
1529
+ * type value (obj, id). Only native methods can return reference types,
1530
+ * and if the returned value is used on the left-hand side of an assignment
1531
+ * op, the identified property will be set. If the return value is in an
1532
+ * r-value, the interpreter just gets obj[id]'s value.
1533
+ */
1534
+ extern JS_PUBLIC_API(void)
1535
+ JS_SetCallReturnValue2(JSContext *cx, jsval v);
1536
+
1537
+ /************************************************************************/
1538
+
1539
+ /*
1540
+ * Strings.
1541
+ *
1542
+ * NB: JS_NewString takes ownership of bytes on success, avoiding a copy; but
1543
+ * on error (signified by null return), it leaves bytes owned by the caller.
1544
+ * So the caller must free bytes in the error case, if it has no use for them.
1545
+ * In contrast, all the JS_New*StringCopy* functions do not take ownership of
1546
+ * the character memory passed to them -- they copy it.
1547
+ */
1548
+ extern JS_PUBLIC_API(JSString *)
1549
+ JS_NewString(JSContext *cx, char *bytes, size_t length);
1550
+
1551
+ extern JS_PUBLIC_API(JSString *)
1552
+ JS_NewStringCopyN(JSContext *cx, const char *s, size_t n);
1553
+
1554
+ extern JS_PUBLIC_API(JSString *)
1555
+ JS_NewStringCopyZ(JSContext *cx, const char *s);
1556
+
1557
+ extern JS_PUBLIC_API(JSString *)
1558
+ JS_InternString(JSContext *cx, const char *s);
1559
+
1560
+ extern JS_PUBLIC_API(JSString *)
1561
+ JS_NewUCString(JSContext *cx, jschar *chars, size_t length);
1562
+
1563
+ extern JS_PUBLIC_API(JSString *)
1564
+ JS_NewUCStringCopyN(JSContext *cx, const jschar *s, size_t n);
1565
+
1566
+ extern JS_PUBLIC_API(JSString *)
1567
+ JS_NewUCStringCopyZ(JSContext *cx, const jschar *s);
1568
+
1569
+ extern JS_PUBLIC_API(JSString *)
1570
+ JS_InternUCStringN(JSContext *cx, const jschar *s, size_t length);
1571
+
1572
+ extern JS_PUBLIC_API(JSString *)
1573
+ JS_InternUCString(JSContext *cx, const jschar *s);
1574
+
1575
+ extern JS_PUBLIC_API(char *)
1576
+ JS_GetStringBytes(JSString *str);
1577
+
1578
+ extern JS_PUBLIC_API(jschar *)
1579
+ JS_GetStringChars(JSString *str);
1580
+
1581
+ extern JS_PUBLIC_API(size_t)
1582
+ JS_GetStringLength(JSString *str);
1583
+
1584
+ extern JS_PUBLIC_API(intN)
1585
+ JS_CompareStrings(JSString *str1, JSString *str2);
1586
+
1587
+ /*
1588
+ * Mutable string support. A string's characters are never mutable in this JS
1589
+ * implementation, but a growable string has a buffer that can be reallocated,
1590
+ * and a dependent string is a substring of another (growable, dependent, or
1591
+ * immutable) string. The direct data members of the (opaque to API clients)
1592
+ * JSString struct may be changed in a single-threaded way for growable and
1593
+ * dependent strings.
1594
+ *
1595
+ * Therefore mutable strings cannot be used by more than one thread at a time.
1596
+ * You may call JS_MakeStringImmutable to convert the string from a mutable
1597
+ * (growable or dependent) string to an immutable (and therefore thread-safe)
1598
+ * string. The engine takes care of converting growable and dependent strings
1599
+ * to immutable for you if you store strings in multi-threaded objects using
1600
+ * JS_SetProperty or kindred API entry points.
1601
+ *
1602
+ * If you store a JSString pointer in a native data structure that is (safely)
1603
+ * accessible to multiple threads, you must call JS_MakeStringImmutable before
1604
+ * retiring the store.
1605
+ */
1606
+ extern JS_PUBLIC_API(JSString *)
1607
+ JS_NewGrowableString(JSContext *cx, jschar *chars, size_t length);
1608
+
1609
+ /*
1610
+ * Create a dependent string, i.e., a string that owns no character storage,
1611
+ * but that refers to a slice of another string's chars. Dependent strings
1612
+ * are mutable by definition, so the thread safety comments above apply.
1613
+ */
1614
+ extern JS_PUBLIC_API(JSString *)
1615
+ JS_NewDependentString(JSContext *cx, JSString *str, size_t start,
1616
+ size_t length);
1617
+
1618
+ /*
1619
+ * Concatenate two strings, resulting in a new growable string. If you create
1620
+ * the left string and pass it to JS_ConcatStrings on a single thread, try to
1621
+ * use JS_NewGrowableString to create the left string -- doing so helps Concat
1622
+ * avoid allocating a new buffer for the result and copying left's chars into
1623
+ * the new buffer. See above for thread safety comments.
1624
+ */
1625
+ extern JS_PUBLIC_API(JSString *)
1626
+ JS_ConcatStrings(JSContext *cx, JSString *left, JSString *right);
1627
+
1628
+ /*
1629
+ * Convert a dependent string into an independent one. This function does not
1630
+ * change the string's mutability, so the thread safety comments above apply.
1631
+ */
1632
+ extern JS_PUBLIC_API(const jschar *)
1633
+ JS_UndependString(JSContext *cx, JSString *str);
1634
+
1635
+ /*
1636
+ * Convert a mutable string (either growable or dependent) into an immutable,
1637
+ * thread-safe one.
1638
+ */
1639
+ extern JS_PUBLIC_API(JSBool)
1640
+ JS_MakeStringImmutable(JSContext *cx, JSString *str);
1641
+
1642
+ /************************************************************************/
1643
+
1644
+ /*
1645
+ * Locale specific string conversion callback.
1646
+ */
1647
+ struct JSLocaleCallbacks {
1648
+ JSLocaleToUpperCase localeToUpperCase;
1649
+ JSLocaleToLowerCase localeToLowerCase;
1650
+ JSLocaleCompare localeCompare;
1651
+ JSLocaleToUnicode localeToUnicode;
1652
+ };
1653
+
1654
+ /*
1655
+ * Establish locale callbacks. The pointer must persist as long as the
1656
+ * JSContext. Passing NULL restores the default behaviour.
1657
+ */
1658
+ extern JS_PUBLIC_API(void)
1659
+ JS_SetLocaleCallbacks(JSContext *cx, JSLocaleCallbacks *callbacks);
1660
+
1661
+ /*
1662
+ * Return the address of the current locale callbacks struct, which may
1663
+ * be NULL.
1664
+ */
1665
+ extern JS_PUBLIC_API(JSLocaleCallbacks *)
1666
+ JS_GetLocaleCallbacks(JSContext *cx);
1667
+
1668
+ /************************************************************************/
1669
+
1670
+ /*
1671
+ * Error reporting.
1672
+ */
1673
+
1674
+ /*
1675
+ * Report an exception represented by the sprintf-like conversion of format
1676
+ * and its arguments. This exception message string is passed to a pre-set
1677
+ * JSErrorReporter function (set by JS_SetErrorReporter; see jspubtd.h for
1678
+ * the JSErrorReporter typedef).
1679
+ */
1680
+ extern JS_PUBLIC_API(void)
1681
+ JS_ReportError(JSContext *cx, const char *format, ...);
1682
+
1683
+ /*
1684
+ * Use an errorNumber to retrieve the format string, args are char *
1685
+ */
1686
+ extern JS_PUBLIC_API(void)
1687
+ JS_ReportErrorNumber(JSContext *cx, JSErrorCallback errorCallback,
1688
+ void *userRef, const uintN errorNumber, ...);
1689
+
1690
+ /*
1691
+ * Use an errorNumber to retrieve the format string, args are jschar *
1692
+ */
1693
+ extern JS_PUBLIC_API(void)
1694
+ JS_ReportErrorNumberUC(JSContext *cx, JSErrorCallback errorCallback,
1695
+ void *userRef, const uintN errorNumber, ...);
1696
+
1697
+ /*
1698
+ * As above, but report a warning instead (JSREPORT_IS_WARNING(report.flags)).
1699
+ * Return true if there was no error trying to issue the warning, and if the
1700
+ * warning was not converted into an error due to the JSOPTION_WERROR option
1701
+ * being set, false otherwise.
1702
+ */
1703
+ extern JS_PUBLIC_API(JSBool)
1704
+ JS_ReportWarning(JSContext *cx, const char *format, ...);
1705
+
1706
+ extern JS_PUBLIC_API(JSBool)
1707
+ JS_ReportErrorFlagsAndNumber(JSContext *cx, uintN flags,
1708
+ JSErrorCallback errorCallback, void *userRef,
1709
+ const uintN errorNumber, ...);
1710
+
1711
+ extern JS_PUBLIC_API(JSBool)
1712
+ JS_ReportErrorFlagsAndNumberUC(JSContext *cx, uintN flags,
1713
+ JSErrorCallback errorCallback, void *userRef,
1714
+ const uintN errorNumber, ...);
1715
+
1716
+ /*
1717
+ * Complain when out of memory.
1718
+ */
1719
+ extern JS_PUBLIC_API(void)
1720
+ JS_ReportOutOfMemory(JSContext *cx);
1721
+
1722
+ struct JSErrorReport {
1723
+ const char *filename; /* source file name, URL, etc., or null */
1724
+ uintN lineno; /* source line number */
1725
+ const char *linebuf; /* offending source line without final \n */
1726
+ const char *tokenptr; /* pointer to error token in linebuf */
1727
+ const jschar *uclinebuf; /* unicode (original) line buffer */
1728
+ const jschar *uctokenptr; /* unicode (original) token pointer */
1729
+ uintN flags; /* error/warning, etc. */
1730
+ uintN errorNumber; /* the error number, e.g. see js.msg */
1731
+ const jschar *ucmessage; /* the (default) error message */
1732
+ const jschar **messageArgs; /* arguments for the error message */
1733
+ };
1734
+
1735
+ /*
1736
+ * JSErrorReport flag values. These may be freely composed.
1737
+ */
1738
+ #define JSREPORT_ERROR 0x0 /* pseudo-flag for default case */
1739
+ #define JSREPORT_WARNING 0x1 /* reported via JS_ReportWarning */
1740
+ #define JSREPORT_EXCEPTION 0x2 /* exception was thrown */
1741
+ #define JSREPORT_STRICT 0x4 /* error or warning due to strict option */
1742
+
1743
+ /*
1744
+ * If JSREPORT_EXCEPTION is set, then a JavaScript-catchable exception
1745
+ * has been thrown for this runtime error, and the host should ignore it.
1746
+ * Exception-aware hosts should also check for JS_IsExceptionPending if
1747
+ * JS_ExecuteScript returns failure, and signal or propagate the exception, as
1748
+ * appropriate.
1749
+ */
1750
+ #define JSREPORT_IS_WARNING(flags) (((flags) & JSREPORT_WARNING) != 0)
1751
+ #define JSREPORT_IS_EXCEPTION(flags) (((flags) & JSREPORT_EXCEPTION) != 0)
1752
+ #define JSREPORT_IS_STRICT(flags) (((flags) & JSREPORT_STRICT) != 0)
1753
+
1754
+ extern JS_PUBLIC_API(JSErrorReporter)
1755
+ JS_SetErrorReporter(JSContext *cx, JSErrorReporter er);
1756
+
1757
+ /************************************************************************/
1758
+
1759
+ /*
1760
+ * Regular Expressions.
1761
+ */
1762
+ #define JSREG_FOLD 0x01 /* fold uppercase to lowercase */
1763
+ #define JSREG_GLOB 0x02 /* global exec, creates array of matches */
1764
+ #define JSREG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line */
1765
+
1766
+ extern JS_PUBLIC_API(JSObject *)
1767
+ JS_NewRegExpObject(JSContext *cx, char *bytes, size_t length, uintN flags);
1768
+
1769
+ extern JS_PUBLIC_API(JSObject *)
1770
+ JS_NewUCRegExpObject(JSContext *cx, jschar *chars, size_t length, uintN flags);
1771
+
1772
+ extern JS_PUBLIC_API(void)
1773
+ JS_SetRegExpInput(JSContext *cx, JSString *input, JSBool multiline);
1774
+
1775
+ extern JS_PUBLIC_API(void)
1776
+ JS_ClearRegExpStatics(JSContext *cx);
1777
+
1778
+ extern JS_PUBLIC_API(void)
1779
+ JS_ClearRegExpRoots(JSContext *cx);
1780
+
1781
+ /* TODO: compile, exec, get/set other statics... */
1782
+
1783
+ /************************************************************************/
1784
+
1785
+ extern JS_PUBLIC_API(JSBool)
1786
+ JS_IsExceptionPending(JSContext *cx);
1787
+
1788
+ extern JS_PUBLIC_API(JSBool)
1789
+ JS_GetPendingException(JSContext *cx, jsval *vp);
1790
+
1791
+ extern JS_PUBLIC_API(void)
1792
+ JS_SetPendingException(JSContext *cx, jsval v);
1793
+
1794
+ extern JS_PUBLIC_API(void)
1795
+ JS_ClearPendingException(JSContext *cx);
1796
+
1797
+ extern JS_PUBLIC_API(JSBool)
1798
+ JS_ReportPendingException(JSContext *cx);
1799
+
1800
+ /*
1801
+ * Save the current exception state. This takes a snapshot of cx's current
1802
+ * exception state without making any change to that state.
1803
+ *
1804
+ * The returned state pointer MUST be passed later to JS_RestoreExceptionState
1805
+ * (to restore that saved state, overriding any more recent state) or else to
1806
+ * JS_DropExceptionState (to free the state struct in case it is not correct
1807
+ * or desirable to restore it). Both Restore and Drop free the state struct,
1808
+ * so callers must stop using the pointer returned from Save after calling the
1809
+ * Release or Drop API.
1810
+ */
1811
+ extern JS_PUBLIC_API(JSExceptionState *)
1812
+ JS_SaveExceptionState(JSContext *cx);
1813
+
1814
+ extern JS_PUBLIC_API(void)
1815
+ JS_RestoreExceptionState(JSContext *cx, JSExceptionState *state);
1816
+
1817
+ extern JS_PUBLIC_API(void)
1818
+ JS_DropExceptionState(JSContext *cx, JSExceptionState *state);
1819
+
1820
+ /*
1821
+ * If the given value is an exception object that originated from an error,
1822
+ * the exception will contain an error report struct, and this API will return
1823
+ * the address of that struct. Otherwise, it returns NULL. The lifetime of
1824
+ * the error report struct that might be returned is the same as the lifetime
1825
+ * of the exception object.
1826
+ */
1827
+ extern JS_PUBLIC_API(JSErrorReport *)
1828
+ JS_ErrorFromException(JSContext *cx, jsval v);
1829
+
1830
+ #ifdef JS_THREADSAFE
1831
+
1832
+ /*
1833
+ * Associate the current thread with the given context. This is done
1834
+ * implicitly by JS_NewContext.
1835
+ *
1836
+ * Returns the old thread id for this context, which should be treated as
1837
+ * an opaque value. This value is provided for comparison to 0, which
1838
+ * indicates that ClearContextThread has been called on this context
1839
+ * since the last SetContextThread, or non-0, which indicates the opposite.
1840
+ */
1841
+ extern JS_PUBLIC_API(jsword)
1842
+ JS_GetContextThread(JSContext *cx);
1843
+
1844
+ extern JS_PUBLIC_API(jsword)
1845
+ JS_SetContextThread(JSContext *cx);
1846
+
1847
+ extern JS_PUBLIC_API(jsword)
1848
+ JS_ClearContextThread(JSContext *cx);
1849
+
1850
+ #endif /* JS_THREADSAFE */
1851
+
1852
+ /************************************************************************/
1853
+
1854
+ JS_END_EXTERN_C
1855
+
1856
+ #endif /* jsapi_h___ */