johnson 1.2.0 → 2.0.0.pre0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +8 -0
- data/Manifest.txt +762 -48
- data/README.rdoc +2 -1
- data/Rakefile +90 -18
- data/ext/spidermonkey/conversions.c +9 -2
- data/ext/spidermonkey/ruby_land_proxy.c +1 -1
- data/ext/spidermonkey/runtime.h +1 -1
- data/ext/tracemonkey/context.cc +125 -0
- data/ext/tracemonkey/context.h +19 -0
- data/ext/tracemonkey/conversions.cc +365 -0
- data/ext/tracemonkey/conversions.h +32 -0
- data/ext/tracemonkey/debugger.cc +234 -0
- data/ext/tracemonkey/debugger.h +10 -0
- data/ext/tracemonkey/extconf.rb +37 -0
- data/ext/tracemonkey/extensions.cc +37 -0
- data/ext/tracemonkey/extensions.h +12 -0
- data/ext/tracemonkey/global.cc +40 -0
- data/ext/tracemonkey/global.h +11 -0
- data/ext/tracemonkey/idhash.cc +16 -0
- data/ext/tracemonkey/idhash.h +8 -0
- data/ext/tracemonkey/immutable_node.cc +1199 -0
- data/ext/tracemonkey/immutable_node.cc.erb +559 -0
- data/ext/tracemonkey/immutable_node.h +22 -0
- data/ext/tracemonkey/jroot.h +215 -0
- data/ext/tracemonkey/js_land_proxy.cc +620 -0
- data/ext/tracemonkey/js_land_proxy.h +20 -0
- data/ext/tracemonkey/ruby_land_proxy.cc +618 -0
- data/ext/tracemonkey/ruby_land_proxy.h +38 -0
- data/ext/tracemonkey/runtime.cc +454 -0
- data/ext/tracemonkey/runtime.h +27 -0
- data/ext/tracemonkey/split_global.cc +392 -0
- data/ext/tracemonkey/split_global.h +11 -0
- data/ext/tracemonkey/tracemonkey.cc +23 -0
- data/ext/tracemonkey/tracemonkey.h +32 -0
- data/lib/johnson.rb +12 -4
- data/lib/johnson/error.rb +5 -0
- data/lib/johnson/js/prelude.js +16 -1
- data/lib/johnson/parser.rb +2 -1
- data/lib/johnson/runtime.rb +87 -26
- data/lib/johnson/spidermonkey/runtime.rb +7 -16
- data/lib/johnson/tracemonkey.rb +13 -0
- data/lib/johnson/tracemonkey/context.rb +10 -0
- data/lib/johnson/tracemonkey/debugger.rb +67 -0
- data/lib/johnson/tracemonkey/immutable_node.rb +282 -0
- data/lib/johnson/tracemonkey/js_land_proxy.rb +64 -0
- data/lib/johnson/tracemonkey/mutable_tree_visitor.rb +242 -0
- data/lib/johnson/tracemonkey/ruby_land_proxy.rb +17 -0
- data/lib/johnson/tracemonkey/runtime.rb +80 -0
- data/test/{johnson_test.rb → generic/johnson_test.rb} +1 -1
- data/test/{parser_test.rb → generic/parser_test.rb} +1 -1
- data/test/helper.rb +23 -4
- data/test/johnson/{browser_test.rb → generic/browser_test.rb} +1 -1
- data/test/johnson/{conversions → generic/conversions}/array_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/boolean_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/callable_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/file_test.rb +1 -1
- data/test/johnson/generic/conversions/helper.rb +1 -0
- data/test/johnson/{conversions → generic/conversions}/nil_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/number_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/regexp_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/string_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/struct_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/symbol_test.rb +1 -1
- data/test/johnson/{conversions → generic/conversions}/thread_test.rb +1 -1
- data/test/johnson/{custom_conversions_test.rb → generic/custom_conversions_test.rb} +1 -1
- data/test/johnson/generic/default_test.rb +12 -0
- data/test/johnson/{error_test.rb → generic/error_test.rb} +1 -1
- data/test/johnson/{extensions_test.rb → generic/extensions_test.rb} +1 -1
- data/test/johnson/generic/helper.rb +1 -0
- data/test/johnson/{nodes → generic/nodes}/array_literal_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/array_node_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/binary_node_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/bracket_access_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/delete_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/do_while_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/dot_accessor_test.rb +1 -1
- data/test/johnson/generic/nodes/export_test.rb +11 -0
- data/test/johnson/{nodes → generic/nodes}/for_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/function_test.rb +1 -1
- data/test/johnson/generic/nodes/helper.rb +1 -0
- data/test/johnson/{nodes → generic/nodes}/if_test.rb +16 -6
- data/test/johnson/generic/nodes/import_test.rb +15 -0
- data/test/johnson/{nodes → generic/nodes}/label_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/let_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/object_literal_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/return_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/semi_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/switch_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/ternary_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/throw_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/try_node_test.rb +36 -6
- data/test/johnson/{nodes → generic/nodes}/typeof_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/unary_node_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/void_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/while_test.rb +1 -1
- data/test/johnson/{nodes → generic/nodes}/with_test.rb +1 -1
- data/test/johnson/{prelude_test.rb → generic/prelude_test.rb} +1 -1
- data/test/johnson/{runtime_test.rb → generic/runtime_test.rb} +3 -6
- data/test/johnson/generic/version_test.rb +13 -0
- data/test/johnson/{visitors → generic/visitors}/dot_visitor_test.rb +1 -1
- data/test/johnson/{visitors → generic/visitors}/enumerating_visitor_test.rb +1 -1
- data/test/johnson/generic/visitors/helper.rb +1 -0
- data/test/johnson/spidermonkey/js_land_proxy_test.rb +1 -5
- data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +11 -7
- data/test/johnson/tracemonkey/context_test.rb +21 -0
- data/test/johnson/tracemonkey/immutable_node_test.rb +34 -0
- data/test/johnson/tracemonkey/js_land_proxy_test.rb +273 -0
- data/test/johnson/tracemonkey/ruby_land_proxy_test.rb +274 -0
- data/test/johnson/tracemonkey/runtime_test.rb +41 -0
- data/test/johnson/tracemonkey/split_global_test.rb +32 -0
- data/vendor/spidermonkey/js.pkg +2 -0
- data/vendor/tracemonkey/Makefile.in +668 -0
- data/vendor/tracemonkey/Makefile.ref +483 -0
- data/vendor/tracemonkey/README.html +54 -0
- data/vendor/tracemonkey/SpiderMonkey.rsp +11 -0
- data/vendor/tracemonkey/Y.js +19 -0
- data/vendor/tracemonkey/aclocal.m4 +9 -0
- data/vendor/tracemonkey/bench.sh +5 -0
- data/vendor/tracemonkey/build/autoconf/acoutput-fast.pl +202 -0
- data/vendor/tracemonkey/build/autoconf/altoptions.m4 +154 -0
- data/vendor/tracemonkey/build/autoconf/config.guess +1537 -0
- data/vendor/tracemonkey/build/autoconf/config.sub +1595 -0
- data/vendor/tracemonkey/build/autoconf/install-sh +119 -0
- data/vendor/tracemonkey/build/autoconf/make-makefile +315 -0
- data/vendor/tracemonkey/build/autoconf/match-dir.sh +101 -0
- data/vendor/tracemonkey/build/autoconf/moznbytetype.m4 +136 -0
- data/vendor/tracemonkey/build/autoconf/nspr.m4 +82 -0
- data/vendor/tracemonkey/build/autoconf/pkg.m4 +59 -0
- data/vendor/tracemonkey/build/autoconf/update-makefile.sh +118 -0
- data/vendor/tracemonkey/build/cygwin-wrapper +75 -0
- data/vendor/tracemonkey/build/hcc +111 -0
- data/vendor/tracemonkey/build/hcpp +155 -0
- data/vendor/tracemonkey/build/unix/mddepend.pl +165 -0
- data/vendor/tracemonkey/build/unix/uniq.pl +63 -0
- data/vendor/tracemonkey/build/win32/pgomerge.py +40 -0
- data/vendor/tracemonkey/builtins.tbl +91 -0
- data/vendor/tracemonkey/call.js +13 -0
- data/vendor/tracemonkey/config.mk +206 -0
- data/vendor/tracemonkey/config/Makefile.in +106 -0
- data/vendor/tracemonkey/config/Moz/Milestone.pm +232 -0
- data/vendor/tracemonkey/config/autoconf.mk.in +362 -0
- data/vendor/tracemonkey/config/check-sync-dirs.py +103 -0
- data/vendor/tracemonkey/config/check-sync-exceptions +7 -0
- data/vendor/tracemonkey/config/config.mk +881 -0
- data/vendor/tracemonkey/config/fastcwd.pl +66 -0
- data/vendor/tracemonkey/config/gcc_hidden.h +2 -0
- data/vendor/tracemonkey/config/insure.mk +53 -0
- data/vendor/tracemonkey/config/make-system-wrappers.pl +59 -0
- data/vendor/tracemonkey/config/milestone.pl +112 -0
- data/vendor/tracemonkey/config/milestone.txt +13 -0
- data/vendor/tracemonkey/config/mkdepend/Makefile.in +84 -0
- data/vendor/tracemonkey/config/mkdepend/cppsetup.c +233 -0
- data/vendor/tracemonkey/config/mkdepend/def.h +184 -0
- data/vendor/tracemonkey/config/mkdepend/ifparser.c +551 -0
- data/vendor/tracemonkey/config/mkdepend/ifparser.h +83 -0
- data/vendor/tracemonkey/config/mkdepend/imakemdep.h +733 -0
- data/vendor/tracemonkey/config/mkdepend/include.c +337 -0
- data/vendor/tracemonkey/config/mkdepend/main.c +860 -0
- data/vendor/tracemonkey/config/mkdepend/mkdepend.man +382 -0
- data/vendor/tracemonkey/config/mkdepend/parse.c +686 -0
- data/vendor/tracemonkey/config/mkdepend/pr.c +124 -0
- data/vendor/tracemonkey/config/nfspwd.pl +50 -0
- data/vendor/tracemonkey/config/nsinstall.c +481 -0
- data/vendor/tracemonkey/config/nsinstall.py +155 -0
- data/vendor/tracemonkey/config/pathsub.c +247 -0
- data/vendor/tracemonkey/config/pathsub.h +74 -0
- data/vendor/tracemonkey/config/preprocessor.pl +671 -0
- data/vendor/tracemonkey/config/revdepth-nt.pl +48 -0
- data/vendor/tracemonkey/config/revdepth.pl +51 -0
- data/vendor/tracemonkey/config/rules.mk +2310 -0
- data/vendor/tracemonkey/config/static-checking-config.mk +21 -0
- data/vendor/tracemonkey/config/static-checking.js +92 -0
- data/vendor/tracemonkey/config/string-format.js +61 -0
- data/vendor/tracemonkey/config/system-headers +1035 -0
- data/vendor/tracemonkey/config/version.mk +85 -0
- data/vendor/tracemonkey/config/version_win.pl +442 -0
- data/vendor/tracemonkey/configure +14183 -0
- data/vendor/tracemonkey/configure.in +5363 -0
- data/vendor/tracemonkey/correct.sh +23 -0
- data/vendor/tracemonkey/correct/check-3d-morph.js +55 -0
- data/vendor/tracemonkey/correct/check-3d-raytrace.js +445 -0
- data/vendor/tracemonkey/correct/check-access-binary-trees.js +52 -0
- data/vendor/tracemonkey/correct/check-access-fannkuch.js +66 -0
- data/vendor/tracemonkey/correct/check-access-nbody.js +171 -0
- data/vendor/tracemonkey/correct/check-access-nsieve.js +40 -0
- data/vendor/tracemonkey/correct/check-bitops-3bit-bits-in-byte.js +35 -0
- data/vendor/tracemonkey/correct/check-bitops-bits-in-byte.js +24 -0
- data/vendor/tracemonkey/correct/check-bitops-bitwise-and.js +29 -0
- data/vendor/tracemonkey/correct/check-bitops-nsieve-bits.js +40 -0
- data/vendor/tracemonkey/correct/check-controlflow-recursive.js +27 -0
- data/vendor/tracemonkey/correct/check-date-format-tofte.js +302 -0
- data/vendor/tracemonkey/correct/check-date-format-xparb.js +421 -0
- data/vendor/tracemonkey/correct/check-mont.js +119 -0
- data/vendor/tracemonkey/dtoa.c +3335 -0
- data/vendor/tracemonkey/editline/Makefile.in +55 -0
- data/vendor/tracemonkey/editline/Makefile.ref +143 -0
- data/vendor/tracemonkey/editline/README +83 -0
- data/vendor/tracemonkey/editline/editline.3 +175 -0
- data/vendor/tracemonkey/editline/editline.c +1371 -0
- data/vendor/tracemonkey/editline/editline.h +135 -0
- data/vendor/tracemonkey/editline/sysunix.c +182 -0
- data/vendor/tracemonkey/editline/unix.h +82 -0
- data/vendor/tracemonkey/if.js +13 -0
- data/vendor/tracemonkey/imacro_asm.js.in +396 -0
- data/vendor/tracemonkey/imacros.c.out +1034 -0
- data/vendor/tracemonkey/imacros.jsasm +770 -0
- data/vendor/tracemonkey/javascript-trace.d +73 -0
- data/vendor/tracemonkey/jitstats.tbl +55 -0
- data/vendor/tracemonkey/js-config.h.in +82 -0
- data/vendor/tracemonkey/js-config.in +111 -0
- data/vendor/tracemonkey/js.mdp +0 -0
- data/vendor/tracemonkey/js.msg +312 -0
- data/vendor/tracemonkey/js3240.rc +79 -0
- data/vendor/tracemonkey/jsOS240.def +654 -0
- data/vendor/tracemonkey/jsapi.cpp +6005 -0
- data/vendor/tracemonkey/jsapi.h +2727 -0
- data/vendor/tracemonkey/jsarena.cpp +450 -0
- data/vendor/tracemonkey/jsarena.h +318 -0
- data/vendor/tracemonkey/jsarray.cpp +3664 -0
- data/vendor/tracemonkey/jsarray.h +238 -0
- data/vendor/tracemonkey/jsatom.cpp +1244 -0
- data/vendor/tracemonkey/jsatom.h +493 -0
- data/vendor/tracemonkey/jsbit.h +249 -0
- data/vendor/tracemonkey/jsbool.cpp +184 -0
- data/vendor/tracemonkey/jsbool.h +88 -0
- data/vendor/tracemonkey/jsbuiltins.cpp +415 -0
- data/vendor/tracemonkey/jsbuiltins.h +456 -0
- data/vendor/tracemonkey/jsclist.h +139 -0
- data/vendor/tracemonkey/jscntxt.cpp +1816 -0
- data/vendor/tracemonkey/jscntxt.h +1541 -0
- data/vendor/tracemonkey/jscompat.h +57 -0
- data/vendor/tracemonkey/jsconfig.mk +181 -0
- data/vendor/tracemonkey/jscpucfg.cpp +194 -0
- data/vendor/tracemonkey/jscpucfg.h +91 -0
- data/vendor/tracemonkey/jsdate.cpp +2465 -0
- data/vendor/tracemonkey/jsdate.h +129 -0
- data/vendor/tracemonkey/jsdbgapi.cpp +2017 -0
- data/vendor/tracemonkey/jsdbgapi.h +500 -0
- data/vendor/tracemonkey/jsdhash.cpp +876 -0
- data/vendor/tracemonkey/jsdhash.h +588 -0
- data/vendor/tracemonkey/jsdtoa.cpp +572 -0
- data/vendor/tracemonkey/jsdtoa.h +131 -0
- data/vendor/tracemonkey/jsdtracef.c +318 -0
- data/vendor/tracemonkey/jsdtracef.h +81 -0
- data/vendor/tracemonkey/jsemit.cpp +7292 -0
- data/vendor/tracemonkey/jsemit.h +802 -0
- data/vendor/tracemonkey/jsexn.cpp +1337 -0
- data/vendor/tracemonkey/jsexn.h +96 -0
- data/vendor/tracemonkey/jsfile.cpp +2747 -0
- data/vendor/tracemonkey/jsfile.h +56 -0
- data/vendor/tracemonkey/jsfile.msg +90 -0
- data/vendor/tracemonkey/jsfun.cpp +3089 -0
- data/vendor/tracemonkey/jsfun.h +366 -0
- data/vendor/tracemonkey/jsgc.cpp +3816 -0
- data/vendor/tracemonkey/jsgc.h +429 -0
- data/vendor/tracemonkey/jshash.cpp +477 -0
- data/vendor/tracemonkey/jshash.h +151 -0
- data/vendor/tracemonkey/jsify.pl +483 -0
- data/vendor/tracemonkey/jsinterp.cpp +7441 -0
- data/vendor/tracemonkey/jsinterp.h +666 -0
- data/vendor/tracemonkey/jsinvoke.cpp +42 -0
- data/vendor/tracemonkey/jsiter.cpp +1040 -0
- data/vendor/tracemonkey/jsiter.h +140 -0
- data/vendor/tracemonkey/jskeyword.tbl +124 -0
- data/vendor/tracemonkey/jskwgen.cpp +460 -0
- data/vendor/tracemonkey/jslibmath.h +69 -0
- data/vendor/tracemonkey/jslock.cpp +1512 -0
- data/vendor/tracemonkey/jslock.h +325 -0
- data/vendor/tracemonkey/jslocko.asm +60 -0
- data/vendor/tracemonkey/jslog2.cpp +111 -0
- data/vendor/tracemonkey/jslong.h +167 -0
- data/vendor/tracemonkey/jsmath.cpp +806 -0
- data/vendor/tracemonkey/jsmath.h +63 -0
- data/vendor/tracemonkey/jsnum.cpp +1374 -0
- data/vendor/tracemonkey/jsnum.h +280 -0
- data/vendor/tracemonkey/jsobj.cpp +6165 -0
- data/vendor/tracemonkey/jsobj.h +870 -0
- data/vendor/tracemonkey/json.cpp +1338 -0
- data/vendor/tracemonkey/json.h +108 -0
- data/vendor/tracemonkey/jsopcode.cpp +5484 -0
- data/vendor/tracemonkey/jsopcode.h +434 -0
- data/vendor/tracemonkey/jsopcode.tbl +591 -0
- data/vendor/tracemonkey/jsoplengen.cpp +121 -0
- data/vendor/tracemonkey/jsotypes.h +202 -0
- data/vendor/tracemonkey/jsparse.cpp +9257 -0
- data/vendor/tracemonkey/jsparse.h +900 -0
- data/vendor/tracemonkey/jsprf.cpp +1262 -0
- data/vendor/tracemonkey/jsprf.h +150 -0
- data/vendor/tracemonkey/jsproto.tbl +117 -0
- data/vendor/tracemonkey/jsprvtd.h +366 -0
- data/vendor/tracemonkey/jspubtd.h +585 -0
- data/vendor/tracemonkey/jsregexp.cpp +5051 -0
- data/vendor/tracemonkey/jsregexp.h +199 -0
- data/vendor/tracemonkey/jsreops.tbl +145 -0
- data/vendor/tracemonkey/jsscan.cpp +2040 -0
- data/vendor/tracemonkey/jsscan.h +467 -0
- data/vendor/tracemonkey/jsscope.cpp +1966 -0
- data/vendor/tracemonkey/jsscope.h +487 -0
- data/vendor/tracemonkey/jsscript.cpp +1932 -0
- data/vendor/tracemonkey/jsscript.h +345 -0
- data/vendor/tracemonkey/jsshell.msg +54 -0
- data/vendor/tracemonkey/jsstack.js +167 -0
- data/vendor/tracemonkey/jsstaticcheck.h +69 -0
- data/vendor/tracemonkey/jsstddef.h +87 -0
- data/vendor/tracemonkey/jsstdint.h +96 -0
- data/vendor/tracemonkey/jsstr.cpp +5277 -0
- data/vendor/tracemonkey/jsstr.h +702 -0
- data/vendor/tracemonkey/jstracer.cpp +10991 -0
- data/vendor/tracemonkey/jstracer.h +794 -0
- data/vendor/tracemonkey/jstypes.h +481 -0
- data/vendor/tracemonkey/jsutil.cpp +361 -0
- data/vendor/tracemonkey/jsutil.h +178 -0
- data/vendor/tracemonkey/jsversion.h +243 -0
- data/vendor/tracemonkey/jswince.asm +44 -0
- data/vendor/tracemonkey/jsxdrapi.cpp +800 -0
- data/vendor/tracemonkey/jsxdrapi.h +220 -0
- data/vendor/tracemonkey/jsxml.cpp +8327 -0
- data/vendor/tracemonkey/jsxml.h +305 -0
- data/vendor/tracemonkey/liveconnect/LiveConnect.dsp +157 -0
- data/vendor/tracemonkey/liveconnect/LiveConnectShell.dsp +120 -0
- data/vendor/tracemonkey/liveconnect/LiveConnectShell.dsw +44 -0
- data/vendor/tracemonkey/liveconnect/Makefile.in +105 -0
- data/vendor/tracemonkey/liveconnect/Makefile.ref +169 -0
- data/vendor/tracemonkey/liveconnect/README.html +712 -0
- data/vendor/tracemonkey/liveconnect/_jni/netscape_javascript_JSException.h +14 -0
- data/vendor/tracemonkey/liveconnect/_jni/netscape_javascript_JSObject.h +155 -0
- data/vendor/tracemonkey/liveconnect/classes/Makefile.in +89 -0
- data/vendor/tracemonkey/liveconnect/classes/Makefile.ref +57 -0
- data/vendor/tracemonkey/liveconnect/classes/netscape/Makefile.ref +47 -0
- data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSException.java +140 -0
- data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSObject.java +183 -0
- data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSProxy.java +58 -0
- data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSRunnable.java +70 -0
- data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/JSUtil.java +59 -0
- data/vendor/tracemonkey/liveconnect/classes/netscape/javascript/Makefile.ref +53 -0
- data/vendor/tracemonkey/liveconnect/config/AIX4.1.mk +45 -0
- data/vendor/tracemonkey/liveconnect/config/AIX4.2.mk +45 -0
- data/vendor/tracemonkey/liveconnect/config/AIX4.3.mk +50 -0
- data/vendor/tracemonkey/liveconnect/config/HP-UXB.10.10.mk +43 -0
- data/vendor/tracemonkey/liveconnect/config/HP-UXB.10.20.mk +43 -0
- data/vendor/tracemonkey/liveconnect/config/HP-UXB.11.00.mk +43 -0
- data/vendor/tracemonkey/liveconnect/config/IRIX6.2.mk +43 -0
- data/vendor/tracemonkey/liveconnect/config/IRIX6.3.mk +43 -0
- data/vendor/tracemonkey/liveconnect/config/IRIX6.5.mk +43 -0
- data/vendor/tracemonkey/liveconnect/config/Linux_All.mk +73 -0
- data/vendor/tracemonkey/liveconnect/config/OSF1V4.0.mk +65 -0
- data/vendor/tracemonkey/liveconnect/config/OSF1V5.0.mk +62 -0
- data/vendor/tracemonkey/liveconnect/config/SunOS5.5.1.mk +55 -0
- data/vendor/tracemonkey/liveconnect/config/SunOS5.6.mk +39 -0
- data/vendor/tracemonkey/liveconnect/config/SunOS5.7.mk +39 -0
- data/vendor/tracemonkey/liveconnect/config/SunOS5.8.mk +39 -0
- data/vendor/tracemonkey/liveconnect/config/WINNT4.0.mk +53 -0
- data/vendor/tracemonkey/liveconnect/jsj.c +886 -0
- data/vendor/tracemonkey/liveconnect/jsj.msg +98 -0
- data/vendor/tracemonkey/liveconnect/jsj_JSObject.c +1377 -0
- data/vendor/tracemonkey/liveconnect/jsj_JavaArray.c +474 -0
- data/vendor/tracemonkey/liveconnect/jsj_JavaClass.c +737 -0
- data/vendor/tracemonkey/liveconnect/jsj_JavaMember.c +191 -0
- data/vendor/tracemonkey/liveconnect/jsj_JavaObject.c +1079 -0
- data/vendor/tracemonkey/liveconnect/jsj_JavaPackage.c +569 -0
- data/vendor/tracemonkey/liveconnect/jsj_array.c +207 -0
- data/vendor/tracemonkey/liveconnect/jsj_class.c +770 -0
- data/vendor/tracemonkey/liveconnect/jsj_convert.c +902 -0
- data/vendor/tracemonkey/liveconnect/jsj_field.c +421 -0
- data/vendor/tracemonkey/liveconnect/jsj_hash.c +488 -0
- data/vendor/tracemonkey/liveconnect/jsj_hash.h +161 -0
- data/vendor/tracemonkey/liveconnect/jsj_method.c +1825 -0
- data/vendor/tracemonkey/liveconnect/jsj_nodl.c +1 -0
- data/vendor/tracemonkey/liveconnect/jsj_private.h +677 -0
- data/vendor/tracemonkey/liveconnect/jsj_simpleapi.c +219 -0
- data/vendor/tracemonkey/liveconnect/jsj_utils.c +513 -0
- data/vendor/tracemonkey/liveconnect/jsjava.h +316 -0
- data/vendor/tracemonkey/liveconnect/netscape_javascript_JSObject.h +155 -0
- data/vendor/tracemonkey/liveconnect/nsCLiveconnect.cpp +785 -0
- data/vendor/tracemonkey/liveconnect/nsCLiveconnect.h +197 -0
- data/vendor/tracemonkey/liveconnect/nsCLiveconnectFactory.cpp +118 -0
- data/vendor/tracemonkey/liveconnect/nsCLiveconnectFactory.h +76 -0
- data/vendor/tracemonkey/liveconnect/nsILiveconnect.h +197 -0
- data/vendor/tracemonkey/liveconnect/nsISecureLiveconnect.h +94 -0
- data/vendor/tracemonkey/liveconnect/nsISecurityContext.h +136 -0
- data/vendor/tracemonkey/lock_SunOS.s +119 -0
- data/vendor/tracemonkey/mandelbrot-results.js +3 -0
- data/vendor/tracemonkey/math-partial-sums.js +32 -0
- data/vendor/tracemonkey/math-trace-tests.js +507 -0
- data/vendor/tracemonkey/md5.js +289 -0
- data/vendor/tracemonkey/nanojit/Assembler.cpp +1984 -0
- data/vendor/tracemonkey/nanojit/Assembler.h +375 -0
- data/vendor/tracemonkey/nanojit/Fragmento.cpp +651 -0
- data/vendor/tracemonkey/nanojit/Fragmento.h +237 -0
- data/vendor/tracemonkey/nanojit/LIR.cpp +2314 -0
- data/vendor/tracemonkey/nanojit/LIR.h +879 -0
- data/vendor/tracemonkey/nanojit/LIRopcode.tbl +252 -0
- data/vendor/tracemonkey/nanojit/Native.h +127 -0
- data/vendor/tracemonkey/nanojit/NativeARM.cpp +1742 -0
- data/vendor/tracemonkey/nanojit/NativeARM.h +844 -0
- data/vendor/tracemonkey/nanojit/NativeSparc.cpp +1130 -0
- data/vendor/tracemonkey/nanojit/NativeSparc.h +948 -0
- data/vendor/tracemonkey/nanojit/NativeThumb.cpp +1322 -0
- data/vendor/tracemonkey/nanojit/NativeThumb.h +525 -0
- data/vendor/tracemonkey/nanojit/Nativei386.cpp +1748 -0
- data/vendor/tracemonkey/nanojit/Nativei386.h +857 -0
- data/vendor/tracemonkey/nanojit/RegAlloc.cpp +183 -0
- data/vendor/tracemonkey/nanojit/RegAlloc.h +95 -0
- data/vendor/tracemonkey/nanojit/TraceTreeDrawer.cpp +306 -0
- data/vendor/tracemonkey/nanojit/TraceTreeDrawer.h +88 -0
- data/vendor/tracemonkey/nanojit/avmplus.cpp +56 -0
- data/vendor/tracemonkey/nanojit/avmplus.h +1016 -0
- data/vendor/tracemonkey/nanojit/nanojit.h +253 -0
- data/vendor/tracemonkey/perfect.js +39 -0
- data/vendor/tracemonkey/plify_jsdhash.sed +35 -0
- data/vendor/tracemonkey/prmjtime.cpp +869 -0
- data/vendor/tracemonkey/prmjtime.h +103 -0
- data/vendor/tracemonkey/ref-config/AIX4.1.mk +65 -0
- data/vendor/tracemonkey/ref-config/AIX4.2.mk +64 -0
- data/vendor/tracemonkey/ref-config/AIX4.3.mk +65 -0
- data/vendor/tracemonkey/ref-config/Darwin.mk +85 -0
- data/vendor/tracemonkey/ref-config/Darwin1.3.mk +81 -0
- data/vendor/tracemonkey/ref-config/Darwin1.4.mk +41 -0
- data/vendor/tracemonkey/ref-config/Darwin5.2.mk +81 -0
- data/vendor/tracemonkey/ref-config/Darwin5.3.mk +81 -0
- data/vendor/tracemonkey/ref-config/Darwin64.mk +72 -0
- data/vendor/tracemonkey/ref-config/HP-UXB.10.10.mk +77 -0
- data/vendor/tracemonkey/ref-config/HP-UXB.10.20.mk +77 -0
- data/vendor/tracemonkey/ref-config/HP-UXB.11.00.mk +80 -0
- data/vendor/tracemonkey/ref-config/IRIX.mk +87 -0
- data/vendor/tracemonkey/ref-config/IRIX5.3.mk +44 -0
- data/vendor/tracemonkey/ref-config/IRIX6.1.mk +44 -0
- data/vendor/tracemonkey/ref-config/IRIX6.2.mk +44 -0
- data/vendor/tracemonkey/ref-config/IRIX6.3.mk +44 -0
- data/vendor/tracemonkey/ref-config/IRIX6.5.mk +44 -0
- data/vendor/tracemonkey/ref-config/Linux_All.mk +105 -0
- data/vendor/tracemonkey/ref-config/Mac_OS10.0.mk +82 -0
- data/vendor/tracemonkey/ref-config/OSF1V4.0.mk +72 -0
- data/vendor/tracemonkey/ref-config/OSF1V5.0.mk +69 -0
- data/vendor/tracemonkey/ref-config/SunOS4.1.4.mk +101 -0
- data/vendor/tracemonkey/ref-config/SunOS5.10.mk +50 -0
- data/vendor/tracemonkey/ref-config/SunOS5.3.mk +91 -0
- data/vendor/tracemonkey/ref-config/SunOS5.4.mk +92 -0
- data/vendor/tracemonkey/ref-config/SunOS5.5.1.mk +44 -0
- data/vendor/tracemonkey/ref-config/SunOS5.5.mk +87 -0
- data/vendor/tracemonkey/ref-config/SunOS5.6.mk +89 -0
- data/vendor/tracemonkey/ref-config/SunOS5.7.mk +44 -0
- data/vendor/tracemonkey/ref-config/SunOS5.8.mk +44 -0
- data/vendor/tracemonkey/ref-config/SunOS5.9.mk +44 -0
- data/vendor/tracemonkey/ref-config/WINNT4.0.mk +118 -0
- data/vendor/tracemonkey/ref-config/WINNT5.0.mk +118 -0
- data/vendor/tracemonkey/ref-config/WINNT5.1.mk +118 -0
- data/vendor/tracemonkey/ref-config/WINNT5.2.mk +118 -0
- data/vendor/tracemonkey/ref-config/WINNT6.0.mk +118 -0
- data/vendor/tracemonkey/ref-config/dgux.mk +64 -0
- data/vendor/tracemonkey/resource.h +15 -0
- data/vendor/tracemonkey/rules.mk +206 -0
- data/vendor/tracemonkey/shell/Makefile.in +72 -0
- data/vendor/tracemonkey/shell/js.cpp +4719 -0
- data/vendor/tracemonkey/t/3d-cube.js +337 -0
- data/vendor/tracemonkey/t/3d-morph.js +54 -0
- data/vendor/tracemonkey/t/3d-raytrace.js +441 -0
- data/vendor/tracemonkey/t/access-binary-trees.js +50 -0
- data/vendor/tracemonkey/t/access-fannkuch.js +66 -0
- data/vendor/tracemonkey/t/access-nbody.js +169 -0
- data/vendor/tracemonkey/t/access-nsieve.js +38 -0
- data/vendor/tracemonkey/t/bitops-3bit-bits-in-byte.js +32 -0
- data/vendor/tracemonkey/t/bitops-bits-in-byte.js +21 -0
- data/vendor/tracemonkey/t/bitops-bitwise-and.js +28 -0
- data/vendor/tracemonkey/t/bitops-nsieve-bits.js +32 -0
- data/vendor/tracemonkey/t/controlflow-recursive.js +25 -0
- data/vendor/tracemonkey/t/crypto-aes.js +422 -0
- data/vendor/tracemonkey/t/crypto-md5.js +286 -0
- data/vendor/tracemonkey/t/crypto-sha1.js +224 -0
- data/vendor/tracemonkey/t/date-format-tofte.js +299 -0
- data/vendor/tracemonkey/t/date-format-xparb.js +417 -0
- data/vendor/tracemonkey/t/math-cordic.js +95 -0
- data/vendor/tracemonkey/t/math-partial-sums.js +33 -0
- data/vendor/tracemonkey/t/math-spectral-norm.js +51 -0
- data/vendor/tracemonkey/t/regexp-dna.js +1712 -0
- data/vendor/tracemonkey/t/string-base64.js +135 -0
- data/vendor/tracemonkey/t/string-fasta.js +85 -0
- data/vendor/tracemonkey/t/string-tagcloud.js +265 -0
- data/vendor/tracemonkey/t/string-unpack-code.js +68 -0
- data/vendor/tracemonkey/t/string-validate-input.js +89 -0
- data/vendor/tracemonkey/time.sh +13 -0
- data/vendor/tracemonkey/trace-test.js +5564 -0
- data/vendor/tracemonkey/v8/base.js +187 -0
- data/vendor/tracemonkey/v8/crypto.js +1689 -0
- data/vendor/tracemonkey/v8/deltablue.js +880 -0
- data/vendor/tracemonkey/v8/earley-boyer.js +4682 -0
- data/vendor/tracemonkey/v8/raytrace.js +3418 -0
- data/vendor/tracemonkey/v8/richards.js +539 -0
- data/vendor/tracemonkey/v8/run-crypto.js +44 -0
- data/vendor/tracemonkey/v8/run-deltablue.js +44 -0
- data/vendor/tracemonkey/v8/run-earley-boyer.js +44 -0
- data/vendor/tracemonkey/v8/run-raytrace.js +44 -0
- data/vendor/tracemonkey/v8/run-richards.js +44 -0
- data/vendor/tracemonkey/v8/run.js +49 -0
- data/vendor/tracemonkey/vprof/readme.txt +93 -0
- data/vendor/tracemonkey/vprof/vprof.cpp +360 -0
- data/vendor/tracemonkey/vprof/vprof.h +245 -0
- data/vendor/tracemonkey/xpconnect/Makefile.in +67 -0
- data/vendor/tracemonkey/xpconnect/crashtests/117307-1.html +20 -0
- data/vendor/tracemonkey/xpconnect/crashtests/193710.html +11 -0
- data/vendor/tracemonkey/xpconnect/crashtests/290162-1.html +5 -0
- data/vendor/tracemonkey/xpconnect/crashtests/326615-1.html +16 -0
- data/vendor/tracemonkey/xpconnect/crashtests/328553-1.html +13 -0
- data/vendor/tracemonkey/xpconnect/crashtests/346258-1.html +12 -0
- data/vendor/tracemonkey/xpconnect/crashtests/346512-1-frame1.xhtml +16 -0
- data/vendor/tracemonkey/xpconnect/crashtests/346512-1-frame2.xhtml +15 -0
- data/vendor/tracemonkey/xpconnect/crashtests/346512-1.xhtml +30 -0
- data/vendor/tracemonkey/xpconnect/crashtests/382133-1.html +3 -0
- data/vendor/tracemonkey/xpconnect/crashtests/386680-1.html +22 -0
- data/vendor/tracemonkey/xpconnect/crashtests/394810-1.html +4 -0
- data/vendor/tracemonkey/xpconnect/crashtests/400349-1.html +20 -0
- data/vendor/tracemonkey/xpconnect/crashtests/403356-1.html +13 -0
- data/vendor/tracemonkey/xpconnect/crashtests/418139-1.svg +22 -0
- data/vendor/tracemonkey/xpconnect/crashtests/420513-1.html +11 -0
- data/vendor/tracemonkey/xpconnect/crashtests/453935-1.html +37 -0
- data/vendor/tracemonkey/xpconnect/crashtests/462926.html +12 -0
- data/vendor/tracemonkey/xpconnect/crashtests/468552-1.html +18 -0
- data/vendor/tracemonkey/xpconnect/crashtests/471366-1.html +12 -0
- data/vendor/tracemonkey/xpconnect/crashtests/475185-1.html +13 -0
- data/vendor/tracemonkey/xpconnect/crashtests/475291-1.html +14 -0
- data/vendor/tracemonkey/xpconnect/crashtests/503286-1.html +23 -0
- data/vendor/tracemonkey/xpconnect/crashtests/crashtests.list +21 -0
- data/vendor/tracemonkey/xpconnect/idl/Makefile.in +78 -0
- data/vendor/tracemonkey/xpconnect/idl/XPCIDispatch.idl +51 -0
- data/vendor/tracemonkey/xpconnect/idl/mozIJSSubScriptLoader.idl +64 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIActiveXSecurityPolicy.idl +67 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIDispatchSupport.idl +119 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIJSContextStack.idl +85 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIJSRuntimeService.idl +51 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIScriptError.idl +102 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIScriptableInterfaces.idl +67 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIXPCScriptNotify.idl +66 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIXPCScriptable.idl +183 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIXPCSecurityManager.idl +114 -0
- data/vendor/tracemonkey/xpconnect/idl/nsIXPConnect.idl +819 -0
- data/vendor/tracemonkey/xpconnect/idl/xpcIJSModuleLoader.idl +95 -0
- data/vendor/tracemonkey/xpconnect/idl/xpcIJSWeakReference.idl +49 -0
- data/vendor/tracemonkey/xpconnect/idl/xpccomponents.idl +254 -0
- data/vendor/tracemonkey/xpconnect/idl/xpcexception.idl +66 -0
- data/vendor/tracemonkey/xpconnect/idl/xpcjsid.idl +83 -0
- data/vendor/tracemonkey/xpconnect/loader/ISO8601DateUtils.jsm +176 -0
- data/vendor/tracemonkey/xpconnect/loader/Makefile.in +63 -0
- data/vendor/tracemonkey/xpconnect/loader/XPCOMUtils.jsm +267 -0
- data/vendor/tracemonkey/xpconnect/loader/mozJSComponentLoader.cpp +1717 -0
- data/vendor/tracemonkey/xpconnect/loader/mozJSComponentLoader.h +172 -0
- data/vendor/tracemonkey/xpconnect/loader/mozJSLoaderConstructors.h +101 -0
- data/vendor/tracemonkey/xpconnect/loader/mozJSSubScriptLoader.cpp +360 -0
- data/vendor/tracemonkey/xpconnect/loader/mozJSSubScriptLoader.h +66 -0
- data/vendor/tracemonkey/xpconnect/public/Makefile.in +54 -0
- data/vendor/tracemonkey/xpconnect/public/nsAXPCNativeCallContext.h +89 -0
- data/vendor/tracemonkey/xpconnect/public/nsAutoJSValHolder.h +168 -0
- data/vendor/tracemonkey/xpconnect/public/xpc_map_end.h +327 -0
- data/vendor/tracemonkey/xpconnect/sample/Makefile.in +71 -0
- data/vendor/tracemonkey/xpconnect/sample/README +39 -0
- data/vendor/tracemonkey/xpconnect/sample/xpcsample1.cpp +337 -0
- data/vendor/tracemonkey/xpconnect/sample/xpcsample1.idl +82 -0
- data/vendor/tracemonkey/xpconnect/sample/xpcsample1.js +21 -0
- data/vendor/tracemonkey/xpconnect/shell/Makefile.in +106 -0
- data/vendor/tracemonkey/xpconnect/shell/jsshell.msg +50 -0
- data/vendor/tracemonkey/xpconnect/shell/xpcshell.cpp +1817 -0
- data/vendor/tracemonkey/xpconnect/shell/xpcshellMacUtils.h +43 -0
- data/vendor/tracemonkey/xpconnect/shell/xpcshellMacUtils.mm +54 -0
- data/vendor/tracemonkey/xpconnect/src/Makefile.in +228 -0
- data/vendor/tracemonkey/xpconnect/src/README +3 -0
- data/vendor/tracemonkey/xpconnect/src/XPCCrossOriginWrapper.cpp +1186 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispConvert.cpp +593 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispInlines.h +667 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispInterface.cpp +383 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispObject.cpp +516 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispParamPropJSClass.cpp +223 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispParams.cpp +103 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispPrivate.h +1401 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispTearOff.cpp +547 -0
- data/vendor/tracemonkey/xpconnect/src/XPCDispTypeInfo.cpp +471 -0
- data/vendor/tracemonkey/xpconnect/src/XPCIDispatchClassInfo.cpp +139 -0
- data/vendor/tracemonkey/xpconnect/src/XPCIDispatchExtension.cpp +362 -0
- data/vendor/tracemonkey/xpconnect/src/XPCNativeWrapper.cpp +1350 -0
- data/vendor/tracemonkey/xpconnect/src/XPCNativeWrapper.h +88 -0
- data/vendor/tracemonkey/xpconnect/src/XPCSafeJSObjectWrapper.cpp +1148 -0
- data/vendor/tracemonkey/xpconnect/src/XPCSystemOnlyWrapper.cpp +718 -0
- data/vendor/tracemonkey/xpconnect/src/XPCWrapper.cpp +850 -0
- data/vendor/tracemonkey/xpconnect/src/XPCWrapper.h +394 -0
- data/vendor/tracemonkey/xpconnect/src/dom_quickstubs.qsconf +568 -0
- data/vendor/tracemonkey/xpconnect/src/nsDispatchSupport.cpp +348 -0
- data/vendor/tracemonkey/xpconnect/src/nsScriptError.cpp +201 -0
- data/vendor/tracemonkey/xpconnect/src/nsXPConnect.cpp +2609 -0
- data/vendor/tracemonkey/xpconnect/src/qsgen.py +1487 -0
- data/vendor/tracemonkey/xpconnect/src/xpc.msg +217 -0
- data/vendor/tracemonkey/xpconnect/src/xpcJSWeakReference.cpp +148 -0
- data/vendor/tracemonkey/xpconnect/src/xpcJSWeakReference.h +56 -0
- data/vendor/tracemonkey/xpconnect/src/xpccallcontext.cpp +579 -0
- data/vendor/tracemonkey/xpconnect/src/xpccomponents.cpp +4144 -0
- data/vendor/tracemonkey/xpconnect/src/xpccontext.cpp +115 -0
- data/vendor/tracemonkey/xpconnect/src/xpcconvert.cpp +2298 -0
- data/vendor/tracemonkey/xpconnect/src/xpcdebug.cpp +481 -0
- data/vendor/tracemonkey/xpconnect/src/xpcexception.cpp +502 -0
- data/vendor/tracemonkey/xpconnect/src/xpcforwards.h +114 -0
- data/vendor/tracemonkey/xpconnect/src/xpcinlines.h +772 -0
- data/vendor/tracemonkey/xpconnect/src/xpcjsid.cpp +1025 -0
- data/vendor/tracemonkey/xpconnect/src/xpcjsruntime.cpp +1342 -0
- data/vendor/tracemonkey/xpconnect/src/xpclog.cpp +128 -0
- data/vendor/tracemonkey/xpconnect/src/xpclog.h +101 -0
- data/vendor/tracemonkey/xpconnect/src/xpcmaps.cpp +761 -0
- data/vendor/tracemonkey/xpconnect/src/xpcmaps.h +713 -0
- data/vendor/tracemonkey/xpconnect/src/xpcmodule.cpp +136 -0
- data/vendor/tracemonkey/xpconnect/src/xpcprivate.h +4138 -0
- data/vendor/tracemonkey/xpconnect/src/xpcquickstubs.cpp +1128 -0
- data/vendor/tracemonkey/xpconnect/src/xpcquickstubs.h +480 -0
- data/vendor/tracemonkey/xpconnect/src/xpcruntimesvc.cpp +179 -0
- data/vendor/tracemonkey/xpconnect/src/xpcstack.cpp +342 -0
- data/vendor/tracemonkey/xpconnect/src/xpcstring.cpp +139 -0
- data/vendor/tracemonkey/xpconnect/src/xpcthreadcontext.cpp +599 -0
- data/vendor/tracemonkey/xpconnect/src/xpcthrower.cpp +399 -0
- data/vendor/tracemonkey/xpconnect/src/xpcvariant.cpp +850 -0
- data/vendor/tracemonkey/xpconnect/src/xpcwrappedjs.cpp +670 -0
- data/vendor/tracemonkey/xpconnect/src/xpcwrappedjsclass.cpp +2015 -0
- data/vendor/tracemonkey/xpconnect/src/xpcwrappednative.cpp +3482 -0
- data/vendor/tracemonkey/xpconnect/src/xpcwrappednativeinfo.cpp +945 -0
- data/vendor/tracemonkey/xpconnect/src/xpcwrappednativejsops.cpp +2003 -0
- data/vendor/tracemonkey/xpconnect/src/xpcwrappednativeproto.cpp +302 -0
- data/vendor/tracemonkey/xpconnect/src/xpcwrappednativescope.cpp +991 -0
- data/vendor/tracemonkey/xpconnect/tests/Makefile.in +75 -0
- data/vendor/tracemonkey/xpconnect/tests/TestXPC.cpp +785 -0
- data/vendor/tracemonkey/xpconnect/tests/chrome/Makefile.in +51 -0
- data/vendor/tracemonkey/xpconnect/tests/chrome/test_bug500931.xul +43 -0
- data/vendor/tracemonkey/xpconnect/tests/components/Makefile.in +85 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_array.cpp +388 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_attributes.cpp +305 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_calljs.cpp +135 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_child.cpp +225 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_const.cpp +76 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_domstring.cpp +118 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_echo.cpp +616 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_in.cpp +204 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_inout.cpp +171 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_module.cpp +77 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_multiple.cpp +554 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_noisy.cpp +154 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_out.cpp +335 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_overloaded.cpp +250 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_private.h +192 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_string.cpp +185 -0
- data/vendor/tracemonkey/xpconnect/tests/components/xpctest_variant.cpp +355 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/StdAfx.cpp +12 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/StdAfx.h +28 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCDispUtilities.h +28 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.cpp +86 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.def +9 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsp +318 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsw +29 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.idl +454 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/XPCIDispatchTest.rc +145 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispSimple.cpp +44 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispSimple.h +56 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispSimple.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.cpp +221 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.h +53 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.cpp +699 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.h +138 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.cpp +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.h +41 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.cpp +256 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.h +88 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.cpp +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.h +43 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.cpp +29 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.h +45 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.cpp +177 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.h +50 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.rgs +23 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/COM/resource.h +36 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/Arrays/XPCIDispatchArrayTests.js +54 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/Attributes/XPCIDispatchAttributeTests.js +150 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCIDispatchInstantiations.js +122 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCStress.js +58 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/Methods/XPCIDispatchMethodTests.js +376 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedCOM/shell.js +377 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedJS/General/XPCIDispatchTestWrappedJS.js +76 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/WrappedJS/shell.js +377 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/exectests.cmd +1 -0
- data/vendor/tracemonkey/xpconnect/tests/idispatch/Tests/jsDriver.pl +1288 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/Makefile.in +61 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest.idl +312 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest2.idl +51 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_attributes.idl +67 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_calljs.idl +59 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_const.idl +61 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_domstring.idl +59 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_in.idl +88 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_inout.idl +86 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_multiple.idl +77 -0
- data/vendor/tracemonkey/xpconnect/tests/idl/xpctest_out.idl +142 -0
- data/vendor/tracemonkey/xpconnect/tests/js/checkid.js +82 -0
- data/vendor/tracemonkey/xpconnect/tests/js/evaluate.js +311 -0
- data/vendor/tracemonkey/xpconnect/tests/js/exceptions-2.js +153 -0
- data/vendor/tracemonkey/xpconnect/tests/js/exceptions-3.js +194 -0
- data/vendor/tracemonkey/xpconnect/tests/js/exceptions-4.js +297 -0
- data/vendor/tracemonkey/xpconnect/tests/js/exceptions-5.js +343 -0
- data/vendor/tracemonkey/xpconnect/tests/js/exceptions.js +230 -0
- data/vendor/tracemonkey/xpconnect/tests/js/javascript.js +96 -0
- data/vendor/tracemonkey/xpconnect/tests/js/multiple-2.js +151 -0
- data/vendor/tracemonkey/xpconnect/tests/js/multiple-3.js +148 -0
- data/vendor/tracemonkey/xpconnect/tests/js/multiple-4.js +152 -0
- data/vendor/tracemonkey/xpconnect/tests/js/multiple.js +137 -0
- data/vendor/tracemonkey/xpconnect/tests/js/notscriptable.js +104 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/simpletest.js +36 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/speed.js +60 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/testxpc.js +464 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/threads.js +74 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/try.js +27 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_array.js +308 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_callcontext.js +68 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_echo.js +636 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_enum_and_sort.js +28 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_enum_constants.js +15 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_enum_create.js +200 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_exceptions.js +167 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_ids.js +135 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_observer.js +36 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_overloaded.js +14 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_primitives.js +141 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_propertybag.js +36 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_variant.js +339 -0
- data/vendor/tracemonkey/xpconnect/tests/js/old/xpctest_variant_array.js +30 -0
- data/vendor/tracemonkey/xpconnect/tests/js/readonlyattributes.js +74 -0
- data/vendor/tracemonkey/xpconnect/tests/js/readwriteattributes.js +101 -0
- data/vendor/tracemonkey/xpconnect/tests/js/scriptable.js +120 -0
- data/vendor/tracemonkey/xpconnect/tests/js/testin.js +203 -0
- data/vendor/tracemonkey/xpconnect/tests/js/xpcfun.js +234 -0
- data/vendor/tracemonkey/xpconnect/tests/js/xpctest_primitives.js +200 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/Makefile.in +66 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/bug500931_helper.html +7 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/inner.html +7 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug361111.xul +29 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug384632.html +32 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug390488.html +65 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug393269.html +46 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug396851.html +43 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug428021.html +41 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug446584.html +49 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug448587.html +31 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug462428.html +42 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug478438.html +66 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug484107.html +100 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug484459.html +36 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_bug500691.html +28 -0
- data/vendor/tracemonkey/xpconnect/tests/mochitest/test_wrappers.html +116 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/bogus_element_type.jsm +1 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/bogus_exports_type.jsm +1 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/bug451678_subscript.js +2 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/component_import.js +144 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/recursive_importA.jsm +44 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/recursive_importB.jsm +45 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/syntax_error.jsm +1 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/test_bogus_files.js +88 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/test_bug408412.js +51 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/test_bug451678.js +52 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/test_bug_442086.js +68 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/test_import.js +127 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/test_js_weak_references.js +63 -0
- data/vendor/tracemonkey/xpconnect/tests/unit/test_recursive_import.js +62 -0
- data/vendor/tracemonkey/xpconnect/tools/Makefile.in +49 -0
- data/vendor/tracemonkey/xpconnect/tools/idl/Makefile.in +53 -0
- data/vendor/tracemonkey/xpconnect/tools/idl/nsIXPCToolsCompiler.idl +60 -0
- data/vendor/tracemonkey/xpconnect/tools/idl/nsIXPCToolsProfiler.idl +57 -0
- data/vendor/tracemonkey/xpconnect/tools/js/CompileJSFiles.js +28 -0
- data/vendor/tracemonkey/xpconnect/tools/js/ListJSFiles.js +18 -0
- data/vendor/tracemonkey/xpconnect/tools/src/Makefile.in +76 -0
- data/vendor/tracemonkey/xpconnect/tools/src/nsXPCToolsCompiler.cpp +161 -0
- data/vendor/tracemonkey/xpconnect/tools/src/nsXPCToolsModule.cpp +65 -0
- data/vendor/tracemonkey/xpconnect/tools/src/nsXPCToolsProfiler.cpp +370 -0
- data/vendor/tracemonkey/xpconnect/tools/src/xpctools_private.h +236 -0
- metadata +782 -107
- data/test/johnson/nodes/export_test.rb +0 -9
- data/test/johnson/nodes/import_test.rb +0 -13
- data/test/johnson/version_test.rb +0 -13
@@ -0,0 +1,1342 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2
|
+
*
|
3
|
+
* ***** BEGIN LICENSE BLOCK *****
|
4
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
5
|
+
*
|
6
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
7
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
8
|
+
* the License. You may obtain a copy of the License at
|
9
|
+
* http://www.mozilla.org/MPL/
|
10
|
+
*
|
11
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
12
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
13
|
+
* for the specific language governing rights and limitations under the
|
14
|
+
* License.
|
15
|
+
*
|
16
|
+
* The Original Code is Mozilla Communicator client code, released
|
17
|
+
* March 31, 1998.
|
18
|
+
*
|
19
|
+
* The Initial Developer of the Original Code is
|
20
|
+
* Netscape Communications Corporation.
|
21
|
+
* Portions created by the Initial Developer are Copyright (C) 1998
|
22
|
+
* the Initial Developer. All Rights Reserved.
|
23
|
+
*
|
24
|
+
* Contributor(s):
|
25
|
+
* John Bandhauer <jband@netscape.com> (original author)
|
26
|
+
*
|
27
|
+
* Alternatively, the contents of this file may be used under the terms of
|
28
|
+
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
29
|
+
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
30
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
31
|
+
* of those above. If you wish to allow use of your version of this file only
|
32
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
33
|
+
* use your version of this file under the terms of the MPL, indicate your
|
34
|
+
* decision by deleting the provisions above and replace them with the notice
|
35
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
36
|
+
* the provisions above, a recipient may use your version of this file under
|
37
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
38
|
+
*
|
39
|
+
* ***** END LICENSE BLOCK ***** */
|
40
|
+
|
41
|
+
/* Per JSRuntime object */
|
42
|
+
|
43
|
+
#include "xpcprivate.h"
|
44
|
+
#include "dom_quickstubs.h"
|
45
|
+
|
46
|
+
/***************************************************************************/
|
47
|
+
|
48
|
+
const char* XPCJSRuntime::mStrings[] = {
|
49
|
+
"constructor", // IDX_CONSTRUCTOR
|
50
|
+
"toString", // IDX_TO_STRING
|
51
|
+
"toSource", // IDX_TO_SOURCE
|
52
|
+
"lastResult", // IDX_LAST_RESULT
|
53
|
+
"returnCode", // IDX_RETURN_CODE
|
54
|
+
"value", // IDX_VALUE
|
55
|
+
"QueryInterface", // IDX_QUERY_INTERFACE
|
56
|
+
"Components", // IDX_COMPONENTS
|
57
|
+
"wrappedJSObject", // IDX_WRAPPED_JSOBJECT
|
58
|
+
"Object", // IDX_OBJECT
|
59
|
+
"Function", // IDX_FUNCTION
|
60
|
+
"prototype", // IDX_PROTOTYPE
|
61
|
+
"createInstance", // IDX_CREATE_INSTANCE
|
62
|
+
"item", // IDX_ITEM
|
63
|
+
"__proto__", // IDX_PROTO
|
64
|
+
"__iterator__" // IDX_ITERATOR
|
65
|
+
#ifdef XPC_IDISPATCH_SUPPORT
|
66
|
+
, "GeckoActiveXObject" // IDX_ACTIVEX_OBJECT
|
67
|
+
, "COMObject" // IDX_COMOBJECT
|
68
|
+
, "supports" // IDX_ACTIVEX_SUPPORTS
|
69
|
+
#endif
|
70
|
+
};
|
71
|
+
|
72
|
+
/***************************************************************************/
|
73
|
+
|
74
|
+
// data holder class for the enumerator callback below
|
75
|
+
struct JSDyingJSObjectData
|
76
|
+
{
|
77
|
+
JSContext* cx;
|
78
|
+
nsVoidArray* array;
|
79
|
+
};
|
80
|
+
|
81
|
+
static JSDHashOperator
|
82
|
+
WrappedJSDyingJSObjectFinder(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
83
|
+
uint32 number, void *arg)
|
84
|
+
{
|
85
|
+
JSDyingJSObjectData* data = (JSDyingJSObjectData*) arg;
|
86
|
+
nsXPCWrappedJS* wrapper = ((JSObject2WrappedJSMap::Entry*)hdr)->value;
|
87
|
+
NS_ASSERTION(wrapper, "found a null JS wrapper!");
|
88
|
+
|
89
|
+
// walk the wrapper chain and find any whose JSObject is to be finalized
|
90
|
+
while(wrapper)
|
91
|
+
{
|
92
|
+
if(wrapper->IsSubjectToFinalization())
|
93
|
+
{
|
94
|
+
if(JS_IsAboutToBeFinalized(data->cx, wrapper->GetJSObject()))
|
95
|
+
data->array->AppendElement(wrapper);
|
96
|
+
}
|
97
|
+
wrapper = wrapper->GetNextWrapper();
|
98
|
+
}
|
99
|
+
return JS_DHASH_NEXT;
|
100
|
+
}
|
101
|
+
|
102
|
+
struct CX_AND_XPCRT_Data
|
103
|
+
{
|
104
|
+
JSContext* cx;
|
105
|
+
XPCJSRuntime* rt;
|
106
|
+
};
|
107
|
+
|
108
|
+
static JSDHashOperator
|
109
|
+
NativeInterfaceGC(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
110
|
+
uint32 number, void *arg)
|
111
|
+
{
|
112
|
+
CX_AND_XPCRT_Data* data = (CX_AND_XPCRT_Data*) arg;
|
113
|
+
((IID2NativeInterfaceMap::Entry*)hdr)->value->
|
114
|
+
DealWithDyingGCThings(data->cx, data->rt);
|
115
|
+
return JS_DHASH_NEXT;
|
116
|
+
}
|
117
|
+
|
118
|
+
static JSDHashOperator
|
119
|
+
NativeInterfaceSweeper(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
120
|
+
uint32 number, void *arg)
|
121
|
+
{
|
122
|
+
CX_AND_XPCRT_Data* data = (CX_AND_XPCRT_Data*) arg;
|
123
|
+
XPCNativeInterface* iface = ((IID2NativeInterfaceMap::Entry*)hdr)->value;
|
124
|
+
if(iface->IsMarked())
|
125
|
+
{
|
126
|
+
iface->Unmark();
|
127
|
+
return JS_DHASH_NEXT;
|
128
|
+
}
|
129
|
+
|
130
|
+
#ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
|
131
|
+
printf("- Destroying XPCNativeInterface for %s\n",
|
132
|
+
JS_GetStringBytes(JSVAL_TO_STRING(iface->GetName())));
|
133
|
+
#endif
|
134
|
+
|
135
|
+
XPCNativeInterface::DestroyInstance(data->cx, data->rt, iface);
|
136
|
+
return JS_DHASH_REMOVE;
|
137
|
+
}
|
138
|
+
|
139
|
+
// *Some* NativeSets are referenced from mClassInfo2NativeSetMap.
|
140
|
+
// *All* NativeSets are referenced from mNativeSetMap.
|
141
|
+
// So, in mClassInfo2NativeSetMap we just clear references to the unmarked.
|
142
|
+
// In mNativeSetMap we clear the references to the unmarked *and* delete them.
|
143
|
+
|
144
|
+
static JSDHashOperator
|
145
|
+
NativeUnMarkedSetRemover(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
146
|
+
uint32 number, void *arg)
|
147
|
+
{
|
148
|
+
XPCNativeSet* set = ((ClassInfo2NativeSetMap::Entry*)hdr)->value;
|
149
|
+
if(set->IsMarked())
|
150
|
+
return JS_DHASH_NEXT;
|
151
|
+
return JS_DHASH_REMOVE;
|
152
|
+
}
|
153
|
+
|
154
|
+
static JSDHashOperator
|
155
|
+
NativeSetSweeper(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
156
|
+
uint32 number, void *arg)
|
157
|
+
{
|
158
|
+
XPCNativeSet* set = ((NativeSetMap::Entry*)hdr)->key_value;
|
159
|
+
if(set->IsMarked())
|
160
|
+
{
|
161
|
+
set->Unmark();
|
162
|
+
return JS_DHASH_NEXT;
|
163
|
+
}
|
164
|
+
|
165
|
+
#ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
|
166
|
+
printf("- Destroying XPCNativeSet for:\n");
|
167
|
+
PRUint16 count = set->GetInterfaceCount();
|
168
|
+
for(PRUint16 k = 0; k < count; k++)
|
169
|
+
{
|
170
|
+
XPCNativeInterface* iface = set->GetInterfaceAt(k);
|
171
|
+
printf(" %s\n",JS_GetStringBytes(JSVAL_TO_STRING(iface->GetName())));
|
172
|
+
}
|
173
|
+
#endif
|
174
|
+
|
175
|
+
XPCNativeSet::DestroyInstance(set);
|
176
|
+
return JS_DHASH_REMOVE;
|
177
|
+
}
|
178
|
+
|
179
|
+
static JSDHashOperator
|
180
|
+
JSClassSweeper(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
181
|
+
uint32 number, void *arg)
|
182
|
+
{
|
183
|
+
XPCNativeScriptableShared* shared =
|
184
|
+
((XPCNativeScriptableSharedMap::Entry*) hdr)->key;
|
185
|
+
if(shared->IsMarked())
|
186
|
+
{
|
187
|
+
#ifdef off_XPC_REPORT_JSCLASS_FLUSHING
|
188
|
+
printf("+ Marked XPCNativeScriptableShared for: %s @ %x\n",
|
189
|
+
shared->GetJSClass()->name,
|
190
|
+
shared->GetJSClass());
|
191
|
+
#endif
|
192
|
+
shared->Unmark();
|
193
|
+
return JS_DHASH_NEXT;
|
194
|
+
}
|
195
|
+
|
196
|
+
#ifdef XPC_REPORT_JSCLASS_FLUSHING
|
197
|
+
printf("- Destroying XPCNativeScriptableShared for: %s @ %x\n",
|
198
|
+
shared->GetJSClass()->name,
|
199
|
+
shared->GetJSClass());
|
200
|
+
#endif
|
201
|
+
|
202
|
+
delete shared;
|
203
|
+
return JS_DHASH_REMOVE;
|
204
|
+
}
|
205
|
+
|
206
|
+
static JSDHashOperator
|
207
|
+
DyingProtoKiller(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
208
|
+
uint32 number, void *arg)
|
209
|
+
{
|
210
|
+
XPCWrappedNativeProto* proto =
|
211
|
+
(XPCWrappedNativeProto*)((JSDHashEntryStub*)hdr)->key;
|
212
|
+
delete proto;
|
213
|
+
return JS_DHASH_REMOVE;
|
214
|
+
}
|
215
|
+
|
216
|
+
static JSDHashOperator
|
217
|
+
DetachedWrappedNativeProtoMarker(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
218
|
+
uint32 number, void *arg)
|
219
|
+
{
|
220
|
+
XPCWrappedNativeProto* proto =
|
221
|
+
(XPCWrappedNativeProto*)((JSDHashEntryStub*)hdr)->key;
|
222
|
+
|
223
|
+
proto->Mark();
|
224
|
+
return JS_DHASH_NEXT;
|
225
|
+
}
|
226
|
+
|
227
|
+
// GCCallback calls are chained
|
228
|
+
static JSBool
|
229
|
+
ContextCallback(JSContext *cx, uintN operation)
|
230
|
+
{
|
231
|
+
XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
|
232
|
+
if(self)
|
233
|
+
{
|
234
|
+
if(operation == JSCONTEXT_NEW)
|
235
|
+
{
|
236
|
+
if(!self->OnJSContextNew(cx))
|
237
|
+
return JS_FALSE;
|
238
|
+
}
|
239
|
+
else if(operation == JSCONTEXT_DESTROY)
|
240
|
+
{
|
241
|
+
delete XPCContext::GetXPCContext(cx);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
return JS_TRUE;
|
245
|
+
}
|
246
|
+
|
247
|
+
struct ObjectHolder : public JSDHashEntryHdr
|
248
|
+
{
|
249
|
+
void *holder;
|
250
|
+
nsScriptObjectTracer* tracer;
|
251
|
+
};
|
252
|
+
|
253
|
+
nsresult
|
254
|
+
XPCJSRuntime::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer)
|
255
|
+
{
|
256
|
+
if(!mJSHolders.ops)
|
257
|
+
return NS_ERROR_OUT_OF_MEMORY;
|
258
|
+
|
259
|
+
ObjectHolder *entry =
|
260
|
+
reinterpret_cast<ObjectHolder*>(JS_DHashTableOperate(&mJSHolders,
|
261
|
+
aHolder,
|
262
|
+
JS_DHASH_ADD));
|
263
|
+
if(!entry)
|
264
|
+
return NS_ERROR_OUT_OF_MEMORY;
|
265
|
+
|
266
|
+
entry->holder = aHolder;
|
267
|
+
entry->tracer = aTracer;
|
268
|
+
|
269
|
+
return NS_OK;
|
270
|
+
}
|
271
|
+
|
272
|
+
nsresult
|
273
|
+
XPCJSRuntime::RemoveJSHolder(void* aHolder)
|
274
|
+
{
|
275
|
+
if(!mJSHolders.ops)
|
276
|
+
return NS_ERROR_OUT_OF_MEMORY;
|
277
|
+
|
278
|
+
JS_DHashTableOperate(&mJSHolders, aHolder, JS_DHASH_REMOVE);
|
279
|
+
|
280
|
+
return NS_OK;
|
281
|
+
}
|
282
|
+
|
283
|
+
// static
|
284
|
+
void XPCJSRuntime::TraceJS(JSTracer* trc, void* data)
|
285
|
+
{
|
286
|
+
XPCJSRuntime* self = (XPCJSRuntime*)data;
|
287
|
+
|
288
|
+
// Skip this part if XPConnect is shutting down. We get into
|
289
|
+
// bad locking problems with the thread iteration otherwise.
|
290
|
+
if(!self->GetXPConnect()->IsShuttingDown())
|
291
|
+
{
|
292
|
+
PRLock* threadLock = XPCPerThreadData::GetLock();
|
293
|
+
if(threadLock)
|
294
|
+
{ // scoped lock
|
295
|
+
nsAutoLock lock(threadLock);
|
296
|
+
|
297
|
+
XPCPerThreadData* iterp = nsnull;
|
298
|
+
XPCPerThreadData* thread;
|
299
|
+
|
300
|
+
while(nsnull != (thread =
|
301
|
+
XPCPerThreadData::IterateThreads(&iterp)))
|
302
|
+
{
|
303
|
+
// Trace those AutoMarkingPtr lists!
|
304
|
+
thread->TraceJS(trc);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
}
|
308
|
+
|
309
|
+
// XPCJSObjectHolders don't participate in cycle collection, so always trace
|
310
|
+
// them here.
|
311
|
+
for(XPCRootSetElem *e = self->mObjectHolderRoots; e ; e = e->GetNextRoot())
|
312
|
+
static_cast<XPCJSObjectHolder*>(e)->TraceJS(trc);
|
313
|
+
|
314
|
+
if(self->GetXPConnect()->ShouldTraceRoots())
|
315
|
+
{
|
316
|
+
// Only trace these if we're not cycle-collecting, the cycle collector
|
317
|
+
// will do that if we are.
|
318
|
+
self->TraceXPConnectRoots(trc);
|
319
|
+
}
|
320
|
+
}
|
321
|
+
|
322
|
+
static void
|
323
|
+
TraceJSObject(PRUint32 aLangID, void *aScriptThing, void *aClosure)
|
324
|
+
{
|
325
|
+
if(aLangID == nsIProgrammingLanguage::JAVASCRIPT)
|
326
|
+
{
|
327
|
+
JS_CALL_TRACER(static_cast<JSTracer*>(aClosure), aScriptThing,
|
328
|
+
js_GetGCThingTraceKind(aScriptThing),
|
329
|
+
"JSObjectHolder");
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
static JSDHashOperator
|
334
|
+
TraceJSHolder(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number,
|
335
|
+
void *arg)
|
336
|
+
{
|
337
|
+
ObjectHolder* entry = reinterpret_cast<ObjectHolder*>(hdr);
|
338
|
+
|
339
|
+
entry->tracer->Trace(entry->holder, TraceJSObject, arg);
|
340
|
+
|
341
|
+
return JS_DHASH_NEXT;
|
342
|
+
}
|
343
|
+
|
344
|
+
struct ClearedGlobalObject : public JSDHashEntryHdr
|
345
|
+
{
|
346
|
+
JSContext* mContext;
|
347
|
+
JSObject* mGlobalObject;
|
348
|
+
};
|
349
|
+
|
350
|
+
void XPCJSRuntime::TraceXPConnectRoots(JSTracer *trc, JSBool rootGlobals)
|
351
|
+
{
|
352
|
+
if(mUnrootedGlobalCount != 0)
|
353
|
+
{
|
354
|
+
JSContext *iter = nsnull, *acx;
|
355
|
+
while((acx = JS_ContextIterator(GetJSRuntime(), &iter)))
|
356
|
+
{
|
357
|
+
if(JS_HAS_OPTION(acx, JSOPTION_UNROOTED_GLOBAL))
|
358
|
+
{
|
359
|
+
NS_ASSERTION(nsXPConnect::GetXPConnect()->GetRequestDepth(acx)
|
360
|
+
== 0, "active cx must be always rooted");
|
361
|
+
NS_ASSERTION(acx->globalObject, "bad state");
|
362
|
+
JS_CALL_OBJECT_TRACER(trc, acx->globalObject,
|
363
|
+
"global object");
|
364
|
+
if(rootGlobals)
|
365
|
+
{
|
366
|
+
NS_ASSERTION(mUnrootedGlobalCount != 0, "bad state");
|
367
|
+
NS_ASSERTION(trc == acx->runtime->gcMarkingTracer,
|
368
|
+
"bad tracer");
|
369
|
+
JS_ToggleOptions(acx, JSOPTION_UNROOTED_GLOBAL);
|
370
|
+
--mUnrootedGlobalCount;
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
XPCWrappedNativeScope::TraceJS(trc, this);
|
377
|
+
|
378
|
+
for(XPCRootSetElem *e = mVariantRoots; e ; e = e->GetNextRoot())
|
379
|
+
static_cast<XPCTraceableVariant*>(e)->TraceJS(trc);
|
380
|
+
|
381
|
+
for(XPCRootSetElem *e = mWrappedJSRoots; e ; e = e->GetNextRoot())
|
382
|
+
static_cast<nsXPCWrappedJS*>(e)->TraceJS(trc);
|
383
|
+
|
384
|
+
if(mJSHolders.ops)
|
385
|
+
JS_DHashTableEnumerate(&mJSHolders, TraceJSHolder, trc);
|
386
|
+
}
|
387
|
+
|
388
|
+
static JSDHashOperator
|
389
|
+
NoteJSHolder(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number,
|
390
|
+
void *arg)
|
391
|
+
{
|
392
|
+
ObjectHolder* entry = reinterpret_cast<ObjectHolder*>(hdr);
|
393
|
+
|
394
|
+
nsCycleCollectionTraversalCallback* cb =
|
395
|
+
static_cast<nsCycleCollectionTraversalCallback*>(arg);
|
396
|
+
cb->NoteRoot(nsIProgrammingLanguage::CPLUSPLUS, entry->holder,
|
397
|
+
entry->tracer);
|
398
|
+
|
399
|
+
return JS_DHASH_NEXT;
|
400
|
+
}
|
401
|
+
|
402
|
+
|
403
|
+
void XPCJSRuntime::AddXPConnectRoots(JSContext* cx,
|
404
|
+
nsCycleCollectionTraversalCallback &cb)
|
405
|
+
{
|
406
|
+
// For all JS objects that are held by native objects but aren't held
|
407
|
+
// through rooting or locking, we need to add all the native objects that
|
408
|
+
// hold them so that the JS objects are colored correctly in the cycle
|
409
|
+
// collector. This includes JSContexts that don't have outstanding requests,
|
410
|
+
// because their global object wasn't marked by the JS GC. All other JS
|
411
|
+
// roots were marked by the JS GC and will be colored correctly in the cycle
|
412
|
+
// collector.
|
413
|
+
|
414
|
+
JSContext *iter = nsnull, *acx;
|
415
|
+
while((acx = JS_ContextIterator(GetJSRuntime(), &iter)))
|
416
|
+
{
|
417
|
+
#ifndef DEBUG_CC
|
418
|
+
// Only skip JSContexts with outstanding requests if DEBUG_CC is not
|
419
|
+
// defined, else we do want to know about all JSContexts to get better
|
420
|
+
// graphs and explanations.
|
421
|
+
if(nsXPConnect::GetXPConnect()->GetRequestDepth(acx) != 0)
|
422
|
+
continue;
|
423
|
+
#endif
|
424
|
+
cb.NoteRoot(nsIProgrammingLanguage::CPLUSPLUS, acx,
|
425
|
+
nsXPConnect::JSContextParticipant());
|
426
|
+
}
|
427
|
+
|
428
|
+
XPCWrappedNativeScope::SuspectAllWrappers(this, cx, cb);
|
429
|
+
|
430
|
+
for(XPCRootSetElem *e = mVariantRoots; e ; e = e->GetNextRoot())
|
431
|
+
cb.NoteXPCOMRoot(static_cast<XPCTraceableVariant*>(e));
|
432
|
+
|
433
|
+
for(XPCRootSetElem *e = mWrappedJSRoots; e ; e = e->GetNextRoot())
|
434
|
+
{
|
435
|
+
nsIXPConnectWrappedJS *wrappedJS = static_cast<nsXPCWrappedJS*>(e);
|
436
|
+
cb.NoteXPCOMRoot(wrappedJS);
|
437
|
+
}
|
438
|
+
|
439
|
+
if(mJSHolders.ops)
|
440
|
+
JS_DHashTableEnumerate(&mJSHolders, NoteJSHolder, &cb);
|
441
|
+
}
|
442
|
+
|
443
|
+
void XPCJSRuntime::UnrootContextGlobals()
|
444
|
+
{
|
445
|
+
mUnrootedGlobalCount = 0;
|
446
|
+
JSContext *iter = nsnull, *acx;
|
447
|
+
while((acx = JS_ContextIterator(GetJSRuntime(), &iter)))
|
448
|
+
{
|
449
|
+
NS_ASSERTION(!JS_HAS_OPTION(acx, JSOPTION_UNROOTED_GLOBAL),
|
450
|
+
"unrooted global should be set only during CC");
|
451
|
+
if(nsXPConnect::GetXPConnect()->GetRequestDepth(acx) == 0)
|
452
|
+
{
|
453
|
+
JS_ClearNewbornRoots(acx);
|
454
|
+
if(acx->globalObject)
|
455
|
+
{
|
456
|
+
JS_ToggleOptions(acx, JSOPTION_UNROOTED_GLOBAL);
|
457
|
+
++mUnrootedGlobalCount;
|
458
|
+
}
|
459
|
+
}
|
460
|
+
}
|
461
|
+
}
|
462
|
+
|
463
|
+
#ifdef DEBUG_CC
|
464
|
+
void XPCJSRuntime::RootContextGlobals()
|
465
|
+
{
|
466
|
+
JSContext *iter = nsnull, *acx;
|
467
|
+
while((acx = JS_ContextIterator(GetJSRuntime(), &iter)))
|
468
|
+
{
|
469
|
+
if(JS_HAS_OPTION(acx, JSOPTION_UNROOTED_GLOBAL))
|
470
|
+
{
|
471
|
+
JS_ToggleOptions(acx, JSOPTION_UNROOTED_GLOBAL);
|
472
|
+
--mUnrootedGlobalCount;
|
473
|
+
}
|
474
|
+
}
|
475
|
+
NS_ASSERTION(mUnrootedGlobalCount == 0, "bad state");
|
476
|
+
}
|
477
|
+
#endif
|
478
|
+
|
479
|
+
// static
|
480
|
+
JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
|
481
|
+
{
|
482
|
+
nsVoidArray* dyingWrappedJSArray;
|
483
|
+
|
484
|
+
XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
|
485
|
+
if(self)
|
486
|
+
{
|
487
|
+
switch(status)
|
488
|
+
{
|
489
|
+
case JSGC_BEGIN:
|
490
|
+
{
|
491
|
+
if(!NS_IsMainThread())
|
492
|
+
{
|
493
|
+
return JS_FALSE;
|
494
|
+
}
|
495
|
+
break;
|
496
|
+
}
|
497
|
+
case JSGC_MARK_END:
|
498
|
+
{
|
499
|
+
NS_ASSERTION(!self->mDoingFinalization, "bad state");
|
500
|
+
|
501
|
+
// mThreadRunningGC indicates that GC is running
|
502
|
+
{ // scoped lock
|
503
|
+
XPCAutoLock lock(self->GetMapLock());
|
504
|
+
NS_ASSERTION(!self->mThreadRunningGC, "bad state");
|
505
|
+
self->mThreadRunningGC = PR_GetCurrentThread();
|
506
|
+
}
|
507
|
+
|
508
|
+
dyingWrappedJSArray = &self->mWrappedJSToReleaseArray;
|
509
|
+
|
510
|
+
{
|
511
|
+
JSDyingJSObjectData data = {cx, dyingWrappedJSArray};
|
512
|
+
|
513
|
+
// Add any wrappers whose JSObjects are to be finalized to
|
514
|
+
// this array. Note that this is a nsVoidArray because
|
515
|
+
// we do not want to be changing the refcount of these wrappers.
|
516
|
+
// We add them to the array now and Release the array members
|
517
|
+
// later to avoid the posibility of doing any JS GCThing
|
518
|
+
// allocations during the gc cycle.
|
519
|
+
self->mWrappedJSMap->
|
520
|
+
Enumerate(WrappedJSDyingJSObjectFinder, &data);
|
521
|
+
}
|
522
|
+
|
523
|
+
// Do cleanup in NativeInterfaces. This part just finds
|
524
|
+
// member cloned function objects that are about to be
|
525
|
+
// collected. It does not deal with collection of interfaces or
|
526
|
+
// sets at this point.
|
527
|
+
CX_AND_XPCRT_Data data = {cx, self};
|
528
|
+
|
529
|
+
self->mIID2NativeInterfaceMap->
|
530
|
+
Enumerate(NativeInterfaceGC, &data);
|
531
|
+
|
532
|
+
// Find dying scopes...
|
533
|
+
XPCWrappedNativeScope::FinishedMarkPhaseOfGC(cx, self);
|
534
|
+
|
535
|
+
self->mDoingFinalization = JS_TRUE;
|
536
|
+
break;
|
537
|
+
}
|
538
|
+
case JSGC_FINALIZE_END:
|
539
|
+
{
|
540
|
+
NS_ASSERTION(self->mDoingFinalization, "bad state");
|
541
|
+
self->mDoingFinalization = JS_FALSE;
|
542
|
+
|
543
|
+
// Release all the members whose JSObjects are now known
|
544
|
+
// to be dead.
|
545
|
+
|
546
|
+
dyingWrappedJSArray = &self->mWrappedJSToReleaseArray;
|
547
|
+
while(1)
|
548
|
+
{
|
549
|
+
nsXPCWrappedJS* wrapper;
|
550
|
+
PRInt32 count = dyingWrappedJSArray->Count();
|
551
|
+
if(!count)
|
552
|
+
{
|
553
|
+
dyingWrappedJSArray->Compact();
|
554
|
+
break;
|
555
|
+
}
|
556
|
+
wrapper = static_cast<nsXPCWrappedJS*>
|
557
|
+
(dyingWrappedJSArray->ElementAt(count-1));
|
558
|
+
dyingWrappedJSArray->RemoveElementAt(count-1);
|
559
|
+
NS_RELEASE(wrapper);
|
560
|
+
}
|
561
|
+
|
562
|
+
|
563
|
+
#ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
|
564
|
+
printf("--------------------------------------------------------------\n");
|
565
|
+
int setsBefore = (int) self->mNativeSetMap->Count();
|
566
|
+
int ifacesBefore = (int) self->mIID2NativeInterfaceMap->Count();
|
567
|
+
#endif
|
568
|
+
|
569
|
+
// We use this occasion to mark and sweep NativeInterfaces,
|
570
|
+
// NativeSets, and the WrappedNativeJSClasses...
|
571
|
+
|
572
|
+
// Do the marking...
|
573
|
+
XPCWrappedNativeScope::MarkAllWrappedNativesAndProtos();
|
574
|
+
|
575
|
+
self->mDetachedWrappedNativeProtoMap->
|
576
|
+
Enumerate(DetachedWrappedNativeProtoMarker, nsnull);
|
577
|
+
|
578
|
+
DOM_MarkInterfaces();
|
579
|
+
|
580
|
+
// Mark the sets used in the call contexts. There is a small
|
581
|
+
// chance that a wrapper's set will change *while* a call is
|
582
|
+
// happening which uses that wrapper's old interfface set. So,
|
583
|
+
// we need to do this marking to avoid collecting those sets
|
584
|
+
// that might no longer be otherwise reachable from the wrappers
|
585
|
+
// or the wrapperprotos.
|
586
|
+
|
587
|
+
// Skip this part if XPConnect is shutting down. We get into
|
588
|
+
// bad locking problems with the thread iteration otherwise.
|
589
|
+
if(!self->GetXPConnect()->IsShuttingDown())
|
590
|
+
{
|
591
|
+
PRLock* threadLock = XPCPerThreadData::GetLock();
|
592
|
+
if(threadLock)
|
593
|
+
{ // scoped lock
|
594
|
+
nsAutoLock lock(threadLock);
|
595
|
+
|
596
|
+
XPCPerThreadData* iterp = nsnull;
|
597
|
+
XPCPerThreadData* thread;
|
598
|
+
|
599
|
+
while(nsnull != (thread =
|
600
|
+
XPCPerThreadData::IterateThreads(&iterp)))
|
601
|
+
{
|
602
|
+
// Mark those AutoMarkingPtr lists!
|
603
|
+
thread->MarkAutoRootsAfterJSFinalize();
|
604
|
+
|
605
|
+
XPCCallContext* ccxp = thread->GetCallContext();
|
606
|
+
while(ccxp)
|
607
|
+
{
|
608
|
+
// Deal with the strictness of callcontext that
|
609
|
+
// complains if you ask for a set when
|
610
|
+
// it is in a state where the set could not
|
611
|
+
// possibly be valid.
|
612
|
+
if(ccxp->CanGetSet())
|
613
|
+
{
|
614
|
+
XPCNativeSet* set = ccxp->GetSet();
|
615
|
+
if(set)
|
616
|
+
set->Mark();
|
617
|
+
}
|
618
|
+
if(ccxp->CanGetInterface())
|
619
|
+
{
|
620
|
+
XPCNativeInterface* iface = ccxp->GetInterface();
|
621
|
+
if(iface)
|
622
|
+
iface->Mark();
|
623
|
+
}
|
624
|
+
ccxp = ccxp->GetPrevCallContext();
|
625
|
+
}
|
626
|
+
}
|
627
|
+
}
|
628
|
+
}
|
629
|
+
|
630
|
+
// Do the sweeping...
|
631
|
+
|
632
|
+
// We don't want to sweep the JSClasses at shutdown time.
|
633
|
+
// At this point there may be JSObjects using them that have
|
634
|
+
// been removed from the other maps.
|
635
|
+
if(!self->GetXPConnect()->IsShuttingDown())
|
636
|
+
{
|
637
|
+
self->mNativeScriptableSharedMap->
|
638
|
+
Enumerate(JSClassSweeper, nsnull);
|
639
|
+
}
|
640
|
+
|
641
|
+
self->mClassInfo2NativeSetMap->
|
642
|
+
Enumerate(NativeUnMarkedSetRemover, nsnull);
|
643
|
+
|
644
|
+
self->mNativeSetMap->
|
645
|
+
Enumerate(NativeSetSweeper, nsnull);
|
646
|
+
|
647
|
+
CX_AND_XPCRT_Data data = {cx, self};
|
648
|
+
|
649
|
+
self->mIID2NativeInterfaceMap->
|
650
|
+
Enumerate(NativeInterfaceSweeper, &data);
|
651
|
+
|
652
|
+
#ifdef DEBUG
|
653
|
+
XPCWrappedNativeScope::ASSERT_NoInterfaceSetsAreMarked();
|
654
|
+
#endif
|
655
|
+
|
656
|
+
#ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
|
657
|
+
int setsAfter = (int) self->mNativeSetMap->Count();
|
658
|
+
int ifacesAfter = (int) self->mIID2NativeInterfaceMap->Count();
|
659
|
+
|
660
|
+
printf("\n");
|
661
|
+
printf("XPCNativeSets: before: %d collected: %d remaining: %d\n",
|
662
|
+
setsBefore, setsBefore - setsAfter, setsAfter);
|
663
|
+
printf("XPCNativeInterfaces: before: %d collected: %d remaining: %d\n",
|
664
|
+
ifacesBefore, ifacesBefore - ifacesAfter, ifacesAfter);
|
665
|
+
printf("--------------------------------------------------------------\n");
|
666
|
+
#endif
|
667
|
+
|
668
|
+
// Sweep scopes needing cleanup
|
669
|
+
XPCWrappedNativeScope::FinishedFinalizationPhaseOfGC(cx);
|
670
|
+
|
671
|
+
// Now we are going to recycle any unused WrappedNativeTearoffs.
|
672
|
+
// We do this by iterating all the live callcontexts (on all
|
673
|
+
// threads!) and marking the tearoffs in use. And then we
|
674
|
+
// iterate over all the WrappedNative wrappers and sweep their
|
675
|
+
// tearoffs.
|
676
|
+
//
|
677
|
+
// This allows us to perhaps minimize the growth of the
|
678
|
+
// tearoffs. And also makes us not hold references to interfaces
|
679
|
+
// on our wrapped natives that we are not actually using.
|
680
|
+
//
|
681
|
+
// XXX We may decide to not do this on *every* gc cycle.
|
682
|
+
|
683
|
+
// Skip this part if XPConnect is shutting down. We get into
|
684
|
+
// bad locking problems with the thread iteration otherwise.
|
685
|
+
if(!self->GetXPConnect()->IsShuttingDown())
|
686
|
+
{
|
687
|
+
PRLock* threadLock = XPCPerThreadData::GetLock();
|
688
|
+
if(threadLock)
|
689
|
+
{
|
690
|
+
// Do the marking...
|
691
|
+
|
692
|
+
{ // scoped lock
|
693
|
+
nsAutoLock lock(threadLock);
|
694
|
+
|
695
|
+
XPCPerThreadData* iterp = nsnull;
|
696
|
+
XPCPerThreadData* thread;
|
697
|
+
|
698
|
+
while(nsnull != (thread =
|
699
|
+
XPCPerThreadData::IterateThreads(&iterp)))
|
700
|
+
{
|
701
|
+
XPCCallContext* ccxp = thread->GetCallContext();
|
702
|
+
while(ccxp)
|
703
|
+
{
|
704
|
+
// Deal with the strictness of callcontext that
|
705
|
+
// complains if you ask for a tearoff when
|
706
|
+
// it is in a state where the tearoff could not
|
707
|
+
// possibly be valid.
|
708
|
+
if(ccxp->CanGetTearOff())
|
709
|
+
{
|
710
|
+
XPCWrappedNativeTearOff* to =
|
711
|
+
ccxp->GetTearOff();
|
712
|
+
if(to)
|
713
|
+
to->Mark();
|
714
|
+
}
|
715
|
+
ccxp = ccxp->GetPrevCallContext();
|
716
|
+
}
|
717
|
+
}
|
718
|
+
}
|
719
|
+
|
720
|
+
// Do the sweeping...
|
721
|
+
XPCWrappedNativeScope::SweepAllWrappedNativeTearOffs();
|
722
|
+
}
|
723
|
+
}
|
724
|
+
|
725
|
+
// Now we need to kill the 'Dying' XPCWrappedNativeProtos.
|
726
|
+
// We transfered these native objects to this table when their
|
727
|
+
// JSObject's were finalized. We did not destroy them immediately
|
728
|
+
// at that point because the ordering of JS finalization is not
|
729
|
+
// deterministic and we did not yet know if any wrappers that
|
730
|
+
// might still be referencing the protos where still yet to be
|
731
|
+
// finalized and destroyed. We *do* know that the protos'
|
732
|
+
// JSObjects would not have been finalized if there were any
|
733
|
+
// wrappers that referenced the proto but where not themselves
|
734
|
+
// slated for finalization in this gc cycle. So... at this point
|
735
|
+
// we know that any and all wrappers that might have been
|
736
|
+
// referencing the protos in the dying list are themselves dead.
|
737
|
+
// So, we can safely delete all the protos in the list.
|
738
|
+
|
739
|
+
self->mDyingWrappedNativeProtoMap->
|
740
|
+
Enumerate(DyingProtoKiller, nsnull);
|
741
|
+
|
742
|
+
|
743
|
+
// mThreadRunningGC indicates that GC is running.
|
744
|
+
// Clear it and notify waiters.
|
745
|
+
{ // scoped lock
|
746
|
+
XPCAutoLock lock(self->GetMapLock());
|
747
|
+
NS_ASSERTION(self->mThreadRunningGC == PR_GetCurrentThread(), "bad state");
|
748
|
+
self->mThreadRunningGC = nsnull;
|
749
|
+
xpc_NotifyAll(self->GetMapLock());
|
750
|
+
}
|
751
|
+
|
752
|
+
break;
|
753
|
+
}
|
754
|
+
case JSGC_END:
|
755
|
+
{
|
756
|
+
// NOTE that this event happens outside of the gc lock in
|
757
|
+
// the js engine. So this could be simultaneous with the
|
758
|
+
// events above.
|
759
|
+
|
760
|
+
// Do any deferred released of native objects.
|
761
|
+
nsVoidArray* array = &self->mNativesToReleaseArray;
|
762
|
+
#ifdef XPC_TRACK_DEFERRED_RELEASES
|
763
|
+
printf("XPC - Begin deferred Release of %d nsISupports pointers\n",
|
764
|
+
array->Count());
|
765
|
+
#endif
|
766
|
+
while(1)
|
767
|
+
{
|
768
|
+
nsISupports* obj;
|
769
|
+
{
|
770
|
+
PRInt32 count = array->Count();
|
771
|
+
if(!count)
|
772
|
+
{
|
773
|
+
array->Compact();
|
774
|
+
break;
|
775
|
+
}
|
776
|
+
obj = reinterpret_cast<nsISupports*>
|
777
|
+
(array->ElementAt(count-1));
|
778
|
+
array->RemoveElementAt(count-1);
|
779
|
+
}
|
780
|
+
NS_RELEASE(obj);
|
781
|
+
}
|
782
|
+
#ifdef XPC_TRACK_DEFERRED_RELEASES
|
783
|
+
printf("XPC - End deferred Releases\n");
|
784
|
+
#endif
|
785
|
+
break;
|
786
|
+
}
|
787
|
+
default:
|
788
|
+
break;
|
789
|
+
}
|
790
|
+
}
|
791
|
+
|
792
|
+
return JS_TRUE;
|
793
|
+
}
|
794
|
+
|
795
|
+
// Auto JS GC lock helper.
|
796
|
+
class AutoLockJSGC
|
797
|
+
{
|
798
|
+
public:
|
799
|
+
AutoLockJSGC(JSRuntime* rt) : mJSRuntime(rt) { JS_LOCK_GC(mJSRuntime); }
|
800
|
+
~AutoLockJSGC() { JS_UNLOCK_GC(mJSRuntime); }
|
801
|
+
private:
|
802
|
+
JSRuntime* mJSRuntime;
|
803
|
+
|
804
|
+
// Disable copy or assignment semantics.
|
805
|
+
AutoLockJSGC(const AutoLockJSGC&);
|
806
|
+
void operator=(const AutoLockJSGC&);
|
807
|
+
};
|
808
|
+
|
809
|
+
//static
|
810
|
+
void
|
811
|
+
XPCJSRuntime::WatchdogMain(void *arg)
|
812
|
+
{
|
813
|
+
XPCJSRuntime* self = static_cast<XPCJSRuntime*>(arg);
|
814
|
+
|
815
|
+
// Lock lasts until we return
|
816
|
+
AutoLockJSGC lock(self->mJSRuntime);
|
817
|
+
|
818
|
+
while (self->mWatchdogThread)
|
819
|
+
{
|
820
|
+
#ifdef DEBUG
|
821
|
+
PRStatus status =
|
822
|
+
#endif
|
823
|
+
PR_WaitCondVar(self->mWatchdogWakeup, PR_TicksPerSecond());
|
824
|
+
JS_ASSERT(status == PR_SUCCESS);
|
825
|
+
|
826
|
+
JSContext* cx = nsnull;
|
827
|
+
while((cx = js_NextActiveContext(self->mJSRuntime, cx)))
|
828
|
+
{
|
829
|
+
JS_TriggerOperationCallback(cx);
|
830
|
+
}
|
831
|
+
}
|
832
|
+
|
833
|
+
/* Wake up the main thread waiting for the watchdog to terminate. */
|
834
|
+
PR_NotifyCondVar(self->mWatchdogWakeup);
|
835
|
+
}
|
836
|
+
|
837
|
+
|
838
|
+
/***************************************************************************/
|
839
|
+
|
840
|
+
#ifdef XPC_CHECK_WRAPPERS_AT_SHUTDOWN
|
841
|
+
static JSDHashOperator
|
842
|
+
DEBUG_WrapperChecker(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
843
|
+
uint32 number, void *arg)
|
844
|
+
{
|
845
|
+
XPCWrappedNative* wrapper = (XPCWrappedNative*)((JSDHashEntryStub*)hdr)->key;
|
846
|
+
NS_ASSERTION(!wrapper->IsValid(), "found a 'valid' wrapper!");
|
847
|
+
++ *((int*)arg);
|
848
|
+
return JS_DHASH_NEXT;
|
849
|
+
}
|
850
|
+
#endif
|
851
|
+
|
852
|
+
static JSDHashOperator
|
853
|
+
WrappedJSShutdownMarker(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
854
|
+
uint32 number, void *arg)
|
855
|
+
{
|
856
|
+
JSRuntime* rt = (JSRuntime*) arg;
|
857
|
+
nsXPCWrappedJS* wrapper = ((JSObject2WrappedJSMap::Entry*)hdr)->value;
|
858
|
+
NS_ASSERTION(wrapper, "found a null JS wrapper!");
|
859
|
+
NS_ASSERTION(wrapper->IsValid(), "found an invalid JS wrapper!");
|
860
|
+
wrapper->SystemIsBeingShutDown(rt);
|
861
|
+
return JS_DHASH_NEXT;
|
862
|
+
}
|
863
|
+
|
864
|
+
static JSDHashOperator
|
865
|
+
DetachedWrappedNativeProtoShutdownMarker(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
866
|
+
uint32 number, void *arg)
|
867
|
+
{
|
868
|
+
XPCWrappedNativeProto* proto =
|
869
|
+
(XPCWrappedNativeProto*)((JSDHashEntryStub*)hdr)->key;
|
870
|
+
|
871
|
+
proto->SystemIsBeingShutDown((JSContext*)arg);
|
872
|
+
return JS_DHASH_NEXT;
|
873
|
+
}
|
874
|
+
|
875
|
+
void XPCJSRuntime::SystemIsBeingShutDown(JSContext* cx)
|
876
|
+
{
|
877
|
+
DOM_ClearInterfaces();
|
878
|
+
|
879
|
+
if(mDetachedWrappedNativeProtoMap)
|
880
|
+
mDetachedWrappedNativeProtoMap->
|
881
|
+
Enumerate(DetachedWrappedNativeProtoShutdownMarker, cx);
|
882
|
+
}
|
883
|
+
|
884
|
+
XPCJSRuntime::~XPCJSRuntime()
|
885
|
+
{
|
886
|
+
if (mWatchdogWakeup)
|
887
|
+
{
|
888
|
+
// If the watchdog thread is running, tell it to terminate waking it
|
889
|
+
// up if necessary and wait until it signals that it finished. As we
|
890
|
+
// must release the lock before calling PR_DestroyCondVar, we use an
|
891
|
+
// extra block here.
|
892
|
+
{
|
893
|
+
AutoLockJSGC lock(mJSRuntime);
|
894
|
+
if (mWatchdogThread) {
|
895
|
+
mWatchdogThread = nsnull;
|
896
|
+
PR_NotifyCondVar(mWatchdogWakeup);
|
897
|
+
PR_WaitCondVar(mWatchdogWakeup, PR_INTERVAL_NO_TIMEOUT);
|
898
|
+
}
|
899
|
+
}
|
900
|
+
PR_DestroyCondVar(mWatchdogWakeup);
|
901
|
+
mWatchdogWakeup = nsnull;
|
902
|
+
}
|
903
|
+
|
904
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
905
|
+
{
|
906
|
+
// count the total JSContexts in use
|
907
|
+
JSContext* iter = nsnull;
|
908
|
+
int count = 0;
|
909
|
+
while(JS_ContextIterator(mJSRuntime, &iter))
|
910
|
+
count ++;
|
911
|
+
if(count)
|
912
|
+
printf("deleting XPCJSRuntime with %d live JSContexts\n", count);
|
913
|
+
}
|
914
|
+
#endif
|
915
|
+
|
916
|
+
// clean up and destroy maps...
|
917
|
+
if(mWrappedJSMap)
|
918
|
+
{
|
919
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
920
|
+
uint32 count = mWrappedJSMap->Count();
|
921
|
+
if(count)
|
922
|
+
printf("deleting XPCJSRuntime with %d live wrapped JSObject\n", (int)count);
|
923
|
+
#endif
|
924
|
+
mWrappedJSMap->Enumerate(WrappedJSShutdownMarker, mJSRuntime);
|
925
|
+
delete mWrappedJSMap;
|
926
|
+
}
|
927
|
+
|
928
|
+
if(mWrappedJSClassMap)
|
929
|
+
{
|
930
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
931
|
+
uint32 count = mWrappedJSClassMap->Count();
|
932
|
+
if(count)
|
933
|
+
printf("deleting XPCJSRuntime with %d live nsXPCWrappedJSClass\n", (int)count);
|
934
|
+
#endif
|
935
|
+
delete mWrappedJSClassMap;
|
936
|
+
}
|
937
|
+
|
938
|
+
if(mIID2NativeInterfaceMap)
|
939
|
+
{
|
940
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
941
|
+
uint32 count = mIID2NativeInterfaceMap->Count();
|
942
|
+
if(count)
|
943
|
+
printf("deleting XPCJSRuntime with %d live XPCNativeInterfaces\n", (int)count);
|
944
|
+
#endif
|
945
|
+
delete mIID2NativeInterfaceMap;
|
946
|
+
}
|
947
|
+
|
948
|
+
if(mClassInfo2NativeSetMap)
|
949
|
+
{
|
950
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
951
|
+
uint32 count = mClassInfo2NativeSetMap->Count();
|
952
|
+
if(count)
|
953
|
+
printf("deleting XPCJSRuntime with %d live XPCNativeSets\n", (int)count);
|
954
|
+
#endif
|
955
|
+
delete mClassInfo2NativeSetMap;
|
956
|
+
}
|
957
|
+
|
958
|
+
if(mNativeSetMap)
|
959
|
+
{
|
960
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
961
|
+
uint32 count = mNativeSetMap->Count();
|
962
|
+
if(count)
|
963
|
+
printf("deleting XPCJSRuntime with %d live XPCNativeSets\n", (int)count);
|
964
|
+
#endif
|
965
|
+
delete mNativeSetMap;
|
966
|
+
}
|
967
|
+
|
968
|
+
if(mMapLock)
|
969
|
+
XPCAutoLock::DestroyLock(mMapLock);
|
970
|
+
|
971
|
+
if(mThisTranslatorMap)
|
972
|
+
{
|
973
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
974
|
+
uint32 count = mThisTranslatorMap->Count();
|
975
|
+
if(count)
|
976
|
+
printf("deleting XPCJSRuntime with %d live ThisTranslator\n", (int)count);
|
977
|
+
#endif
|
978
|
+
delete mThisTranslatorMap;
|
979
|
+
}
|
980
|
+
|
981
|
+
#ifdef XPC_CHECK_WRAPPERS_AT_SHUTDOWN
|
982
|
+
if(DEBUG_WrappedNativeHashtable)
|
983
|
+
{
|
984
|
+
int LiveWrapperCount = 0;
|
985
|
+
JS_DHashTableEnumerate(DEBUG_WrappedNativeHashtable,
|
986
|
+
DEBUG_WrapperChecker, &LiveWrapperCount);
|
987
|
+
if(LiveWrapperCount)
|
988
|
+
printf("deleting XPCJSRuntime with %d live XPCWrappedNative (found in wrapper check)\n", (int)LiveWrapperCount);
|
989
|
+
JS_DHashTableDestroy(DEBUG_WrappedNativeHashtable);
|
990
|
+
}
|
991
|
+
#endif
|
992
|
+
|
993
|
+
if(mNativeScriptableSharedMap)
|
994
|
+
{
|
995
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
996
|
+
uint32 count = mNativeScriptableSharedMap->Count();
|
997
|
+
if(count)
|
998
|
+
printf("deleting XPCJSRuntime with %d live XPCNativeScriptableShared\n", (int)count);
|
999
|
+
#endif
|
1000
|
+
delete mNativeScriptableSharedMap;
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
if(mDyingWrappedNativeProtoMap)
|
1004
|
+
{
|
1005
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
1006
|
+
uint32 count = mDyingWrappedNativeProtoMap->Count();
|
1007
|
+
if(count)
|
1008
|
+
printf("deleting XPCJSRuntime with %d live but dying XPCWrappedNativeProto\n", (int)count);
|
1009
|
+
#endif
|
1010
|
+
delete mDyingWrappedNativeProtoMap;
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
if(mDetachedWrappedNativeProtoMap)
|
1014
|
+
{
|
1015
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
1016
|
+
uint32 count = mDetachedWrappedNativeProtoMap->Count();
|
1017
|
+
if(count)
|
1018
|
+
printf("deleting XPCJSRuntime with %d live detached XPCWrappedNativeProto\n", (int)count);
|
1019
|
+
#endif
|
1020
|
+
delete mDetachedWrappedNativeProtoMap;
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
if(mExplicitNativeWrapperMap)
|
1024
|
+
{
|
1025
|
+
#ifdef XPC_DUMP_AT_SHUTDOWN
|
1026
|
+
uint32 count = mExplicitNativeWrapperMap->Count();
|
1027
|
+
if(count)
|
1028
|
+
printf("deleting XPCJSRuntime with %d live explicit XPCNativeWrapper\n", (int)count);
|
1029
|
+
#endif
|
1030
|
+
delete mExplicitNativeWrapperMap;
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
// unwire the readable/JSString sharing magic
|
1034
|
+
XPCStringConvert::ShutdownDOMStringFinalizer();
|
1035
|
+
|
1036
|
+
XPCConvert::RemoveXPCOMUCStringFinalizer();
|
1037
|
+
|
1038
|
+
if(mJSHolders.ops)
|
1039
|
+
{
|
1040
|
+
JS_DHashTableFinish(&mJSHolders);
|
1041
|
+
mJSHolders.ops = nsnull;
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
if(mJSRuntime)
|
1045
|
+
{
|
1046
|
+
JS_DestroyRuntime(mJSRuntime);
|
1047
|
+
JS_ShutDown();
|
1048
|
+
#ifdef DEBUG_shaver_off
|
1049
|
+
fprintf(stderr, "nJRSI: destroyed runtime %p\n", (void *)mJSRuntime);
|
1050
|
+
#endif
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
XPCPerThreadData::ShutDown();
|
1054
|
+
}
|
1055
|
+
|
1056
|
+
XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
1057
|
+
: mXPConnect(aXPConnect),
|
1058
|
+
mJSRuntime(nsnull),
|
1059
|
+
mWrappedJSMap(JSObject2WrappedJSMap::newMap(XPC_JS_MAP_SIZE)),
|
1060
|
+
mWrappedJSClassMap(IID2WrappedJSClassMap::newMap(XPC_JS_CLASS_MAP_SIZE)),
|
1061
|
+
mIID2NativeInterfaceMap(IID2NativeInterfaceMap::newMap(XPC_NATIVE_INTERFACE_MAP_SIZE)),
|
1062
|
+
mClassInfo2NativeSetMap(ClassInfo2NativeSetMap::newMap(XPC_NATIVE_SET_MAP_SIZE)),
|
1063
|
+
mNativeSetMap(NativeSetMap::newMap(XPC_NATIVE_SET_MAP_SIZE)),
|
1064
|
+
mThisTranslatorMap(IID2ThisTranslatorMap::newMap(XPC_THIS_TRANSLATOR_MAP_SIZE)),
|
1065
|
+
mNativeScriptableSharedMap(XPCNativeScriptableSharedMap::newMap(XPC_NATIVE_JSCLASS_MAP_SIZE)),
|
1066
|
+
mDyingWrappedNativeProtoMap(XPCWrappedNativeProtoMap::newMap(XPC_DYING_NATIVE_PROTO_MAP_SIZE)),
|
1067
|
+
mDetachedWrappedNativeProtoMap(XPCWrappedNativeProtoMap::newMap(XPC_DETACHED_NATIVE_PROTO_MAP_SIZE)),
|
1068
|
+
mExplicitNativeWrapperMap(XPCNativeWrapperMap::newMap(XPC_NATIVE_WRAPPER_MAP_SIZE)),
|
1069
|
+
mMapLock(XPCAutoLock::NewLock("XPCJSRuntime::mMapLock")),
|
1070
|
+
mThreadRunningGC(nsnull),
|
1071
|
+
mWrappedJSToReleaseArray(),
|
1072
|
+
mNativesToReleaseArray(),
|
1073
|
+
mDoingFinalization(JS_FALSE),
|
1074
|
+
mVariantRoots(nsnull),
|
1075
|
+
mWrappedJSRoots(nsnull),
|
1076
|
+
mObjectHolderRoots(nsnull),
|
1077
|
+
mUnrootedGlobalCount(0),
|
1078
|
+
mWatchdogWakeup(nsnull),
|
1079
|
+
mWatchdogThread(nsnull)
|
1080
|
+
{
|
1081
|
+
#ifdef XPC_CHECK_WRAPPERS_AT_SHUTDOWN
|
1082
|
+
DEBUG_WrappedNativeHashtable =
|
1083
|
+
JS_NewDHashTable(JS_DHashGetStubOps(), nsnull,
|
1084
|
+
sizeof(JSDHashEntryStub), 128);
|
1085
|
+
#endif
|
1086
|
+
|
1087
|
+
DOM_InitInterfaces();
|
1088
|
+
|
1089
|
+
// these jsids filled in later when we have a JSContext to work with.
|
1090
|
+
mStrIDs[0] = 0;
|
1091
|
+
|
1092
|
+
mJSRuntime = JS_NewRuntime(32L * 1024L * 1024L); // pref ?
|
1093
|
+
if(mJSRuntime)
|
1094
|
+
{
|
1095
|
+
// Unconstrain the runtime's threshold on nominal heap size, to avoid
|
1096
|
+
// triggering GC too often if operating continuously near an arbitrary
|
1097
|
+
// finite threshold (0xffffffff is infinity for uint32 parameters).
|
1098
|
+
// This leaves the maximum-JS_malloc-bytes threshold still in effect
|
1099
|
+
// to cause period, and we hope hygienic, last-ditch GCs from within
|
1100
|
+
// the GC's allocator.
|
1101
|
+
JS_SetGCParameter(mJSRuntime, JSGC_MAX_BYTES, 0xffffffff);
|
1102
|
+
JS_SetContextCallback(mJSRuntime, ContextCallback);
|
1103
|
+
JS_SetGCCallbackRT(mJSRuntime, GCCallback);
|
1104
|
+
JS_SetExtraGCRoots(mJSRuntime, TraceJS, this);
|
1105
|
+
mWatchdogWakeup = JS_NEW_CONDVAR(mJSRuntime->gcLock);
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
if(!JS_DHashTableInit(&mJSHolders, JS_DHashGetStubOps(), nsnull,
|
1109
|
+
sizeof(ObjectHolder), 512))
|
1110
|
+
mJSHolders.ops = nsnull;
|
1111
|
+
|
1112
|
+
// Install a JavaScript 'debugger' keyword handler in debug builds only
|
1113
|
+
#ifdef DEBUG
|
1114
|
+
if(mJSRuntime && !JS_GetGlobalDebugHooks(mJSRuntime)->debuggerHandler)
|
1115
|
+
xpc_InstallJSDebuggerKeywordHandler(mJSRuntime);
|
1116
|
+
#endif
|
1117
|
+
|
1118
|
+
AutoLockJSGC lock(mJSRuntime);
|
1119
|
+
|
1120
|
+
mWatchdogThread = PR_CreateThread(PR_USER_THREAD, WatchdogMain, this,
|
1121
|
+
PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
|
1122
|
+
PR_UNJOINABLE_THREAD, 0);
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
// static
|
1126
|
+
XPCJSRuntime*
|
1127
|
+
XPCJSRuntime::newXPCJSRuntime(nsXPConnect* aXPConnect)
|
1128
|
+
{
|
1129
|
+
NS_PRECONDITION(aXPConnect,"bad param");
|
1130
|
+
|
1131
|
+
XPCJSRuntime* self = new XPCJSRuntime(aXPConnect);
|
1132
|
+
|
1133
|
+
if(self &&
|
1134
|
+
self->GetJSRuntime() &&
|
1135
|
+
self->GetWrappedJSMap() &&
|
1136
|
+
self->GetWrappedJSClassMap() &&
|
1137
|
+
self->GetIID2NativeInterfaceMap() &&
|
1138
|
+
self->GetClassInfo2NativeSetMap() &&
|
1139
|
+
self->GetNativeSetMap() &&
|
1140
|
+
self->GetThisTranslatorMap() &&
|
1141
|
+
self->GetNativeScriptableSharedMap() &&
|
1142
|
+
self->GetDyingWrappedNativeProtoMap() &&
|
1143
|
+
self->GetExplicitNativeWrapperMap() &&
|
1144
|
+
self->GetMapLock() &&
|
1145
|
+
self->mWatchdogThread)
|
1146
|
+
{
|
1147
|
+
return self;
|
1148
|
+
}
|
1149
|
+
delete self;
|
1150
|
+
return nsnull;
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
JSBool
|
1154
|
+
XPCJSRuntime::OnJSContextNew(JSContext *cx)
|
1155
|
+
{
|
1156
|
+
// if it is our first context then we need to generate our string ids
|
1157
|
+
JSBool ok = JS_TRUE;
|
1158
|
+
if(!mStrIDs[0])
|
1159
|
+
{
|
1160
|
+
JS_SetGCParameterForThread(cx, JSGC_MAX_CODE_CACHE_BYTES, 16 * 1024 * 1024);
|
1161
|
+
JSAutoRequest ar(cx);
|
1162
|
+
for(uintN i = 0; i < IDX_TOTAL_COUNT; i++)
|
1163
|
+
{
|
1164
|
+
JSString* str = JS_InternString(cx, mStrings[i]);
|
1165
|
+
if(!str || !JS_ValueToId(cx, STRING_TO_JSVAL(str), &mStrIDs[i]))
|
1166
|
+
{
|
1167
|
+
mStrIDs[0] = 0;
|
1168
|
+
ok = JS_FALSE;
|
1169
|
+
break;
|
1170
|
+
}
|
1171
|
+
mStrJSVals[i] = STRING_TO_JSVAL(str);
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
if (!ok)
|
1175
|
+
return JS_FALSE;
|
1176
|
+
|
1177
|
+
XPCPerThreadData* tls = XPCPerThreadData::GetData(cx);
|
1178
|
+
if(!tls)
|
1179
|
+
return JS_FALSE;
|
1180
|
+
|
1181
|
+
XPCContext* xpc = new XPCContext(this, cx);
|
1182
|
+
if (!xpc)
|
1183
|
+
return JS_FALSE;
|
1184
|
+
|
1185
|
+
JS_SetThreadStackLimit(cx, tls->GetStackLimit());
|
1186
|
+
JS_SetScriptStackQuota(cx, 100*1024*1024);
|
1187
|
+
return JS_TRUE;
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
JSBool
|
1191
|
+
XPCJSRuntime::DeferredRelease(nsISupports* obj)
|
1192
|
+
{
|
1193
|
+
NS_ASSERTION(obj, "bad param");
|
1194
|
+
|
1195
|
+
if(!mNativesToReleaseArray.Count())
|
1196
|
+
{
|
1197
|
+
// This array sometimes has 1000's
|
1198
|
+
// of entries, and usually has 50-200 entries. Avoid lots
|
1199
|
+
// of incremental grows. We compact it down when we're done.
|
1200
|
+
mNativesToReleaseArray.SizeTo(256);
|
1201
|
+
}
|
1202
|
+
return mNativesToReleaseArray.AppendElement(obj);
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
/***************************************************************************/
|
1206
|
+
|
1207
|
+
#ifdef DEBUG
|
1208
|
+
static JSDHashOperator
|
1209
|
+
WrappedJSClassMapDumpEnumerator(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
1210
|
+
uint32 number, void *arg)
|
1211
|
+
{
|
1212
|
+
((IID2WrappedJSClassMap::Entry*)hdr)->value->DebugDump(*(PRInt16*)arg);
|
1213
|
+
return JS_DHASH_NEXT;
|
1214
|
+
}
|
1215
|
+
static JSDHashOperator
|
1216
|
+
WrappedJSMapDumpEnumerator(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
1217
|
+
uint32 number, void *arg)
|
1218
|
+
{
|
1219
|
+
((JSObject2WrappedJSMap::Entry*)hdr)->value->DebugDump(*(PRInt16*)arg);
|
1220
|
+
return JS_DHASH_NEXT;
|
1221
|
+
}
|
1222
|
+
static JSDHashOperator
|
1223
|
+
NativeSetDumpEnumerator(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
1224
|
+
uint32 number, void *arg)
|
1225
|
+
{
|
1226
|
+
((NativeSetMap::Entry*)hdr)->key_value->DebugDump(*(PRInt16*)arg);
|
1227
|
+
return JS_DHASH_NEXT;
|
1228
|
+
}
|
1229
|
+
#endif
|
1230
|
+
|
1231
|
+
void
|
1232
|
+
XPCJSRuntime::DebugDump(PRInt16 depth)
|
1233
|
+
{
|
1234
|
+
#ifdef DEBUG
|
1235
|
+
depth--;
|
1236
|
+
XPC_LOG_ALWAYS(("XPCJSRuntime @ %x", this));
|
1237
|
+
XPC_LOG_INDENT();
|
1238
|
+
XPC_LOG_ALWAYS(("mXPConnect @ %x", mXPConnect));
|
1239
|
+
XPC_LOG_ALWAYS(("mJSRuntime @ %x", mJSRuntime));
|
1240
|
+
XPC_LOG_ALWAYS(("mMapLock @ %x", mMapLock));
|
1241
|
+
|
1242
|
+
XPC_LOG_ALWAYS(("mWrappedJSToReleaseArray @ %x with %d wrappers(s)", \
|
1243
|
+
&mWrappedJSToReleaseArray,
|
1244
|
+
mWrappedJSToReleaseArray.Count()));
|
1245
|
+
|
1246
|
+
int cxCount = 0;
|
1247
|
+
JSContext* iter = nsnull;
|
1248
|
+
while(JS_ContextIterator(mJSRuntime, &iter))
|
1249
|
+
++cxCount;
|
1250
|
+
XPC_LOG_ALWAYS(("%d JS context(s)", cxCount));
|
1251
|
+
|
1252
|
+
iter = nsnull;
|
1253
|
+
while(JS_ContextIterator(mJSRuntime, &iter))
|
1254
|
+
{
|
1255
|
+
XPCContext *xpc = XPCContext::GetXPCContext(iter);
|
1256
|
+
XPC_LOG_INDENT();
|
1257
|
+
xpc->DebugDump(depth);
|
1258
|
+
XPC_LOG_OUTDENT();
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
XPC_LOG_ALWAYS(("mWrappedJSClassMap @ %x with %d wrapperclasses(s)", \
|
1262
|
+
mWrappedJSClassMap, mWrappedJSClassMap ? \
|
1263
|
+
mWrappedJSClassMap->Count() : 0));
|
1264
|
+
// iterate wrappersclasses...
|
1265
|
+
if(depth && mWrappedJSClassMap && mWrappedJSClassMap->Count())
|
1266
|
+
{
|
1267
|
+
XPC_LOG_INDENT();
|
1268
|
+
mWrappedJSClassMap->Enumerate(WrappedJSClassMapDumpEnumerator, &depth);
|
1269
|
+
XPC_LOG_OUTDENT();
|
1270
|
+
}
|
1271
|
+
XPC_LOG_ALWAYS(("mWrappedJSMap @ %x with %d wrappers(s)", \
|
1272
|
+
mWrappedJSMap, mWrappedJSMap ? \
|
1273
|
+
mWrappedJSMap->Count() : 0));
|
1274
|
+
// iterate wrappers...
|
1275
|
+
if(depth && mWrappedJSMap && mWrappedJSMap->Count())
|
1276
|
+
{
|
1277
|
+
XPC_LOG_INDENT();
|
1278
|
+
mWrappedJSMap->Enumerate(WrappedJSMapDumpEnumerator, &depth);
|
1279
|
+
XPC_LOG_OUTDENT();
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
XPC_LOG_ALWAYS(("mIID2NativeInterfaceMap @ %x with %d interface(s)", \
|
1283
|
+
mIID2NativeInterfaceMap, mIID2NativeInterfaceMap ? \
|
1284
|
+
mIID2NativeInterfaceMap->Count() : 0));
|
1285
|
+
|
1286
|
+
XPC_LOG_ALWAYS(("mClassInfo2NativeSetMap @ %x with %d sets(s)", \
|
1287
|
+
mClassInfo2NativeSetMap, mClassInfo2NativeSetMap ? \
|
1288
|
+
mClassInfo2NativeSetMap->Count() : 0));
|
1289
|
+
|
1290
|
+
XPC_LOG_ALWAYS(("mThisTranslatorMap @ %x with %d translator(s)", \
|
1291
|
+
mThisTranslatorMap, mThisTranslatorMap ? \
|
1292
|
+
mThisTranslatorMap->Count() : 0));
|
1293
|
+
|
1294
|
+
XPC_LOG_ALWAYS(("mNativeSetMap @ %x with %d sets(s)", \
|
1295
|
+
mNativeSetMap, mNativeSetMap ? \
|
1296
|
+
mNativeSetMap->Count() : 0));
|
1297
|
+
|
1298
|
+
// iterate sets...
|
1299
|
+
if(depth && mNativeSetMap && mNativeSetMap->Count())
|
1300
|
+
{
|
1301
|
+
XPC_LOG_INDENT();
|
1302
|
+
mNativeSetMap->Enumerate(NativeSetDumpEnumerator, &depth);
|
1303
|
+
XPC_LOG_OUTDENT();
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
XPC_LOG_OUTDENT();
|
1307
|
+
#endif
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
/***************************************************************************/
|
1311
|
+
|
1312
|
+
void
|
1313
|
+
XPCRootSetElem::AddToRootSet(JSRuntime* rt, XPCRootSetElem** listHead)
|
1314
|
+
{
|
1315
|
+
NS_ASSERTION(!mSelfp, "Must be not linked");
|
1316
|
+
|
1317
|
+
AutoLockJSGC lock(rt);
|
1318
|
+
mSelfp = listHead;
|
1319
|
+
mNext = *listHead;
|
1320
|
+
if(mNext)
|
1321
|
+
{
|
1322
|
+
NS_ASSERTION(mNext->mSelfp == listHead, "Must be list start");
|
1323
|
+
mNext->mSelfp = &mNext;
|
1324
|
+
}
|
1325
|
+
*listHead = this;
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
void
|
1329
|
+
XPCRootSetElem::RemoveFromRootSet(JSRuntime* rt)
|
1330
|
+
{
|
1331
|
+
NS_ASSERTION(mSelfp, "Must be linked");
|
1332
|
+
|
1333
|
+
AutoLockJSGC lock(rt);
|
1334
|
+
NS_ASSERTION(*mSelfp == this, "Link invariant");
|
1335
|
+
*mSelfp = mNext;
|
1336
|
+
if(mNext)
|
1337
|
+
mNext->mSelfp = mSelfp;
|
1338
|
+
#ifdef DEBUG
|
1339
|
+
mSelfp = nsnull;
|
1340
|
+
mNext = nsnull;
|
1341
|
+
#endif
|
1342
|
+
}
|