Commit Graph

2728 Commits

Author SHA1 Message Date
nboyd%atg.com
95389f0d7e Better javadoc 2000-08-30 13:41:15 +00:00
mkaply%us.ibm.com
a7e2c5bb4c #50212
r=brendan, a=brendan
OS/2 GCC doesn't define _M_IX86
2000-08-30 01:04:59 +00:00
brendan%mozilla.org
20a51b8298 Finish fixing 42221, for sure. 2000-08-29 23:09:47 +00:00
mccabe%netscape.com
5c644e8fc3 Potential fix to 50313
Initialize stack variable to NULL on suspicion that later possibly-unset use of it is causing crash.
2000-08-26 07:10:31 +00:00
brendan%mozilla.org
c77f05ae2e Clean up JSObjectOps layering violations by adding mark and clear ops; JSClass gets a corresponding mark op so classes with unregistered roots in private data can mark them. The JS API gets a new JS_MarkGCThing entry point for JSObjectOps.mark implementors. Prerequisite check-in for bug 49816 and others (r=shaver). 2000-08-26 02:30:22 +00:00
brendan%mozilla.org
9f6b515501 Lazily define escape and unescape (via js_InitStringClass) only #ifndef MOZILLA_CLIENT, because the DOM must predefine backward-compatible versions of these functions that 'stick' (42221, r=mccabe). 2000-08-26 02:05:41 +00:00
mccabe%netscape.com
91dae5c247 Fix to 39141.
Check for empty element case in array literals ( first element in [,'foo'] ) now uses the next token instead of the previous one when constructing the node, so the first element gets TOK_COMMA instead of TOK_LB.

This fixes a crash from previously accepted JS.

r=rogerl
2000-08-26 01:44:35 +00:00
brendan%mozilla.org
53dfa73056 Macro-ize FPU mode fixing and do it on ever js_InitNumberClass; also, simplify #ifdefs to unify OS2 with XP_PC && _M_IX86 case (50212, r=mkaply@us.ibm.com). 2000-08-25 03:14:50 +00:00
jband%netscape.com
47af0b5999 bug 49748. Fix crash due to JS loader holding xpconnect service too long. Also add unimplemented method to xpconnect service and fix cast for bug 49641. r=shaver@mozilla.org a=brendan@mozilla.org 2000-08-24 07:50:27 +00:00
beard%netscape.com
85ec8a2278 use QueryElementAt() to save space and time. r=shaver 2000-08-24 04:10:47 +00:00
brendan%mozilla.org
f80865ab42 Eliminate silly gcc warning. 2000-08-24 03:14:17 +00:00
brendan%mozilla.org
0b6d9aa649 Add strict warning about trailing comma in object initializers being non-ECMA (50001, r=shaver). 2000-08-23 23:55:43 +00:00
rogerl%netscape.com
d7c5abb056 Fixed printOperands to handle <NaR> 2000-08-23 01:07:19 +00:00
rogerl%netscape.com
934c77a9b2 Fixed printOperand to handle <NaR> properly. Added missing 'return this' to
all constructors.
2000-08-23 01:06:52 +00:00
rogerl%netscape.com
d876d27a02 r,a=beard@netscape.com. Bug #45415, fix LiveConnect memory leak. 2000-08-22 23:31:09 +00:00
nboyd%atg.com
c03250308b Fix bug 48930: work around a MS JIT bug. 2000-08-22 17:04:21 +00:00
waldemar%netscape.com
8d725f1e58 Added arguments to attributes; made 'use', 'namespace', and 'constructor' into keywords and simplified resulting grammar; merged attribute definitions into const definitions; made eval use function call syntax; renamed 'language' to 'use'. 2000-08-22 04:31:37 +00:00
waldemar%netscape.com
37c88b80da Added \Q escape 2000-08-22 04:29:34 +00:00
waldemar%netscape.com
89765d999d Added line-break constraint 2000-08-22 04:29:01 +00:00
waldemar%netscape.com
b9ffa39439 Made terminal constraint error message more detailed 2000-08-22 04:28:01 +00:00
brendan%mozilla.org
f447340dff Fix UMR on ok in JS_ResolveStandardClass (46703, r=rogerl). 2000-08-22 00:25:17 +00:00
pavel%gingerall.cz
d24db69aaf - JSVALToSV handles perl objects in the right way 2000-08-21 16:52:49 +00:00
nboyd%atg.com
561cf27d98 Fix bug 49325. 2000-08-21 15:56:15 +00:00
nboyd%atg.com
06f16c883f Fix class path 2000-08-21 15:51:57 +00:00
brendan%mozilla.org
6aea0bf81f Re-constipate JSClass.name. 2000-08-19 19:17:32 +00:00
jband%netscape.com
577d93dfb4 fix the warnings that went along with the last bustage fix - in case one of the compilers needs it. brendan can fix as he likes in the morning 2000-08-19 10:36:45 +00:00
jband%netscape.com
598c2a90c2 fix bustage 2000-08-19 10:22:13 +00:00
brendan%mozilla.org
56c94e849a Move shell to DIRS from ENABLE_TESTS ifdef addition to DIRS (r=mccabe,leaf). 2000-08-19 08:41:34 +00:00
brendan%mozilla.org
f59c35edb2 Support lazy initialization of standard classes and their associated global functions/properties (46703, r=jband,rogerl). 2000-08-19 08:37:07 +00:00
brendan%mozilla.org
896fb216bc Add stub entry struct and ops for const void *keys, split out JS_DHashTableRawRemove, beefed up comments (part of 46703, r=jband). 2000-08-19 08:36:32 +00:00
cls%seawood.org
5ef043ad42 Use the -n32 ABI as the default for Irix 6.x but allow the option to disable it. 2000-08-19 08:05:05 +00:00
jband%netscape.com
77fff625c9 Add support for -w and -s for reporting warnings and doing strict JS checking (as supported by the engine). Also update the usage info. ra=brendan@mozilla.org 2000-08-19 03:28:01 +00:00
jband%netscape.com
870adce9bf Adding better diagnostic message to help in finding and fixing mismatched calls to JS_AddNamedRoot/JS_RemoveRoot. ra=brendan@mozilla.org 2000-08-19 03:25:16 +00:00
beard%netscape.com
e4a813ca47 added debugger classes. 2000-08-19 02:42:05 +00:00
brendan%mozilla.org
95c4e4dc86 Add jsdhash. 2000-08-18 00:04:53 +00:00
nboyd%atg.com
aad3b49e2b Fix for bug 49302 2000-08-17 12:37:32 +00:00
nboyd%atg.com
40ff06028a Fix 49301. 2000-08-17 12:28:46 +00:00
rogerl%netscape.com
2799c5b4ed Backing out fix to see if Linux build passes alivetest. 2000-08-17 00:30:57 +00:00
rogerl%netscape.com
d3804fb66f Bug #31255. r,a=brendan. Once more unto the '-->' accepted as line comment
fix.
2000-08-16 22:46:04 +00:00
rogerl%netscape.com
e1584cd317 Bug #39141, r=mccabe, a=beard. Fix crash for empty array initializer. 2000-08-16 22:43:26 +00:00
shaver%mozilla.org
f66cde2438 Fix 47354 and 39975 by providing a system-privileged scope backstop for
JS Components, and teaching the ScriptSecurityManager to check for
XPC-wrapped native objects in the scope chain when looking for an
object's principal. r=jband/a=brendan
2000-08-16 04:01:02 +00:00
nboyd%atg.com
9a21820390 Merge changes from EXP_DEBUGGER branch into tip.
Implements simple command-line debugger for scripts.
2000-08-15 15:54:46 +00:00
mccabe%netscape.com
d8cabef55b Fix to 39438.
Add a TokenStream entry to the regexp parser state so that regexps compiled at script-compilation time can report filename and line number on error.
2000-08-11 23:51:12 +00:00
conrad%ingress.com
d9e8edcf29 Changed from using strings for nsIDirectoryService props to using macro names defined in nsDirectoryServiceDefs.h r=valeski 2000-08-11 20:31:57 +00:00
waldemar%netscape.com
fec02531da Updated to generate Netscape 6-compatible HTML 2000-08-11 06:27:55 +00:00
waldemar%netscape.com
7a3bd65ac3 Added attributes to for-initializers and no-line-breaks in a few places 2000-08-11 06:27:25 +00:00
waldemar%netscape.com
d955e75027 Updated to match documentation site 2000-08-11 06:24:57 +00:00
waldemar%netscape.com
b7c2380049 Updated to match styles.css on documentation site 2000-08-11 06:24:39 +00:00
mccabe%netscape.com
16ab7000d2 Back in backed-out fix. 2000-08-11 02:58:30 +00:00
mccabe%netscape.com
e38da88c9f Backout until I can figure out why mac doesn't like strlen here, even though it seems OK elsewhere. 2000-08-10 23:32:03 +00:00
mccabe%netscape.com
8ddfc050c7 Fix to 46566.
Always copy the current line string out of the token buffer when generating an error report, rather than just passing the token buffer itself.  The token buffer wasn't necessarily a well-terminated string, so displaying the contents of the string in the error report produced unexpected results.

The unicode string in the error report is owned by a JSString; this string is rooted for the (stack-based) lifetime of the error report.

Fix courtesy jband.

r=mccabe
a=beard
2000-08-10 23:02:39 +00:00
mccabe%netscape.com
bb5465f725 Fix to 34425 -
Always create an error report, even when there is no current stack frame and it might be empty.  This fixes an API regression; we used to allow JS_ReportError to be called from the API when no JavaScript was running.

r=rogerl
a=beard
2000-08-10 22:57:40 +00:00
mccabe%netscape.com
69b8cc3cca Fix to 47409 -
Don't use timezone comment in javascript Date object toString string if it looks like it might not be ASCII.

a,r=beard
2000-08-10 22:54:45 +00:00
brendan%mozilla.org
2ffe707880 Fix cut-and-paste bugs in JavaMember_finalize (48304, r=pschwartau). 2000-08-10 03:09:41 +00:00
mccabe%netscape.com
5fb749ab79 Cast some parameters to PRUnichar * from jschar * to make the Mac happy. 2000-08-09 23:42:24 +00:00
mccabe%netscape.com
4efbf7baec Fix to 24688. Post a message to the JavaScript console whenever a call is made through XPConnect to a JS Component or other JS object that results in an exception.
Also eliminate xpcJSErrorReport and merge some functionality from it into nsScriptError.

r=jband,a=beard
2000-08-09 22:48:52 +00:00
rogerl%netscape.com
9d79d55a1b r,a=brendan@mozilla.org. Adding missing ECMA3 compliance toLocaleXXX
functions to built-in Array, Date and Object object prototypes.
2000-08-09 21:46:03 +00:00
nboyd%atg.com
faa5b161dc fix 47859 2000-08-09 20:23:50 +00:00
nboyd%atg.com
c65fc2d8fd Fix 47859 2000-08-09 20:22:37 +00:00
rogerl%netscape.com
e0214135b4 r=brendan, bug# 34276. Fix for correctly including winsock2.h. 2000-08-08 20:28:49 +00:00
rogerl%netscape.com
cf1bd923c5 (update to fix for bug #31255). Previous patch was insufficient in that it
didn't handle the case when the tokenstream is not tokenizing newlines.
2000-08-08 20:24:56 +00:00
rogerl%netscape.com
e8f1a9e20c Added 'static' to global object routines. 2000-08-04 20:54:24 +00:00
rogerl%netscape.com
67730faf1f Oops. Left icode output on by default, now off. 2000-08-04 20:37:42 +00:00
rogerl%netscape.com
0013224436 Prototype munging for built-in global properties, implemented Function
object & Boolean object.
2000-08-04 20:28:35 +00:00
waldemar%netscape.com
9e38333da6 Made link order consistent 2000-08-02 23:09:53 +00:00
waldemar%netscape.com
8941a10acb Fixed Mac errors and warnings 2000-08-02 23:09:29 +00:00
jband%netscape.com
d957e12a12 interim fix for bug 25180. Build double wrappers around JS components used by JS code. Includes secured scheme for getting at underlying JSObject for those who really need to do this. a=warren r=rginda 2000-08-02 03:57:59 +00:00
beard%netscape.com
e2d1e94396 fixing warnings, removing need for JStrings to be copied for mClass 2000-08-02 03:53:04 +00:00
nboyd%atg.com
0667cc6b4b Fix javadoc. 2000-07-31 21:19:05 +00:00
rginda%netscape.com
80b337ffd6 shut up "unused param" warnings by only naming the register param if the icode uses a RegisterList operand. 2000-07-29 02:00:12 +00:00
nboyd%atg.com
091e5f848f Experimental changes for debugger. 2000-07-27 14:54:13 +00:00
rogerl%netscape.com
54e6f7c03f Patch from Norris :
A Rhino user has complained about concurrency problems in the interpreter,
and I think the attached diff fixes some problems that could be caused if
the same interpreted function or script was called simultaneously from
two different threads.
2000-07-26 23:04:14 +00:00
mccabe%netscape.com
6183efe935 Not part of the Mozilla build.
Promulgate line-editing to the lcshell standalone command-line interpreter, and add more comments to the js shell support for the same.
2000-07-26 03:14:49 +00:00
rogerl%netscape.com
9cb37bc8c8 Function prototype objects etc. 2000-07-26 01:56:47 +00:00
rogerl%netscape.com
c30779b359 More ECMA 3 mucking about to support constructors etc. 2000-07-25 22:58:04 +00:00
brendan%mozilla.org
4736a63576 What a dork, I didn't test-build on Linux! 2000-07-24 21:28:08 +00:00
putterman%netscape.com
6f2bb03f35 backing out brendan's changes to fix build 2000-07-24 21:13:13 +00:00
morse%netscape.com
57b98ea166 attempt to fix build bustage 2000-07-24 21:03:41 +00:00
brendan%mozilla.org
5e0d51703d Micro-optimize source (compilers probably do it, but hey); fix a comment. 2000-07-24 20:17:24 +00:00
brendan%mozilla.org
af6dc1da89 Fix broken code that stored off the end of 'vector' in ProcessArgs (not part of build). 2000-07-24 20:13:50 +00:00
brendan%mozilla.org
ef35aeadcc Fix second (prototype-owns-property) setter/shared special case to unlock properly (45940, r=mccabe). 2000-07-22 01:03:04 +00:00
rogerl%netscape.com
7b8358b869 r=brendan@mozilla.org Bug #31381 Bug in Alpha 64-bit pointer cast.
Added extra 'long'field to Java wrapper object to handle platforms with
64 bit pointers.
2000-07-21 21:57:29 +00:00
rogerl%netscape.com
11aa5e9f47 r,a=brendan@mozilla.org. Bug #23502, crash in qsort when user function
misbehaves.
2000-07-21 21:46:22 +00:00
nboyd%atg.com
a0e64bea0b Fix 45928 NativeDate uses getDeclaredConstructor instead of getConstructor 2000-07-21 17:13:09 +00:00
beard%netscape.com
583d45e258 added jsmath.cpp/h 2000-07-21 05:07:29 +00:00
beard%netscape.com
90c948a47a XML project file. 2000-07-21 05:07:05 +00:00
beard%netscape.com
eec51fa4ce update dependencies to include jsmath.o 2000-07-21 05:01:10 +00:00
beard%netscape.com
94888cdb78 add jsmath.cpp to the build. 2000-07-21 05:00:43 +00:00
beard%netscape.com
b955eb7e09 scope of loop variables fix 2000-07-21 05:00:10 +00:00
rogerl%netscape.com
84455b51d9 Implementing Object.prototype object and global object for ECMA 3
Adding Math class support.
2000-07-21 01:16:49 +00:00
jband%netscape.com
43adc72647 drastically reduce unnecessary malloc calls from js_Atomize. r=brendan@mozilla.org. a=brendan@mozilla.org 2000-07-21 00:57:19 +00:00
dougt%netscape.com
b5027cd07a more debug information. r=jband. 2000-07-21 00:53:07 +00:00
jband%netscape.com
f392c7097c fix for crash that can happen when wrapped JS objects get accessed after xpconnect shutdown. This was burning outside users of xpconnect. bug 45669. r=mccabe@netscape.com a=brendan@mozilla.org 2000-07-19 06:15:32 +00:00
jband%netscape.com
a09164a7d1 fix bustage from dougt's last change to this file. not part of build. r=dougt@netscape.com 2000-07-19 06:11:12 +00:00
jband%netscape.com
ff320436f0 patches from madams@janna.com to build xpconnect standalone. bug 42026. r=leaf@mozilla.org a=brendan@mozilla.org 2000-07-19 03:36:27 +00:00
rogerl%netscape.com
06f0a5261f Removed all xxxCall, using simple call for everything.
Changed methods to use mMethods vector instead.
Various other fixes etc.
2000-07-18 20:53:03 +00:00
beard%netscape.com
7a1c2d350a Added ClassOutput.java, WrapHandler.java. 2000-07-18 01:29:34 +00:00
beard%netscape.com
a5ef09a1a6 cleaned up by removing widenCString() calls when using world.identifiers 2000-07-17 20:39:19 +00:00
nboyd%atg.com
22adf6c37b Fix javadoc error. 2000-07-17 14:08:28 +00:00
brendan%mozilla.org
5ee77531dd Remove unused vars and WIN16 crap; improve freelist-scavenging code to avoid taking too big an arena off the freelist in the case where nb > arenasize (41381 again, r=jband@netscape.com). 2000-07-15 19:12:49 +00:00
mcafee%netscape.com
c77af9f272 Ignore generated files 2000-07-15 15:56:34 +00:00
rginda%netscape.com
950d90e264 removing bogus assert (per rogerl) 2000-07-15 00:01:25 +00:00
beard%netscape.com
96e8363f86 added operator[](const char*) to StringAtomTable. 2000-07-14 23:10:02 +00:00
rogerl%netscape.com
3def89ee0d Fixed slots for non-function vars, plus bug in slot xcrement. 2000-07-14 22:23:20 +00:00
brendan%mozilla.org
1735e9b50e Fix for..in loop bug that reopened 41126 (r=jband@netscape.com). 2000-07-14 05:37:40 +00:00
brendan%mozilla.org
d5fbbb870c Fix 41381 regression from last fix attempt (r=jband). 2000-07-14 05:35:08 +00:00
jband%netscape.com
cc7bff60f8 Fix dropProperty crash. This is needed because the JSObjects used by xpconnect wrapped natives need to act both as host objects with non-slot properties and as a plain JSObjects using the default JSOps and all that entails. So, we can't be passing the host-style props to dropProperty though we do still need to do so for other props. This has only been working up to now by luck. r=brendan@mozilla.org a=brendan@mozilla.org 2000-07-14 05:34:46 +00:00
rogerl%netscape.com
0d866e25b5 Backed out time() 2000-07-14 01:46:14 +00:00
rogerl%netscape.com
23e9d7c1c8 Type targetted binary operators.
Added 'time()' function as native.
2000-07-14 01:00:53 +00:00
jband%netscape.com
bd65f5dc54 add THREADSAFE nsISupports implementation macros to some of the classes which lacked them. bug 45404. a=brendan@mozilla.org 2000-07-13 23:04:15 +00:00
brendan%mozilla.org
f0b2ab9b86 Why didn't the lack of this break Linux, where I tested? 2000-07-13 05:56:28 +00:00
syd%netscape.com
dacf41392f Add support to JS profiler for collecting min, max, and average execution
times of functions. Doesn't yet handle rentrancy. Create Makefile.in files
so this stuff will build on *nix. r=jband, a=leaf
2000-07-13 05:19:22 +00:00
brendan%mozilla.org
2566f33358 Try again for bug 41381, r=wtc@netscape.com 2000-07-13 05:08:35 +00:00
brendan%mozilla.org
d63dccc79d Uh oh. Back out last change until I'm sure I'm not an idiot. 2000-07-13 04:00:33 +00:00
brendan%mozilla.org
ac90b0c17d Fix ancient bugs: compare-and-swap is not threadsafe given A-B-A address replay via malloc/free; release to mark in pool->first empty arena would not free anything, as troy@tellme.com found (41381, r=wtc@netscape.com). 2000-07-13 03:49:22 +00:00
beard%netscape.com
89608ef140 need <stdio.h> for fopen on the Mac. 2000-07-13 02:23:55 +00:00
beard%netscape.com
60feb5d1fd fixing readEvalFile to save off important Context data members. implemented identical_Default for string 2000-07-13 01:35:57 +00:00
beard%netscape.com
e9a25e0a62 fixing readEvalFile() by creating another Context 2000-07-13 00:44:30 +00:00
rogerl%netscape.com
58dc7e47b7 Switching to generic binary operator in order to distinguish situation
where Operators package had been loaded and be able to generate typed
versions of the binary operators otherwise.
2000-07-13 00:14:54 +00:00
dougt%netscape.com
d84c495203 bug 40750.
Adding followSymlink flag to nsILocalFile.
Adjusting callers.
windows shortcut optimizations.
r=blizzard@mozilla.org.
a=brendan@mozilla.org
2000-07-12 23:31:31 +00:00
jdunn%netscape.com
8e48251700 do not include -lm for HPUX (as well as BeOS)
r= leaf@mozilla.org
2000-07-12 22:41:17 +00:00
brendan%mozilla.org
7a8885ff90 Fix 'out of order' malloc failure-handling bug found by cgn1234@yahoo.com (41022, r=cgn1234). 2000-07-12 01:44:12 +00:00
rogerl%netscape.com
b8bd1adb30 Implemented Import -only it's not in the parser yet.
Added missing defineXXX functions.
2000-07-11 23:49:20 +00:00
rginda%netscape.com
3a02396fda cleaned up linux warnings, minor debugger tweaks 2000-07-11 23:08:03 +00:00
rogerl%netscape.com
774d010635 More on @ operator. Fixed R 4billion print bug. 2000-07-11 20:54:06 +00:00
rogerl%netscape.com
087d2475a7 Some parts of x@<name> working. 2000-07-10 23:18:07 +00:00
jband%netscape.com
6b88acecab add previously overlooked support for nsIXPCNativeCallContext implementors to signal that they have set the method return value for the JS caller. a=brendan@mozilla.org r=vidur@netscape.com 2000-07-10 22:39:37 +00:00
rogerl%netscape.com
68724857b9 r=brendan@mozilla.org, Fix for #31255, support '-->' on line by itself as
a line comment - allows old, bogus HTML to execute a la 4.X.
2000-07-10 20:23:54 +00:00
rogerl%netscape.com
abddb6b6be r=brendan@mozilla.org, Fix for #44013 - enforce security for defineGetter
& defineSetter by calling OBJ_CHECK_ACCESS.
2000-07-10 20:21:38 +00:00
brendan%mozilla.org
7acd9814b4 Fix an out-of-date comment. 2000-07-08 02:35:56 +00:00
brendan%mozilla.org
58ffa1e2e0 Make it safe to nest a GC from js_AllocGCThing, ultimately from the interpreter; also make sure we collect all garbage (even garbage created by finalizers who unroot or unlock GC-things) when destroying the last context (39125, 44376, r=mccabe@netscape.com). 2000-07-08 02:06:01 +00:00
rogerl%netscape.com
daba9186aa Support for 'constructor'. 2000-07-08 01:08:29 +00:00
nboyd%atg.com
0a9b985a17 Deprecate FlattenedObject. 2000-07-07 14:41:35 +00:00
waterson%netscape.com
c1a0e63f75 Brendan meant to add jsdhash.h to the Mac build, too. 2000-07-06 20:55:23 +00:00
waterson%netscape.com
1001bcd519 Brendan meant add jsdhash.c to the Mac build, too. 2000-07-06 20:54:17 +00:00
rogerl%netscape.com
1375151969 Removed preprocess step, consolidated identifier handling. 2000-07-06 18:26:26 +00:00
brendan%mozilla.org
b117e30fa4 Fix lying comment, pick control flow nit (r=lumpy,a=jack). 2000-07-06 07:38:11 +00:00
brendan%mozilla.org
6d7ae73603 Add jsdhash.h to export/install lists, and jsdhash.c/.obj. 2000-07-06 04:46:18 +00:00
brendan%mozilla.org
2ecb3888a2 Avoid 80th column violations and unnecessary local variable. 2000-07-06 01:15:08 +00:00
brendan%mozilla.org
e5ca3a7b1a Undo teeny optimization from rev 3.28, alas it breaks ECMA Ed. 3, 15.5.4.15. 2000-07-06 00:30:46 +00:00
nboyd%atg.com
a1f493ab08 Remove obsolete references to NodeFactory. 2000-07-05 17:08:26 +00:00
nboyd%atg.com
fdeea4b93b Subject:
Re: Rhino1.5.R1: problems with multithreaded embedded application.
        Date:
             Mon, 03 Jul 2000 14:38:56 -0400
       From:
             Norris Boyd <nboyd@atg.com>
 Organization:
             Art Technology Group
         To:
             Fergus Gallagher <Fergus.Gallagher@orbisuk.com>
 Newsgroups:
             netscape.public.mozilla.jseng
  References:
             1




You found a bug in Rhino; I wonder if others have been running into the same thing.

The problem is with a class called LazilyLoadedCtor. I wrote this class to reduce the
time
required by initStandardObjects by only creating standard objects when the associated
constructors are first accessed. The problem is that this class was not threadsafe.
I've
made changes to that class, and to ScriptableObject as well. The design of dynamic
properties calling getters and setters (which LazilyLoadedCtor uses) didn't really
allow
any way for the getter/setter to replace itself without a thread hazard. I've now
extended
setters so that they can return a value which replaces the getter/setter to avoid this
problem.

Thanks for finding this problem. There have been a couple of other reports of problems
in
this area, so I hope this will fix them.

The patch follows.

--N

Index: LazilyLoadedCtor.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/LazilyLoadedCtor.java,v
retrieving revision 1.1
diff -u -r1.1 LazilyLoadedCtor.java
--- LazilyLoadedCtor.java 2000/02/29 21:34:37 1.1
+++ LazilyLoadedCtor.java 2000/07/03 18:31:03
@@ -58,9 +58,12 @@
     }

     public Object getProperty(ScriptableObject obj) {
-        obj.delete(ctorName);
         try {
-            ScriptableObject.defineClass(obj, Class.forName(className));
+            synchronized (obj) {
+                if (!isReplaced)
+                    ScriptableObject.defineClass(obj, Class.forName(className));
+                isReplaced = true;
+            }
         }
         catch (ClassNotFoundException e) {
             throw WrappedException.wrapException(e);
@@ -83,11 +86,14 @@
         return obj.get(ctorName, obj);
     }

-    public void setProperty(ScriptableObject obj, Object val) {
-        obj.delete(ctorName);
-        obj.put(ctorName, obj, val);
+    public Object setProperty(ScriptableObject obj, Object val) {
+        synchronized (obj) {
+            isReplaced = true;
+            return val;
+        }
     }

     private String ctorName;
     private String className;
+    private boolean isReplaced;
 }
Index: ScriptableObject.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/ScriptableObject.java,v
retrieving revision 1.17
diff -u -r1.17 ScriptableObject.java
--- ScriptableObject.java 2000/03/13 17:12:36 1.17
+++ ScriptableObject.java 2000/07/03 18:31:04
@@ -246,11 +246,21 @@
                             break;
                         }
                     }
-                    getterSlot.setter.invoke(start, arg);
+                    Object v = getterSlot.setter.invoke(start, arg);
+                    if (getterSlot.setterReturnsValue) {
+                        slots[slotIndex].value = v;
+                        if (!(v instanceof Method))
+                            slots[slotIndex].flags = 0;
+                    }
                     return;
                 }
                 Object[] args = { this, actualArg };
-                getterSlot.setter.invoke(getterSlot.delegateTo, args);
+                Object v = getterSlot.setter.invoke(getterSlot.delegateTo, args);
+                if (getterSlot.setterReturnsValue) {
+                    slots[slotIndex].value = v;
+                    if (!(v instanceof Method))
+                        slots[slotIndex].flags = 0;
+                }
                 return;
             }
             catch (InvocationTargetException e) {
@@ -1183,6 +1193,7 @@
         slot.delegateTo = delegateTo;
         slot.getter = getter;
         slot.setter = setter;
+        slot.setterReturnsValue = setter != null && setter.getReturnType() !=
Void.TYPE;
         slot.value = null;
         slot.attributes = (short) attributes;
         slot.flags = flags;
@@ -1551,6 +1562,7 @@
     Object delegateTo;  // OPT: merge with "value"
     Method getter;
     Method setter;
+    boolean setterReturnsValue;
 }




Fergus Gallagher wrote:

> I am having problems getting my head around contexts and scopes and my
> multi-threaded application fall over.
>
> If I set "global=false" the following code used a per-thread
> initStandardObject() and this seems to work.  But when I set
> "global=true", the global "parentScope" is used and I get some wierd
> errors.
>
> If I change "__CODE__.slice(0,5)" to
> 1. "__CODE__" - works
> 2. "__CODE__.substring(0,5)" - fails
> 3. "__CODE__.toString()" - works
>
> Any help appreciated.
>
> Fergus
>
> ===== Test.java =========================================
> import java.io.*;
> import org.mozilla.javascript.*;
>
> public class Test implements Runnable {
>         private Script script;
>         private Scriptable parentScope;
>         private String __CODE__="ABCDEFGHIJK";
>         private boolean global = true;
>         private static Context globalContext = null;
>         public Test() throws Exception {
>                 String js= "java.lang.System.out.println(__CODE__.slice(0,5));";
>                 globalContext.setCompileFunctionsWithDynamicScope(false);
>                 parentScope = globalContext.initStandardObjects(null);
>                 StringReader sr = new StringReader(js);
>                 script = globalContext.compileReader(parentScope, sr, "(compiled)",
> 1,null);
>         }
>
>         public void run() {
>                 try {
>                         Context context = Context.enter();
>                         Scriptable threadScope;
>                         if (global) {
>                                 threadScope = context.newObject(parentScope);
>                                 threadScope.setPrototype(parentScope);
>                                 threadScope.setParentScope(null);
>                         } else {
>                                 threadScope = context.initStandardObjects(null);
>                         }
>                         threadScope.put("__CODE__",threadScope,__CODE__);
>                         script.exec(context,threadScope);
>                 }
>                 catch (Exception e) {
>                         System.err.println(e.getClass().getName()+":
"+e.getMessage());
>                 }
>                 finally {
>                         Context.exit();
>                 }
>         }
>
>         public static void main(String args[]) throws Exception {
>         globalContext = Context.enter();
>                 Test me = new Test();
>                 int count=10;
>                 Thread[] threads = new Thread[count];
>                 for (int i=0; i<count; i++) {
>                         Thread t = new Thread(me);
>                         threads[i] = t;
>                         t.start();
>                 }
>                 for (int i=0; i<count; i++) {
>                         threads[i].join();
>                 }
>                 Context.exit();
>         }
> }
>
> ==== OUTPUT ===============================================
> ABCDE
> ABCDE
> org.mozilla.javascript.EcmaError: undefined is not a function.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> ===========================================================
>
> The number and type of exceptions is highly variable from run to run -
> anywhere from 1-9 out of 10.
> The EcmaError in particular only happens occasionally.
>
> --
> Fergus Gallagher          Tel: +44 (20) 8 987 0717
> Orbis                     Fax: +44 (20) 8 742 2649
> The Swan Centre           email: Fergus.Gallagher@orbisuk.com
> Fishers Lane              Web: http://www.orbisuk.com
> London W4 1RX / UK
2000-07-03 18:40:35 +00:00
jband%netscape.com
53edf6e9f7 updating readme. Not part of build 2000-07-02 19:37:57 +00:00
cls%seawood.org
1f3b6d75ab Removed obsolete REQUIRES variable from every Makefile.in/makefile.win 2000-06-30 08:08:04 +00:00
jband%netscape.com
1a7630d560 Fix dogfood/crash bugs: 42750, 39858 and fix 43897 and improve JS/XPConnect error reporting to help with crasher 40792. r=mccabe@netscape.com. 2000-06-30 04:04:46 +00:00
beard%netscape.com
0eeae607ae Fix build bustage. 2000-06-29 18:40:58 +00:00
rogerl%netscape.com
fd98adafce use handleDot for call, too. 2000-06-29 18:30:47 +00:00
beard%netscape.com
8f5fea173e delete property support. 2000-06-29 18:14:14 +00:00
beard%netscape.com
a4c5f704f4 DELETE_PROP 2000-06-29 18:13:46 +00:00
beard%netscape.com
7a6367c583 DELETE_PROP 2000-06-29 17:14:56 +00:00
beard%netscape.com
11134b4173 added DELETE_PROP instruction to implement the "delete" operation. 2000-06-29 17:11:50 +00:00
beard%netscape.com
97dfdc5f04 unused parameter warning 2000-06-29 05:48:09 +00:00
beard%netscape.com
8f4cadb250 complementary operator delete(void*, JSClass*). 2000-06-29 05:46:36 +00:00
beard%netscape.com
8891b0c7ba some classes to test js2 with. 2000-06-29 04:49:48 +00:00
beard%netscape.com
8da0055bc5 updated dependencies 2000-06-29 04:25:10 +00:00
beard%netscape.com
074f981eb4 Changed StaticCall to use static slot. 2000-06-29 04:23:56 +00:00
beard%netscape.com
b202adfd39 Fixing static dotted expressions. 2000-06-29 04:23:20 +00:00
beard%netscape.com
7a512866fd now uses conditional compilation #if defined(OPCODE_NAMES), so that a simple "icode.h" can be included by vmtypes.h and vmtypes.cpp. 2000-06-29 04:21:00 +00:00
beard%netscape.com
486b437613 moved all machine generated classes, etc. to icode.h. 2000-06-29 04:19:19 +00:00
beard%netscape.com
2a451cdd8b Generated by tools/gencode.pl. 2000-06-29 04:18:16 +00:00
beard%netscape.com
640ba6e24c fixed static calls. 2000-06-29 03:15:52 +00:00
rogerl%netscape.com
63744d7c1c Implicit this and class lookup stuff. 2000-06-29 01:21:41 +00:00
cls%seawood.org
e5efcb7528 wrap ifndef XPCONNECT_STANDALONE around xpconnect test components that require external interfaces. Thanks to Mark Adams <madams@janna.com> for the patch. Bug 42026 2000-06-28 22:53:55 +00:00
beard%netscape.com
237dd352ed implemented JSClass::printProperties(). 2000-06-28 19:46:13 +00:00
beard%netscape.com
9930edd0d5 Enhanced printing of types. 2000-06-28 19:45:44 +00:00
beard%netscape.com
c0e9f6d274 Type of a JSType* is Type_Type (wow, recursive). Changed mBaseType to be JSType* instead of const JSType*. 2000-06-28 19:45:09 +00:00
rogerl%netscape.com
52bffdadcf First set of unified 'dot' handling changes for statics. 2000-06-28 18:41:30 +00:00
beard%netscape.com
d40b8dd8cb added jsclasses.h 2000-06-28 18:10:04 +00:00
beard%netscape.com
941b505765 Fix string <. 2000-06-28 16:38:20 +00:00
beard%netscape.com
d9bf640477 Fixed dynamic lookup of static slots. Added code to compare strings. 2000-06-28 16:32:52 +00:00
beard%netscape.com
b1350d87b6 GET_STATIC/SET_STATIC/STATIC_XCR now use an index rather than a name. Implemented GET_PROP/SET_PROP for class objects (looks up slot dynamically, etc.) 2000-06-28 16:15:06 +00:00
beard%netscape.com
866b5d3d8d GET_STATIC/SET_STATIC/STATIC_XCR now use an index rather than a name. Now using JSClass::hasStatic() rather than looking up statics in class' scope. 2000-06-28 16:14:18 +00:00
beard%netscape.com
8132734212 GET_STATIC/SET_STATIC/STATIC_XCR now use an index rather than a name. 2000-06-28 16:13:12 +00:00
beard%netscape.com
970477555f Static slots. 2000-06-28 16:11:54 +00:00
cls%seawood.org
a9f6433fbe Tweaks to build xpconnect standalone. Bug #42024. Thanks to Mark Adams <madams@janna.com> for the patches. 2000-06-28 07:03:13 +00:00
beard%netscape.com
2b1351cc3b Win-specific operator== noise. 2000-06-27 03:52:56 +00:00
beard%netscape.com
4873ce7882 Fixed unitialized static class members. 2000-06-27 03:43:40 +00:00
beard%netscape.com
7b2b4a1e2f addSlot -> defineSlot, added defineStatic. 2000-06-27 03:42:42 +00:00
brendan%mozilla.org
9f75641ee2 Not again\! 2000-06-27 03:29:49 +00:00
beard%netscape.com
74e8d0a780 Fixed type management. 2000-06-27 03:21:33 +00:00
brendan%mozilla.org
af94bec8f7 Fix my stupid missing comma bustage. 2000-06-27 03:17:47 +00:00
rogerl%netscape.com
fbdb3fe1c1 lots of stuff me and Patrick did 2000-06-27 02:39:32 +00:00
brendan%mozilla.org
6afe0ed1a7 Fix JS_SetPrototype and __proto__ setting to deal with shared scopes; use JSObjectOps for setProto and setParent operations, and add spare op slots (41126, r=shaver@mozilla.org,pschwartau@netscape.com). 2000-06-27 02:37:25 +00:00
beard%netscape.com
965f10e915 JSValue::operator==: added CASE(type) to fix warning. 2000-06-26 17:47:07 +00:00
beard%netscape.com
f276cc3dfd added JSObject::deleteProperty(), and changed mName in JSType to be a JSString. Need to revisit other uses of String soon. 2000-06-26 17:42:20 +00:00
beard%netscape.com
07dff8c5d1 simplified string addition 2000-06-26 17:25:25 +00:00
beard%netscape.com
fef138fae2 defined JSStringBase, and constructors from in JSString 2000-06-26 17:24:57 +00:00
beard%netscape.com
769d11bcbf String addition: don't share structure with LHS. 2000-06-26 17:09:27 +00:00
beard%netscape.com
45301bb589 added constructor from JSString&. 2000-06-26 16:55:01 +00:00
beard%netscape.com
3a78e14938 Reset register usage after generating each initializer statement. 2000-06-26 15:19:45 +00:00
beard%netscape.com
714e109074 Simplified NEW_CLASS, using a single do .. while loop, introducing nextPC instruction iterator to simplify initial case. now calls all defined constructors. 2000-06-26 15:06:36 +00:00
beard%netscape.com
07d6ee2613 Only call non-null constructors. 2000-06-25 17:04:38 +00:00
beard%netscape.com
40e53d46ea Conditionally set constructor, if it has any instructions. 2000-06-25 17:04:01 +00:00
beard%netscape.com
21f549896a updated dependencies 2000-06-25 16:44:29 +00:00
beard%netscape.com
d6c6cc31bb check for non-null superClass 2000-06-25 16:43:25 +00:00
beard%netscape.com
5d311184e2 hooked up superClass' scope as the prototype of a class's scope, to do method inheritance, removed bogus JSInstance::getSlotCount(), which overcounted slots. 2000-06-25 16:35:33 +00:00
beard%netscape.com
728580c6f8 Added calls to superClass constructors. 2000-06-24 22:42:43 +00:00
beard%netscape.com
e41bd745dd JSInstance::getSlotCount() no longer recursive. 2000-06-24 22:42:15 +00:00
beard%netscape.com
7b76b9503a Beginning support for superclass slots. 2000-06-24 22:07:00 +00:00
beard%netscape.com
36eef7adea Added emptyArgs, removed unused return value in readEvalFile 2000-06-24 05:42:51 +00:00