johnson 2.0.0.pre1 → 2.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +12 -0
- data/Manifest.txt +4 -285
- data/Rakefile +13 -20
- data/ext/tracemonkey/global.cc +4 -1
- data/ext/tracemonkey/js.cc +30 -33
- data/ext/tracemonkey/runtime.cc +96 -6
- data/ext/tracemonkey/split_global.cc +0 -5
- data/ext/tracemonkey/tracemonkey.h +2 -2
- data/lib/johnson.rb +2 -2
- data/lib/johnson/runtime.rb +25 -15
- data/lib/johnson/tracemonkey/runtime.rb +6 -3
- data/vendor/tracemonkey/config/system-headers +1 -3
- data/vendor/tracemonkey/jscntxt.h +5 -2
- data/vendor/tracemonkey/jsdbgapi.cpp +9 -1
- data/vendor/tracemonkey/jsdbgapi.h +4 -0
- data/vendor/tracemonkey/tests/ecma/NativeObjects/browser.js +0 -0
- data/vendor/tracemonkey/tests/ecma/NativeObjects/jstests.list +0 -0
- data/vendor/tracemonkey/tests/ecma_3_1/Object/jstests.list +1 -1
- data/vendor/tracemonkey/tests/js1_3/misc/browser.js +0 -0
- data/vendor/tracemonkey/tests/js1_3/misc/jstests.list +0 -0
- data/vendor/tracemonkey/tests/js1_5/Regress/jstests.list +4 -4
- data/vendor/tracemonkey/tests/js1_5/Scope/jstests.list +1 -1
- data/vendor/tracemonkey/tests/js1_5/decompilation/jstests.list +2 -2
- data/vendor/tracemonkey/tests/js1_7/decompilation/jstests.list +1 -1
- data/vendor/tracemonkey/tests/shell.js +2 -1
- metadata +51 -309
- data/ext/spidermonkey/context.c +0 -116
- data/ext/spidermonkey/context.h +0 -19
- data/ext/spidermonkey/conversions.c +0 -361
- data/ext/spidermonkey/conversions.h +0 -31
- data/ext/spidermonkey/debugger.c +0 -234
- data/ext/spidermonkey/debugger.h +0 -10
- data/ext/spidermonkey/extconf.rb +0 -32
- data/ext/spidermonkey/extensions.c +0 -37
- data/ext/spidermonkey/extensions.h +0 -12
- data/ext/spidermonkey/global.c +0 -40
- data/ext/spidermonkey/global.h +0 -11
- data/ext/spidermonkey/idhash.c +0 -16
- data/ext/spidermonkey/idhash.h +0 -8
- data/ext/spidermonkey/immutable_node.c +0 -1153
- data/ext/spidermonkey/immutable_node.c.erb +0 -523
- data/ext/spidermonkey/immutable_node.h +0 -22
- data/ext/spidermonkey/jroot.h +0 -197
- data/ext/spidermonkey/js_land_proxy.c +0 -620
- data/ext/spidermonkey/js_land_proxy.h +0 -20
- data/ext/spidermonkey/ruby_land_proxy.c +0 -618
- data/ext/spidermonkey/ruby_land_proxy.h +0 -38
- data/ext/spidermonkey/runtime.c +0 -396
- data/ext/spidermonkey/runtime.h +0 -27
- data/ext/spidermonkey/spidermonkey.c +0 -22
- data/ext/spidermonkey/spidermonkey.h +0 -29
- data/lib/johnson/spidermonkey.rb +0 -12
- data/lib/johnson/spidermonkey/context.rb +0 -10
- data/lib/johnson/spidermonkey/debugger.rb +0 -67
- data/lib/johnson/spidermonkey/immutable_node.rb +0 -282
- data/lib/johnson/spidermonkey/js_land_proxy.rb +0 -64
- data/lib/johnson/spidermonkey/mutable_tree_visitor.rb +0 -242
- data/lib/johnson/spidermonkey/ruby_land_proxy.rb +0 -17
- data/lib/johnson/spidermonkey/runtime.rb +0 -74
- data/test/johnson/spidermonkey/context_test.rb +0 -21
- data/test/johnson/spidermonkey/immutable_node_test.rb +0 -34
- data/test/johnson/spidermonkey/js_land_proxy_test.rb +0 -273
- data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +0 -274
- data/test/johnson/spidermonkey/runtime_test.rb +0 -41
- data/vendor/spidermonkey/.cvsignore +0 -9
- data/vendor/spidermonkey/Makefile.in +0 -449
- data/vendor/spidermonkey/Makefile.ref +0 -365
- data/vendor/spidermonkey/README.html +0 -820
- data/vendor/spidermonkey/SpiderMonkey.rsp +0 -12
- data/vendor/spidermonkey/Y.js +0 -19
- data/vendor/spidermonkey/build.mk +0 -43
- data/vendor/spidermonkey/config.mk +0 -192
- data/vendor/spidermonkey/config/AIX4.1.mk +0 -65
- data/vendor/spidermonkey/config/AIX4.2.mk +0 -64
- data/vendor/spidermonkey/config/AIX4.3.mk +0 -65
- data/vendor/spidermonkey/config/Darwin.mk +0 -83
- data/vendor/spidermonkey/config/Darwin1.3.mk +0 -81
- data/vendor/spidermonkey/config/Darwin1.4.mk +0 -41
- data/vendor/spidermonkey/config/Darwin5.2.mk +0 -81
- data/vendor/spidermonkey/config/Darwin5.3.mk +0 -81
- data/vendor/spidermonkey/config/HP-UXB.10.10.mk +0 -77
- data/vendor/spidermonkey/config/HP-UXB.10.20.mk +0 -77
- data/vendor/spidermonkey/config/HP-UXB.11.00.mk +0 -80
- data/vendor/spidermonkey/config/IRIX.mk +0 -87
- data/vendor/spidermonkey/config/IRIX5.3.mk +0 -44
- data/vendor/spidermonkey/config/IRIX6.1.mk +0 -44
- data/vendor/spidermonkey/config/IRIX6.2.mk +0 -44
- data/vendor/spidermonkey/config/IRIX6.3.mk +0 -44
- data/vendor/spidermonkey/config/IRIX6.5.mk +0 -44
- data/vendor/spidermonkey/config/Linux_All.mk +0 -103
- data/vendor/spidermonkey/config/Mac_OS10.0.mk +0 -82
- data/vendor/spidermonkey/config/OSF1V4.0.mk +0 -72
- data/vendor/spidermonkey/config/OSF1V5.0.mk +0 -69
- data/vendor/spidermonkey/config/SunOS4.1.4.mk +0 -101
- data/vendor/spidermonkey/config/SunOS5.10.mk +0 -50
- data/vendor/spidermonkey/config/SunOS5.3.mk +0 -91
- data/vendor/spidermonkey/config/SunOS5.4.mk +0 -92
- data/vendor/spidermonkey/config/SunOS5.5.1.mk +0 -44
- data/vendor/spidermonkey/config/SunOS5.5.mk +0 -87
- data/vendor/spidermonkey/config/SunOS5.6.mk +0 -89
- data/vendor/spidermonkey/config/SunOS5.7.mk +0 -44
- data/vendor/spidermonkey/config/SunOS5.8.mk +0 -44
- data/vendor/spidermonkey/config/SunOS5.9.mk +0 -44
- data/vendor/spidermonkey/config/WINNT4.0.mk +0 -117
- data/vendor/spidermonkey/config/WINNT5.0.mk +0 -117
- data/vendor/spidermonkey/config/WINNT5.1.mk +0 -117
- data/vendor/spidermonkey/config/WINNT5.2.mk +0 -117
- data/vendor/spidermonkey/config/WINNT6.0.mk +0 -117
- data/vendor/spidermonkey/config/dgux.mk +0 -64
- data/vendor/spidermonkey/editline/Makefile.ref +0 -144
- data/vendor/spidermonkey/editline/README +0 -83
- data/vendor/spidermonkey/editline/editline.3 +0 -175
- data/vendor/spidermonkey/editline/editline.c +0 -1369
- data/vendor/spidermonkey/editline/editline.h +0 -135
- data/vendor/spidermonkey/editline/sysunix.c +0 -182
- data/vendor/spidermonkey/editline/unix.h +0 -82
- data/vendor/spidermonkey/fdlibm/.cvsignore +0 -7
- data/vendor/spidermonkey/fdlibm/Makefile.in +0 -127
- data/vendor/spidermonkey/fdlibm/Makefile.ref +0 -192
- data/vendor/spidermonkey/fdlibm/e_acos.c +0 -147
- data/vendor/spidermonkey/fdlibm/e_acosh.c +0 -105
- data/vendor/spidermonkey/fdlibm/e_asin.c +0 -156
- data/vendor/spidermonkey/fdlibm/e_atan2.c +0 -165
- data/vendor/spidermonkey/fdlibm/e_atanh.c +0 -110
- data/vendor/spidermonkey/fdlibm/e_cosh.c +0 -133
- data/vendor/spidermonkey/fdlibm/e_exp.c +0 -202
- data/vendor/spidermonkey/fdlibm/e_fmod.c +0 -184
- data/vendor/spidermonkey/fdlibm/e_gamma.c +0 -71
- data/vendor/spidermonkey/fdlibm/e_gamma_r.c +0 -70
- data/vendor/spidermonkey/fdlibm/e_hypot.c +0 -173
- data/vendor/spidermonkey/fdlibm/e_j0.c +0 -524
- data/vendor/spidermonkey/fdlibm/e_j1.c +0 -523
- data/vendor/spidermonkey/fdlibm/e_jn.c +0 -315
- data/vendor/spidermonkey/fdlibm/e_lgamma.c +0 -71
- data/vendor/spidermonkey/fdlibm/e_lgamma_r.c +0 -347
- data/vendor/spidermonkey/fdlibm/e_log.c +0 -184
- data/vendor/spidermonkey/fdlibm/e_log10.c +0 -134
- data/vendor/spidermonkey/fdlibm/e_pow.c +0 -386
- data/vendor/spidermonkey/fdlibm/e_rem_pio2.c +0 -222
- data/vendor/spidermonkey/fdlibm/e_remainder.c +0 -120
- data/vendor/spidermonkey/fdlibm/e_scalb.c +0 -89
- data/vendor/spidermonkey/fdlibm/e_sinh.c +0 -122
- data/vendor/spidermonkey/fdlibm/e_sqrt.c +0 -497
- data/vendor/spidermonkey/fdlibm/fdlibm.h +0 -273
- data/vendor/spidermonkey/fdlibm/fdlibm.mak +0 -1453
- data/vendor/spidermonkey/fdlibm/fdlibm.mdp +0 -0
- data/vendor/spidermonkey/fdlibm/k_cos.c +0 -135
- data/vendor/spidermonkey/fdlibm/k_rem_pio2.c +0 -354
- data/vendor/spidermonkey/fdlibm/k_sin.c +0 -114
- data/vendor/spidermonkey/fdlibm/k_standard.c +0 -785
- data/vendor/spidermonkey/fdlibm/k_tan.c +0 -170
- data/vendor/spidermonkey/fdlibm/s_asinh.c +0 -101
- data/vendor/spidermonkey/fdlibm/s_atan.c +0 -175
- data/vendor/spidermonkey/fdlibm/s_cbrt.c +0 -133
- data/vendor/spidermonkey/fdlibm/s_ceil.c +0 -120
- data/vendor/spidermonkey/fdlibm/s_copysign.c +0 -72
- data/vendor/spidermonkey/fdlibm/s_cos.c +0 -118
- data/vendor/spidermonkey/fdlibm/s_erf.c +0 -356
- data/vendor/spidermonkey/fdlibm/s_expm1.c +0 -267
- data/vendor/spidermonkey/fdlibm/s_fabs.c +0 -70
- data/vendor/spidermonkey/fdlibm/s_finite.c +0 -71
- data/vendor/spidermonkey/fdlibm/s_floor.c +0 -121
- data/vendor/spidermonkey/fdlibm/s_frexp.c +0 -99
- data/vendor/spidermonkey/fdlibm/s_ilogb.c +0 -85
- data/vendor/spidermonkey/fdlibm/s_isnan.c +0 -74
- data/vendor/spidermonkey/fdlibm/s_ldexp.c +0 -66
- data/vendor/spidermonkey/fdlibm/s_lib_version.c +0 -73
- data/vendor/spidermonkey/fdlibm/s_log1p.c +0 -211
- data/vendor/spidermonkey/fdlibm/s_logb.c +0 -79
- data/vendor/spidermonkey/fdlibm/s_matherr.c +0 -64
- data/vendor/spidermonkey/fdlibm/s_modf.c +0 -132
- data/vendor/spidermonkey/fdlibm/s_nextafter.c +0 -124
- data/vendor/spidermonkey/fdlibm/s_rint.c +0 -131
- data/vendor/spidermonkey/fdlibm/s_scalbn.c +0 -107
- data/vendor/spidermonkey/fdlibm/s_signgam.c +0 -40
- data/vendor/spidermonkey/fdlibm/s_significand.c +0 -68
- data/vendor/spidermonkey/fdlibm/s_sin.c +0 -118
- data/vendor/spidermonkey/fdlibm/s_tan.c +0 -112
- data/vendor/spidermonkey/fdlibm/s_tanh.c +0 -122
- data/vendor/spidermonkey/fdlibm/w_acos.c +0 -78
- data/vendor/spidermonkey/fdlibm/w_acosh.c +0 -78
- data/vendor/spidermonkey/fdlibm/w_asin.c +0 -80
- data/vendor/spidermonkey/fdlibm/w_atan2.c +0 -79
- data/vendor/spidermonkey/fdlibm/w_atanh.c +0 -81
- data/vendor/spidermonkey/fdlibm/w_cosh.c +0 -77
- data/vendor/spidermonkey/fdlibm/w_exp.c +0 -88
- data/vendor/spidermonkey/fdlibm/w_fmod.c +0 -78
- data/vendor/spidermonkey/fdlibm/w_gamma.c +0 -85
- data/vendor/spidermonkey/fdlibm/w_gamma_r.c +0 -81
- data/vendor/spidermonkey/fdlibm/w_hypot.c +0 -78
- data/vendor/spidermonkey/fdlibm/w_j0.c +0 -105
- data/vendor/spidermonkey/fdlibm/w_j1.c +0 -106
- data/vendor/spidermonkey/fdlibm/w_jn.c +0 -128
- data/vendor/spidermonkey/fdlibm/w_lgamma.c +0 -85
- data/vendor/spidermonkey/fdlibm/w_lgamma_r.c +0 -81
- data/vendor/spidermonkey/fdlibm/w_log.c +0 -78
- data/vendor/spidermonkey/fdlibm/w_log10.c +0 -81
- data/vendor/spidermonkey/fdlibm/w_pow.c +0 -99
- data/vendor/spidermonkey/fdlibm/w_remainder.c +0 -77
- data/vendor/spidermonkey/fdlibm/w_scalb.c +0 -95
- data/vendor/spidermonkey/fdlibm/w_sinh.c +0 -77
- data/vendor/spidermonkey/fdlibm/w_sqrt.c +0 -77
- data/vendor/spidermonkey/javascript-trace.d +0 -73
- data/vendor/spidermonkey/js.c +0 -3951
- data/vendor/spidermonkey/js.mdp +0 -0
- data/vendor/spidermonkey/js.msg +0 -308
- data/vendor/spidermonkey/js.pkg +0 -2
- data/vendor/spidermonkey/js3240.rc +0 -79
- data/vendor/spidermonkey/jsOS240.def +0 -654
- data/vendor/spidermonkey/jsapi.c +0 -5836
- data/vendor/spidermonkey/jsapi.h +0 -2624
- data/vendor/spidermonkey/jsarena.c +0 -450
- data/vendor/spidermonkey/jsarena.h +0 -318
- data/vendor/spidermonkey/jsarray.c +0 -2996
- data/vendor/spidermonkey/jsarray.h +0 -127
- data/vendor/spidermonkey/jsatom.c +0 -1045
- data/vendor/spidermonkey/jsatom.h +0 -442
- data/vendor/spidermonkey/jsbit.h +0 -253
- data/vendor/spidermonkey/jsbool.c +0 -176
- data/vendor/spidermonkey/jsbool.h +0 -73
- data/vendor/spidermonkey/jsclist.h +0 -139
- data/vendor/spidermonkey/jscntxt.c +0 -1348
- data/vendor/spidermonkey/jscntxt.h +0 -1120
- data/vendor/spidermonkey/jscompat.h +0 -57
- data/vendor/spidermonkey/jsconfig.h +0 -248
- data/vendor/spidermonkey/jsconfig.mk +0 -181
- data/vendor/spidermonkey/jscpucfg.c +0 -396
- data/vendor/spidermonkey/jscpucfg.h +0 -212
- data/vendor/spidermonkey/jsdate.c +0 -2390
- data/vendor/spidermonkey/jsdate.h +0 -124
- data/vendor/spidermonkey/jsdbgapi.c +0 -1802
- data/vendor/spidermonkey/jsdbgapi.h +0 -464
- data/vendor/spidermonkey/jsdhash.c +0 -868
- data/vendor/spidermonkey/jsdhash.h +0 -592
- data/vendor/spidermonkey/jsdtoa.c +0 -3167
- data/vendor/spidermonkey/jsdtoa.h +0 -130
- data/vendor/spidermonkey/jsdtracef.c +0 -317
- data/vendor/spidermonkey/jsdtracef.h +0 -77
- data/vendor/spidermonkey/jsemit.c +0 -6909
- data/vendor/spidermonkey/jsemit.h +0 -741
- data/vendor/spidermonkey/jsexn.c +0 -1371
- data/vendor/spidermonkey/jsexn.h +0 -96
- data/vendor/spidermonkey/jsfile.c +0 -2736
- data/vendor/spidermonkey/jsfile.h +0 -56
- data/vendor/spidermonkey/jsfile.msg +0 -90
- data/vendor/spidermonkey/jsfun.c +0 -2634
- data/vendor/spidermonkey/jsfun.h +0 -254
- data/vendor/spidermonkey/jsgc.c +0 -3562
- data/vendor/spidermonkey/jsgc.h +0 -403
- data/vendor/spidermonkey/jshash.c +0 -476
- data/vendor/spidermonkey/jshash.h +0 -151
- data/vendor/spidermonkey/jsify.pl +0 -485
- data/vendor/spidermonkey/jsinterp.c +0 -7007
- data/vendor/spidermonkey/jsinterp.h +0 -525
- data/vendor/spidermonkey/jsinvoke.c +0 -43
- data/vendor/spidermonkey/jsiter.c +0 -1067
- data/vendor/spidermonkey/jsiter.h +0 -122
- data/vendor/spidermonkey/jskeyword.tbl +0 -124
- data/vendor/spidermonkey/jskwgen.c +0 -460
- data/vendor/spidermonkey/jslibmath.h +0 -266
- data/vendor/spidermonkey/jslock.c +0 -1309
- data/vendor/spidermonkey/jslock.h +0 -313
- data/vendor/spidermonkey/jslocko.asm +0 -60
- data/vendor/spidermonkey/jslog2.c +0 -94
- data/vendor/spidermonkey/jslong.c +0 -264
- data/vendor/spidermonkey/jslong.h +0 -412
- data/vendor/spidermonkey/jsmath.c +0 -567
- data/vendor/spidermonkey/jsmath.h +0 -57
- data/vendor/spidermonkey/jsnum.c +0 -1239
- data/vendor/spidermonkey/jsnum.h +0 -283
- data/vendor/spidermonkey/jsobj.c +0 -5282
- data/vendor/spidermonkey/jsobj.h +0 -709
- data/vendor/spidermonkey/jsopcode.c +0 -5245
- data/vendor/spidermonkey/jsopcode.h +0 -394
- data/vendor/spidermonkey/jsopcode.tbl +0 -523
- data/vendor/spidermonkey/jsotypes.h +0 -202
- data/vendor/spidermonkey/jsparse.c +0 -6704
- data/vendor/spidermonkey/jsparse.h +0 -511
- data/vendor/spidermonkey/jsprf.c +0 -1264
- data/vendor/spidermonkey/jsprf.h +0 -150
- data/vendor/spidermonkey/jsproto.tbl +0 -128
- data/vendor/spidermonkey/jsprvtd.h +0 -267
- data/vendor/spidermonkey/jspubtd.h +0 -744
- data/vendor/spidermonkey/jsregexp.c +0 -4364
- data/vendor/spidermonkey/jsregexp.h +0 -183
- data/vendor/spidermonkey/jsreops.tbl +0 -145
- data/vendor/spidermonkey/jsscan.c +0 -2012
- data/vendor/spidermonkey/jsscan.h +0 -387
- data/vendor/spidermonkey/jsscope.c +0 -1957
- data/vendor/spidermonkey/jsscope.h +0 -418
- data/vendor/spidermonkey/jsscript.c +0 -1832
- data/vendor/spidermonkey/jsscript.h +0 -287
- data/vendor/spidermonkey/jsshell.msg +0 -50
- data/vendor/spidermonkey/jsstddef.h +0 -83
- data/vendor/spidermonkey/jsstr.c +0 -5005
- data/vendor/spidermonkey/jsstr.h +0 -641
- data/vendor/spidermonkey/jstypes.h +0 -475
- data/vendor/spidermonkey/jsutil.c +0 -345
- data/vendor/spidermonkey/jsutil.h +0 -157
- data/vendor/spidermonkey/jsxdrapi.c +0 -800
- data/vendor/spidermonkey/jsxdrapi.h +0 -218
- data/vendor/spidermonkey/jsxml.c +0 -8476
- data/vendor/spidermonkey/jsxml.h +0 -349
- data/vendor/spidermonkey/lock_SunOS.s +0 -119
- data/vendor/spidermonkey/perfect.js +0 -39
- data/vendor/spidermonkey/plify_jsdhash.sed +0 -36
- data/vendor/spidermonkey/prmjtime.c +0 -846
- data/vendor/spidermonkey/prmjtime.h +0 -103
- data/vendor/spidermonkey/resource.h +0 -15
- data/vendor/spidermonkey/rules.mk +0 -197
- data/vendor/spidermonkey/win32.order +0 -384
data/vendor/spidermonkey/jsobj.h
DELETED
@@ -1,709 +0,0 @@
|
|
1
|
-
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2
|
-
* vim: set ts=8 sw=4 et tw=78:
|
3
|
-
*
|
4
|
-
* ***** BEGIN LICENSE BLOCK *****
|
5
|
-
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
6
|
-
*
|
7
|
-
* The contents of this file are subject to the Mozilla Public License Version
|
8
|
-
* 1.1 (the "License"); you may not use this file except in compliance with
|
9
|
-
* the License. You may obtain a copy of the License at
|
10
|
-
* http://www.mozilla.org/MPL/
|
11
|
-
*
|
12
|
-
* Software distributed under the License is distributed on an "AS IS" basis,
|
13
|
-
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
14
|
-
* for the specific language governing rights and limitations under the
|
15
|
-
* License.
|
16
|
-
*
|
17
|
-
* The Original Code is Mozilla Communicator client code, released
|
18
|
-
* March 31, 1998.
|
19
|
-
*
|
20
|
-
* The Initial Developer of the Original Code is
|
21
|
-
* Netscape Communications Corporation.
|
22
|
-
* Portions created by the Initial Developer are Copyright (C) 1998
|
23
|
-
* the Initial Developer. All Rights Reserved.
|
24
|
-
*
|
25
|
-
* Contributor(s):
|
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
|
-
#ifndef jsobj_h___
|
42
|
-
#define jsobj_h___
|
43
|
-
/*
|
44
|
-
* JS object definitions.
|
45
|
-
*
|
46
|
-
* A JS object consists of a possibly-shared object descriptor containing
|
47
|
-
* ordered property names, called the map; and a dense vector of property
|
48
|
-
* values, called slots. The map/slot pointer pair is GC'ed, while the map
|
49
|
-
* is reference counted and the slot vector is malloc'ed.
|
50
|
-
*/
|
51
|
-
#include "jshash.h" /* Added by JSIFY */
|
52
|
-
#include "jsprvtd.h"
|
53
|
-
#include "jspubtd.h"
|
54
|
-
|
55
|
-
JS_BEGIN_EXTERN_C
|
56
|
-
|
57
|
-
struct JSObjectMap {
|
58
|
-
jsrefcount nrefs; /* count of all referencing objects */
|
59
|
-
JSObjectOps *ops; /* high level object operation vtable */
|
60
|
-
uint32 freeslot; /* index of next free slot in object */
|
61
|
-
};
|
62
|
-
|
63
|
-
/* Shorthand macros for frequently-made calls. */
|
64
|
-
#define OBJ_LOOKUP_PROPERTY(cx,obj,id,objp,propp) \
|
65
|
-
(obj)->map->ops->lookupProperty(cx,obj,id,objp,propp)
|
66
|
-
#define OBJ_DEFINE_PROPERTY(cx,obj,id,value,getter,setter,attrs,propp) \
|
67
|
-
(obj)->map->ops->defineProperty(cx,obj,id,value,getter,setter,attrs,propp)
|
68
|
-
#define OBJ_GET_PROPERTY(cx,obj,id,vp) \
|
69
|
-
(obj)->map->ops->getProperty(cx,obj,id,vp)
|
70
|
-
#define OBJ_SET_PROPERTY(cx,obj,id,vp) \
|
71
|
-
(obj)->map->ops->setProperty(cx,obj,id,vp)
|
72
|
-
#define OBJ_GET_ATTRIBUTES(cx,obj,id,prop,attrsp) \
|
73
|
-
(obj)->map->ops->getAttributes(cx,obj,id,prop,attrsp)
|
74
|
-
#define OBJ_SET_ATTRIBUTES(cx,obj,id,prop,attrsp) \
|
75
|
-
(obj)->map->ops->setAttributes(cx,obj,id,prop,attrsp)
|
76
|
-
#define OBJ_DELETE_PROPERTY(cx,obj,id,rval) \
|
77
|
-
(obj)->map->ops->deleteProperty(cx,obj,id,rval)
|
78
|
-
#define OBJ_DEFAULT_VALUE(cx,obj,hint,vp) \
|
79
|
-
(obj)->map->ops->defaultValue(cx,obj,hint,vp)
|
80
|
-
#define OBJ_ENUMERATE(cx,obj,enum_op,statep,idp) \
|
81
|
-
(obj)->map->ops->enumerate(cx,obj,enum_op,statep,idp)
|
82
|
-
#define OBJ_CHECK_ACCESS(cx,obj,id,mode,vp,attrsp) \
|
83
|
-
(obj)->map->ops->checkAccess(cx,obj,id,mode,vp,attrsp)
|
84
|
-
|
85
|
-
/* These four are time-optimized to avoid stub calls. */
|
86
|
-
#define OBJ_THIS_OBJECT(cx,obj) \
|
87
|
-
((obj)->map->ops->thisObject \
|
88
|
-
? (obj)->map->ops->thisObject(cx,obj) \
|
89
|
-
: (obj))
|
90
|
-
#define OBJ_DROP_PROPERTY(cx,obj,prop) \
|
91
|
-
((obj)->map->ops->dropProperty \
|
92
|
-
? (obj)->map->ops->dropProperty(cx,obj,prop) \
|
93
|
-
: (void)0)
|
94
|
-
#define OBJ_GET_REQUIRED_SLOT(cx,obj,slot) \
|
95
|
-
((obj)->map->ops->getRequiredSlot \
|
96
|
-
? (obj)->map->ops->getRequiredSlot(cx, obj, slot) \
|
97
|
-
: JSVAL_VOID)
|
98
|
-
#define OBJ_SET_REQUIRED_SLOT(cx,obj,slot,v) \
|
99
|
-
((obj)->map->ops->setRequiredSlot \
|
100
|
-
? (obj)->map->ops->setRequiredSlot(cx, obj, slot, v) \
|
101
|
-
: JS_TRUE)
|
102
|
-
|
103
|
-
#define OBJ_TO_INNER_OBJECT(cx,obj) \
|
104
|
-
JS_BEGIN_MACRO \
|
105
|
-
JSClass *clasp_ = OBJ_GET_CLASS(cx, obj); \
|
106
|
-
if (clasp_->flags & JSCLASS_IS_EXTENDED) { \
|
107
|
-
JSExtendedClass *xclasp_ = (JSExtendedClass*)clasp_; \
|
108
|
-
if (xclasp_->innerObject) \
|
109
|
-
obj = xclasp_->innerObject(cx, obj); \
|
110
|
-
} \
|
111
|
-
JS_END_MACRO
|
112
|
-
|
113
|
-
#define OBJ_TO_OUTER_OBJECT(cx,obj) \
|
114
|
-
JS_BEGIN_MACRO \
|
115
|
-
JSClass *clasp_ = OBJ_GET_CLASS(cx, obj); \
|
116
|
-
if (clasp_->flags & JSCLASS_IS_EXTENDED) { \
|
117
|
-
JSExtendedClass *xclasp_ = (JSExtendedClass*)clasp_; \
|
118
|
-
if (xclasp_->outerObject) \
|
119
|
-
obj = xclasp_->outerObject(cx, obj); \
|
120
|
-
} \
|
121
|
-
JS_END_MACRO
|
122
|
-
|
123
|
-
#define JS_INITIAL_NSLOTS 6
|
124
|
-
|
125
|
-
/*
|
126
|
-
* When JSObject.dslots is not null, JSObject.dslots[-1] records the number of
|
127
|
-
* available slots.
|
128
|
-
*/
|
129
|
-
struct JSObject {
|
130
|
-
JSObjectMap *map;
|
131
|
-
jsval fslots[JS_INITIAL_NSLOTS];
|
132
|
-
jsval *dslots; /* dynamically allocated slots */
|
133
|
-
};
|
134
|
-
|
135
|
-
#define JSSLOT_PROTO 0
|
136
|
-
#define JSSLOT_PARENT 1
|
137
|
-
#define JSSLOT_CLASS 2
|
138
|
-
#define JSSLOT_PRIVATE 3
|
139
|
-
#define JSSLOT_START(clasp) (((clasp)->flags & JSCLASS_HAS_PRIVATE) \
|
140
|
-
? JSSLOT_PRIVATE + 1 \
|
141
|
-
: JSSLOT_CLASS + 1)
|
142
|
-
|
143
|
-
#define JSSLOT_FREE(clasp) (JSSLOT_START(clasp) \
|
144
|
-
+ JSCLASS_RESERVED_SLOTS(clasp))
|
145
|
-
|
146
|
-
/*
|
147
|
-
* STOBJ prefix means Single Threaded Object. Use the following fast macros to
|
148
|
-
* directly manipulate slots in obj when only one thread can access obj and
|
149
|
-
* when obj->map->freeslot can be inconsistent with slots.
|
150
|
-
*/
|
151
|
-
|
152
|
-
#define STOBJ_NSLOTS(obj) \
|
153
|
-
((obj)->dslots ? (uint32)(obj)->dslots[-1] : (uint32)JS_INITIAL_NSLOTS)
|
154
|
-
|
155
|
-
#define STOBJ_GET_SLOT(obj,slot) \
|
156
|
-
((slot) < JS_INITIAL_NSLOTS \
|
157
|
-
? (obj)->fslots[(slot)] \
|
158
|
-
: (JS_ASSERT((slot) < (uint32)(obj)->dslots[-1]), \
|
159
|
-
(obj)->dslots[(slot) - JS_INITIAL_NSLOTS]))
|
160
|
-
|
161
|
-
#define STOBJ_SET_SLOT(obj,slot,value) \
|
162
|
-
((slot) < JS_INITIAL_NSLOTS \
|
163
|
-
? (obj)->fslots[(slot)] = (value) \
|
164
|
-
: (JS_ASSERT((slot) < (uint32)(obj)->dslots[-1]), \
|
165
|
-
(obj)->dslots[(slot) - JS_INITIAL_NSLOTS] = (value)))
|
166
|
-
|
167
|
-
#define STOBJ_GET_PROTO(obj) \
|
168
|
-
JSVAL_TO_OBJECT((obj)->fslots[JSSLOT_PROTO])
|
169
|
-
#define STOBJ_SET_PROTO(obj,proto) \
|
170
|
-
((obj)->fslots[JSSLOT_PROTO] = OBJECT_TO_JSVAL(proto))
|
171
|
-
|
172
|
-
#define STOBJ_GET_PARENT(obj) \
|
173
|
-
JSVAL_TO_OBJECT((obj)->fslots[JSSLOT_PARENT])
|
174
|
-
#define STOBJ_SET_PARENT(obj,parent) \
|
175
|
-
((obj)->fslots[JSSLOT_PARENT] = OBJECT_TO_JSVAL(parent))
|
176
|
-
|
177
|
-
/*
|
178
|
-
* We use JSSLOT_CLASS to store both JSClass* and the system flag as an int-
|
179
|
-
* tagged value (see jsapi.h for details) with the system flag stored in the
|
180
|
-
* second lowest bit.
|
181
|
-
*/
|
182
|
-
#define STOBJ_GET_CLASS(obj) ((JSClass *)((obj)->fslots[JSSLOT_CLASS] & ~3))
|
183
|
-
#define STOBJ_IS_SYSTEM(obj) (((obj)->fslots[JSSLOT_CLASS] & 2) != 0)
|
184
|
-
|
185
|
-
#define STOBJ_SET_SYSTEM(obj) ((void)((obj)->fslots[JSSLOT_CLASS] |= 2))
|
186
|
-
|
187
|
-
#define STOBJ_GET_PRIVATE(obj) \
|
188
|
-
(JS_ASSERT(JSVAL_IS_INT(STOBJ_GET_SLOT(obj, JSSLOT_PRIVATE))), \
|
189
|
-
JSVAL_TO_PRIVATE(STOBJ_GET_SLOT(obj, JSSLOT_PRIVATE)))
|
190
|
-
|
191
|
-
#define OBJ_CHECK_SLOT(obj,slot) \
|
192
|
-
JS_ASSERT(slot < (obj)->map->freeslot)
|
193
|
-
|
194
|
-
#define LOCKED_OBJ_GET_SLOT(obj,slot) \
|
195
|
-
(OBJ_CHECK_SLOT(obj, slot), STOBJ_GET_SLOT(obj, slot))
|
196
|
-
#define LOCKED_OBJ_SET_SLOT(obj,slot,value) \
|
197
|
-
(OBJ_CHECK_SLOT(obj, slot), STOBJ_SET_SLOT(obj, slot, value))
|
198
|
-
|
199
|
-
/*
|
200
|
-
* NB: Don't call LOCKED_OBJ_SET_SLOT or STOBJ_SET_SLOT for a write to a slot
|
201
|
-
* that may contain a function reference already, or where the new value is a
|
202
|
-
* function ref, and the object's scope may be branded with a property cache
|
203
|
-
* structural type capability that distinguishes versions of the object with
|
204
|
-
* and without the function property. Instead use LOCKED_OBJ_WRITE_BARRIER or
|
205
|
-
* a fast inline equivalent (JSOP_SETNAME/JSOP_SETPROP cases in jsinterp.c).
|
206
|
-
*/
|
207
|
-
#define LOCKED_OBJ_WRITE_BARRIER(cx,obj,slot,newval) \
|
208
|
-
JS_BEGIN_MACRO \
|
209
|
-
JSScope *scope_ = OBJ_SCOPE(obj); \
|
210
|
-
JS_ASSERT(scope_->object == (obj)); \
|
211
|
-
GC_WRITE_BARRIER(cx, scope_, LOCKED_OBJ_GET_SLOT(obj, slot), newval); \
|
212
|
-
LOCKED_OBJ_SET_SLOT(obj, slot, newval); \
|
213
|
-
JS_END_MACRO
|
214
|
-
|
215
|
-
#define LOCKED_OBJ_GET_PROTO(obj) \
|
216
|
-
(OBJ_CHECK_SLOT(obj, JSSLOT_PROTO), STOBJ_GET_PROTO(obj))
|
217
|
-
#define LOCKED_OBJ_SET_PROTO(obj,proto) \
|
218
|
-
(OBJ_CHECK_SLOT(obj, JSSLOT_PROTO), STOBJ_SET_PROTO(obj, proto))
|
219
|
-
|
220
|
-
#define LOCKED_OBJ_GET_PARENT(obj) \
|
221
|
-
(OBJ_CHECK_SLOT(obj, JSSLOT_PARENT), STOBJ_GET_PARENT(obj))
|
222
|
-
#define LOCKED_OBJ_SET_PARENT(obj,parent) \
|
223
|
-
(OBJ_CHECK_SLOT(obj, JSSLOT_PARENT), STOBJ_SET_PARENT(obj, parent))
|
224
|
-
|
225
|
-
#define LOCKED_OBJ_GET_CLASS(obj) \
|
226
|
-
(OBJ_CHECK_SLOT(obj, JSSLOT_CLASS), STOBJ_GET_CLASS(obj))
|
227
|
-
|
228
|
-
#define LOCKED_OBJ_GET_PRIVATE(obj) \
|
229
|
-
(OBJ_CHECK_SLOT(obj, JSSLOT_PRIVATE), STOBJ_GET_PRIVATE(obj))
|
230
|
-
|
231
|
-
#ifdef JS_THREADSAFE
|
232
|
-
|
233
|
-
/* Thread-safe functions and wrapper macros for accessing slots in obj. */
|
234
|
-
#define OBJ_GET_SLOT(cx,obj,slot) \
|
235
|
-
(OBJ_CHECK_SLOT(obj, slot), \
|
236
|
-
(OBJ_IS_NATIVE(obj) && OBJ_SCOPE(obj)->title.ownercx == cx) \
|
237
|
-
? LOCKED_OBJ_GET_SLOT(obj, slot) \
|
238
|
-
: js_GetSlotThreadSafe(cx, obj, slot))
|
239
|
-
|
240
|
-
#define OBJ_SET_SLOT(cx,obj,slot,value) \
|
241
|
-
JS_BEGIN_MACRO \
|
242
|
-
OBJ_CHECK_SLOT(obj, slot); \
|
243
|
-
if (OBJ_IS_NATIVE(obj) && OBJ_SCOPE(obj)->title.ownercx == cx) \
|
244
|
-
LOCKED_OBJ_WRITE_BARRIER(cx, obj, slot, value); \
|
245
|
-
else \
|
246
|
-
js_SetSlotThreadSafe(cx, obj, slot, value); \
|
247
|
-
JS_END_MACRO
|
248
|
-
|
249
|
-
/*
|
250
|
-
* If thread-safe, define an OBJ_GET_SLOT wrapper that bypasses, for a native
|
251
|
-
* object, the lock-free "fast path" test of (OBJ_SCOPE(obj)->ownercx == cx),
|
252
|
-
* to avoid needlessly switching from lock-free to lock-full scope when doing
|
253
|
-
* GC on a different context from the last one to own the scope. The caller
|
254
|
-
* in this case is probably a JSClass.mark function, e.g., fun_mark, or maybe
|
255
|
-
* a finalizer.
|
256
|
-
*
|
257
|
-
* The GC runs only when all threads except the one on which the GC is active
|
258
|
-
* are suspended at GC-safe points, so calling STOBJ_GET_SLOT from the GC's
|
259
|
-
* thread is safe when rt->gcRunning is set. See jsgc.c for details.
|
260
|
-
*/
|
261
|
-
#define THREAD_IS_RUNNING_GC(rt, thread) \
|
262
|
-
((rt)->gcRunning && (rt)->gcThread == (thread))
|
263
|
-
|
264
|
-
#define CX_THREAD_IS_RUNNING_GC(cx) \
|
265
|
-
THREAD_IS_RUNNING_GC((cx)->runtime, (cx)->thread)
|
266
|
-
|
267
|
-
#else /* !JS_THREADSAFE */
|
268
|
-
|
269
|
-
#define OBJ_GET_SLOT(cx,obj,slot) LOCKED_OBJ_GET_SLOT(obj,slot)
|
270
|
-
#define OBJ_SET_SLOT(cx,obj,slot,value) LOCKED_OBJ_WRITE_BARRIER(cx,obj,slot, \
|
271
|
-
value)
|
272
|
-
|
273
|
-
#endif /* !JS_THREADSAFE */
|
274
|
-
|
275
|
-
/* Thread-safe proto, parent, and class access macros. */
|
276
|
-
#define OBJ_GET_PROTO(cx,obj) \
|
277
|
-
STOBJ_GET_PROTO(obj)
|
278
|
-
#define OBJ_SET_PROTO(cx,obj,proto) \
|
279
|
-
STOBJ_SET_SLOT(obj, JSSLOT_PROTO, OBJECT_TO_JSVAL(proto))
|
280
|
-
|
281
|
-
#define OBJ_GET_PARENT(cx,obj) \
|
282
|
-
STOBJ_GET_PARENT(obj)
|
283
|
-
#define OBJ_SET_PARENT(cx,obj,parent) \
|
284
|
-
STOBJ_SET_SLOT(obj, JSSLOT_PARENT, OBJECT_TO_JSVAL(parent))
|
285
|
-
|
286
|
-
/*
|
287
|
-
* Class is invariant and comes from the fixed JSSLOT_CLASS. Thus no locking
|
288
|
-
* is necessary to read it. Same for the private slot.
|
289
|
-
*/
|
290
|
-
#define OBJ_GET_CLASS(cx,obj) STOBJ_GET_CLASS(obj)
|
291
|
-
#define OBJ_GET_PRIVATE(cx,obj) STOBJ_GET_PRIVATE(obj)
|
292
|
-
|
293
|
-
/* Test whether a map or object is native. */
|
294
|
-
#define MAP_IS_NATIVE(map) \
|
295
|
-
JS_LIKELY((map)->ops == &js_ObjectOps || \
|
296
|
-
(map)->ops->newObjectMap == js_ObjectOps.newObjectMap)
|
297
|
-
|
298
|
-
#define OBJ_IS_NATIVE(obj) MAP_IS_NATIVE((obj)->map)
|
299
|
-
|
300
|
-
extern JS_FRIEND_DATA(JSObjectOps) js_ObjectOps;
|
301
|
-
extern JS_FRIEND_DATA(JSObjectOps) js_WithObjectOps;
|
302
|
-
extern JSClass js_ObjectClass;
|
303
|
-
extern JSClass js_WithClass;
|
304
|
-
extern JSClass js_BlockClass;
|
305
|
-
|
306
|
-
/*
|
307
|
-
* Block scope object macros. The slots reserved by js_BlockClass are:
|
308
|
-
*
|
309
|
-
* JSSLOT_PRIVATE JSStackFrame * active frame pointer or null
|
310
|
-
* JSSLOT_BLOCK_DEPTH int depth of block slots in frame
|
311
|
-
*
|
312
|
-
* After JSSLOT_BLOCK_DEPTH come one or more slots for the block locals.
|
313
|
-
*
|
314
|
-
* A With object is like a Block object, in that both have one reserved slot
|
315
|
-
* telling the stack depth of the relevant slots (the slot whose value is the
|
316
|
-
* object named in the with statement, the slots containing the block's local
|
317
|
-
* variables); and both have a private slot referring to the JSStackFrame in
|
318
|
-
* whose activation they were created (or null if the with or block object
|
319
|
-
* outlives the frame).
|
320
|
-
*/
|
321
|
-
#define JSSLOT_BLOCK_DEPTH (JSSLOT_PRIVATE + 1)
|
322
|
-
|
323
|
-
#define OBJ_IS_CLONED_BLOCK(obj) \
|
324
|
-
(OBJ_SCOPE(obj)->object != (obj))
|
325
|
-
#define OBJ_BLOCK_COUNT(cx,obj) \
|
326
|
-
(OBJ_SCOPE(obj)->entryCount)
|
327
|
-
#define OBJ_BLOCK_DEPTH(cx,obj) \
|
328
|
-
JSVAL_TO_INT(STOBJ_GET_SLOT(obj, JSSLOT_BLOCK_DEPTH))
|
329
|
-
#define OBJ_SET_BLOCK_DEPTH(cx,obj,depth) \
|
330
|
-
STOBJ_SET_SLOT(obj, JSSLOT_BLOCK_DEPTH, INT_TO_JSVAL(depth))
|
331
|
-
|
332
|
-
/*
|
333
|
-
* To make sure this slot is well-defined, always call js_NewWithObject to
|
334
|
-
* create a With object, don't call js_NewObject directly. When creating a
|
335
|
-
* With object that does not correspond to a stack slot, pass -1 for depth.
|
336
|
-
*
|
337
|
-
* When popping the stack across this object's "with" statement, client code
|
338
|
-
* must call JS_SetPrivate(cx, withobj, NULL).
|
339
|
-
*/
|
340
|
-
extern JSObject *
|
341
|
-
js_NewWithObject(JSContext *cx, JSObject *proto, JSObject *parent, jsint depth);
|
342
|
-
|
343
|
-
/*
|
344
|
-
* Create a new block scope object not linked to any proto or parent object.
|
345
|
-
* Blocks are created by the compiler to reify let blocks and comprehensions.
|
346
|
-
* Only when dynamic scope is captured do they need to be cloned and spliced
|
347
|
-
* into an active scope chain.
|
348
|
-
*/
|
349
|
-
extern JSObject *
|
350
|
-
js_NewBlockObject(JSContext *cx);
|
351
|
-
|
352
|
-
extern JSObject *
|
353
|
-
js_CloneBlockObject(JSContext *cx, JSObject *proto, JSObject *parent,
|
354
|
-
JSStackFrame *fp);
|
355
|
-
|
356
|
-
extern JSBool
|
357
|
-
js_PutBlockObject(JSContext *cx, JSBool normalUnwind);
|
358
|
-
|
359
|
-
struct JSSharpObjectMap {
|
360
|
-
jsrefcount depth;
|
361
|
-
jsatomid sharpgen;
|
362
|
-
JSHashTable *table;
|
363
|
-
};
|
364
|
-
|
365
|
-
#define SHARP_BIT ((jsatomid) 1)
|
366
|
-
#define BUSY_BIT ((jsatomid) 2)
|
367
|
-
#define SHARP_ID_SHIFT 2
|
368
|
-
#define IS_SHARP(he) (JS_PTR_TO_UINT32((he)->value) & SHARP_BIT)
|
369
|
-
#define MAKE_SHARP(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|SHARP_BIT))
|
370
|
-
#define IS_BUSY(he) (JS_PTR_TO_UINT32((he)->value) & BUSY_BIT)
|
371
|
-
#define MAKE_BUSY(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|BUSY_BIT))
|
372
|
-
#define CLEAR_BUSY(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)&~BUSY_BIT))
|
373
|
-
|
374
|
-
extern JSHashEntry *
|
375
|
-
js_EnterSharpObject(JSContext *cx, JSObject *obj, JSIdArray **idap,
|
376
|
-
jschar **sp);
|
377
|
-
|
378
|
-
extern void
|
379
|
-
js_LeaveSharpObject(JSContext *cx, JSIdArray **idap);
|
380
|
-
|
381
|
-
/*
|
382
|
-
* Mark objects stored in map if GC happens between js_EnterSharpObject
|
383
|
-
* and js_LeaveSharpObject. GC calls this when map->depth > 0.
|
384
|
-
*/
|
385
|
-
extern void
|
386
|
-
js_TraceSharpMap(JSTracer *trc, JSSharpObjectMap *map);
|
387
|
-
|
388
|
-
extern JSBool
|
389
|
-
js_HasOwnPropertyHelper(JSContext *cx, JSLookupPropOp lookup, jsval *vp);
|
390
|
-
|
391
|
-
extern JSObject *
|
392
|
-
js_InitBlockClass(JSContext *cx, JSObject* obj);
|
393
|
-
|
394
|
-
extern JSObject *
|
395
|
-
js_InitEval(JSContext *cx, JSObject *obj);
|
396
|
-
|
397
|
-
extern JSObject *
|
398
|
-
js_InitObjectClass(JSContext *cx, JSObject *obj);
|
399
|
-
|
400
|
-
/* Select Object.prototype method names shared between jsapi.c and jsobj.c. */
|
401
|
-
extern const char js_watch_str[];
|
402
|
-
extern const char js_unwatch_str[];
|
403
|
-
extern const char js_hasOwnProperty_str[];
|
404
|
-
extern const char js_isPrototypeOf_str[];
|
405
|
-
extern const char js_propertyIsEnumerable_str[];
|
406
|
-
extern const char js_defineGetter_str[];
|
407
|
-
extern const char js_defineSetter_str[];
|
408
|
-
extern const char js_lookupGetter_str[];
|
409
|
-
extern const char js_lookupSetter_str[];
|
410
|
-
|
411
|
-
extern void
|
412
|
-
js_InitObjectMap(JSObjectMap *map, jsrefcount nrefs, JSObjectOps *ops,
|
413
|
-
JSClass *clasp);
|
414
|
-
|
415
|
-
extern JSObjectMap *
|
416
|
-
js_NewObjectMap(JSContext *cx, jsrefcount nrefs, JSObjectOps *ops,
|
417
|
-
JSClass *clasp, JSObject *obj);
|
418
|
-
|
419
|
-
extern void
|
420
|
-
js_DestroyObjectMap(JSContext *cx, JSObjectMap *map);
|
421
|
-
|
422
|
-
extern JSObjectMap *
|
423
|
-
js_HoldObjectMap(JSContext *cx, JSObjectMap *map);
|
424
|
-
|
425
|
-
extern JSObjectMap *
|
426
|
-
js_DropObjectMap(JSContext *cx, JSObjectMap *map, JSObject *obj);
|
427
|
-
|
428
|
-
extern JSBool
|
429
|
-
js_GetClassId(JSContext *cx, JSClass *clasp, jsid *idp);
|
430
|
-
|
431
|
-
extern JSObject *
|
432
|
-
js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent,
|
433
|
-
uintN objectSize);
|
434
|
-
|
435
|
-
/*
|
436
|
-
* See jsapi.h, JS_NewObjectWithGivenProto.
|
437
|
-
*
|
438
|
-
* objectSize is either the explicit size for the allocated object or 0
|
439
|
-
* indicating to use the default size based on object's class.
|
440
|
-
*/
|
441
|
-
extern JSObject *
|
442
|
-
js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
|
443
|
-
JSObject *parent, uintN objectSize);
|
444
|
-
|
445
|
-
/*
|
446
|
-
* Fast access to immutable standard objects (constructors and prototypes).
|
447
|
-
*/
|
448
|
-
extern JSBool
|
449
|
-
js_GetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key,
|
450
|
-
JSObject **objp);
|
451
|
-
|
452
|
-
extern JSBool
|
453
|
-
js_SetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key, JSObject *cobj);
|
454
|
-
|
455
|
-
extern JSBool
|
456
|
-
js_FindClassObject(JSContext *cx, JSObject *start, jsid id, jsval *vp);
|
457
|
-
|
458
|
-
extern JSObject *
|
459
|
-
js_ConstructObject(JSContext *cx, JSClass *clasp, JSObject *proto,
|
460
|
-
JSObject *parent, uintN argc, jsval *argv);
|
461
|
-
|
462
|
-
extern void
|
463
|
-
js_FinalizeObject(JSContext *cx, JSObject *obj);
|
464
|
-
|
465
|
-
extern JSBool
|
466
|
-
js_AllocSlot(JSContext *cx, JSObject *obj, uint32 *slotp);
|
467
|
-
|
468
|
-
extern void
|
469
|
-
js_FreeSlot(JSContext *cx, JSObject *obj, uint32 slot);
|
470
|
-
|
471
|
-
/* JSVAL_INT_MAX as a string */
|
472
|
-
#define JSVAL_INT_MAX_STRING "1073741823"
|
473
|
-
|
474
|
-
#define CHECK_FOR_STRING_INDEX(id) \
|
475
|
-
JS_BEGIN_MACRO \
|
476
|
-
if (JSID_IS_ATOM(id)) { \
|
477
|
-
JSAtom *atom_ = JSID_TO_ATOM(id); \
|
478
|
-
JSString *str_ = ATOM_TO_STRING(atom_); \
|
479
|
-
const jschar *s_ = JSFLATSTR_CHARS(str_); \
|
480
|
-
JSBool negative_ = (*s_ == '-'); \
|
481
|
-
if (negative_) s_++; \
|
482
|
-
if (JS7_ISDEC(*s_)) { \
|
483
|
-
size_t n_ = JSFLATSTR_LENGTH(str_) - negative_; \
|
484
|
-
if (n_ <= sizeof(JSVAL_INT_MAX_STRING) - 1) \
|
485
|
-
id = js_CheckForStringIndex(id, s_, s_ + n_, negative_); \
|
486
|
-
} \
|
487
|
-
} \
|
488
|
-
JS_END_MACRO
|
489
|
-
|
490
|
-
extern jsid
|
491
|
-
js_CheckForStringIndex(jsid id, const jschar *cp, const jschar *end,
|
492
|
-
JSBool negative);
|
493
|
-
|
494
|
-
/*
|
495
|
-
* Find or create a property named by id in obj's scope, with the given getter
|
496
|
-
* and setter, slot, attributes, and other members.
|
497
|
-
*/
|
498
|
-
extern JSScopeProperty *
|
499
|
-
js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id,
|
500
|
-
JSPropertyOp getter, JSPropertyOp setter, uint32 slot,
|
501
|
-
uintN attrs, uintN flags, intN shortid);
|
502
|
-
|
503
|
-
/*
|
504
|
-
* Change sprop to have the given attrs, getter, and setter in scope, morphing
|
505
|
-
* it into a potentially new JSScopeProperty. Return a pointer to the changed
|
506
|
-
* or identical property.
|
507
|
-
*/
|
508
|
-
extern JSScopeProperty *
|
509
|
-
js_ChangeNativePropertyAttrs(JSContext *cx, JSObject *obj,
|
510
|
-
JSScopeProperty *sprop, uintN attrs, uintN mask,
|
511
|
-
JSPropertyOp getter, JSPropertyOp setter);
|
512
|
-
|
513
|
-
/*
|
514
|
-
* On error, return false. On success, if propp is non-null, return true with
|
515
|
-
* obj locked and with a held property in *propp; if propp is null, return true
|
516
|
-
* but release obj's lock first. Therefore all callers who pass non-null propp
|
517
|
-
* result parameters must later call OBJ_DROP_PROPERTY(cx, obj, *propp) both to
|
518
|
-
* drop the held property, and to release the lock on obj.
|
519
|
-
*/
|
520
|
-
extern JSBool
|
521
|
-
js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
522
|
-
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
|
523
|
-
JSProperty **propp);
|
524
|
-
|
525
|
-
extern JSBool
|
526
|
-
js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
527
|
-
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
|
528
|
-
uintN flags, intN shortid, JSProperty **propp);
|
529
|
-
|
530
|
-
/*
|
531
|
-
* Unlike js_DefineProperty, propp must be non-null. On success, and if id was
|
532
|
-
* found, return true with *objp non-null and locked, and with a held property
|
533
|
-
* stored in *propp. If successful but id was not found, return true with both
|
534
|
-
* *objp and *propp null. Therefore all callers who receive a non-null *propp
|
535
|
-
* must later call OBJ_DROP_PROPERTY(cx, *objp, *propp).
|
536
|
-
*/
|
537
|
-
extern JS_FRIEND_API(JSBool)
|
538
|
-
js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
539
|
-
JSProperty **propp);
|
540
|
-
|
541
|
-
/*
|
542
|
-
* Specialized subroutine that allows caller to preset JSRESOLVE_* flags and
|
543
|
-
* returns the index along the prototype chain in which *propp was found, or
|
544
|
-
* the last index if not found, or -1 on error.
|
545
|
-
*/
|
546
|
-
extern int
|
547
|
-
js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
548
|
-
JSObject **objp, JSProperty **propp);
|
549
|
-
|
550
|
-
extern int
|
551
|
-
js_FindPropertyHelper(JSContext *cx, jsid id, JSObject **objp,
|
552
|
-
JSObject **pobjp, JSProperty **propp,
|
553
|
-
JSPropCacheEntry **entryp);
|
554
|
-
|
555
|
-
/*
|
556
|
-
* Return the index along the scope chain in which id was found, or the last
|
557
|
-
* index if not found, or -1 on error.
|
558
|
-
*/
|
559
|
-
extern JS_FRIEND_API(JSBool)
|
560
|
-
js_FindProperty(JSContext *cx, jsid id, JSObject **objp, JSObject **pobjp,
|
561
|
-
JSProperty **propp);
|
562
|
-
|
563
|
-
extern JSObject *
|
564
|
-
js_FindIdentifierBase(JSContext *cx, jsid id, JSPropCacheEntry *entry);
|
565
|
-
|
566
|
-
extern JSObject *
|
567
|
-
js_FindVariableScope(JSContext *cx, JSFunction **funp);
|
568
|
-
|
569
|
-
/*
|
570
|
-
* NB: js_NativeGet and js_NativeSet are called with the scope containing sprop
|
571
|
-
* (pobj's scope for Get, obj's for Set) locked, and on successful return, that
|
572
|
-
* scope is again locked. But on failure, both functions return false with the
|
573
|
-
* scope containing sprop unlocked.
|
574
|
-
*/
|
575
|
-
extern JSBool
|
576
|
-
js_NativeGet(JSContext *cx, JSObject *obj, JSObject *pobj,
|
577
|
-
JSScopeProperty *sprop, jsval *vp);
|
578
|
-
|
579
|
-
extern JSBool
|
580
|
-
js_NativeSet(JSContext *cx, JSObject *obj, JSScopeProperty *sprop, jsval *vp);
|
581
|
-
|
582
|
-
extern JSBool
|
583
|
-
js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
584
|
-
JSPropCacheEntry **entryp);
|
585
|
-
|
586
|
-
extern JSBool
|
587
|
-
js_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
|
588
|
-
|
589
|
-
extern JSBool
|
590
|
-
js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
591
|
-
JSPropCacheEntry **entryp);
|
592
|
-
|
593
|
-
extern JSBool
|
594
|
-
js_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
|
595
|
-
|
596
|
-
extern JSBool
|
597
|
-
js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
|
598
|
-
uintN *attrsp);
|
599
|
-
|
600
|
-
extern JSBool
|
601
|
-
js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
|
602
|
-
uintN *attrsp);
|
603
|
-
|
604
|
-
extern JSBool
|
605
|
-
js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval);
|
606
|
-
|
607
|
-
extern JSBool
|
608
|
-
js_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp);
|
609
|
-
|
610
|
-
extern JSIdArray *
|
611
|
-
js_NewIdArray(JSContext *cx, jsint length);
|
612
|
-
|
613
|
-
/*
|
614
|
-
* Unlike realloc(3), this function frees ida on failure.
|
615
|
-
*/
|
616
|
-
extern JSIdArray *
|
617
|
-
js_SetIdArrayLength(JSContext *cx, JSIdArray *ida, jsint length);
|
618
|
-
|
619
|
-
extern JSBool
|
620
|
-
js_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
621
|
-
jsval *statep, jsid *idp);
|
622
|
-
|
623
|
-
extern void
|
624
|
-
js_TraceNativeIteratorStates(JSTracer *trc);
|
625
|
-
|
626
|
-
extern JSBool
|
627
|
-
js_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
|
628
|
-
jsval *vp, uintN *attrsp);
|
629
|
-
|
630
|
-
extern JSBool
|
631
|
-
js_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
|
632
|
-
|
633
|
-
extern JSBool
|
634
|
-
js_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
635
|
-
jsval *rval);
|
636
|
-
|
637
|
-
extern JSBool
|
638
|
-
js_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
|
639
|
-
|
640
|
-
extern JSBool
|
641
|
-
js_SetProtoOrParent(JSContext *cx, JSObject *obj, uint32 slot, JSObject *pobj);
|
642
|
-
|
643
|
-
extern JSBool
|
644
|
-
js_IsDelegate(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
|
645
|
-
|
646
|
-
extern JSBool
|
647
|
-
js_GetClassPrototype(JSContext *cx, JSObject *scope, jsid id,
|
648
|
-
JSObject **protop);
|
649
|
-
|
650
|
-
extern JSBool
|
651
|
-
js_SetClassPrototype(JSContext *cx, JSObject *ctor, JSObject *proto,
|
652
|
-
uintN attrs);
|
653
|
-
|
654
|
-
/*
|
655
|
-
* Wrap boolean, number or string as Boolean, Number or String object.
|
656
|
-
* *vp must not be an object, null or undefined.
|
657
|
-
*/
|
658
|
-
extern JSBool
|
659
|
-
js_PrimitiveToObject(JSContext *cx, jsval *vp);
|
660
|
-
|
661
|
-
extern JSBool
|
662
|
-
js_ValueToObject(JSContext *cx, jsval v, JSObject **objp);
|
663
|
-
|
664
|
-
extern JSObject *
|
665
|
-
js_ValueToNonNullObject(JSContext *cx, jsval v);
|
666
|
-
|
667
|
-
extern JSBool
|
668
|
-
js_TryValueOf(JSContext *cx, JSObject *obj, JSType type, jsval *rval);
|
669
|
-
|
670
|
-
extern JSBool
|
671
|
-
js_TryMethod(JSContext *cx, JSObject *obj, JSAtom *atom,
|
672
|
-
uintN argc, jsval *argv, jsval *rval);
|
673
|
-
|
674
|
-
extern JSBool
|
675
|
-
js_XDRObject(JSXDRState *xdr, JSObject **objp);
|
676
|
-
|
677
|
-
extern void
|
678
|
-
js_TraceObject(JSTracer *trc, JSObject *obj);
|
679
|
-
|
680
|
-
extern void
|
681
|
-
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);
|
682
|
-
|
683
|
-
extern void
|
684
|
-
js_Clear(JSContext *cx, JSObject *obj);
|
685
|
-
|
686
|
-
extern jsval
|
687
|
-
js_GetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot);
|
688
|
-
|
689
|
-
extern JSBool
|
690
|
-
js_SetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v);
|
691
|
-
|
692
|
-
extern JSObject *
|
693
|
-
js_CheckScopeChainValidity(JSContext *cx, JSObject *scopeobj, const char *caller);
|
694
|
-
|
695
|
-
extern JSBool
|
696
|
-
js_CheckPrincipalsAccess(JSContext *cx, JSObject *scopeobj,
|
697
|
-
JSPrincipals *principals, JSAtom *caller);
|
698
|
-
|
699
|
-
/* Infallible -- returns its argument if there is no wrapped object. */
|
700
|
-
extern JSObject *
|
701
|
-
js_GetWrappedObject(JSContext *cx, JSObject *obj);
|
702
|
-
|
703
|
-
/* NB: Infallible. */
|
704
|
-
extern const char *
|
705
|
-
js_ComputeFilename(JSContext *cx, JSStackFrame *caller,
|
706
|
-
JSPrincipals *principals, uintN *linenop);
|
707
|
-
JS_END_EXTERN_C
|
708
|
-
|
709
|
-
#endif /* jsobj_h___ */
|