johnson 1.2.0 → 2.0.0.pre0

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 (782) hide show
  1. data/CHANGELOG.rdoc +8 -0
  2. data/Manifest.txt +762 -48
  3. data/README.rdoc +2 -1
  4. data/Rakefile +90 -18
  5. data/ext/spidermonkey/conversions.c +9 -2
  6. data/ext/spidermonkey/ruby_land_proxy.c +1 -1
  7. data/ext/spidermonkey/runtime.h +1 -1
  8. data/ext/tracemonkey/context.cc +125 -0
  9. data/ext/tracemonkey/context.h +19 -0
  10. data/ext/tracemonkey/conversions.cc +365 -0
  11. data/ext/tracemonkey/conversions.h +32 -0
  12. data/ext/tracemonkey/debugger.cc +234 -0
  13. data/ext/tracemonkey/debugger.h +10 -0
  14. data/ext/tracemonkey/extconf.rb +37 -0
  15. data/ext/tracemonkey/extensions.cc +37 -0
  16. data/ext/tracemonkey/extensions.h +12 -0
  17. data/ext/tracemonkey/global.cc +40 -0
  18. data/ext/tracemonkey/global.h +11 -0
  19. data/ext/tracemonkey/idhash.cc +16 -0
  20. data/ext/tracemonkey/idhash.h +8 -0
  21. data/ext/tracemonkey/immutable_node.cc +1199 -0
  22. data/ext/tracemonkey/immutable_node.cc.erb +559 -0
  23. data/ext/tracemonkey/immutable_node.h +22 -0
  24. data/ext/tracemonkey/jroot.h +215 -0
  25. data/ext/tracemonkey/js_land_proxy.cc +620 -0
  26. data/ext/tracemonkey/js_land_proxy.h +20 -0
  27. data/ext/tracemonkey/ruby_land_proxy.cc +618 -0
  28. data/ext/tracemonkey/ruby_land_proxy.h +38 -0
  29. data/ext/tracemonkey/runtime.cc +454 -0
  30. data/ext/tracemonkey/runtime.h +27 -0
  31. data/ext/tracemonkey/split_global.cc +392 -0
  32. data/ext/tracemonkey/split_global.h +11 -0
  33. data/ext/tracemonkey/tracemonkey.cc +23 -0
  34. data/ext/tracemonkey/tracemonkey.h +32 -0
  35. data/lib/johnson.rb +12 -4
  36. data/lib/johnson/error.rb +5 -0
  37. data/lib/johnson/js/prelude.js +16 -1
  38. data/lib/johnson/parser.rb +2 -1
  39. data/lib/johnson/runtime.rb +87 -26
  40. data/lib/johnson/spidermonkey/runtime.rb +7 -16
  41. data/lib/johnson/tracemonkey.rb +13 -0
  42. data/lib/johnson/tracemonkey/context.rb +10 -0
  43. data/lib/johnson/tracemonkey/debugger.rb +67 -0
  44. data/lib/johnson/tracemonkey/immutable_node.rb +282 -0
  45. data/lib/johnson/tracemonkey/js_land_proxy.rb +64 -0
  46. data/lib/johnson/tracemonkey/mutable_tree_visitor.rb +242 -0
  47. data/lib/johnson/tracemonkey/ruby_land_proxy.rb +17 -0
  48. data/lib/johnson/tracemonkey/runtime.rb +80 -0
  49. data/test/{johnson_test.rb → generic/johnson_test.rb} +1 -1
  50. data/test/{parser_test.rb → generic/parser_test.rb} +1 -1
  51. data/test/helper.rb +23 -4
  52. data/test/johnson/{browser_test.rb → generic/browser_test.rb} +1 -1
  53. data/test/johnson/{conversions → generic/conversions}/array_test.rb +1 -1
  54. data/test/johnson/{conversions → generic/conversions}/boolean_test.rb +1 -1
  55. data/test/johnson/{conversions → generic/conversions}/callable_test.rb +1 -1
  56. data/test/johnson/{conversions → generic/conversions}/file_test.rb +1 -1
  57. data/test/johnson/generic/conversions/helper.rb +1 -0
  58. data/test/johnson/{conversions → generic/conversions}/nil_test.rb +1 -1
  59. data/test/johnson/{conversions → generic/conversions}/number_test.rb +1 -1
  60. data/test/johnson/{conversions → generic/conversions}/regexp_test.rb +1 -1
  61. data/test/johnson/{conversions → generic/conversions}/string_test.rb +1 -1
  62. data/test/johnson/{conversions → generic/conversions}/struct_test.rb +1 -1
  63. data/test/johnson/{conversions → generic/conversions}/symbol_test.rb +1 -1
  64. data/test/johnson/{conversions → generic/conversions}/thread_test.rb +1 -1
  65. data/test/johnson/{custom_conversions_test.rb → generic/custom_conversions_test.rb} +1 -1
  66. data/test/johnson/generic/default_test.rb +12 -0
  67. data/test/johnson/{error_test.rb → generic/error_test.rb} +1 -1
  68. data/test/johnson/{extensions_test.rb → generic/extensions_test.rb} +1 -1
  69. data/test/johnson/generic/helper.rb +1 -0
  70. data/test/johnson/{nodes → generic/nodes}/array_literal_test.rb +1 -1
  71. data/test/johnson/{nodes → generic/nodes}/array_node_test.rb +1 -1
  72. data/test/johnson/{nodes → generic/nodes}/binary_node_test.rb +1 -1
  73. data/test/johnson/{nodes → generic/nodes}/bracket_access_test.rb +1 -1
  74. data/test/johnson/{nodes → generic/nodes}/delete_test.rb +1 -1
  75. data/test/johnson/{nodes → generic/nodes}/do_while_test.rb +1 -1
  76. data/test/johnson/{nodes → generic/nodes}/dot_accessor_test.rb +1 -1
  77. data/test/johnson/generic/nodes/export_test.rb +11 -0
  78. data/test/johnson/{nodes → generic/nodes}/for_test.rb +1 -1
  79. data/test/johnson/{nodes → generic/nodes}/function_test.rb +1 -1
  80. data/test/johnson/generic/nodes/helper.rb +1 -0
  81. data/test/johnson/{nodes → generic/nodes}/if_test.rb +16 -6
  82. data/test/johnson/generic/nodes/import_test.rb +15 -0
  83. data/test/johnson/{nodes → generic/nodes}/label_test.rb +1 -1
  84. data/test/johnson/{nodes → generic/nodes}/let_test.rb +1 -1
  85. data/test/johnson/{nodes → generic/nodes}/object_literal_test.rb +1 -1
  86. data/test/johnson/{nodes → generic/nodes}/return_test.rb +1 -1
  87. data/test/johnson/{nodes → generic/nodes}/semi_test.rb +1 -1
  88. data/test/johnson/{nodes → generic/nodes}/switch_test.rb +1 -1
  89. data/test/johnson/{nodes → generic/nodes}/ternary_test.rb +1 -1
  90. data/test/johnson/{nodes → generic/nodes}/throw_test.rb +1 -1
  91. data/test/johnson/{nodes → generic/nodes}/try_node_test.rb +36 -6
  92. data/test/johnson/{nodes → generic/nodes}/typeof_test.rb +1 -1
  93. data/test/johnson/{nodes → generic/nodes}/unary_node_test.rb +1 -1
  94. data/test/johnson/{nodes → generic/nodes}/void_test.rb +1 -1
  95. data/test/johnson/{nodes → generic/nodes}/while_test.rb +1 -1
  96. data/test/johnson/{nodes → generic/nodes}/with_test.rb +1 -1
  97. data/test/johnson/{prelude_test.rb → generic/prelude_test.rb} +1 -1
  98. data/test/johnson/{runtime_test.rb → generic/runtime_test.rb} +3 -6
  99. data/test/johnson/generic/version_test.rb +13 -0
  100. data/test/johnson/{visitors → generic/visitors}/dot_visitor_test.rb +1 -1
  101. data/test/johnson/{visitors → generic/visitors}/enumerating_visitor_test.rb +1 -1
  102. data/test/johnson/generic/visitors/helper.rb +1 -0
  103. data/test/johnson/spidermonkey/js_land_proxy_test.rb +1 -5
  104. data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +11 -7
  105. data/test/johnson/tracemonkey/context_test.rb +21 -0
  106. data/test/johnson/tracemonkey/immutable_node_test.rb +34 -0
  107. data/test/johnson/tracemonkey/js_land_proxy_test.rb +273 -0
  108. data/test/johnson/tracemonkey/ruby_land_proxy_test.rb +274 -0
  109. data/test/johnson/tracemonkey/runtime_test.rb +41 -0
  110. data/test/johnson/tracemonkey/split_global_test.rb +32 -0
  111. data/vendor/spidermonkey/js.pkg +2 -0
  112. data/vendor/tracemonkey/Makefile.in +668 -0
  113. data/vendor/tracemonkey/Makefile.ref +483 -0
  114. data/vendor/tracemonkey/README.html +54 -0
  115. data/vendor/tracemonkey/SpiderMonkey.rsp +11 -0
  116. data/vendor/tracemonkey/Y.js +19 -0
  117. data/vendor/tracemonkey/aclocal.m4 +9 -0
  118. data/vendor/tracemonkey/bench.sh +5 -0
  119. data/vendor/tracemonkey/build/autoconf/acoutput-fast.pl +202 -0
  120. data/vendor/tracemonkey/build/autoconf/altoptions.m4 +154 -0
  121. data/vendor/tracemonkey/build/autoconf/config.guess +1537 -0
  122. data/vendor/tracemonkey/build/autoconf/config.sub +1595 -0
  123. data/vendor/tracemonkey/build/autoconf/install-sh +119 -0
  124. data/vendor/tracemonkey/build/autoconf/make-makefile +315 -0
  125. data/vendor/tracemonkey/build/autoconf/match-dir.sh +101 -0
  126. data/vendor/tracemonkey/build/autoconf/moznbytetype.m4 +136 -0
  127. data/vendor/tracemonkey/build/autoconf/nspr.m4 +82 -0
  128. data/vendor/tracemonkey/build/autoconf/pkg.m4 +59 -0
  129. data/vendor/tracemonkey/build/autoconf/update-makefile.sh +118 -0
  130. data/vendor/tracemonkey/build/cygwin-wrapper +75 -0
  131. data/vendor/tracemonkey/build/hcc +111 -0
  132. data/vendor/tracemonkey/build/hcpp +155 -0
  133. data/vendor/tracemonkey/build/unix/mddepend.pl +165 -0
  134. data/vendor/tracemonkey/build/unix/uniq.pl +63 -0
  135. data/vendor/tracemonkey/build/win32/pgomerge.py +40 -0
  136. data/vendor/tracemonkey/builtins.tbl +91 -0
  137. data/vendor/tracemonkey/call.js +13 -0
  138. data/vendor/tracemonkey/config.mk +206 -0
  139. data/vendor/tracemonkey/config/Makefile.in +106 -0
  140. data/vendor/tracemonkey/config/Moz/Milestone.pm +232 -0
  141. data/vendor/tracemonkey/config/autoconf.mk.in +362 -0
  142. data/vendor/tracemonkey/config/check-sync-dirs.py +103 -0
  143. data/vendor/tracemonkey/config/check-sync-exceptions +7 -0
  144. data/vendor/tracemonkey/config/config.mk +881 -0
  145. data/vendor/tracemonkey/config/fastcwd.pl +66 -0
  146. data/vendor/tracemonkey/config/gcc_hidden.h +2 -0
  147. data/vendor/tracemonkey/config/insure.mk +53 -0
  148. data/vendor/tracemonkey/config/make-system-wrappers.pl +59 -0
  149. data/vendor/tracemonkey/config/milestone.pl +112 -0
  150. data/vendor/tracemonkey/config/milestone.txt +13 -0
  151. data/vendor/tracemonkey/config/mkdepend/Makefile.in +84 -0
  152. data/vendor/tracemonkey/config/mkdepend/cppsetup.c +233 -0
  153. data/vendor/tracemonkey/config/mkdepend/def.h +184 -0
  154. data/vendor/tracemonkey/config/mkdepend/ifparser.c +551 -0
  155. data/vendor/tracemonkey/config/mkdepend/ifparser.h +83 -0
  156. data/vendor/tracemonkey/config/mkdepend/imakemdep.h +733 -0
  157. data/vendor/tracemonkey/config/mkdepend/include.c +337 -0
  158. data/vendor/tracemonkey/config/mkdepend/main.c +860 -0
  159. data/vendor/tracemonkey/config/mkdepend/mkdepend.man +382 -0
  160. data/vendor/tracemonkey/config/mkdepend/parse.c +686 -0
  161. data/vendor/tracemonkey/config/mkdepend/pr.c +124 -0
  162. data/vendor/tracemonkey/config/nfspwd.pl +50 -0
  163. data/vendor/tracemonkey/config/nsinstall.c +481 -0
  164. data/vendor/tracemonkey/config/nsinstall.py +155 -0
  165. data/vendor/tracemonkey/config/pathsub.c +247 -0
  166. data/vendor/tracemonkey/config/pathsub.h +74 -0
  167. data/vendor/tracemonkey/config/preprocessor.pl +671 -0
  168. data/vendor/tracemonkey/config/revdepth-nt.pl +48 -0
  169. data/vendor/tracemonkey/config/revdepth.pl +51 -0
  170. data/vendor/tracemonkey/config/rules.mk +2310 -0
  171. data/vendor/tracemonkey/config/static-checking-config.mk +21 -0
  172. data/vendor/tracemonkey/config/static-checking.js +92 -0
  173. data/vendor/tracemonkey/config/string-format.js +61 -0
  174. data/vendor/tracemonkey/config/system-headers +1035 -0
  175. data/vendor/tracemonkey/config/version.mk +85 -0
  176. data/vendor/tracemonkey/config/version_win.pl +442 -0
  177. data/vendor/tracemonkey/configure +14183 -0
  178. data/vendor/tracemonkey/configure.in +5363 -0
  179. data/vendor/tracemonkey/correct.sh +23 -0
  180. data/vendor/tracemonkey/correct/check-3d-morph.js +55 -0
  181. data/vendor/tracemonkey/correct/check-3d-raytrace.js +445 -0
  182. data/vendor/tracemonkey/correct/check-access-binary-trees.js +52 -0
  183. data/vendor/tracemonkey/correct/check-access-fannkuch.js +66 -0
  184. data/vendor/tracemonkey/correct/check-access-nbody.js +171 -0
  185. data/vendor/tracemonkey/correct/check-access-nsieve.js +40 -0
  186. data/vendor/tracemonkey/correct/check-bitops-3bit-bits-in-byte.js +35 -0
  187. data/vendor/tracemonkey/correct/check-bitops-bits-in-byte.js +24 -0
  188. data/vendor/tracemonkey/correct/check-bitops-bitwise-and.js +29 -0
  189. data/vendor/tracemonkey/correct/check-bitops-nsieve-bits.js +40 -0
  190. data/vendor/tracemonkey/correct/check-controlflow-recursive.js +27 -0
  191. data/vendor/tracemonkey/correct/check-date-format-tofte.js +302 -0
  192. data/vendor/tracemonkey/correct/check-date-format-xparb.js +421 -0
  193. data/vendor/tracemonkey/correct/check-mont.js +119 -0
  194. data/vendor/tracemonkey/dtoa.c +3335 -0
  195. data/vendor/tracemonkey/editline/Makefile.in +55 -0
  196. data/vendor/tracemonkey/editline/Makefile.ref +143 -0
  197. data/vendor/tracemonkey/editline/README +83 -0
  198. data/vendor/tracemonkey/editline/editline.3 +175 -0
  199. data/vendor/tracemonkey/editline/editline.c +1371 -0
  200. data/vendor/tracemonkey/editline/editline.h +135 -0
  201. data/vendor/tracemonkey/editline/sysunix.c +182 -0
  202. data/vendor/tracemonkey/editline/unix.h +82 -0
  203. data/vendor/tracemonkey/if.js +13 -0
  204. data/vendor/tracemonkey/imacro_asm.js.in +396 -0
  205. data/vendor/tracemonkey/imacros.c.out +1034 -0
  206. data/vendor/tracemonkey/imacros.jsasm +770 -0
  207. data/vendor/tracemonkey/javascript-trace.d +73 -0
  208. data/vendor/tracemonkey/jitstats.tbl +55 -0
  209. data/vendor/tracemonkey/js-config.h.in +82 -0
  210. data/vendor/tracemonkey/js-config.in +111 -0
  211. data/vendor/tracemonkey/js.mdp +0 -0
  212. data/vendor/tracemonkey/js.msg +312 -0
  213. data/vendor/tracemonkey/js3240.rc +79 -0
  214. data/vendor/tracemonkey/jsOS240.def +654 -0
  215. data/vendor/tracemonkey/jsapi.cpp +6005 -0
  216. data/vendor/tracemonkey/jsapi.h +2727 -0
  217. data/vendor/tracemonkey/jsarena.cpp +450 -0
  218. data/vendor/tracemonkey/jsarena.h +318 -0
  219. data/vendor/tracemonkey/jsarray.cpp +3664 -0
  220. data/vendor/tracemonkey/jsarray.h +238 -0
  221. data/vendor/tracemonkey/jsatom.cpp +1244 -0
  222. data/vendor/tracemonkey/jsatom.h +493 -0
  223. data/vendor/tracemonkey/jsbit.h +249 -0
  224. data/vendor/tracemonkey/jsbool.cpp +184 -0
  225. data/vendor/tracemonkey/jsbool.h +88 -0
  226. data/vendor/tracemonkey/jsbuiltins.cpp +415 -0
  227. data/vendor/tracemonkey/jsbuiltins.h +456 -0
  228. data/vendor/tracemonkey/jsclist.h +139 -0
  229. data/vendor/tracemonkey/jscntxt.cpp +1816 -0
  230. data/vendor/tracemonkey/jscntxt.h +1541 -0
  231. data/vendor/tracemonkey/jscompat.h +57 -0
  232. data/vendor/tracemonkey/jsconfig.mk +181 -0
  233. data/vendor/tracemonkey/jscpucfg.cpp +194 -0
  234. data/vendor/tracemonkey/jscpucfg.h +91 -0
  235. data/vendor/tracemonkey/jsdate.cpp +2465 -0
  236. data/vendor/tracemonkey/jsdate.h +129 -0
  237. data/vendor/tracemonkey/jsdbgapi.cpp +2017 -0
  238. data/vendor/tracemonkey/jsdbgapi.h +500 -0
  239. data/vendor/tracemonkey/jsdhash.cpp +876 -0
  240. data/vendor/tracemonkey/jsdhash.h +588 -0
  241. data/vendor/tracemonkey/jsdtoa.cpp +572 -0
  242. data/vendor/tracemonkey/jsdtoa.h +131 -0
  243. data/vendor/tracemonkey/jsdtracef.c +318 -0
  244. data/vendor/tracemonkey/jsdtracef.h +81 -0
  245. data/vendor/tracemonkey/jsemit.cpp +7292 -0
  246. data/vendor/tracemonkey/jsemit.h +802 -0
  247. data/vendor/tracemonkey/jsexn.cpp +1337 -0
  248. data/vendor/tracemonkey/jsexn.h +96 -0
  249. data/vendor/tracemonkey/jsfile.cpp +2747 -0
  250. data/vendor/tracemonkey/jsfile.h +56 -0
  251. data/vendor/tracemonkey/jsfile.msg +90 -0
  252. data/vendor/tracemonkey/jsfun.cpp +3089 -0
  253. data/vendor/tracemonkey/jsfun.h +366 -0
  254. data/vendor/tracemonkey/jsgc.cpp +3816 -0
  255. data/vendor/tracemonkey/jsgc.h +429 -0
  256. data/vendor/tracemonkey/jshash.cpp +477 -0
  257. data/vendor/tracemonkey/jshash.h +151 -0
  258. data/vendor/tracemonkey/jsify.pl +483 -0
  259. data/vendor/tracemonkey/jsinterp.cpp +7441 -0
  260. data/vendor/tracemonkey/jsinterp.h +666 -0
  261. data/vendor/tracemonkey/jsinvoke.cpp +42 -0
  262. data/vendor/tracemonkey/jsiter.cpp +1040 -0
  263. data/vendor/tracemonkey/jsiter.h +140 -0
  264. data/vendor/tracemonkey/jskeyword.tbl +124 -0
  265. data/vendor/tracemonkey/jskwgen.cpp +460 -0
  266. data/vendor/tracemonkey/jslibmath.h +69 -0
  267. data/vendor/tracemonkey/jslock.cpp +1512 -0
  268. data/vendor/tracemonkey/jslock.h +325 -0
  269. data/vendor/tracemonkey/jslocko.asm +60 -0
  270. data/vendor/tracemonkey/jslog2.cpp +111 -0
  271. data/vendor/tracemonkey/jslong.h +167 -0
  272. data/vendor/tracemonkey/jsmath.cpp +806 -0
  273. data/vendor/tracemonkey/jsmath.h +63 -0
  274. data/vendor/tracemonkey/jsnum.cpp +1374 -0
  275. data/vendor/tracemonkey/jsnum.h +280 -0
  276. data/vendor/tracemonkey/jsobj.cpp +6165 -0
  277. data/vendor/tracemonkey/jsobj.h +870 -0
  278. data/vendor/tracemonkey/json.cpp +1338 -0
  279. data/vendor/tracemonkey/json.h +108 -0
  280. data/vendor/tracemonkey/jsopcode.cpp +5484 -0
  281. data/vendor/tracemonkey/jsopcode.h +434 -0
  282. data/vendor/tracemonkey/jsopcode.tbl +591 -0
  283. data/vendor/tracemonkey/jsoplengen.cpp +121 -0
  284. data/vendor/tracemonkey/jsotypes.h +202 -0
  285. data/vendor/tracemonkey/jsparse.cpp +9257 -0
  286. data/vendor/tracemonkey/jsparse.h +900 -0
  287. data/vendor/tracemonkey/jsprf.cpp +1262 -0
  288. data/vendor/tracemonkey/jsprf.h +150 -0
  289. data/vendor/tracemonkey/jsproto.tbl +117 -0
  290. data/vendor/tracemonkey/jsprvtd.h +366 -0
  291. data/vendor/tracemonkey/jspubtd.h +585 -0
  292. data/vendor/tracemonkey/jsregexp.cpp +5051 -0
  293. data/vendor/tracemonkey/jsregexp.h +199 -0
  294. data/vendor/tracemonkey/jsreops.tbl +145 -0
  295. data/vendor/tracemonkey/jsscan.cpp +2040 -0
  296. data/vendor/tracemonkey/jsscan.h +467 -0
  297. data/vendor/tracemonkey/jsscope.cpp +1966 -0
  298. data/vendor/tracemonkey/jsscope.h +487 -0
  299. data/vendor/tracemonkey/jsscript.cpp +1932 -0
  300. data/vendor/tracemonkey/jsscript.h +345 -0
  301. data/vendor/tracemonkey/jsshell.msg +54 -0
  302. data/vendor/tracemonkey/jsstack.js +167 -0
  303. data/vendor/tracemonkey/jsstaticcheck.h +69 -0
  304. data/vendor/tracemonkey/jsstddef.h +87 -0
  305. data/vendor/tracemonkey/jsstdint.h +96 -0
  306. data/vendor/tracemonkey/jsstr.cpp +5277 -0
  307. data/vendor/tracemonkey/jsstr.h +702 -0
  308. data/vendor/tracemonkey/jstracer.cpp +10991 -0
  309. data/vendor/tracemonkey/jstracer.h +794 -0
  310. data/vendor/tracemonkey/jstypes.h +481 -0
  311. data/vendor/tracemonkey/jsutil.cpp +361 -0
  312. data/vendor/tracemonkey/jsutil.h +178 -0
  313. data/vendor/tracemonkey/jsversion.h +243 -0
  314. data/vendor/tracemonkey/jswince.asm +44 -0
  315. data/vendor/tracemonkey/jsxdrapi.cpp +800 -0
  316. data/vendor/tracemonkey/jsxdrapi.h +220 -0
  317. data/vendor/tracemonkey/jsxml.cpp +8327 -0
  318. data/vendor/tracemonkey/jsxml.h +305 -0
  319. data/vendor/tracemonkey/liveconnect/LiveConnect.dsp +157 -0
  320. data/vendor/tracemonkey/liveconnect/LiveConnectShell.dsp +120 -0
  321. data/vendor/tracemonkey/liveconnect/LiveConnectShell.dsw +44 -0
  322. data/vendor/tracemonkey/liveconnect/Makefile.in +105 -0
  323. data/vendor/tracemonkey/liveconnect/Makefile.ref +169 -0
  324. data/vendor/tracemonkey/liveconnect/README.html +712 -0
  325. data/vendor/tracemonkey/liveconnect/_jni/netscape_javascript_JSException.h +14 -0
  326. data/vendor/tracemonkey/liveconnect/_jni/netscape_javascript_JSObject.h +155 -0
  327. data/vendor/tracemonkey/liveconnect/classes/Makefile.in +89 -0
  328. data/vendor/tracemonkey/liveconnect/classes/Makefile.ref +57 -0
  329. data/vendor/tracemonkey/liveconnect/classes/netscape/Makefile.ref +47 -0
  330. data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSException.java +140 -0
  331. data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSObject.java +183 -0
  332. data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSProxy.java +58 -0
  333. data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSRunnable.java +70 -0
  334. data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSUtil.java +59 -0
  335. data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/Makefile.ref +53 -0
  336. data/vendor/tracemonkey/liveconnect/config/AIX4.1.mk +45 -0
  337. data/vendor/tracemonkey/liveconnect/config/AIX4.2.mk +45 -0
  338. data/vendor/tracemonkey/liveconnect/config/AIX4.3.mk +50 -0
  339. data/vendor/tracemonkey/liveconnect/config/HP-UXB.10.10.mk +43 -0
  340. data/vendor/tracemonkey/liveconnect/config/HP-UXB.10.20.mk +43 -0
  341. data/vendor/tracemonkey/liveconnect/config/HP-UXB.11.00.mk +43 -0
  342. data/vendor/tracemonkey/liveconnect/config/IRIX6.2.mk +43 -0
  343. data/vendor/tracemonkey/liveconnect/config/IRIX6.3.mk +43 -0
  344. data/vendor/tracemonkey/liveconnect/config/IRIX6.5.mk +43 -0
  345. data/vendor/tracemonkey/liveconnect/config/Linux_All.mk +73 -0
  346. data/vendor/tracemonkey/liveconnect/config/OSF1V4.0.mk +65 -0
  347. data/vendor/tracemonkey/liveconnect/config/OSF1V5.0.mk +62 -0
  348. data/vendor/tracemonkey/liveconnect/config/SunOS5.5.1.mk +55 -0
  349. data/vendor/tracemonkey/liveconnect/config/SunOS5.6.mk +39 -0
  350. data/vendor/tracemonkey/liveconnect/config/SunOS5.7.mk +39 -0
  351. data/vendor/tracemonkey/liveconnect/config/SunOS5.8.mk +39 -0
  352. data/vendor/tracemonkey/liveconnect/config/WINNT4.0.mk +53 -0
  353. data/vendor/tracemonkey/liveconnect/jsj.c +886 -0
  354. data/vendor/tracemonkey/liveconnect/jsj.msg +98 -0
  355. data/vendor/tracemonkey/liveconnect/jsj_JSObject.c +1377 -0
  356. data/vendor/tracemonkey/liveconnect/jsj_JavaArray.c +474 -0
  357. data/vendor/tracemonkey/liveconnect/jsj_JavaClass.c +737 -0
  358. data/vendor/tracemonkey/liveconnect/jsj_JavaMember.c +191 -0
  359. data/vendor/tracemonkey/liveconnect/jsj_JavaObject.c +1079 -0
  360. data/vendor/tracemonkey/liveconnect/jsj_JavaPackage.c +569 -0
  361. data/vendor/tracemonkey/liveconnect/jsj_array.c +207 -0
  362. data/vendor/tracemonkey/liveconnect/jsj_class.c +770 -0
  363. data/vendor/tracemonkey/liveconnect/jsj_convert.c +902 -0
  364. data/vendor/tracemonkey/liveconnect/jsj_field.c +421 -0
  365. data/vendor/tracemonkey/liveconnect/jsj_hash.c +488 -0
  366. data/vendor/tracemonkey/liveconnect/jsj_hash.h +161 -0
  367. data/vendor/tracemonkey/liveconnect/jsj_method.c +1825 -0
  368. data/vendor/tracemonkey/liveconnect/jsj_nodl.c +1 -0
  369. data/vendor/tracemonkey/liveconnect/jsj_private.h +677 -0
  370. data/vendor/tracemonkey/liveconnect/jsj_simpleapi.c +219 -0
  371. data/vendor/tracemonkey/liveconnect/jsj_utils.c +513 -0
  372. data/vendor/tracemonkey/liveconnect/jsjava.h +316 -0
  373. data/vendor/tracemonkey/liveconnect/netscape_javascript_JSObject.h +155 -0
  374. data/vendor/tracemonkey/liveconnect/nsCLiveconnect.cpp +785 -0
  375. data/vendor/tracemonkey/liveconnect/nsCLiveconnect.h +197 -0
  376. data/vendor/tracemonkey/liveconnect/nsCLiveconnectFactory.cpp +118 -0
  377. data/vendor/tracemonkey/liveconnect/nsCLiveconnectFactory.h +76 -0
  378. data/vendor/tracemonkey/liveconnect/nsILiveconnect.h +197 -0
  379. data/vendor/tracemonkey/liveconnect/nsISecureLiveconnect.h +94 -0
  380. data/vendor/tracemonkey/liveconnect/nsISecurityContext.h +136 -0
  381. data/vendor/tracemonkey/lock_SunOS.s +119 -0
  382. data/vendor/tracemonkey/mandelbrot-results.js +3 -0
  383. data/vendor/tracemonkey/math-partial-sums.js +32 -0
  384. data/vendor/tracemonkey/math-trace-tests.js +507 -0
  385. data/vendor/tracemonkey/md5.js +289 -0
  386. data/vendor/tracemonkey/nanojit/Assembler.cpp +1984 -0
  387. data/vendor/tracemonkey/nanojit/Assembler.h +375 -0
  388. data/vendor/tracemonkey/nanojit/Fragmento.cpp +651 -0
  389. data/vendor/tracemonkey/nanojit/Fragmento.h +237 -0
  390. data/vendor/tracemonkey/nanojit/LIR.cpp +2314 -0
  391. data/vendor/tracemonkey/nanojit/LIR.h +879 -0
  392. data/vendor/tracemonkey/nanojit/LIRopcode.tbl +252 -0
  393. data/vendor/tracemonkey/nanojit/Native.h +127 -0
  394. data/vendor/tracemonkey/nanojit/NativeARM.cpp +1742 -0
  395. data/vendor/tracemonkey/nanojit/NativeARM.h +844 -0
  396. data/vendor/tracemonkey/nanojit/NativeSparc.cpp +1130 -0
  397. data/vendor/tracemonkey/nanojit/NativeSparc.h +948 -0
  398. data/vendor/tracemonkey/nanojit/NativeThumb.cpp +1322 -0
  399. data/vendor/tracemonkey/nanojit/NativeThumb.h +525 -0
  400. data/vendor/tracemonkey/nanojit/Nativei386.cpp +1748 -0
  401. data/vendor/tracemonkey/nanojit/Nativei386.h +857 -0
  402. data/vendor/tracemonkey/nanojit/RegAlloc.cpp +183 -0
  403. data/vendor/tracemonkey/nanojit/RegAlloc.h +95 -0
  404. data/vendor/tracemonkey/nanojit/TraceTreeDrawer.cpp +306 -0
  405. data/vendor/tracemonkey/nanojit/TraceTreeDrawer.h +88 -0
  406. data/vendor/tracemonkey/nanojit/avmplus.cpp +56 -0
  407. data/vendor/tracemonkey/nanojit/avmplus.h +1016 -0
  408. data/vendor/tracemonkey/nanojit/nanojit.h +253 -0
  409. data/vendor/tracemonkey/perfect.js +39 -0
  410. data/vendor/tracemonkey/plify_jsdhash.sed +35 -0
  411. data/vendor/tracemonkey/prmjtime.cpp +869 -0
  412. data/vendor/tracemonkey/prmjtime.h +103 -0
  413. data/vendor/tracemonkey/ref-config/AIX4.1.mk +65 -0
  414. data/vendor/tracemonkey/ref-config/AIX4.2.mk +64 -0
  415. data/vendor/tracemonkey/ref-config/AIX4.3.mk +65 -0
  416. data/vendor/tracemonkey/ref-config/Darwin.mk +85 -0
  417. data/vendor/tracemonkey/ref-config/Darwin1.3.mk +81 -0
  418. data/vendor/tracemonkey/ref-config/Darwin1.4.mk +41 -0
  419. data/vendor/tracemonkey/ref-config/Darwin5.2.mk +81 -0
  420. data/vendor/tracemonkey/ref-config/Darwin5.3.mk +81 -0
  421. data/vendor/tracemonkey/ref-config/Darwin64.mk +72 -0
  422. data/vendor/tracemonkey/ref-config/HP-UXB.10.10.mk +77 -0
  423. data/vendor/tracemonkey/ref-config/HP-UXB.10.20.mk +77 -0
  424. data/vendor/tracemonkey/ref-config/HP-UXB.11.00.mk +80 -0
  425. data/vendor/tracemonkey/ref-config/IRIX.mk +87 -0
  426. data/vendor/tracemonkey/ref-config/IRIX5.3.mk +44 -0
  427. data/vendor/tracemonkey/ref-config/IRIX6.1.mk +44 -0
  428. data/vendor/tracemonkey/ref-config/IRIX6.2.mk +44 -0
  429. data/vendor/tracemonkey/ref-config/IRIX6.3.mk +44 -0
  430. data/vendor/tracemonkey/ref-config/IRIX6.5.mk +44 -0
  431. data/vendor/tracemonkey/ref-config/Linux_All.mk +105 -0
  432. data/vendor/tracemonkey/ref-config/Mac_OS10.0.mk +82 -0
  433. data/vendor/tracemonkey/ref-config/OSF1V4.0.mk +72 -0
  434. data/vendor/tracemonkey/ref-config/OSF1V5.0.mk +69 -0
  435. data/vendor/tracemonkey/ref-config/SunOS4.1.4.mk +101 -0
  436. data/vendor/tracemonkey/ref-config/SunOS5.10.mk +50 -0
  437. data/vendor/tracemonkey/ref-config/SunOS5.3.mk +91 -0
  438. data/vendor/tracemonkey/ref-config/SunOS5.4.mk +92 -0
  439. data/vendor/tracemonkey/ref-config/SunOS5.5.1.mk +44 -0
  440. data/vendor/tracemonkey/ref-config/SunOS5.5.mk +87 -0
  441. data/vendor/tracemonkey/ref-config/SunOS5.6.mk +89 -0
  442. data/vendor/tracemonkey/ref-config/SunOS5.7.mk +44 -0
  443. data/vendor/tracemonkey/ref-config/SunOS5.8.mk +44 -0
  444. data/vendor/tracemonkey/ref-config/SunOS5.9.mk +44 -0
  445. data/vendor/tracemonkey/ref-config/WINNT4.0.mk +118 -0
  446. data/vendor/tracemonkey/ref-config/WINNT5.0.mk +118 -0
  447. data/vendor/tracemonkey/ref-config/WINNT5.1.mk +118 -0
  448. data/vendor/tracemonkey/ref-config/WINNT5.2.mk +118 -0
  449. data/vendor/tracemonkey/ref-config/WINNT6.0.mk +118 -0
  450. data/vendor/tracemonkey/ref-config/dgux.mk +64 -0
  451. data/vendor/tracemonkey/resource.h +15 -0
  452. data/vendor/tracemonkey/rules.mk +206 -0
  453. data/vendor/tracemonkey/shell/Makefile.in +72 -0
  454. data/vendor/tracemonkey/shell/js.cpp +4719 -0
  455. data/vendor/tracemonkey/t/3d-cube.js +337 -0
  456. data/vendor/tracemonkey/t/3d-morph.js +54 -0
  457. data/vendor/tracemonkey/t/3d-raytrace.js +441 -0
  458. data/vendor/tracemonkey/t/access-binary-trees.js +50 -0
  459. data/vendor/tracemonkey/t/access-fannkuch.js +66 -0
  460. data/vendor/tracemonkey/t/access-nbody.js +169 -0
  461. data/vendor/tracemonkey/t/access-nsieve.js +38 -0
  462. data/vendor/tracemonkey/t/bitops-3bit-bits-in-byte.js +32 -0
  463. data/vendor/tracemonkey/t/bitops-bits-in-byte.js +21 -0
  464. data/vendor/tracemonkey/t/bitops-bitwise-and.js +28 -0
  465. data/vendor/tracemonkey/t/bitops-nsieve-bits.js +32 -0
  466. data/vendor/tracemonkey/t/controlflow-recursive.js +25 -0
  467. data/vendor/tracemonkey/t/crypto-aes.js +422 -0
  468. data/vendor/tracemonkey/t/crypto-md5.js +286 -0
  469. data/vendor/tracemonkey/t/crypto-sha1.js +224 -0
  470. data/vendor/tracemonkey/t/date-format-tofte.js +299 -0
  471. data/vendor/tracemonkey/t/date-format-xparb.js +417 -0
  472. data/vendor/tracemonkey/t/math-cordic.js +95 -0
  473. data/vendor/tracemonkey/t/math-partial-sums.js +33 -0
  474. data/vendor/tracemonkey/t/math-spectral-norm.js +51 -0
  475. data/vendor/tracemonkey/t/regexp-dna.js +1712 -0
  476. data/vendor/tracemonkey/t/string-base64.js +135 -0
  477. data/vendor/tracemonkey/t/string-fasta.js +85 -0
  478. data/vendor/tracemonkey/t/string-tagcloud.js +265 -0
  479. data/vendor/tracemonkey/t/string-unpack-code.js +68 -0
  480. data/vendor/tracemonkey/t/string-validate-input.js +89 -0
  481. data/vendor/tracemonkey/time.sh +13 -0
  482. data/vendor/tracemonkey/trace-test.js +5564 -0
  483. data/vendor/tracemonkey/v8/base.js +187 -0
  484. data/vendor/tracemonkey/v8/crypto.js +1689 -0
  485. data/vendor/tracemonkey/v8/deltablue.js +880 -0
  486. data/vendor/tracemonkey/v8/earley-boyer.js +4682 -0
  487. data/vendor/tracemonkey/v8/raytrace.js +3418 -0
  488. data/vendor/tracemonkey/v8/richards.js +539 -0
  489. data/vendor/tracemonkey/v8/run-crypto.js +44 -0
  490. data/vendor/tracemonkey/v8/run-deltablue.js +44 -0
  491. data/vendor/tracemonkey/v8/run-earley-boyer.js +44 -0
  492. data/vendor/tracemonkey/v8/run-raytrace.js +44 -0
  493. data/vendor/tracemonkey/v8/run-richards.js +44 -0
  494. data/vendor/tracemonkey/v8/run.js +49 -0
  495. data/vendor/tracemonkey/vprof/readme.txt +93 -0
  496. data/vendor/tracemonkey/vprof/vprof.cpp +360 -0
  497. data/vendor/tracemonkey/vprof/vprof.h +245 -0
  498. data/vendor/tracemonkey/xpconnect/Makefile.in +67 -0
  499. data/vendor/tracemonkey/xpconnect/crashtests/117307-1.html +20 -0
  500. data/vendor/tracemonkey/xpconnect/crashtests/193710.html +11 -0
  501. data/vendor/tracemonkey/xpconnect/crashtests/290162-1.html +5 -0
  502. data/vendor/tracemonkey/xpconnect/crashtests/326615-1.html +16 -0
  503. data/vendor/tracemonkey/xpconnect/crashtests/328553-1.html +13 -0
  504. data/vendor/tracemonkey/xpconnect/crashtests/346258-1.html +12 -0
  505. data/vendor/tracemonkey/xpconnect/crashtests/346512-1-frame1.xhtml +16 -0
  506. data/vendor/tracemonkey/xpconnect/crashtests/346512-1-frame2.xhtml +15 -0
  507. data/vendor/tracemonkey/xpconnect/crashtests/346512-1.xhtml +30 -0
  508. data/vendor/tracemonkey/xpconnect/crashtests/382133-1.html +3 -0
  509. data/vendor/tracemonkey/xpconnect/crashtests/386680-1.html +22 -0
  510. data/vendor/tracemonkey/xpconnect/crashtests/394810-1.html +4 -0
  511. data/vendor/tracemonkey/xpconnect/crashtests/400349-1.html +20 -0
  512. data/vendor/tracemonkey/xpconnect/crashtests/403356-1.html +13 -0
  513. data/vendor/tracemonkey/xpconnect/crashtests/418139-1.svg +22 -0
  514. data/vendor/tracemonkey/xpconnect/crashtests/420513-1.html +11 -0
  515. data/vendor/tracemonkey/xpconnect/crashtests/453935-1.html +37 -0
  516. data/vendor/tracemonkey/xpconnect/crashtests/462926.html +12 -0
  517. data/vendor/tracemonkey/xpconnect/crashtests/468552-1.html +18 -0
  518. data/vendor/tracemonkey/xpconnect/crashtests/471366-1.html +12 -0
  519. data/vendor/tracemonkey/xpconnect/crashtests/475185-1.html +13 -0
  520. data/vendor/tracemonkey/xpconnect/crashtests/475291-1.html +14 -0
  521. data/vendor/tracemonkey/xpconnect/crashtests/503286-1.html +23 -0
  522. data/vendor/tracemonkey/xpconnect/crashtests/crashtests.list +21 -0
  523. data/vendor/tracemonkey/xpconnect/idl/Makefile.in +78 -0
  524. data/vendor/tracemonkey/xpconnect/idl/XPCIDispatch.idl +51 -0
  525. data/vendor/tracemonkey/xpconnect/idl/mozIJSSubScriptLoader.idl +64 -0
  526. data/vendor/tracemonkey/xpconnect/idl/nsIActiveXSecurityPolicy.idl +67 -0
  527. data/vendor/tracemonkey/xpconnect/idl/nsIDispatchSupport.idl +119 -0
  528. data/vendor/tracemonkey/xpconnect/idl/nsIJSContextStack.idl +85 -0
  529. data/vendor/tracemonkey/xpconnect/idl/nsIJSRuntimeService.idl +51 -0
  530. data/vendor/tracemonkey/xpconnect/idl/nsIScriptError.idl +102 -0
  531. data/vendor/tracemonkey/xpconnect/idl/nsIScriptableInterfaces.idl +67 -0
  532. data/vendor/tracemonkey/xpconnect/idl/nsIXPCScriptNotify.idl +66 -0
  533. data/vendor/tracemonkey/xpconnect/idl/nsIXPCScriptable.idl +183 -0
  534. data/vendor/tracemonkey/xpconnect/idl/nsIXPCSecurityManager.idl +114 -0
  535. data/vendor/tracemonkey/xpconnect/idl/nsIXPConnect.idl +819 -0
  536. data/vendor/tracemonkey/xpconnect/idl/xpcIJSModuleLoader.idl +95 -0
  537. data/vendor/tracemonkey/xpconnect/idl/xpcIJSWeakReference.idl +49 -0
  538. data/vendor/tracemonkey/xpconnect/idl/xpccomponents.idl +254 -0
  539. data/vendor/tracemonkey/xpconnect/idl/xpcexception.idl +66 -0
  540. data/vendor/tracemonkey/xpconnect/idl/xpcjsid.idl +83 -0
  541. data/vendor/tracemonkey/xpconnect/loader/ISO8601DateUtils.jsm +176 -0
  542. data/vendor/tracemonkey/xpconnect/loader/Makefile.in +63 -0
  543. data/vendor/tracemonkey/xpconnect/loader/XPCOMUtils.jsm +267 -0
  544. data/vendor/tracemonkey/xpconnect/loader/mozJSComponentLoader.cpp +1717 -0
  545. data/vendor/tracemonkey/xpconnect/loader/mozJSComponentLoader.h +172 -0
  546. data/vendor/tracemonkey/xpconnect/loader/mozJSLoaderConstructors.h +101 -0
  547. data/vendor/tracemonkey/xpconnect/loader/mozJSSubScriptLoader.cpp +360 -0
  548. data/vendor/tracemonkey/xpconnect/loader/mozJSSubScriptLoader.h +66 -0
  549. data/vendor/tracemonkey/xpconnect/public/Makefile.in +54 -0
  550. data/vendor/tracemonkey/xpconnect/public/nsAXPCNativeCallContext.h +89 -0
  551. data/vendor/tracemonkey/xpconnect/public/nsAutoJSValHolder.h +168 -0
  552. data/vendor/tracemonkey/xpconnect/public/xpc_map_end.h +327 -0
  553. data/vendor/tracemonkey/xpconnect/sample/Makefile.in +71 -0
  554. data/vendor/tracemonkey/xpconnect/sample/README +39 -0
  555. data/vendor/tracemonkey/xpconnect/sample/xpcsample1.cpp +337 -0
  556. data/vendor/tracemonkey/xpconnect/sample/xpcsample1.idl +82 -0
  557. data/vendor/tracemonkey/xpconnect/sample/xpcsample1.js +21 -0
  558. data/vendor/tracemonkey/xpconnect/shell/Makefile.in +106 -0
  559. data/vendor/tracemonkey/xpconnect/shell/jsshell.msg +50 -0
  560. data/vendor/tracemonkey/xpconnect/shell/xpcshell.cpp +1817 -0
  561. data/vendor/tracemonkey/xpconnect/shell/xpcshellMacUtils.h +43 -0
  562. data/vendor/tracemonkey/xpconnect/shell/xpcshellMacUtils.mm +54 -0
  563. data/vendor/tracemonkey/xpconnect/src/Makefile.in +228 -0
  564. data/vendor/tracemonkey/xpconnect/src/README +3 -0
  565. data/vendor/tracemonkey/xpconnect/src/XPCCrossOriginWrapper.cpp +1186 -0
  566. data/vendor/tracemonkey/xpconnect/src/XPCDispConvert.cpp +593 -0
  567. data/vendor/tracemonkey/xpconnect/src/XPCDispInlines.h +667 -0
  568. data/vendor/tracemonkey/xpconnect/src/XPCDispInterface.cpp +383 -0
  569. data/vendor/tracemonkey/xpconnect/src/XPCDispObject.cpp +516 -0
  570. data/vendor/tracemonkey/xpconnect/src/XPCDispParamPropJSClass.cpp +223 -0
  571. data/vendor/tracemonkey/xpconnect/src/XPCDispParams.cpp +103 -0
  572. data/vendor/tracemonkey/xpconnect/src/XPCDispPrivate.h +1401 -0
  573. data/vendor/tracemonkey/xpconnect/src/XPCDispTearOff.cpp +547 -0
  574. data/vendor/tracemonkey/xpconnect/src/XPCDispTypeInfo.cpp +471 -0
  575. data/vendor/tracemonkey/xpconnect/src/XPCIDispatchClassInfo.cpp +139 -0
  576. data/vendor/tracemonkey/xpconnect/src/XPCIDispatchExtension.cpp +362 -0
  577. data/vendor/tracemonkey/xpconnect/src/XPCNativeWrapper.cpp +1350 -0
  578. data/vendor/tracemonkey/xpconnect/src/XPCNativeWrapper.h +88 -0
  579. data/vendor/tracemonkey/xpconnect/src/XPCSafeJSObjectWrapper.cpp +1148 -0
  580. data/vendor/tracemonkey/xpconnect/src/XPCSystemOnlyWrapper.cpp +718 -0
  581. data/vendor/tracemonkey/xpconnect/src/XPCWrapper.cpp +850 -0
  582. data/vendor/tracemonkey/xpconnect/src/XPCWrapper.h +394 -0
  583. data/vendor/tracemonkey/xpconnect/src/dom_quickstubs.qsconf +568 -0
  584. data/vendor/tracemonkey/xpconnect/src/nsDispatchSupport.cpp +348 -0
  585. data/vendor/tracemonkey/xpconnect/src/nsScriptError.cpp +201 -0
  586. data/vendor/tracemonkey/xpconnect/src/nsXPConnect.cpp +2609 -0
  587. data/vendor/tracemonkey/xpconnect/src/qsgen.py +1487 -0
  588. data/vendor/tracemonkey/xpconnect/src/xpc.msg +217 -0
  589. data/vendor/tracemonkey/xpconnect/src/xpcJSWeakReference.cpp +148 -0
  590. data/vendor/tracemonkey/xpconnect/src/xpcJSWeakReference.h +56 -0
  591. data/vendor/tracemonkey/xpconnect/src/xpccallcontext.cpp +579 -0
  592. data/vendor/tracemonkey/xpconnect/src/xpccomponents.cpp +4144 -0
  593. data/vendor/tracemonkey/xpconnect/src/xpccontext.cpp +115 -0
  594. data/vendor/tracemonkey/xpconnect/src/xpcconvert.cpp +2298 -0
  595. data/vendor/tracemonkey/xpconnect/src/xpcdebug.cpp +481 -0
  596. data/vendor/tracemonkey/xpconnect/src/xpcexception.cpp +502 -0
  597. data/vendor/tracemonkey/xpconnect/src/xpcforwards.h +114 -0
  598. data/vendor/tracemonkey/xpconnect/src/xpcinlines.h +772 -0
  599. data/vendor/tracemonkey/xpconnect/src/xpcjsid.cpp +1025 -0
  600. data/vendor/tracemonkey/xpconnect/src/xpcjsruntime.cpp +1342 -0
  601. data/vendor/tracemonkey/xpconnect/src/xpclog.cpp +128 -0
  602. data/vendor/tracemonkey/xpconnect/src/xpclog.h +101 -0
  603. data/vendor/tracemonkey/xpconnect/src/xpcmaps.cpp +761 -0
  604. data/vendor/tracemonkey/xpconnect/src/xpcmaps.h +713 -0
  605. data/vendor/tracemonkey/xpconnect/src/xpcmodule.cpp +136 -0
  606. data/vendor/tracemonkey/xpconnect/src/xpcprivate.h +4138 -0
  607. data/vendor/tracemonkey/xpconnect/src/xpcquickstubs.cpp +1128 -0
  608. data/vendor/tracemonkey/xpconnect/src/xpcquickstubs.h +480 -0
  609. data/vendor/tracemonkey/xpconnect/src/xpcruntimesvc.cpp +179 -0
  610. data/vendor/tracemonkey/xpconnect/src/xpcstack.cpp +342 -0
  611. data/vendor/tracemonkey/xpconnect/src/xpcstring.cpp +139 -0
  612. data/vendor/tracemonkey/xpconnect/src/xpcthreadcontext.cpp +599 -0
  613. data/vendor/tracemonkey/xpconnect/src/xpcthrower.cpp +399 -0
  614. data/vendor/tracemonkey/xpconnect/src/xpcvariant.cpp +850 -0
  615. data/vendor/tracemonkey/xpconnect/src/xpcwrappedjs.cpp +670 -0
  616. data/vendor/tracemonkey/xpconnect/src/xpcwrappedjsclass.cpp +2015 -0
  617. data/vendor/tracemonkey/xpconnect/src/xpcwrappednative.cpp +3482 -0
  618. data/vendor/tracemonkey/xpconnect/src/xpcwrappednativeinfo.cpp +945 -0
  619. data/vendor/tracemonkey/xpconnect/src/xpcwrappednativejsops.cpp +2003 -0
  620. data/vendor/tracemonkey/xpconnect/src/xpcwrappednativeproto.cpp +302 -0
  621. data/vendor/tracemonkey/xpconnect/src/xpcwrappednativescope.cpp +991 -0
  622. data/vendor/tracemonkey/xpconnect/tests/Makefile.in +75 -0
  623. data/vendor/tracemonkey/xpconnect/tests/TestXPC.cpp +785 -0
  624. data/vendor/tracemonkey/xpconnect/tests/chrome/Makefile.in +51 -0
  625. data/vendor/tracemonkey/xpconnect/tests/chrome/test_bug500931.xul +43 -0
  626. data/vendor/tracemonkey/xpconnect/tests/components/Makefile.in +85 -0
  627. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_array.cpp +388 -0
  628. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_attributes.cpp +305 -0
  629. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_calljs.cpp +135 -0
  630. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_child.cpp +225 -0
  631. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_const.cpp +76 -0
  632. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_domstring.cpp +118 -0
  633. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_echo.cpp +616 -0
  634. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_in.cpp +204 -0
  635. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_inout.cpp +171 -0
  636. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_module.cpp +77 -0
  637. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_multiple.cpp +554 -0
  638. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_noisy.cpp +154 -0
  639. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_out.cpp +335 -0
  640. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_overloaded.cpp +250 -0
  641. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_private.h +192 -0
  642. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_string.cpp +185 -0
  643. data/vendor/tracemonkey/xpconnect/tests/components/xpctest_variant.cpp +355 -0
  644. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/StdAfx.cpp +12 -0
  645. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/StdAfx.h +28 -0
  646. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCDispUtilities.h +28 -0
  647. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.cpp +86 -0
  648. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.def +9 -0
  649. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsp +318 -0
  650. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsw +29 -0
  651. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.idl +454 -0
  652. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.rc +145 -0
  653. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispSimple.cpp +44 -0
  654. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispSimple.h +56 -0
  655. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispSimple.rgs +23 -0
  656. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.cpp +221 -0
  657. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.h +53 -0
  658. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.rgs +23 -0
  659. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.cpp +699 -0
  660. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.h +138 -0
  661. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.rgs +23 -0
  662. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.cpp +23 -0
  663. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.h +41 -0
  664. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.rgs +23 -0
  665. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.cpp +256 -0
  666. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.h +88 -0
  667. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.rgs +23 -0
  668. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.cpp +23 -0
  669. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.h +43 -0
  670. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.rgs +23 -0
  671. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.cpp +29 -0
  672. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.h +45 -0
  673. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.rgs +23 -0
  674. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.cpp +177 -0
  675. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.h +50 -0
  676. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.rgs +23 -0
  677. data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/resource.h +36 -0
  678. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/Arrays/XPCIDispatchArrayTests.js +54 -0
  679. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/Attributes/XPCIDispatchAttributeTests.js +150 -0
  680. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCIDispatchInstantiations.js +122 -0
  681. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCStress.js +58 -0
  682. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/Methods/XPCIDispatchMethodTests.js +376 -0
  683. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/shell.js +377 -0
  684. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedJS/General/XPCIDispatchTestWrappedJS.js +76 -0
  685. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedJS/shell.js +377 -0
  686. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/exectests.cmd +1 -0
  687. data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/jsDriver.pl +1288 -0
  688. data/vendor/tracemonkey/xpconnect/tests/idl/Makefile.in +61 -0
  689. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest.idl +312 -0
  690. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest2.idl +51 -0
  691. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_attributes.idl +67 -0
  692. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_calljs.idl +59 -0
  693. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_const.idl +61 -0
  694. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_domstring.idl +59 -0
  695. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_in.idl +88 -0
  696. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_inout.idl +86 -0
  697. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_multiple.idl +77 -0
  698. data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_out.idl +142 -0
  699. data/vendor/tracemonkey/xpconnect/tests/js/checkid.js +82 -0
  700. data/vendor/tracemonkey/xpconnect/tests/js/evaluate.js +311 -0
  701. data/vendor/tracemonkey/xpconnect/tests/js/exceptions-2.js +153 -0
  702. data/vendor/tracemonkey/xpconnect/tests/js/exceptions-3.js +194 -0
  703. data/vendor/tracemonkey/xpconnect/tests/js/exceptions-4.js +297 -0
  704. data/vendor/tracemonkey/xpconnect/tests/js/exceptions-5.js +343 -0
  705. data/vendor/tracemonkey/xpconnect/tests/js/exceptions.js +230 -0
  706. data/vendor/tracemonkey/xpconnect/tests/js/javascript.js +96 -0
  707. data/vendor/tracemonkey/xpconnect/tests/js/multiple-2.js +151 -0
  708. data/vendor/tracemonkey/xpconnect/tests/js/multiple-3.js +148 -0
  709. data/vendor/tracemonkey/xpconnect/tests/js/multiple-4.js +152 -0
  710. data/vendor/tracemonkey/xpconnect/tests/js/multiple.js +137 -0
  711. data/vendor/tracemonkey/xpconnect/tests/js/notscriptable.js +104 -0
  712. data/vendor/tracemonkey/xpconnect/tests/js/old/simpletest.js +36 -0
  713. data/vendor/tracemonkey/xpconnect/tests/js/old/speed.js +60 -0
  714. data/vendor/tracemonkey/xpconnect/tests/js/old/testxpc.js +464 -0
  715. data/vendor/tracemonkey/xpconnect/tests/js/old/threads.js +74 -0
  716. data/vendor/tracemonkey/xpconnect/tests/js/old/try.js +27 -0
  717. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_array.js +308 -0
  718. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_callcontext.js +68 -0
  719. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_echo.js +636 -0
  720. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_enum_and_sort.js +28 -0
  721. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_enum_constants.js +15 -0
  722. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_enum_create.js +200 -0
  723. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_exceptions.js +167 -0
  724. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_ids.js +135 -0
  725. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_observer.js +36 -0
  726. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_overloaded.js +14 -0
  727. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_primitives.js +141 -0
  728. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_propertybag.js +36 -0
  729. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_variant.js +339 -0
  730. data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_variant_array.js +30 -0
  731. data/vendor/tracemonkey/xpconnect/tests/js/readonlyattributes.js +74 -0
  732. data/vendor/tracemonkey/xpconnect/tests/js/readwriteattributes.js +101 -0
  733. data/vendor/tracemonkey/xpconnect/tests/js/scriptable.js +120 -0
  734. data/vendor/tracemonkey/xpconnect/tests/js/testin.js +203 -0
  735. data/vendor/tracemonkey/xpconnect/tests/js/xpcfun.js +234 -0
  736. data/vendor/tracemonkey/xpconnect/tests/js/xpctest_primitives.js +200 -0
  737. data/vendor/tracemonkey/xpconnect/tests/mochitest/Makefile.in +66 -0
  738. data/vendor/tracemonkey/xpconnect/tests/mochitest/bug500931_helper.html +7 -0
  739. data/vendor/tracemonkey/xpconnect/tests/mochitest/inner.html +7 -0
  740. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug361111.xul +29 -0
  741. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug384632.html +32 -0
  742. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug390488.html +65 -0
  743. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug393269.html +46 -0
  744. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug396851.html +43 -0
  745. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug428021.html +41 -0
  746. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug446584.html +49 -0
  747. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug448587.html +31 -0
  748. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug462428.html +42 -0
  749. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug478438.html +66 -0
  750. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug484107.html +100 -0
  751. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug484459.html +36 -0
  752. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug500691.html +28 -0
  753. data/vendor/tracemonkey/xpconnect/tests/mochitest/test_wrappers.html +116 -0
  754. data/vendor/tracemonkey/xpconnect/tests/unit/bogus_element_type.jsm +1 -0
  755. data/vendor/tracemonkey/xpconnect/tests/unit/bogus_exports_type.jsm +1 -0
  756. data/vendor/tracemonkey/xpconnect/tests/unit/bug451678_subscript.js +2 -0
  757. data/vendor/tracemonkey/xpconnect/tests/unit/component_import.js +144 -0
  758. data/vendor/tracemonkey/xpconnect/tests/unit/recursive_importA.jsm +44 -0
  759. data/vendor/tracemonkey/xpconnect/tests/unit/recursive_importB.jsm +45 -0
  760. data/vendor/tracemonkey/xpconnect/tests/unit/syntax_error.jsm +1 -0
  761. data/vendor/tracemonkey/xpconnect/tests/unit/test_bogus_files.js +88 -0
  762. data/vendor/tracemonkey/xpconnect/tests/unit/test_bug408412.js +51 -0
  763. data/vendor/tracemonkey/xpconnect/tests/unit/test_bug451678.js +52 -0
  764. data/vendor/tracemonkey/xpconnect/tests/unit/test_bug_442086.js +68 -0
  765. data/vendor/tracemonkey/xpconnect/tests/unit/test_import.js +127 -0
  766. data/vendor/tracemonkey/xpconnect/tests/unit/test_js_weak_references.js +63 -0
  767. data/vendor/tracemonkey/xpconnect/tests/unit/test_recursive_import.js +62 -0
  768. data/vendor/tracemonkey/xpconnect/tools/Makefile.in +49 -0
  769. data/vendor/tracemonkey/xpconnect/tools/idl/Makefile.in +53 -0
  770. data/vendor/tracemonkey/xpconnect/tools/idl/nsIXPCToolsCompiler.idl +60 -0
  771. data/vendor/tracemonkey/xpconnect/tools/idl/nsIXPCToolsProfiler.idl +57 -0
  772. data/vendor/tracemonkey/xpconnect/tools/js/CompileJSFiles.js +28 -0
  773. data/vendor/tracemonkey/xpconnect/tools/js/ListJSFiles.js +18 -0
  774. data/vendor/tracemonkey/xpconnect/tools/src/Makefile.in +76 -0
  775. data/vendor/tracemonkey/xpconnect/tools/src/nsXPCToolsCompiler.cpp +161 -0
  776. data/vendor/tracemonkey/xpconnect/tools/src/nsXPCToolsModule.cpp +65 -0
  777. data/vendor/tracemonkey/xpconnect/tools/src/nsXPCToolsProfiler.cpp +370 -0
  778. data/vendor/tracemonkey/xpconnect/tools/src/xpctools_private.h +236 -0
  779. metadata +782 -107
  780. data/test/johnson/nodes/export_test.rb +0 -9
  781. data/test/johnson/nodes/import_test.rb +0 -13
  782. data/test/johnson/version_test.rb +0 -13
@@ -0,0 +1,223 @@
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
+ * ***** BEGIN LICENSE BLOCK *****
3
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
+ *
5
+ * The contents of this file are subject to the Mozilla Public License Version
6
+ * 1.1 (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ * http://www.mozilla.org/MPL/
9
+ *
10
+ * Software distributed under the License is distributed on an "AS IS" basis,
11
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
+ * for the specific language governing rights and limitations under the
13
+ * License.
14
+ *
15
+ * The Original Code is the IDispatch implementation for XPConnect.
16
+ *
17
+ * The Initial Developer of the Original Code is
18
+ * David Bradley.
19
+ * Portions created by the Initial Developer are Copyright (C) 2002
20
+ * the Initial Developer. All Rights Reserved.
21
+ *
22
+ * Contributor(s):
23
+ *
24
+ * Alternatively, the contents of this file may be used under the terms of
25
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
26
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
+ * in which case the provisions of the GPL or the LGPL are applicable instead
28
+ * of those above. If you wish to allow use of your version of this file only
29
+ * under the terms of either the GPL or the LGPL, and not to allow others to
30
+ * use your version of this file under the terms of the MPL, indicate your
31
+ * decision by deleting the provisions above and replace them with the notice
32
+ * and other provisions required by the GPL or the LGPL. If you do not delete
33
+ * the provisions above, a recipient may use your version of this file under
34
+ * the terms of any one of the MPL, the GPL or the LGPL.
35
+ *
36
+ * ***** END LICENSE BLOCK ***** */
37
+
38
+ /** \file XPCDispParamPropJSClass.cpp
39
+ * Implementation for the XPCDispParamPropJSClass class
40
+ * This file contains the implementation of the XPCDispParamPropJSClass class
41
+ */
42
+
43
+ #include "xpcprivate.h"
44
+
45
+ /**
46
+ * Helper function to retrieve the parameterized property instance
47
+ * from the JS object's private slot
48
+ * @param cx a JS context
49
+ * @param obj the JS object to retrieve the instance from
50
+ * @return the parameterized property class
51
+ */
52
+ inline
53
+ XPCDispParamPropJSClass* GetParamProp(JSContext* cx, JSObject* obj)
54
+ {
55
+ return reinterpret_cast<XPCDispParamPropJSClass*>(xpc_GetJSPrivate(obj));
56
+ }
57
+
58
+ /**
59
+ * Handles getting a property via a parameterized property.
60
+ * This object is used as part of the parameterized property mechanism.
61
+ * property get requests are forward to our owner and on to IDispatch's
62
+ * Invoke
63
+ * @param cx A pointer to a JS context
64
+ * @param obj The object to perform the get on
65
+ * @param id ID of the parameter to get
66
+ * @param vp Pointer to the return value
67
+ * @return JSBool JS_TRUE if property was retrieved
68
+ */
69
+ static JSBool
70
+ XPC_PP_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
71
+ {
72
+ XPCDispParamPropJSClass* paramProp = GetParamProp(cx, obj);
73
+ JSObject* originalObj = paramProp->GetWrapper()->GetFlatJSObject();
74
+ XPCCallContext ccx(JS_CALLER, cx, originalObj, nsnull, id,
75
+ paramProp->GetParams()->GetParamCount(), nsnull, vp);
76
+ return paramProp->Invoke(ccx, XPCDispObject::CALL_GETTER, vp);
77
+ }
78
+
79
+ /**
80
+ * Handles getting a property via a parameterized property.
81
+ * This object is used as part of the parameterized property mechanism.
82
+ * property get requests are forward to our owner and on to IDispatch's
83
+ * Invoke
84
+ * @param cx A pointer to a JS context
85
+ * @param obj The object to perform the get on
86
+ * @param id ID of the parameter to get
87
+ * @param vp Pointer to the return value
88
+ * @return JSBool JS_TRUE if property was retrieved
89
+ */
90
+ static JSBool
91
+ XPC_PP_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
92
+ {
93
+ XPCDispParamPropJSClass* paramProp = GetParamProp(cx, obj);
94
+ JSObject* originalObj = paramProp->GetWrapper()->GetFlatJSObject();
95
+ XPCCallContext ccx(JS_CALLER, cx, originalObj, nsnull, id,
96
+ paramProp->GetParams()->GetParamCount(), nsnull, vp);
97
+ _variant_t var;
98
+ uintN err;
99
+ if(!XPCDispConvert::JSToCOM(ccx, *vp, var, err))
100
+ return JS_FALSE;
101
+ XPCDispParams* params = paramProp->GetParams();
102
+ params->SetNamedPropID();
103
+ // params will own var
104
+ params->InsertParam(var);
105
+ // Save off the value passed in so we can return it.
106
+ // Invoke resets the value to what ever IDispatch returns, in this
107
+ // case empty, converted to undefined
108
+ jsval retJSVal = *vp;
109
+ AUTO_MARK_JSVAL(ccx, retJSVal);
110
+ if (paramProp->Invoke(ccx, XPCDispObject::CALL_SETTER, vp))
111
+ {
112
+ *vp = retJSVal;
113
+ return JS_TRUE;
114
+ }
115
+ return JS_FALSE;
116
+ }
117
+
118
+ /**
119
+ * Handles getting a property via a parameterized property.
120
+ * This object is used as part of the parameterized property mechanism.
121
+ * property get requests are forward to our owner and on to IDispatch's
122
+ * Invoke
123
+ * @param cx A pointer to a JS context
124
+ * @param obj The object to perform the get on
125
+ * @param id ID of the parameter to get
126
+ * @param vp Pointer to the return value
127
+ * @return JSBool JS_TRUE if property was retrieved
128
+ */
129
+ static void
130
+ XPC_PP_Finalize(JSContext *cx, JSObject *obj)
131
+ {
132
+ delete GetParamProp(cx, obj);
133
+ }
134
+
135
+ /**
136
+ * Is called to trace things that the object holds.
137
+ * @param trc the tracing structure
138
+ * @param obj the object being marked
139
+ */
140
+ static void
141
+ XPC_PP_Trace(JSTracer *trc, JSObject *obj)
142
+ {
143
+ XPCDispParamPropJSClass* paramProp = GetParamProp(trc->context, obj);
144
+ if(paramProp)
145
+ {
146
+ XPCWrappedNative* wrapper = paramProp->GetWrapper();
147
+ if(wrapper && wrapper->IsValid())
148
+ xpc_TraceForValidWrapper(trc, wrapper);
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Our JSClass used by XPCDispParamPropClass
154
+ * @see XPCDispParamPropClass
155
+ */
156
+ static JSClass ParamPropClass = {
157
+ "XPCDispParamPropJSCass", // Name
158
+ JSCLASS_HAS_PRIVATE | JSCLASS_MARK_IS_TRACE, // flags
159
+
160
+ /* Mandatory non-null function pointer members. */
161
+ JS_PropertyStub, // addProperty
162
+ JS_PropertyStub, // delProperty
163
+ XPC_PP_GetProperty, // getProperty
164
+ XPC_PP_SetProperty, // setProperty
165
+ JS_EnumerateStub, // enumerate
166
+ JS_ResolveStub, // resolve
167
+ JS_ConvertStub, // convert
168
+ XPC_PP_Finalize, // finalize
169
+
170
+ /* Optionally non-null members start here. */
171
+ nsnull, // getObjectOps;
172
+ nsnull, // checkAccess;
173
+ nsnull, // call;
174
+ nsnull, // construct;
175
+ nsnull, // xdrObject;
176
+ nsnull, // hasInstance;
177
+ JS_CLASS_TRACE(XPC_PP_Trace), // mark/trace;
178
+ nsnull // spare;
179
+ };
180
+
181
+ // static
182
+ JSBool XPCDispParamPropJSClass::NewInstance(XPCCallContext& ccx,
183
+ XPCWrappedNative* wrapper,
184
+ PRUint32 dispID,
185
+ XPCDispParams* dispParams,
186
+ jsval* paramPropObj)
187
+ {
188
+ XPCDispParamPropJSClass* pDispParam =
189
+ new XPCDispParamPropJSClass(wrapper, ccx.GetTearOff()->GetNative(),
190
+ dispID, dispParams);
191
+ if(!pDispParam)
192
+ return JS_FALSE;
193
+ JSObject * obj = JS_NewObject(ccx, &ParamPropClass, nsnull, nsnull);
194
+ if(!obj)
195
+ return JS_FALSE;
196
+ if(!JS_SetPrivate(ccx, obj, pDispParam))
197
+ return JS_FALSE;
198
+ *paramPropObj = OBJECT_TO_JSVAL(obj);
199
+ return JS_TRUE;
200
+ }
201
+
202
+ XPCDispParamPropJSClass::XPCDispParamPropJSClass(XPCWrappedNative* wrapper,
203
+ nsISupports * dispObj,
204
+ PRUint32 dispID,
205
+ XPCDispParams* dispParams) :
206
+ mWrapper(wrapper),
207
+ mDispID(dispID),
208
+ mDispParams(dispParams),
209
+ mDispObj(nsnull)
210
+ {
211
+ NS_ADDREF(mWrapper);
212
+ dispObj->QueryInterface(NSID_IDISPATCH,
213
+ reinterpret_cast<void**>
214
+ (&mDispObj));
215
+ }
216
+
217
+ XPCDispParamPropJSClass::~XPCDispParamPropJSClass()
218
+ {
219
+ delete mDispParams;
220
+ // release our members
221
+ NS_IF_RELEASE(mWrapper);
222
+ NS_IF_RELEASE(mDispObj);
223
+ }
@@ -0,0 +1,103 @@
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
+ * ***** BEGIN LICENSE BLOCK *****
3
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
+ *
5
+ * The contents of this file are subject to the Mozilla Public License Version
6
+ * 1.1 (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ * http://www.mozilla.org/MPL/
9
+ *
10
+ * Software distributed under the License is distributed on an "AS IS" basis,
11
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
+ * for the specific language governing rights and limitations under the
13
+ * License.
14
+ *
15
+ * The Original Code is the IDispatch implementation for XPConnect.
16
+ *
17
+ * The Initial Developer of the Original Code is
18
+ * David Bradley.
19
+ * Portions created by the Initial Developer are Copyright (C) 2002
20
+ * the Initial Developer. All Rights Reserved.
21
+ *
22
+ * Contributor(s):
23
+ *
24
+ * Alternatively, the contents of this file may be used under the terms of
25
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
26
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
+ * in which case the provisions of the GPL or the LGPL are applicable instead
28
+ * of those above. If you wish to allow use of your version of this file only
29
+ * under the terms of either the GPL or the LGPL, and not to allow others to
30
+ * use your version of this file under the terms of the MPL, indicate your
31
+ * decision by deleting the provisions above and replace them with the notice
32
+ * and other provisions required by the GPL or the LGPL. If you do not delete
33
+ * the provisions above, a recipient may use your version of this file under
34
+ * the terms of any one of the MPL, the GPL or the LGPL.
35
+ *
36
+ * ***** END LICENSE BLOCK ***** */
37
+
38
+ /**
39
+ * \file XPCDispParams.cpp
40
+ * Implementation of the helper class XPCDispParams
41
+ */
42
+
43
+ #include "xpcprivate.h"
44
+
45
+ XPCDispParams::XPCDispParams(PRUint32 args) :
46
+ mRefBuffer(mStackRefBuffer + sizeof(VARIANT)),
47
+ mDispParamsAllocated(nsnull),
48
+ mRefBufferAllocated(nsnull),
49
+ mPropID(DISPID_PROPERTYPUT)
50
+ #ifdef DEBUG
51
+ ,mInserted(PR_FALSE)
52
+ #endif
53
+ {
54
+ if(args >= DEFAULT_ARG_ARRAY_SIZE)
55
+ {
56
+ mRefBufferAllocated = new char[RefBufferSize(args)];
57
+ mRefBuffer = mRefBufferAllocated + sizeof(VARIANT);
58
+ }
59
+ // Initialize the full buffer that was allocated
60
+ memset(mRefBuffer - sizeof(VARIANT), 0, RefBufferSize(args));
61
+ // Initialize the IDispatch parameters
62
+ mDispParams.cArgs = args;
63
+ if(args == 0)
64
+ mDispParams.rgvarg = nsnull;
65
+ else if (args <= DEFAULT_ARG_ARRAY_SIZE)
66
+ mDispParams.rgvarg = mStackArgs + 1;
67
+ else
68
+ {
69
+ mDispParamsAllocated = new VARIANT[args + 1];
70
+ mDispParams.rgvarg = mDispParamsAllocated + 1;
71
+ }
72
+ mDispParams.rgdispidNamedArgs = nsnull;
73
+ mDispParams.cNamedArgs = 0;
74
+ }
75
+
76
+
77
+ XPCDispParams::~XPCDispParams()
78
+ {
79
+ // Cleanup the variants
80
+ for(PRUint32 index = 0; index < mDispParams.cArgs; ++index)
81
+ VariantClear(mDispParams.rgvarg + index);
82
+ // Cleanup if we allocated the variant array. Remember that
83
+ // our buffer may point one element into the allocate buffer
84
+ delete [] mRefBufferAllocated;
85
+ delete [] mDispParamsAllocated;
86
+ }
87
+
88
+ void XPCDispParams::InsertParam(_variant_t & var)
89
+ {
90
+ #ifdef DEBUG
91
+ NS_ASSERTION(!mInserted,
92
+ "XPCDispParams::InsertParam cannot be called more than once");
93
+ mInserted = PR_TRUE;
94
+ #endif
95
+ // Bump the pointer back and increment the arg count
96
+ --mDispParams.rgvarg;
97
+ mRefBuffer -= sizeof(VARIANT);
98
+ ++mDispParams.cArgs;
99
+ // Assign the value
100
+ mDispParams.rgvarg[0] = var.Detach();
101
+ // initialize the ref buffer
102
+ memset(mRefBuffer, 0, sizeof(VARIANT));
103
+ }
@@ -0,0 +1,1401 @@
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
+ * ***** BEGIN LICENSE BLOCK *****
3
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
+ *
5
+ * The contents of this file are subject to the Mozilla Public License Version
6
+ * 1.1 (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ * http://www.mozilla.org/MPL/
9
+ *
10
+ * Software distributed under the License is distributed on an "AS IS" basis,
11
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
+ * for the specific language governing rights and limitations under the
13
+ * License.
14
+ *
15
+ * The Original Code is the IDispatch implementation for XPConnect.
16
+ *
17
+ * The Initial Developer of the Original Code is
18
+ * David Bradley.
19
+ * Portions created by the Initial Developer are Copyright (C) 2002
20
+ * the Initial Developer. All Rights Reserved.
21
+ *
22
+ * Contributor(s):
23
+ *
24
+ * Alternatively, the contents of this file may be used under the terms of
25
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
26
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
+ * in which case the provisions of the GPL or the LGPL are applicable instead
28
+ * of those above. If you wish to allow use of your version of this file only
29
+ * under the terms of either the GPL or the LGPL, and not to allow others to
30
+ * use your version of this file under the terms of the MPL, indicate your
31
+ * decision by deleting the provisions above and replace them with the notice
32
+ * and other provisions required by the GPL or the LGPL. If you do not delete
33
+ * the provisions above, a recipient may use your version of this file under
34
+ * the terms of any one of the MPL, the GPL or the LGPL.
35
+ *
36
+ * ***** END LICENSE BLOCK ***** */
37
+
38
+ #ifndef XPCDispPrivate_h__
39
+ #define XPCDispPrivate_h__
40
+
41
+ /**
42
+ * \file XPCDispPrivate.h
43
+ * \brief Contains all the private class declarations
44
+ */
45
+
46
+ #ifndef xpcprivate_h___
47
+ #error "DispPrivate.h should not be included directly, please use XPCPrivate.h"
48
+ #endif
49
+
50
+ /**
51
+ * Needed for CComPtr and friends
52
+ */
53
+ #include <atlbase.h>
54
+ /**
55
+ * Needed for _variant_t and _bstr_t
56
+ */
57
+ #include <comdef.h>
58
+ /**
59
+ * IObjectSafety interface and friends
60
+ */
61
+ #include "objsafe.h"
62
+
63
+ // MS clutters the global namespace with so many macro names :-(
64
+ // I tried to keep these includes in the CPP's but it became too
65
+ // convoluted
66
+ #undef GetClassInfo
67
+ #undef GetClassName
68
+ #undef GetMessage
69
+
70
+ // We need IDispatch
71
+ #include "nsIDispatchSupport.h"
72
+
73
+ // The following are macro helpers pulled from XPCOM but tailored to COM
74
+ #define NS_DECL_IUNKNOWN \
75
+ public: \
76
+ STDMETHOD(QueryInterface)(REFIID aIID, \
77
+ void** aInstancePtr); \
78
+ STDMETHODIMP_(ULONG) AddRef(void); \
79
+ STDMETHODIMP_(ULONG) Release(void); \
80
+ protected: \
81
+ ULONG mRefCnt;
82
+
83
+ #define NS_IMPL_COM_QUERY_HEAD(_class) \
84
+ STDMETHODIMP _class::QueryInterface(REFIID aIID, void** aInstancePtr) \
85
+ { \
86
+ NS_ASSERTION(aInstancePtr, \
87
+ "QueryInterface requires a non-NULL destination!"); \
88
+ if( !aInstancePtr ) \
89
+ return E_POINTER; \
90
+ IUnknown* foundInterface;
91
+
92
+ #define NS_IMPL_COM_QUERY_BODY(_interface) \
93
+ if(IsEqualIID(aIID, __uuidof(_interface)) ) \
94
+ foundInterface = static_cast<_interface*>(this); \
95
+ else
96
+
97
+ #define NS_IMPL_COM_QUERY_TAIL_GUTS \
98
+ foundInterface = 0; \
99
+ HRESULT status; \
100
+ if( !foundInterface ) \
101
+ status = E_NOINTERFACE; \
102
+ else \
103
+ { \
104
+ NS_ADDREF(foundInterface); \
105
+ status = S_OK; \
106
+ } \
107
+ *aInstancePtr = foundInterface; \
108
+ return status; \
109
+ }
110
+
111
+ #define NS_COM_MAP_BEGIN(_implClass) NS_IMPL_COM_QUERY_HEAD(_implClass)
112
+ #define NS_COM_MAP_ENTRY(_interface) NS_IMPL_COM_QUERY_BODY(_interface)
113
+ #define NS_COM_MAP_END NS_IMPL_COM_QUERY_TAIL_GUTS
114
+
115
+ #define NS_COM_IMPL_ADDREF(_class) \
116
+ STDMETHODIMP_(ULONG) _class::AddRef(void) \
117
+ { \
118
+ NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
119
+ NS_ASSERT_OWNINGTHREAD(_class); \
120
+ ++mRefCnt; \
121
+ NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \
122
+ return mRefCnt; \
123
+ }
124
+
125
+ #define NS_COM_IMPL_RELEASE(_class) \
126
+ STDMETHODIMP_(ULONG) _class::Release(void) \
127
+ { \
128
+ NS_PRECONDITION(0 != mRefCnt, "dup release"); \
129
+ NS_ASSERT_OWNINGTHREAD(_class); \
130
+ --mRefCnt; \
131
+ NS_LOG_RELEASE(this, mRefCnt, #_class); \
132
+ if(mRefCnt == 0) { \
133
+ mRefCnt = 1; /* stabilize */ \
134
+ delete this; \
135
+ return 0; \
136
+ } \
137
+ return mRefCnt; \
138
+ }
139
+
140
+ extern const nsID NSID_IDISPATCH;
141
+
142
+ /**
143
+ * JS<>COM Conversion functions. XPCDispConvert serves more as a namespace than
144
+ * a class. It contains the functions to convert between JS and COM data and
145
+ * any helper functions needed
146
+ */
147
+ class XPCDispConvert
148
+ {
149
+ public:
150
+ /**
151
+ * Returns the COM type for a given jsval
152
+ * @param ccx XPConnect call context
153
+ * @param val Value to look up the type for
154
+ * @return the COM variant type
155
+ */
156
+ static
157
+ VARTYPE JSTypeToCOMType(XPCCallContext& ccx, jsval val);
158
+
159
+ /**
160
+ * Converts a JSVal to a COM variant
161
+ * @param ccx XPConnect call context
162
+ * @param src JS Value to convert
163
+ * @param dest COM variant to receive the converted value
164
+ * @param err receives the error code if any of a failed conversion
165
+ * @return True if the conversion succeeded
166
+ */
167
+ static
168
+ JSBool JSToCOM(XPCCallContext& ccx, jsval src, VARIANT & dest,
169
+ nsresult& err, JSBool isByRef = JS_FALSE);
170
+
171
+ /**
172
+ * Converts a COM variant to a jsval
173
+ * @param ccx XPConnect call context
174
+ * @param src COM variant to convert
175
+ * @param dest jsval to receive the converted value
176
+ * @param err receives the error code if any of a failed conversion
177
+ * @return Returns true if the conversion succeeded
178
+ */
179
+ static
180
+ JSBool COMToJS(XPCCallContext& ccx, const VARIANT & src, jsval & dest,
181
+ nsresult& err);
182
+ private:
183
+ /**
184
+ * Converts a JS Array to a safe array
185
+ * @param ccx XPConnect call context
186
+ * @param obj JSObject that is the array
187
+ * @param var the variant to receive the array
188
+ * @param err receives the error code if any of a failed conversion
189
+ * @return True if the conversion succeeded
190
+ */
191
+ static
192
+ JSBool JSArrayToCOMArray(XPCCallContext& ccx, JSObject *obj, VARIANT & var,
193
+ nsresult& err);
194
+ /**
195
+ * Converts a COM Array to a JS Array
196
+ * @param ccx XPConnect call context
197
+ * @param src the variant holding the array
198
+ * @param dest the jsval to receive the array
199
+ * @param err receives the error code if any of a failed conversion
200
+ * @return True if the conversion succeeded
201
+ */
202
+ static
203
+ JSBool COMArrayToJSArray(XPCCallContext& ccx, const VARIANT & src,
204
+ jsval & dest, nsresult& err);
205
+ };
206
+
207
+ /**
208
+ * JS callback function that is called when a function is invoked
209
+ * @param cx the JS context the function is invoked with
210
+ * @param obj the object the function is invoked on
211
+ * @param argc the number of parameters passed to the function
212
+ * @param argv the array of parameters passed to the function
213
+ * @param vp holds the result of the function
214
+ * @return true if the function completes without error
215
+ */
216
+ JSBool
217
+ XPC_IDispatch_CallMethod(JSContext *cx, JSObject *obj, uintN argc,
218
+ jsval *argv, jsval *vp);
219
+ /**
220
+ * JS callback function that is called when a getter/setter is invoked
221
+ * @param cx the JS context the function is invoked with
222
+ * @param obj the object the function is invoked on
223
+ * @param argc the number of parameters passed to the function
224
+ * @param argv the array of parameters passed to the function
225
+ * @param vp holds the result of the function
226
+ * @return true if the function completes without error
227
+ */
228
+ JSBool
229
+ XPC_IDispatch_GetterSetter(JSContext *cx, JSObject *obj, uintN argc,
230
+ jsval *argv, jsval *vp);
231
+
232
+ /**
233
+ * This class holds an array of names. This is only used in wrapped
234
+ * JS objects, so the dispid's are not arbitrary. They begin with 1
235
+ * and so dispid - 1 is the index into the array mNames
236
+ */
237
+ class XPCDispNameArray
238
+ {
239
+ public:
240
+ /**
241
+ * Intializes the array to zero elements
242
+ */
243
+ XPCDispNameArray();
244
+ /**
245
+ * Cleans up the mNames array
246
+ */
247
+ ~XPCDispNameArray();
248
+ /**
249
+ * Sets the size of the array
250
+ * @param size the new size of the array
251
+ */
252
+ void SetSize(PRUint32 size);
253
+ /**
254
+ * Returns the current size of the array
255
+ * @return the current size of the array
256
+ */
257
+ PRUint32 GetSize() const;
258
+ /**
259
+ * Assigns a name/string to a given element. This function will not
260
+ * expand the array and performs bounds checking in debug builds.
261
+ * @param dispid IDispatch id for the name
262
+ * @param name the name to assign
263
+ */
264
+ void SetName(DISPID dispid, nsAString const & name);
265
+ /**
266
+ * Retrieves a name/string for a dispid. This function
267
+ * performs bounds checking in debug builds
268
+ * @param dispid dispatch ID of the name to retrieve
269
+ */
270
+ const nsAString& GetName(DISPID dispid) const;
271
+ /**
272
+ * Performs a search of the array for the target returning the
273
+ * the id for the name
274
+ * @param target the name to find
275
+ */
276
+ DISPID Find(const nsAString &target) const;
277
+ private:
278
+ PRUint32 mCount;
279
+ nsString* mNames;
280
+ };
281
+
282
+ /**
283
+ * This class represents an array of JSID's.
284
+ * It takes care of marking the ID's during GC
285
+ */
286
+ class XPCDispIDArray
287
+ {
288
+ public:
289
+ /**
290
+ * Initializes the array from the JSIdArray passed in
291
+ * @param ccx XPConnect call context
292
+ * @param array a JS array of ID's
293
+ */
294
+ XPCDispIDArray(XPCCallContext& ccx, JSIdArray* array);
295
+
296
+ /**
297
+ * Returns the length of the array
298
+ * @return length of the array
299
+ */
300
+ PRUint32 Length() const;
301
+
302
+ /**
303
+ * Returns an ID within the array
304
+ * @param cx a JS context
305
+ * @param index index into the array
306
+ * @return the ID as a jsval
307
+ */
308
+ jsval Item(JSContext* cx, PRUint32 index) const;
309
+
310
+ /**
311
+ * Called to trace jsval associated with the ID's
312
+ */
313
+ void TraceJS(JSTracer* trc);
314
+
315
+ /**
316
+ * Called to unmark the ID's marked during GC marking trace
317
+ */
318
+ void Unmark();
319
+
320
+ /**
321
+ * Tests whether the ID is marked
322
+ */
323
+ JSBool IsMarked() const;
324
+ private:
325
+ JSBool mMarked;
326
+ nsVoidArray mIDArray;
327
+ };
328
+
329
+ /**
330
+ * Implements ITypeInfo interface for JSObjects
331
+ */
332
+ class XPCDispTypeInfo : public ITypeInfo
333
+ {
334
+ NS_DECL_IUNKNOWN
335
+ public:
336
+ /**
337
+ * Manages an array of FUNCDESC structs
338
+ */
339
+ class FuncDescArray
340
+ {
341
+ public:
342
+ /**
343
+ * Initializes the function description array
344
+ */
345
+ FuncDescArray(XPCCallContext& ccx, JSObject* obj,
346
+ const XPCDispIDArray& array, XPCDispNameArray & names);
347
+ /**
348
+ * cleans up the function description array
349
+ */
350
+ ~FuncDescArray();
351
+ /**
352
+ * Retrieves a function description from the array.
353
+ * @param index index into the array
354
+ * @return pointer to the function description
355
+ */
356
+ FUNCDESC* Get(PRUint32 index);
357
+ /**
358
+ * Releases a function description object. Currently there is nothing
359
+ * to do as ownership is maintained by the object and the objects
360
+ * returned never live longer than the FuncDescArray instance they
361
+ * were created on
362
+ */
363
+ void Release(FUNCDESC *);
364
+ /**
365
+ * Returns the length of the array
366
+ * @return the length of the array
367
+ */
368
+ PRUint32 Length() const;
369
+ private:
370
+ nsVoidArray mArray;
371
+ /**
372
+ * Initializes a function description object
373
+ * @param ccx XPConnect context
374
+ * @param obj Array to used for the initialization
375
+ * @param propInfo property information for the element/function
376
+ */
377
+ PRBool BuildFuncDesc(XPCCallContext& ccx, JSObject* obj,
378
+ XPCDispJSPropertyInfo & propInfo);
379
+ };
380
+ /**
381
+ * Creates an instance of XPCDispTypeInfo
382
+ * This static function is to be used to create instances of XPCDispTypeInfo.
383
+ */
384
+ static
385
+ XPCDispTypeInfo* New(XPCCallContext& ccx, JSObject* obj);
386
+ virtual ~XPCDispTypeInfo();
387
+ // ITypeInfo methods, see MSDN for detail information
388
+ STDMETHOD(GetTypeAttr)(
389
+ /* [out] */ TYPEATTR __RPC_FAR *__RPC_FAR *ppTypeAttr);
390
+
391
+ STDMETHOD(GetTypeComp)(
392
+ /* [out] */ ITypeComp __RPC_FAR *__RPC_FAR *ppTComp);
393
+
394
+ STDMETHOD(GetFuncDesc)(
395
+ /* [in] */ UINT index,
396
+ /* [out] */ FUNCDESC __RPC_FAR *__RPC_FAR *ppFuncDesc);
397
+
398
+ STDMETHOD(GetVarDesc)(
399
+ /* [in] */ UINT index,
400
+ /* [out] */ VARDESC __RPC_FAR *__RPC_FAR *ppVarDesc);
401
+
402
+ STDMETHOD(GetNames)(
403
+ /* [in] */ MEMBERID memid,
404
+ /* [length_is][size_is][out] */ BSTR __RPC_FAR *rgBstrNames,
405
+ /* [in] */ UINT cMaxNames,
406
+ /* [out] */ UINT __RPC_FAR *pcNames);
407
+
408
+ STDMETHOD(GetRefTypeOfImplType)(
409
+ /* [in] */ UINT index,
410
+ /* [out] */ HREFTYPE __RPC_FAR *pRefType);
411
+
412
+ STDMETHOD(GetImplTypeFlags)(
413
+ /* [in] */ UINT index,
414
+ /* [out] */ INT __RPC_FAR *pImplTypeFlags);
415
+
416
+ STDMETHOD(GetIDsOfNames)(
417
+ /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
418
+ /* [in] */ UINT cNames,
419
+ /* [size_is][out] */ MEMBERID __RPC_FAR *pMemId);
420
+
421
+ STDMETHOD(Invoke)(
422
+ /* [in] */ PVOID pvInstance,
423
+ /* [in] */ MEMBERID memid,
424
+ /* [in] */ WORD wFlags,
425
+ /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
426
+ /* [out] */ VARIANT __RPC_FAR *pVarResult,
427
+ /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
428
+ /* [out] */ UINT __RPC_FAR *puArgErr);
429
+
430
+ STDMETHOD(GetDocumentation)(
431
+ /* [in] */ MEMBERID memid,
432
+ /* [out] */ BSTR __RPC_FAR *pBstrName,
433
+ /* [out] */ BSTR __RPC_FAR *pBstrDocString,
434
+ /* [out] */ DWORD __RPC_FAR *pdwHelpContext,
435
+ /* [out] */ BSTR __RPC_FAR *pBstrHelpFile);
436
+
437
+ STDMETHOD(GetDllEntry)(
438
+ /* [in] */ MEMBERID memid,
439
+ /* [in] */ INVOKEKIND invKind,
440
+ /* [out] */ BSTR __RPC_FAR *pBstrDllName,
441
+ /* [out] */ BSTR __RPC_FAR *pBstrName,
442
+ /* [out] */ WORD __RPC_FAR *pwOrdinal);
443
+
444
+ STDMETHOD(GetRefTypeInfo)(
445
+ /* [in] */ HREFTYPE hRefType,
446
+ /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
447
+
448
+ STDMETHOD(AddressOfMember)(
449
+ /* [in] */ MEMBERID memid,
450
+ /* [in] */ INVOKEKIND invKind,
451
+ /* [out] */ PVOID __RPC_FAR *ppv);
452
+
453
+ STDMETHOD(CreateInstance)(
454
+ /* [in] */ IUnknown __RPC_FAR *pUnkOuter,
455
+ /* [in] */ REFIID riid,
456
+ /* [iid_is][out] */ PVOID __RPC_FAR *ppvObj);
457
+
458
+ STDMETHOD(GetMops)(
459
+ /* [in] */ MEMBERID memid,
460
+ /* [out] */ BSTR __RPC_FAR *pBstrMops);
461
+
462
+ STDMETHOD(GetContainingTypeLib)(
463
+ /* [out] */ ITypeLib __RPC_FAR *__RPC_FAR *ppTLib,
464
+ /* [out] */ UINT __RPC_FAR *pIndex);
465
+
466
+ virtual /* [local] */ void STDMETHODCALLTYPE ReleaseTypeAttr(
467
+ /* [in] */ TYPEATTR __RPC_FAR *pTypeAttr);
468
+
469
+ virtual /* [local] */ void STDMETHODCALLTYPE ReleaseFuncDesc(
470
+ /* [in] */ FUNCDESC __RPC_FAR *pFuncDesc);
471
+
472
+ virtual /* [local] */ void STDMETHODCALLTYPE ReleaseVarDesc(
473
+ /* [in] */ VARDESC __RPC_FAR *pVarDesc);
474
+ /**
475
+ * Returns the name of a function given a DISPID
476
+ * @param dispID the DISPID to look up
477
+ * @return the name of the function
478
+ */
479
+ const nsAString& GetNameForDispID(DISPID dispID);
480
+ private:
481
+ /**
482
+ * Initializes the object
483
+ * @param ccx an XPConnect call context
484
+ * @param obj the JS object being wrapped
485
+ * @param array the array of JS ID's for the object
486
+ */
487
+ XPCDispTypeInfo(XPCCallContext& ccx, JSObject* obj, XPCDispIDArray* array);
488
+ JSObject* mJSObject;
489
+ XPCDispIDArray* mIDArray;
490
+ XPCDispNameArray mNameArray;
491
+ // mFuncDescArray must occur after
492
+ // TODO: We should probably refactor this so this isn't a requirement
493
+ FuncDescArray mFuncDescArray;
494
+ };
495
+
496
+ /**
497
+ * Helper class that describes a JS function or property
498
+ */
499
+ class XPCDispJSPropertyInfo
500
+ {
501
+ public:
502
+ /**
503
+ * Inspects a JS Function or property
504
+ * @param cx A JS Context
505
+ * @param memid the ID of the property or function
506
+ * @param obj the JS object the property or function resides on
507
+ * @param val ID val of the property or function
508
+ */
509
+ XPCDispJSPropertyInfo(JSContext*cx, PRUint32 memid, JSObject* obj, jsval val);
510
+ /**
511
+ * Returns true if the property information was initialized property
512
+ * @return true if the property information was initialized property
513
+ */
514
+ PRBool Valid() const;
515
+ /**
516
+ * Returns the number of parameters
517
+ * If this is a setter, the parameter count is always one
518
+ * @return the number of parameters
519
+ */
520
+ PRUint32 GetParamCount() const;
521
+ /**
522
+ * Returns the generated member ID/dispid
523
+ * This is based on the order of the function/property within the object
524
+ * @return the memid of the property
525
+ */
526
+ PRUint32 GetMemID() const;
527
+ /**
528
+ * Returns the COM's INVOKEKIND for the property/method
529
+ * @return the COM's INVOKEKIND for the property/method
530
+ */
531
+ INVOKEKIND GetInvokeKind() const;
532
+ /**
533
+ * Assigns the return type in elemDesc
534
+ * @param ccx an xpconnect call context
535
+ * @param elemDesc the element description to set the return type
536
+ */
537
+ void GetReturnType(XPCCallContext& ccx, ELEMDESC & elemDesc);
538
+ /**
539
+ * Returns an element description for the property
540
+ * @return the element descriptoin object, ownership is assumed by
541
+ * the caller.
542
+ */
543
+ ELEMDESC * GetParamInfo();
544
+ /**
545
+ * Tests whether this is a property
546
+ * @return true if this is a property
547
+ */
548
+ PRBool IsProperty() const;
549
+ /**
550
+ * Test whether this is read-only
551
+ * @return true if this is read-only
552
+ */
553
+ PRBool IsReadOnly() const;
554
+ /**
555
+ * Tests whether this is a setter
556
+ * @return true if this is a setter
557
+ */
558
+ PRBool IsSetter() const;
559
+ /**
560
+ * Denotes this property has a setter (is not read-only)
561
+ */
562
+ void SetSetter();
563
+ /**
564
+ * returns the name of the property/method
565
+ * @return the name of the property/method
566
+ */
567
+ nsAString const & GetName() const;
568
+ private:
569
+ enum property_type
570
+ {
571
+ INVALID,
572
+ PROPERTY,
573
+ READONLY_PROPERTY,
574
+ FUNCTION,
575
+ SETTER_MODE = 0x20
576
+ };
577
+
578
+ PRUint32 mPropertyType;
579
+ PRUint32 mParamCount;
580
+ PRUint32 mMemID;
581
+ jsval mProperty;
582
+ nsString mName;
583
+
584
+ /**
585
+ * Accessor for the property type mProperty
586
+ * @return property_type for the property
587
+ */
588
+ inline
589
+ property_type PropertyType() const;
590
+ };
591
+
592
+ /**
593
+ * Tearoff for nsXPCWrappedJS to use
594
+ */
595
+ class XPCDispatchTearOff : public IDispatch, public ISupportErrorInfo
596
+ {
597
+ public:
598
+ /**
599
+ * Constructor initializes our COM pointer back to our main object
600
+ */
601
+ XPCDispatchTearOff(nsIXPConnectWrappedJS * wrappedJS);
602
+ /**
603
+ * Release the our allocated data, and decrements our main objects refcnt
604
+ */
605
+ virtual ~XPCDispatchTearOff();
606
+ /**
607
+ * Error handling function
608
+ * @param riid the interface IID of the error
609
+ */
610
+ STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
611
+ /**
612
+ * Thread safe AddRef
613
+ */
614
+ STDMETHODIMP_(ULONG) AddRef();
615
+ /**
616
+ * Thread safe Release
617
+ */
618
+ STDMETHODIMP_(ULONG) Release();
619
+ /**
620
+ * QueryInterface that returns us or the main object
621
+ * See MSDN for form information
622
+ * @param IID interface ID we're querying to
623
+ * @param pPtr a pointer to the pointer that will receive the resultant
624
+ * interface pointer
625
+ * @return HRESULT
626
+ */
627
+ STDMETHOD(QueryInterface)(REFIID IID,void ** pPtr);
628
+ /**
629
+ * Returns the number of type info's for this IDispatch instance.
630
+ * See MSDN for form information
631
+ * @param pctinfo pointer to the variable to receive the count
632
+ * @return HRESULT
633
+ */
634
+ STDMETHOD(GetTypeInfoCount)(unsigned int * pctinfo);
635
+ /**
636
+ * Returns the type information for this IDispatch instance
637
+ * See MSDN for form information
638
+ * @return HRESULT
639
+ */
640
+ STDMETHOD(GetTypeInfo)(unsigned int iTInfo, LCID lcid,
641
+ ITypeInfo FAR* FAR* ppTInfo);
642
+ /**
643
+ * Returns the ID's for the given names of methods
644
+ * See MSDN for form information
645
+ * @return HRESULT
646
+ */
647
+ STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames,
648
+ unsigned int cNames, LCID lcid,
649
+ DISPID FAR* rgDispId);
650
+ /**
651
+ * Invokes an interface method
652
+ * See MSDN for form information
653
+ * @return HRESULT
654
+ */
655
+ STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
656
+ DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult,
657
+ EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr);
658
+
659
+ private:
660
+ // Pointer back to our main object
661
+ nsCOMPtr<nsIXPConnectWrappedJS> mWrappedJS;
662
+ // The Type information for our instance
663
+ XPCDispTypeInfo * mCOMTypeInfo;
664
+ // Reference count
665
+ ULONG mRefCnt;
666
+ // Returns the type information
667
+ XPCDispTypeInfo * GetCOMTypeInfo();
668
+ // Returns the JS Object being used to wrap
669
+ inline
670
+ JSObject* GetJSObject();
671
+
672
+ NS_DECL_OWNINGTHREAD;
673
+ };
674
+
675
+ /**
676
+ * IDispatch interface information.
677
+ * This is used within the XPCWrappedNativeTearOff to collect and maintain
678
+ * information for a specific IDispatch interface. This is similar to
679
+ * XPCNativeInterface
680
+ */
681
+ class XPCDispInterface
682
+ {
683
+ public:
684
+ /**
685
+ * Member information. This class is used within the XPCDispInterface
686
+ * to describe a specific method of an IDispatch interface.
687
+ */
688
+ class Member
689
+ {
690
+ public:
691
+ /**
692
+ * Parameter Information. This class is mainly a wrapper around
693
+ * ELEMDESC that allows easier inspection
694
+ */
695
+ class ParamInfo
696
+ {
697
+ public:
698
+ /**
699
+ * Initializes mParamInfo to the element description passed in
700
+ * @param paramInfo the parameter information being wrapped
701
+ */
702
+ ParamInfo(const ELEMDESC * paramInfo);
703
+ /**
704
+ * Initializes an output parameter
705
+ * @param varBuffer a pointer to the variant's buffer
706
+ * @param var Pointer to the variant being initialized
707
+ */
708
+ JSBool InitializeOutputParam(void * varBuffer,
709
+ VARIANT & var) const;
710
+ /**
711
+ * Tests if a specific flag is set
712
+ * @param flag the flag to be tested
713
+ * @return true if the flag is set
714
+ */
715
+ PRBool IsFlagSet(unsigned short flag) const;
716
+ /**
717
+ * Returns true if this is an input parameter
718
+ * @return true if this is an input parameter
719
+ */
720
+ PRBool IsIn() const;
721
+ /**
722
+ * Returns true if this is an output parameter
723
+ * @return true if this is an output parameter
724
+ */
725
+ PRBool IsOut() const;
726
+ /**
727
+ * Returns true if this is an optional parameter
728
+ * @return true if this is an optional parameter
729
+ */
730
+ PRBool IsOptional() const;
731
+ /**
732
+ * Returns true if this is a return value parameter
733
+ * @return true if this is a return value parameter
734
+ */
735
+ PRBool IsRetVal() const;
736
+ // TODO: Handle VT_ARRAY as well
737
+ /**
738
+ * Returns the type of the parameter
739
+ * @return VARTYPE, the type of the parameter
740
+ */
741
+ VARTYPE GetType() const;
742
+ private:
743
+ const ELEMDESC * mParamInfo;
744
+ };
745
+ Member();
746
+ ~Member();
747
+ /**
748
+ * Placement new is needed to initialize array in class XPCDispInterface
749
+ * @param p the address of the member to construct
750
+ * @return p
751
+ */
752
+ void* operator new(size_t, Member* p) CPP_THROW_NEW;
753
+ /**
754
+ * Is this a setter
755
+ * @return true if this is a setter
756
+ */
757
+ PRBool IsSetter() const;
758
+ /**
759
+ * Is this a getter
760
+ * @return true if this is a getter
761
+ */
762
+ PRBool IsGetter() const;
763
+ /**
764
+ * Is this a property
765
+ * @return true if this is a property
766
+ */
767
+ PRBool IsProperty() const;
768
+ /**
769
+ * Is this a parameterized setter
770
+ * @return true if this is a parameterized property
771
+ */
772
+ PRBool IsParameterizedSetter() const;
773
+ /**
774
+ * Is this a parameterized getter
775
+ * @return true if this is a parameterized property
776
+ */
777
+ PRBool IsParameterizedGetter() const;
778
+ /**
779
+ * Is this a parameterized property
780
+ * @return true if this is a parameterized property
781
+ */
782
+ PRBool IsParameterizedProperty() const;
783
+ /**
784
+ * Is this a function
785
+ * @return true if this is a function
786
+ */
787
+ PRBool IsFunction() const;
788
+ /**
789
+ * Returns the name of the method as a jsval
790
+ * @return the name of the method as a jsval
791
+ */
792
+ jsval GetName() const;
793
+ /**
794
+ * Returns the function object as a value for the method
795
+ * @param ccx an XPConnect call context
796
+ * @param iface The native interface of the function
797
+ * @param retval pointer to the jsval to receive the name
798
+ * @return JS_TRUE if the function object was return
799
+ */
800
+ JSBool GetValue(XPCCallContext& ccx, XPCNativeInterface* iface,
801
+ jsval * retval) const;
802
+ /**
803
+ * returns the dispid of the method
804
+ * @return the dispid of the method
805
+ */
806
+ PRUint32 GetDispID() const;
807
+ /**
808
+ * returns the number of parameters of the method
809
+ * @param Ask from getter instead of setter version of the function
810
+ * @return the number of parameters of the method
811
+ */
812
+ PRUint32 GetParamCount(PRBool getter = PR_FALSE) const;
813
+ /**
814
+ * Returns parameter information for the specified parameter
815
+ * @param index the index of the parameter
816
+ * @param Ask from getter instead of setter version of the function
817
+ * @return Parameter information
818
+ */
819
+ ParamInfo GetParamInfo(PRUint32 index, PRBool getter = PR_FALSE) const;
820
+ // === Setup functions ===
821
+ /**
822
+ * Sets the name of the method
823
+ * @param name the name to assign
824
+ */
825
+ void SetName(jsval name);
826
+ /**
827
+ * Marks the member as a getter.
828
+ * Both MakeGetter and MakeSetter can be called, making it a setter/getter
829
+ */
830
+ void MakeGetter();
831
+ /**
832
+ * Marks the member as a setter
833
+ */
834
+ void MakeSetter();
835
+ /**
836
+ * Marks the member as a function
837
+ * Should not be called if MakeGetter/Setter is called. Will assert
838
+ */
839
+ void SetFunction();
840
+ /**
841
+ * Used to reset the type of of member
842
+ */
843
+ void ResetType();
844
+ /**
845
+ * Sets the type information for the parameter
846
+ * @param dispID the DISPID of the member
847
+ * @param pTypeInfo Pointer to the COM type information
848
+ * @param fundesc function description
849
+ */
850
+ void SetTypeInfo(DISPID dispID, ITypeInfo* pTypeInfo,
851
+ FUNCDESC* funcdesc);
852
+ /**
853
+ * Sets the function description for the getter version of the function.
854
+ * @param funcdesc function description
855
+ */
856
+ void SetGetterFuncDesc(FUNCDESC* funcdesc);
857
+ /**
858
+ * Sets the member ID
859
+ * @param memID the IDispatch ID of the member
860
+ */
861
+ void SetMemID(DISPID memID);
862
+ /**
863
+ * Returns the IDispatch ID of the member
864
+ * @return the IDispatch ID of the member
865
+ */
866
+ DISPID GetMemID() const;
867
+
868
+ private:
869
+ DISPID mMemID;
870
+ /**
871
+ * Our internal flags identify the type of member
872
+ * A member can be both getter/setter
873
+ */
874
+ enum member_type
875
+ {
876
+ UNINITIALIZED = 0,
877
+ SET_PROPERTY = 1,
878
+ GET_PROPERTY = 2,
879
+ FUNCTION = 4,
880
+ RESOLVED = 8
881
+ };
882
+ PRUint16 mType;
883
+ jsval mVal; // Mutable
884
+ jsval mName; // Mutable
885
+ CComPtr<ITypeInfo> mTypeInfo;
886
+ FUNCDESC* mFuncDesc; // We own this
887
+ FUNCDESC* mGetterFuncDesc; // We own this
888
+ /**
889
+ * Helper function to return the parameter type
890
+ * @param index index of the parameter to return the type of
891
+ * @return The parameter type
892
+ */
893
+ PRUint16 GetParamType(PRUint32 index) const;
894
+ /**
895
+ * Helper function to test if a flag is set in mType
896
+ * @param flag the flag to test for
897
+ * @return true if the flag is set
898
+ */
899
+ PRBool IsFlagSet(unsigned short flag) const;
900
+ };
901
+ /**
902
+ * Returns the JSObject for the tearoff
903
+ * @return pointer to the JSObject
904
+ * @see mJSObject
905
+ */
906
+ JSObject* GetJSObject() const;
907
+ /**
908
+ * Sets the JSObject for the tearoff
909
+ * @param jsobj the object being assigned
910
+ * @see GetJSObject() const
911
+ */
912
+ void SetJSObject(JSObject* jsobj);
913
+ /**
914
+ * Locates the member by name
915
+ * @param name the name of the member to be returned
916
+ * @return pointer to the member found, nsnull if not found
917
+ */
918
+ const Member * FindMember(jsval name) const;
919
+ /**
920
+ * Looksup a member ignoring case
921
+ * TODO: We should look at performance issues concerning this
922
+ * @param ccx A call context
923
+ * @param name The name of the member
924
+ * @return A pointer to a member or nsnull if not found
925
+ */
926
+ const Member* FindMemberCI(XPCCallContext& ccx, jsval name) const;
927
+ /**
928
+ * Returns a member via index
929
+ * @param index the index of the parameter
930
+ * @return reference to the member in the array
931
+ */
932
+ const Member & GetMember(PRUint32 index);
933
+ /**
934
+ * Returns the number of members
935
+ * @return the number of members
936
+ */
937
+ PRUint32 GetMemberCount() const;
938
+ /**
939
+ * Creates a new instance of XPCDispInterface
940
+ * @param cx a JS Context
941
+ * @param pIface the interface pointer to the object
942
+ * @return new instance of XPCDispInterface
943
+ */
944
+ static
945
+ XPCDispInterface* NewInstance(JSContext* cx, nsISupports * pIface);
946
+ /**
947
+ * Delete operator that frees up the memory allocated to the object
948
+ * @param p pointer to the objects memory
949
+ */
950
+ void operator delete(void * p);
951
+ /**
952
+ * Cleans up the members
953
+ */
954
+ ~XPCDispInterface();
955
+ private:
956
+ /**
957
+ * Initializes the object's members
958
+ * @param cx a JS context
959
+ * @param pTypeInfo pointer to the type type information
960
+ * @param members number of members for the object
961
+ */
962
+ XPCDispInterface(JSContext* cx,
963
+ ITypeInfo * pTypeInfo,
964
+ PRUint32 members);
965
+ /**
966
+ * Allocates the memory for the object
967
+ * @param members number of members in this interface
968
+ * @return pointer to the memory for the object
969
+ */
970
+ void * operator new (size_t, PRUint32 members) CPP_THROW_NEW;
971
+
972
+ /**
973
+ * This stores the JSObject for the tearoff, since this object
974
+ * is stored as the JSObject * in the tearoff
975
+ */
976
+ JSObject* mJSObject;
977
+ PRUint32 mMemberCount;
978
+ Member mMembers[1];
979
+ /**
980
+ * Inspects the type information and stores it in this object
981
+ * @param cx a JS context
982
+ * @param pTypeInfo pointer to the type information for the object
983
+ * @param members number of members in the interface
984
+ * @return PR_TRUE if it worked, PR_FALSE if it didn't (usually out of
985
+ * memory)
986
+ */
987
+ PRBool InspectIDispatch(JSContext * cx, ITypeInfo * pTypeInfo,
988
+ PRUint32 members);
989
+
990
+ /**
991
+ * Small utility to count members needed for XPConnect
992
+ * XPConnect has one entry for a property while IDispatch can have two
993
+ * Generally interfaces are small enough, that linear searching should
994
+ * be ok
995
+ */
996
+ class Allocator
997
+ {
998
+ public:
999
+ /**
1000
+ * Constructor, creates the initial buffer
1001
+ * @param cx a JS context
1002
+ * @param pTypeInfo pointer to IDispatch type info, our caller holds
1003
+ * the reference we don't need to
1004
+ */
1005
+ Allocator(JSContext * cx, ITypeInfo * pTypeInfo);
1006
+ /**
1007
+ * Destructor, frees the buffer we allocated
1008
+ */
1009
+ inline
1010
+ ~Allocator();
1011
+ /**
1012
+ * Returns the allocated XPCDispInterface object
1013
+ * @return the allocated XPCDispInterface object
1014
+ */
1015
+ inline
1016
+ XPCDispInterface* Allocate();
1017
+ private:
1018
+ DISPID * mMemIDs;
1019
+ PRUint32 mCount; // Total unique ID's found
1020
+ PRUint32 mIDispatchMembers; // Total entries reported by ITypeInfo
1021
+ JSContext* mCX;
1022
+ ITypeInfo* mTypeInfo;
1023
+
1024
+ /**
1025
+ * Returns the number of members found
1026
+ * @return The number of members found
1027
+ */
1028
+ inline
1029
+ PRUint32 Count() const;
1030
+ /**
1031
+ * Adds the member ID to the list
1032
+ * @param memID The member ID to test
1033
+ */
1034
+ void Add(DISPID memID);
1035
+ /**
1036
+ * Allows our caller to handle unexpected problems like out of memory
1037
+ * @return PR_TRUE if the buffer was allocated
1038
+ */
1039
+ inline
1040
+ PRBool Valid() const;
1041
+
1042
+ // No copying or assigning allowed
1043
+ Allocator(const Allocator&);
1044
+ Allocator& operator =(const Allocator&);
1045
+ };
1046
+ /**
1047
+ * Friendship need to gain access to private operator new
1048
+ */
1049
+ friend class Allocator;
1050
+ };
1051
+
1052
+ /**
1053
+ * Used to invoke IDispatch methods
1054
+ * This has turned into kind of a catch all, and probably should be
1055
+ * cleaned up
1056
+ */
1057
+ class XPCDispObject
1058
+ {
1059
+ public:
1060
+ enum CallMode {CALL_METHOD, CALL_GETTER, CALL_SETTER};
1061
+ /**
1062
+ * This invokes an IDispatch method
1063
+ * @param ccx an XPConnect call context
1064
+ * @param pDisp the IDispatch pointer
1065
+ * @param dispID the DISPID of the method/property
1066
+ * @param mode the call mode, method/property
1067
+ * @param params the parameters need for the method/property
1068
+ * @param retval pointer to a jsval to receive the return value
1069
+ * @param member a pointer to an interface member
1070
+ * @param rt a pointer to the XPConnect JS Runtime
1071
+ * @return true if the method/property was invoked properly
1072
+ */
1073
+ static
1074
+ JSBool Dispatch(XPCCallContext& ccx, IDispatch * pDisp,
1075
+ DISPID dispID, CallMode mode, XPCDispParams * params,
1076
+ jsval* retval, XPCDispInterface::Member* member = nsnull,
1077
+ XPCJSRuntime* rt = nsnull);
1078
+ /**
1079
+ * Used to invoke an IDispatch method using the XPCCallContext
1080
+ * @param ccx an XPConnect call context
1081
+ * @param mode call mode for the call
1082
+ */
1083
+ static
1084
+ JSBool Invoke(XPCCallContext & ccx, CallMode mode);
1085
+ /**
1086
+ * Performs the various security checks, caps, hosting flags, etc.
1087
+ * Instantiates the object and will return that object if createdObject
1088
+ * result is not null
1089
+ * @param ccx an XPConnect call context
1090
+ * @param aCID the class ID to be tested
1091
+ * @param createdObject is the optional object to be returned
1092
+ */
1093
+ static
1094
+ HRESULT SecurityCheck(XPCCallContext & ccx, const CLSID & aCID,
1095
+ IDispatch ** createdObject = nsnull);
1096
+ /**
1097
+ * Instantiates a COM object given a class ID or a prog ID
1098
+ * @param ccx an XPConnect call context
1099
+ * @param className a prog ID or a class ID in the form of
1100
+ * {00000000-0000-0000-0000-000000000000}
1101
+ * @param enforceSecurity if true, will apply checks to ensure
1102
+ * the object can be created giving the current
1103
+ * security settings.
1104
+ * @param result pointer to the pointer to receive the interface pointer
1105
+ */
1106
+ static
1107
+ HRESULT COMCreateInstance(XPCCallContext & ccx, BSTR className,
1108
+ PRBool enforceSecurity, IDispatch ** result);
1109
+ /**
1110
+ * Wraps an IDispatch interface, returning the object as a jsval
1111
+ * @param pDispatch IDispatch pointer
1112
+ * @param cx a JS Context
1113
+ * @param obj A pointer to a JS object serving as the global object
1114
+ * @param rval is a pointer to a jsval to receive the JS object wrapper
1115
+ */
1116
+ static
1117
+ PRBool WrapIDispatch(IDispatch *pDispatch, XPCCallContext & ccx,
1118
+ JSObject *obj, jsval *rval);
1119
+ };
1120
+
1121
+ class XPCIDispatchExtension
1122
+ {
1123
+ public:
1124
+ /**
1125
+ * Reset the enabled flag if xpconnect is re-initialized.
1126
+ */
1127
+ static void InitStatics() { mIsEnabled = PR_TRUE; }
1128
+
1129
+ /**
1130
+ * returns true if IDispatch extension is enabled
1131
+ * @return true if IDispatch extension is enabled
1132
+ */
1133
+ static PRBool IsEnabled() { return mIsEnabled; }
1134
+ /**
1135
+ * Enables the IDispatch extension
1136
+ */
1137
+ static void Enable() { mIsEnabled = PR_TRUE; }
1138
+ /**
1139
+ * Disables the IDispatch extension
1140
+ */
1141
+ static void Disable() { mIsEnabled = PR_FALSE; }
1142
+ /**
1143
+ * Initializes the IDispatch support system
1144
+ * this exposes the ActiveXObject and COMObject to JS
1145
+ * @param aJSContext a JS context
1146
+ * @param aGlobalJSObj a global JS object
1147
+ */
1148
+ static JSBool Initialize(JSContext * aJSContext,
1149
+ JSObject* aGlobalJSObj);
1150
+ /**
1151
+ * This is the define property for the IDispatch system. It called from
1152
+ * the XPConnect's DefineProperty
1153
+ * @param ccx an XPConnect call context
1154
+ * @param obj the JS object receiving the property
1155
+ * @param idval ID of the property to add
1156
+ * @param wrapperToReflectInterfaceNames the wrapper
1157
+ * @param propFlags JS property flags
1158
+ * @param resolved a pointer to a JSBool, set to true if properly resolved
1159
+ */
1160
+ static JSBool DefineProperty(XPCCallContext & ccx,
1161
+ JSObject *obj, jsval idval,
1162
+ XPCWrappedNative* wrapperToReflectInterfaceNames,
1163
+ uintN propFlags, JSBool* resolved);
1164
+ /**
1165
+ * IDispatch system's enumeration function. This is called
1166
+ * from XPC_WN_Shared_Enumerate
1167
+ * @param ccx a XPConnect call context
1168
+ * @param obj pointer to the JSObject
1169
+ * @param wrapper pointer to the wrapper
1170
+ * @return true if the enumeration was successful
1171
+ */
1172
+ static JSBool Enumerate(XPCCallContext& ccx, JSObject* obj,
1173
+ XPCWrappedNative * wrapper);
1174
+ /**
1175
+ * This is the delegated QI called from the wrapped JS class
1176
+ * DelegatedQueryInterface
1177
+ * @param self pointer to the object
1178
+ * @param aInstancePtr pointer to an interface pointer to receive the QI'd
1179
+ * pointer
1180
+ * @return an XPCOM result
1181
+ */
1182
+ static nsresult IDispatchQIWrappedJS(nsXPCWrappedJS * self,
1183
+ void ** aInstancePtr);
1184
+
1185
+ private:
1186
+ static PRBool mIsEnabled;
1187
+ };
1188
+
1189
+ /**
1190
+ * This is a helper class that factored out the parameter cleanup code
1191
+ */
1192
+ class XPCDispParams
1193
+ {
1194
+ public:
1195
+ /**
1196
+ * Initializes the parameters object
1197
+ * @param args the number of parameters this object will hold
1198
+ */
1199
+ XPCDispParams(PRUint32 args);
1200
+ /**
1201
+ * Cleans up the parameters' data
1202
+ */
1203
+ ~XPCDispParams();
1204
+ /**
1205
+ * This sets the named prop ID to our local mPropId. This is used for
1206
+ * setters.
1207
+ */
1208
+ void SetNamedPropID();
1209
+ /**
1210
+ * Returns a reference to a parameter
1211
+ * @param index index of the parameter
1212
+ * @return a reference to the parameter at index
1213
+ */
1214
+ VARIANT & GetParamRef(PRUint32 index);
1215
+ /**
1216
+ * Returns the parameter by value
1217
+ * @param index index of the parameter
1218
+ * @return a copy of the parameter
1219
+ */
1220
+ _variant_t GetParam(PRUint32 index) const;
1221
+ /**
1222
+ * Returns the output buffer for an output parameter
1223
+ * @param index index of the output parameter
1224
+ * @return a pointer to the buffer for the output parameter
1225
+ */
1226
+ void * GetOutputBuffer(PRUint32 index);
1227
+ /**
1228
+ * Returns a DISPPARAMS structure pointer for the parameters
1229
+ * @return a DISPPARAMS structure pointer for the parameters
1230
+ */
1231
+ DISPPARAMS* GetDispParams() const { return &const_cast<XPCDispParams*>(this)->mDispParams; }
1232
+ /**
1233
+ * Returns the number of parameters
1234
+ * @return the number of parameters
1235
+ */
1236
+ uintN GetParamCount() const { return mDispParams.cArgs; }
1237
+ /**
1238
+ * Inserts a parameter
1239
+ * This is mainly used for parameterized properties
1240
+ * @param var the parameter to insert
1241
+ */
1242
+ void InsertParam(_variant_t & var);
1243
+ private:
1244
+ /**
1245
+ * Don't allow copying
1246
+ */
1247
+ XPCDispParams(const XPCDispParams & other) {
1248
+ NS_ERROR("XPCDispParams can't be copied"); }
1249
+ /**
1250
+ * We don't allow assignments
1251
+ */
1252
+ XPCDispParams& operator =(const XPCDispParams&) {
1253
+ NS_ERROR("XPCDispParams can't be assigned"); }
1254
+
1255
+ enum
1256
+ {
1257
+ DEFAULT_ARG_ARRAY_SIZE = 8,
1258
+ DEFAULT_REF_BUFFER_SIZE = 8 * sizeof(VARIANT)
1259
+ };
1260
+ static
1261
+ PRUint32 RefBufferSize(PRUint32 args) { return (args + 1) * sizeof(VARIANT); }
1262
+
1263
+ DISPPARAMS mDispParams;
1264
+ char* mRefBuffer;
1265
+ VARIANT* mDispParamsAllocated;
1266
+ char* mRefBufferAllocated;
1267
+ /**
1268
+ * Used by output/ref variant types
1269
+ */
1270
+ char mStackRefBuffer[DEFAULT_REF_BUFFER_SIZE];
1271
+ VARIANT mStackArgs[DEFAULT_ARG_ARRAY_SIZE];
1272
+ DISPID mPropID;
1273
+ #ifdef DEBUG
1274
+ PRBool mInserted;
1275
+ #endif
1276
+ };
1277
+
1278
+ /**
1279
+ * Parameterized property object JSClass
1280
+ * This class is used to support parameterized properties for IDispatch
1281
+ */
1282
+ class XPCDispParamPropJSClass
1283
+ {
1284
+ public:
1285
+ /**
1286
+ * returns a new or existing JS object as a jsval. This currently always
1287
+ * returns a new instance. But it may be worth looking into reusing
1288
+ * objects
1289
+ * @param ccx an XPConnect call context
1290
+ * @param wrapper the wrapper this parameterized property belongs to
1291
+ * @param dispID DISPID of the parameterized property
1292
+ * @param dispParams the parameters for the parameterized properties
1293
+ * @param paramPropObj pointer to the jsval that will receive the
1294
+ * JS function object
1295
+ * @return true if the JS function object was created
1296
+ */
1297
+ static JSBool NewInstance(XPCCallContext& ccx, XPCWrappedNative* wrapper,
1298
+ PRUint32 dispID,
1299
+ XPCDispParams* dispParams,
1300
+ jsval* paramPropObj);
1301
+ /**
1302
+ * Cleans up the member, derefs the mDispObj, mWrapper and such
1303
+ */
1304
+ ~XPCDispParamPropJSClass();
1305
+ /**
1306
+ * Returns the wrapper
1307
+ * @return pointer to the wrapper (on loan)
1308
+ */
1309
+ XPCWrappedNative* GetWrapper() const { return mWrapper; }
1310
+ /**
1311
+ * Invokes the parameterized getter/setter
1312
+ * @param ccx XPConnect call context
1313
+ * @param mode call mode
1314
+ * @param retval pointer to a jsval to receive the result
1315
+ */
1316
+ JSBool Invoke(XPCCallContext& ccx,
1317
+ XPCDispObject::CallMode mode,
1318
+ jsval* retval);
1319
+ /**
1320
+ * Returns the parameters for the parameterized property
1321
+ * @return a reference to the parameters for the parameterized property
1322
+ */
1323
+ XPCDispParams* GetParams() const { return mDispParams; }
1324
+ private:
1325
+ /**
1326
+ * Private constructor to initialize data members
1327
+ * @param wrapper The wrapper this parameterized object belongs to
1328
+ * @param dispObj pointer to the IDispatch object
1329
+ * @param dispID the DISPID of the parametersized property
1330
+ * @param dispParams the parameters for the parameterized property
1331
+ */
1332
+ XPCDispParamPropJSClass(XPCWrappedNative* wrapper, nsISupports* dispObj,
1333
+ PRUint32 dispID, XPCDispParams* dispParams);
1334
+
1335
+ XPCWrappedNative* mWrapper;
1336
+ PRUint32 mDispID;
1337
+ XPCDispParams* mDispParams;
1338
+ IDispatch* mDispObj;
1339
+ };
1340
+
1341
+ /**
1342
+ * This class is a service that exposes some handy utility methods for
1343
+ * IDispatch users
1344
+ */
1345
+ class nsDispatchSupport : public nsIDispatchSupport
1346
+ {
1347
+ public:
1348
+ NS_DECL_ISUPPORTS
1349
+ NS_DECL_NSIDISPATCHSUPPORT
1350
+ /**
1351
+ * Initialize nsISupports base objects
1352
+ */
1353
+ nsDispatchSupport();
1354
+ /**
1355
+ * Cleansup nsISupports
1356
+ */
1357
+ virtual ~nsDispatchSupport();
1358
+ /**
1359
+ * Returns the existing instance or creates a new one
1360
+ * @return an nsDispatchSupport object
1361
+ */
1362
+ static nsDispatchSupport* GetSingleton();
1363
+ /**
1364
+ * Called on shutdown to free the instance
1365
+ */
1366
+ static void FreeSingleton() { NS_IF_RELEASE(mInstance); }
1367
+
1368
+ private:
1369
+ static nsDispatchSupport* mInstance;
1370
+ };
1371
+
1372
+ /**
1373
+ * Provides class info for IDispatch based objects
1374
+ */
1375
+ class XPCIDispatchClassInfo : public nsIClassInfo
1376
+ {
1377
+ public:
1378
+ /**
1379
+ * Returns a single instance of XPCIDispatchClassInfo
1380
+ * @return the lone instance
1381
+ */
1382
+ static XPCIDispatchClassInfo* GetSingleton();
1383
+ /**
1384
+ * Releases our hold on the instance
1385
+ */
1386
+ static void FreeSingleton();
1387
+ NS_DECL_ISUPPORTS
1388
+ NS_DECL_NSICLASSINFO
1389
+ private:
1390
+ /**
1391
+ * Only our methods create and destroy instances
1392
+ */
1393
+ XPCIDispatchClassInfo() {}
1394
+ virtual ~XPCIDispatchClassInfo() {}
1395
+
1396
+ static XPCIDispatchClassInfo* sInstance;
1397
+ };
1398
+
1399
+ #include "XPCDispInlines.h"
1400
+
1401
+ #endif