b994d1306038f9a29b4f367d4b49d768677bca0e
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2004-09-01  Richard Williamson   <rjw@apple.com>
2
3         Add pid to exception messages (to help debug dashboard clients).
4
5         Reviewed by Chris.
6
7         * kjs/interpreter.cpp:
8         (Interpreter::evaluate):
9
10 === Safari-161 ===
11
12 2004-08-20  Richard Williamson   <rjw@apple.com>
13
14         Implemented new JNI abstraction.  We no longer invoke Java methods
15         directly with JNI, rather we call into the plugin.  This allows the
16         plugin to dispatch the call to the appropriate VM thread.  This
17         change should (will?) fix a whole class of threading related problems with
18         the Java VM.
19
20         Reviewed by Hyatt.
21
22         * JavaScriptCore.pbproj/project.pbxproj:
23         * bindings/c/c_instance.h:
24         (KJS::Bindings::CInstance::setExecutionContext):
25         (KJS::Bindings::CInstance::executionContext):
26         * bindings/jni/jni_instance.cpp:
27         (JavaInstance::JavaInstance):
28         (JavaInstance::invokeMethod):
29         (JavaInstance::setExecutionContext):
30         (JavaInstance::executionContext):
31         * bindings/jni/jni_instance.h:
32         * bindings/jni/jni_jsobject.cpp:
33         (JSObject::convertJObjectToValue):
34         * bindings/jni/jni_runtime.cpp:
35         (JavaField::JavaField):
36         (JavaArray::convertJObjectToArray):
37         (JavaField::valueFromInstance):
38         (JavaArray::JavaArray):
39         (JavaArray::valueAt):
40         * bindings/jni/jni_runtime.h:
41         (KJS::Bindings::JavaArray::operator=):
42         (KJS::Bindings::JavaArray::executionContext):
43         * bindings/jni/jni_utility.h:
44         * bindings/objc/objc_instance.h:
45         (KJS::Bindings::ObjcInstance::setExecutionContext):
46         (KJS::Bindings::ObjcInstance::executionContext):
47         * bindings/runtime.cpp:
48         (Instance::createBindingForLanguageInstance):
49         * bindings/runtime.h:
50         * bindings/runtime_root.h:
51         (KJS::Bindings::RootObject::nativeHandle):
52
53 === Safari-158 ===
54
55 2004-08-19  Vicki Murley  <vicki@apple.com>
56
57         Reviewed by John.
58
59         * kjs/property_map.cpp:
60         (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
61
62 2004-08-17  Darin Adler  <darin@apple.com>
63
64         Reviewed by Adele.
65
66         - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
67
68         * kjs/property_map.h: Added some private functions.
69         * kjs/property_map.cpp:
70         (KJS::PropertyMap::clear): Set sentinelCount to 0.
71         (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
72         Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
73         (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
74         (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
75         (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
76         deleted-element sentinels.
77         (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
78
79 2004-08-16  Maciej Stachowiak  <mjs@apple.com>
80
81         Code change by Eric Albert, reviewd by me.
82
83         <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
84
85         * kjs/date_object.cpp:
86         (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
87         entirely would be even better, but is not required to fix this bug.
88
89 === Safari-157 ===
90
91 2004-08-16  Richard Williamson   <rjw@apple.com>
92
93         Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
94
95         Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
96
97         Reviewed by Chris.
98
99         * bindings/NP_jsobject.cpp:
100         (NPN_Evaluate):
101         * bindings/jni/jni_jsobject.cpp:
102         (JSObject::eval):
103         * bindings/objc/WebScriptObject.mm:
104         (-[WebScriptObject evaluateWebScript:]):
105
106 2004-08-15  Richard Williamson   <rjw@apple.com>
107
108         More updates to np headers.  Implemented new NPN functions.
109
110         Reviewed by Darin.
111
112         * bindings/NP_jsobject.cpp:
113         (NPN_HasProperty):
114         (NPN_HasMethod):
115         * bindings/npapi.h:
116         * bindings/npruntime.h:
117
118 2004-08-13  Darin Adler  <darin@apple.com>
119
120         - fix build so we can compile again
121
122         * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
123         is good enough so that we can compile, but it's only a stopgap measure, because I think
124         Richard has a newer one he wants to check in.
125
126 2004-08-12  Richard Williamson   <rjw@apple.com>
127
128         Bring npruntime.h and friends closer to compliance with
129         latest spec.
130
131         Reviewed by Maciej.
132
133         * JavaScriptCore.pbproj/project.pbxproj:
134         * bindings/NP_jsobject.cpp:
135         (jsAllocate):
136         (_NPN_CreateScriptObject):
137         (NPN_Call):
138         (NPN_Evaluate):
139         (NPN_GetProperty):
140         (NPN_SetProperty):
141         (NPN_RemoveProperty):
142         * bindings/NP_jsobject.h:
143         * bindings/c/c_instance.cpp:
144         (CInstance::invokeMethod):
145         * bindings/c/c_utility.cpp:
146         (convertNPVariantToValue):
147         * bindings/npruntime.cpp:
148         (NPN_IdentifierIsString):
149         (NPN_VariantIsVoid):
150         (NPN_VariantIsNull):
151         (NPN_VariantIsUndefined):
152         (NPN_VariantIsBool):
153         (NPN_VariantIsInt32):
154         (NPN_VariantIsDouble):
155         (NPN_VariantIsString):
156         (NPN_VariantIsObject):
157         (NPN_VariantToBool):
158         (NPN_VariantToString):
159         (NPN_VariantToInt32):
160         (NPN_VariantToDouble):
161         (NPN_VariantToObject):
162         (NPN_InitializeVariantAsVoid):
163         (NPN_InitializeVariantAsNull):
164         (NPN_InitializeVariantAsUndefined):
165         (NPN_InitializeVariantWithBool):
166         (NPN_InitializeVariantWithInt32):
167         (NPN_InitializeVariantWithDouble):
168         (NPN_InitializeVariantWithString):
169         (NPN_InitializeVariantWithStringCopy):
170         (NPN_InitializeVariantWithObject):
171         (NPN_InitializeVariantWithVariant):
172         (NPN_ReleaseVariantValue):
173         (NPN_CreateObject):
174         * bindings/npruntime.h:
175         (_NPString::):
176         (_NPString::_NPVariant::):
177         * bindings/npruntime_priv.h: Added.
178
179 2004-08-12  Darin Adler  <darin@apple.com>
180
181         Reviewed by Adele.
182
183         - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
184
185         * kjs/function.cpp:
186         (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
187         (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
188         (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
189         to skip leading "+" or "-".
190
191 === Safari-156 ===
192
193 2004-08-12  Darin Adler  <darin@apple.com>
194
195         Reviewed by Ken.
196
197         - fixed 43 Mozilla JavaScript tests
198
199         * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
200         * kjs/date_object.cpp:
201         (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
202         than constructing a number object to pass to it.
203         (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
204         (KJS::parseDate): Change to return a double instead of creating the Number object here.
205         (KJS::timeClip): Implement this as specified in the language standard.
206
207         * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
208         flags on the prototype property.
209
210         * kjs/function.cpp:
211         (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
212         currently in scope.
213         (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
214         file later.
215         (KJS::parseDigit): Added. Helper function for parseInt.
216         (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
217         strtoll can handle. Also matches standard more closely.
218         (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
219         instead of 0.
220         (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
221
222         * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
223
224         * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
225         * kjs/lexer.cpp:
226         (Lexer::setCode): Clear error state.
227         (Lexer::lex): Set error state if the lexer encounters an error
228
229         * kjs/internal.cpp:
230         (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
231         (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
232
233         * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
234         Change round to round values between -0.5 and -0 to -0 instead of +0.
235
236         * kjs/nodes.h: Add evaluateReference function to GroupNode.
237         * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
238         expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
239         would change x.y into a value that can't be deleted as a side effect.
240
241         * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
242         the specification.
243
244         * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
245         get rid of the fixed size limit for code.
246
247         * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
248         returns the string without creating a new Rep, since I'm using substr in a place where it will
249         often be passed a 0.
250
251         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
252         the other day that was making a couple tests fail.
253         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
254         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
255         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
256         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
257         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
258
259         * kjs/string_object.lut.h: Regenerated.
260
261 2004-08-11  Darin Adler  <darin@apple.com>
262
263         - fixed a tiny problem with the UTF-16 PCRE check-in
264
265         * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
266         the ctype_meta flag to get set in items that should not have it.
267
268         * pcre/chartables.c: Regenerated.
269
270 2004-08-10  Richard Williamson   <rjw@apple.com>
271
272         Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
273
274         The following WebScripting methods are now supported on bound
275         objects:
276
277         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
278         - (void)setValue:(id)value forUndefinedKey:(NSString *)key
279         - (id)valueForUndefinedKey:(NSString *)key
280
281         Reviewed by Chris.
282
283         * bindings/c/c_class.cpp:
284         (CClass::fieldNamed):
285         * bindings/c/c_class.h:
286         * bindings/jni/jni_class.cpp:
287         (JavaClass::fieldNamed):
288         * bindings/jni/jni_class.h:
289         * bindings/objc/objc_class.h:
290         (KJS::Bindings::ObjcClass::isa):
291         * bindings/objc/objc_class.mm:
292         (ObjcClass::methodsNamed):
293         (ObjcClass::fieldNamed):
294         (ObjcClass::fallbackObject):
295         * bindings/objc/objc_instance.h:
296         * bindings/objc/objc_instance.mm:
297         (ObjcInstance::invokeMethod):
298         (ObjcInstance::setValueOfField):
299         (ObjcInstance::setValueOfUndefinedField):
300         (ObjcInstance::getValueOfField):
301         (ObjcInstance::getValueOfUndefinedField):
302         * bindings/objc/objc_runtime.h:
303         (KJS::Bindings::ObjcField::~ObjcField):
304         (KJS::Bindings::ObjcField::ObjcField):
305         (KJS::Bindings::ObjcField::operator=):
306         (KJS::Bindings::FallbackObjectImp::classInfo):
307         * bindings/objc/objc_runtime.mm:
308         (ObjcField::ObjcField):
309         (ObjcField::name):
310         (ObjcField::type):
311         (ObjcField::valueFromInstance):
312         (ObjcField::setValueToInstance):
313         (FallbackObjectImp::FallbackObjectImp):
314         (FallbackObjectImp::get):
315         (FallbackObjectImp::put):
316         (FallbackObjectImp::canPut):
317         (FallbackObjectImp::implementsCall):
318         (FallbackObjectImp::call):
319         (FallbackObjectImp::hasProperty):
320         (FallbackObjectImp::deleteProperty):
321         (FallbackObjectImp::defaultValue):
322         * bindings/runtime.h:
323         (KJS::Bindings::Class::fallbackObject):
324         (KJS::Bindings::Instance::getValueOfUndefinedField):
325         (KJS::Bindings::Instance::setValueOfUndefinedField):
326         * bindings/runtime_object.cpp:
327         (RuntimeObjectImp::get):
328         (RuntimeObjectImp::put):
329         (RuntimeObjectImp::canPut):
330         (RuntimeObjectImp::hasProperty):
331         * bindings/testbindings.mm:
332         (-[MyFirstInterface valueForUndefinedKey:]):
333         (-[MyFirstInterface setValue:forUndefinedKey:]):
334
335 2004-08-10  Darin Adler  <darin@apple.com>
336
337         Reviewed by Dave.
338
339         - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
340
341         * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
342         or uint16_t depending on the mode, and used appropriate in the 7 public functions
343         that need to use it.
344         * pcre/pcre.c: Add UTF-16 support to all functions.
345         * pcre/study.c: Ditto.
346
347         * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
348         the mode. Changed declarations to use symbolic constants and typedefs so we size
349         things to ichar when needed.
350
351         * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
352         sized to 16-bit characters instead of 8-bit.
353
354         * pcre/get.c:
355         (pcre_copy_substring): Use pcre_char instead of char.
356         (pcre_get_substring_list): Ditto.
357         (pcre_free_substring_list): Ditto.
358         (pcre_get_substring): Ditto.
359         (pcre_free_substring): Ditto.
360
361         * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
362         of hard-coding 8-bit table sizes.
363
364         * pcre/chartables.c: Regenerated.
365
366         * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
367         * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
368         is not null. The null string still has a null pointer. This prevents us from
369         passing a null through to the regular expression engine (which results in a null
370         error even when the string length is 0).
371
372         * kjs/regexp.cpp:
373         (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
374         (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
375
376 2004-08-09  Darin Adler  <darin@apple.com>
377
378         Reviewed by Maciej.
379
380         - fixed 28 Mozilla JavaScript tests
381
382         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
383         checking the number of arguments for the join method.
384
385         * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
386         than integers, so we aren't limited to 32 bits.
387
388         * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
389         the implementation of the pow operation. Also simplied a case that was handling positive
390         and negative infinity separately.
391
392         * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
393         putting them in a long, so that unsigned shift will work properly.
394
395         * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
396
397         * kjs/operations.cpp:
398         (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
399         sign of isinf; our isinf function returns +1 even for negative infinity.
400         (KJS::isNegInf): And again.
401         (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
402         Our floating point already handles the various infinity cases correctly.
403
404         * kjs/regexp_object.cpp:
405         (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
406         (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
407         array in cases where we did not match.
408         (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
409         "global", "ignoreCase", "multiline", and "source".
410
411         * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
412         string into undefined rather than an empty string. For the slice method, handle an
413         undefined parameter for the limit properly as decribed in the specification, and add
414         the limit to one case that didn't have the limit at all. For the methods that generate
415         HTML strings, use lowercase tags instead of uppercase.
416
417         * kjs/ustring.cpp:
418         (KJS::UChar::toLower): Use u_tolower from the ICU library.
419         (KJS::UChar::toUpper): Use u_toupper from the ICU library.
420         (KJS::UString::append): Fix some math that caused a buffer overflow.
421         (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
422         flag) rather than converting them all to 0.
423         (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
424
425         * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
426
427         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
428         the Unicode specification in a few cases where it was wrong before.
429         * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
430         * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
431         * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
432         * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
433         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
434         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
435         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
436         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
437         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
438
439         * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
440
441         * kjs/number_object.lut.h: Regenerated.
442
443 2004-08-09  Darin Adler  <darin@apple.com>
444
445         Reviewed by Maciej.
446
447         - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
448
449         * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
450         we get a buffer overflow.
451
452 === Safari-155 ===
453
454 2004-08-05  Richard Williamson   <rjw@apple.com>
455
456         Fixed part of 3674747.  The QT guys need this for feature freeze.
457
458         This patch implements support for the
459
460         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
461
462         method of objects bound to JavaScript.
463
464         Reviewed by John.
465
466         * ChangeLog:
467         * bindings/objc/objc_class.mm:
468         (ObjcClass::methodsNamed):
469         (ObjcClass::fieldNamed):
470         * bindings/objc/objc_instance.mm:
471         (ObjcInstance::invokeMethod):
472         * bindings/objc/objc_runtime.h:
473         (KJS::Bindings::ObjcMethod::~ObjcMethod):
474         (KJS::Bindings::ObjcMethod::isFallbackMethod):
475         (KJS::Bindings::ObjcMethod::javaScriptName):
476         * bindings/objc/objc_runtime.mm:
477         (ObjcMethod::ObjcMethod):
478         (ObjcMethod::getMethodSignature):
479         (ObjcMethod::setJavaScriptName):
480         * bindings/testbindings.mm:
481
482 2004-08-04  Vicki Murley  <vicki@apple.com>
483
484         Reviewed by mjs.
485  
486         - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error        
487
488         * kjs/lexer.cpp:
489         (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
490         go to the next line and continue parsing the string (instead of failing).  This matches 
491         behavior in Mac IE and Mozilla.
492
493 2004-08-03  Kevin Decker  <kdecker@apple.com>
494
495         Reviewed by Darin.
496
497         Rolled in changes from the latest KJS sources that support additional 
498         Number.prototype functions. 
499
500         Specifically this patch covers the follow parts of the ECMA 3 spec:
501         15.7.4.5, 15.7.4.6, and 15.7.4.7 
502         
503         Fixes:
504         <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
505         <rdar://problem/3749492> missing Number.toPrecision prototype implementation
506         <rdar://problem/3749591> missing Number.toExponential prototype implementation
507
508         * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
509         list of supported identifiers (a macro).
510         * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
511         and toExponential(). 
512         (NumberPrototypeImp::NumberPrototypeImp):
513         (NumberProtoFuncImp::call):
514         * kjs/number_object.h: Added property names for toFixed, toPrecision,
515         and toExponential. 
516         (KJS::NumberProtoFuncImp::):
517         * tests/mozilla/expected.html: Update results.
518
519 2004-08-03  Darin Adler  <darin@apple.com>
520
521         Reviewed by Ken.
522
523         - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
524
525         * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
526         we are supposed to just copy the regular expression object, and do so.
527         Also tighten up arguments check to handle case where an actual "undefined"
528         is passed rather than just omitting an argument.
529
530         * tests/mozilla/expected.html: Update results.
531
532 2004-08-02  Darin Adler  <darin@apple.com>
533
534         * tests/mozilla/.cvsignore: Added.
535         * tests/mozilla/expected.html: Update results.
536
537 2004-08-02  Darin Adler  <darin@apple.com>
538
539         Reviewed by Ken.
540
541         - fixed RegExp.toString so 3 more Mozilla regexp tests pass
542
543         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
544         Append the flags here so more tests paseed.
545
546 2004-08-02  Darin Adler  <darin@apple.com>
547
548         Reviewed by Ken.
549
550         - fixed a couple things making 5 Mozilla regexp tests pass
551
552         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
553         for the prototype.
554         (RegExpObjectImp::construct): Fix bug where the string "undefined" would
555         be used as the flags string when no parameter was passed.
556
557         * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
558         Added a class info object for RegExp prototype so it can return
559         a string instead of raising an exception when converting to a string.
560
561         * tests/mozilla/expected.html: Update results.
562
563 2004-08-02  Darin Adler  <darin@apple.com>
564
565         Reviewed by Kevin.
566
567         - fix crashes in mozilla tests due to mishandling NaN
568
569         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
570         calls to toInteger so that NaN will get turned into something that fits in an integer.
571         These were the ones John already fixed, but his fix used isnan and the new fix is
572         more efficient.
573
574         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
575         after a call to toInteger to handle NaN properly. Also removed separate check
576         for undefined that's not needed.
577
578         * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
579         as in the above two files, but for a lot more functions. Also changed one place with
580         an explicit check for undefined to instead just check isNaN.
581
582         * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
583         like me who don't keep $SYMROOTS in their $PATH.
584
585 === Safari-154 ===
586
587 === Safari-153 ===
588
589 2004-07-26  Kevin Decker  <kdecker@apple.com>
590
591         Changes done by Darin, reviewed by Kevin.
592
593         - changed testkjs to build in Xcode rather than from Makefile
594
595         * .cvsignore: Removed obsolete files from this list.
596         * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
597         Changed to build target "All" rather than default target. This makes us
598         build the testkjs test tool.
599         * dummy.cpp: Removed.
600         * kjs/.cvsignore: Removed obsolete files from this list, including
601         the testkjs tool, which is now built in the symroots directory.
602         * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
603         changed this file. Also this has the nice side effect of causing the tool
604         to be rebuilt in the new location even if there are no other changes in
605         your tree when you check this out.
606         * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
607         without setting the execute bit on jsDriver.pl.
608
609 2004-07-22  Kevin Decker  <kdecker@apple.com>
610
611         Reviewed by Darin
612         
613         Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions). 
614
615         * kjs/function_object.cpp:
616         (FunctionObjectImp::construct):
617         * kjs/function_object.h:
618         * kjs/object.cpp:
619         (KJS::ObjectImp::construct):
620         * kjs/object.h:
621         (KJS::Object::construct):
622
623 2004-07-21  Darin Adler  <darin@apple.com>
624
625         * bindings/npruntime.h: Fixed typo.
626
627 2004-07-19  John Sullivan  <sullivan@apple.com>
628
629         Reviewed by Maciej.
630         
631         - bulletproofed array.slice() against NAN arguments. Harri noticed this
632         vulnerability in my patch for 3714644
633
634         * kjs/array_object.cpp:
635         (ArrayProtoFuncImp::call):
636         handle NAN parameters passed to slice() by clamping to 0 and length.
637
638 2004-07-19  Richard Williamson   <rjw@apple.com>
639
640         Fixed 3733349.  Prevent Java applet callbacks into JavaScript after applet
641         has been destroyed.
642
643         Reviewed by John.
644
645         * bindings/jni/jni_jsobject.cpp:
646         (JSObject::invoke):
647         (JSObject::JSObject):
648
649 2004-07-16  John Sullivan  <sullivan@apple.com>
650
651         Reviewed by Maciej.
652         
653         - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link 
654         hangs browser with javascript
655
656         * kjs/array_object.cpp:
657         (ArrayProtoFuncImp::call):
658         Check for undefined type for args[0] the same way we were already checking
659         for args[1]. In this case, args was zero-length, but we were treating
660         args[0] like an integer anyway. Resulted in some code looping from a NAN
661         value to 4, taking approximately forever.
662
663         * JavaScriptCore.pbproj/project.pbxproj:
664         version wars
665         
666 === Safari-152 ===
667
668 2004-07-14  Maciej Stachowiak  <mjs@apple.com>
669
670         Reviewed by John.
671
672         <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
673         <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
674
675         * kjs/number_object.cpp:
676         (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
677
678 2004-07-13  Kevin Decker  <kdecker@apple.com>
679
680         Reviewed by kocienda.
681
682         - made testkjs and JavaScriptCore a subtarget of 'All'
683         - testkjs now builds in $SYMROOTS
684
685         * JavaScriptCore.pbproj/project.pbxproj:
686
687 === Safari-151 ===
688
689 2004-06-24  Chris Blumenberg  <cblu@apple.com>
690
691         Ignore .mode1 files in JavaScriptCore.pbproj
692
693         Reviewed by kocienda.
694
695         * JavaScriptCore.pbproj/.cvsignore:
696
697 2004-06-23  Richard Williamson   <rjw@apple.com>
698
699         Implemented changes for latest npruntime.h.
700         
701         Reviewed by Chris.
702
703         * JavaScriptCore.pbproj/project.pbxproj:
704         * bindings/NP_jsobject.cpp:
705         (listFromVariantArgs):
706         (identiferFromNPIdentifier):
707         (_NPN_CreateScriptObject):
708         (NPN_Call):
709         (NPN_Evaluate):
710         (NPN_GetProperty):
711         (NPN_SetProperty):
712         (NPN_RemoveProperty):
713         * bindings/NP_jsobject.h:
714         * bindings/c/c_class.cpp:
715         (CClass::methodsNamed):
716         (CClass::fieldNamed):
717         * bindings/c/c_instance.cpp:
718         (CInstance::invokeMethod):
719         * bindings/c/c_utility.cpp:
720         (convertNPVariantToValue):
721         * bindings/c/c_utility.h:
722         * bindings/npruntime.cpp:
723         (stringIdentifierEqual):
724         (stringIdentifierHash):
725         (getStringIdentifierDictionary):
726         (intIdentifierEqual):
727         (intIdentifierHash):
728         (getIntIdentifierDictionary):
729         (NPN_GetStringIdentifier):
730         (NPN_GetStringIdentifiers):
731         (NPN_GetIntIdentifier):
732         (NPN_IdentifierIsString):
733         (NPN_UTF8FromIdentifier):
734         (NPN_VariantToInt32):
735         (NPN_VariantToDouble):
736         (NPN_SetException):
737         * bindings/npruntime.h:
738         * bindings/objc/WebScriptObject.mm:
739         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
740         * bindings/runtime_object.cpp:
741         (RuntimeObjectImp::~RuntimeObjectImp):
742         * bindings/runtime_root.cpp:
743         (KJS::Bindings::rootForInterpreter):
744         * bindings/testbindings.cpp:
745         (initializeIdentifiers):
746         (logMessage):
747         (setDoubleValue):
748         (setIntValue):
749         (setBooleanValue):
750
751 === JavaScriptCore-146.1 ===
752
753 2004-06-16  Richard Williamson   <rjw@apple.com>
754
755         Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
756
757         This turned out to be a show stopper for Dashboard.  Accessing a nil
758         ObjC property from JS caused a crash.  Similar to the problem
759         3696112 fixed below.
760         
761         Reviewed by Trey.
762
763         * bindings/objc/objc_runtime.mm:
764         (KJS::Bindings::ObjcField::valueFromInstance):
765
766 === Safari-146 ===
767
768 2004-06-16  Richard Williamson   <rjw@apple.com>
769
770         Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
771
772         This turned out to be a show stopper for Dashboard.  We now
773         return Undefined() when nil is returned from a ObjC method
774         that returns an object type.
775         
776         Reviewed by Maciej.
777
778         * bindings/objc/objc_utility.mm:
779         (KJS::Bindings::convertObjcValueToValue):
780
781 === Safari-145 ===
782
783 2004-06-15  Richard Williamson   <rjw@apple.com>
784
785         Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
786
787         No longer need to check respondsToSelector: for
788         isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
789         because these now have a default implementation on NSObject.
790
791         Reviewed by Trey.
792
793         * bindings/objc/objc_class.mm:
794         (ObjcClass::methodsNamed):
795         (ObjcClass::fieldNamed):
796
797 2004-06-14  Darin Adler  <darin@apple.com>
798
799         Reviewed by Maciej.
800
801         - fixed some things for GC that Patrick missed, or that happened after the branch
802
803         * bindings/objc/WebScriptObject.mm:
804         (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
805         (-[WebScriptObject finalize]): Added.
806
807         - added some missing nil checks
808
809         * bindings/objc/objc_instance.mm:
810         (ObjcInstance::ObjcInstance): Check for nil.
811         (ObjcInstance::~ObjcInstance): Check for nil.
812         (ObjcInstance::operator=): Check for nil.
813
814 2004-06-14  Darin Adler  <darin@apple.com>
815
816         Reviewed by me, code changes by Patrick Beard.
817
818         - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
819
820         * bindings/objc/objc_instance.mm:
821         (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
822         (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
823         (ObjcInstance::operator=): More of the same.
824         (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
825
826         * bindings/objc/objc_runtime.mm:
827         (ObjcArray::ObjcArray): Use CFRetain instead of retain.
828         (ObjcArray::~ObjcArray): Use CFRelease instead of release.
829         (ObjcArray::operator=): More of the same.
830
831         * bindings/testbindings.mm: Fixed incorrect license.
832         (main): Use [pool drain] if compiling on Tiger.
833
834 === Safari-144 ===
835
836 2004-06-10  Kevin Decker  <kdecker@apple.com>
837
838         Reviewed by John.
839
840         * kjs/lexer.cpp: 
841         (Lexer::setCode):
842             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
843         * kjs/lexer.h:
844         (KJS::Lexer::lineNo):
845             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
846
847 === JavaScriptCore-143.2 ===
848
849 2004-06-07  Darin Adler  <darin@apple.com>
850
851         - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
852
853         * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
854         * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
855
856 === JavaScriptCore-143.1 ===
857
858 2004-06-04  Kevin Decker  <kdecker@apple.com>
859
860         Reviewed by Darin
861         
862         - fixed <rdar://problem/3680594>
863
864         * kjs/object.cpp:
865         (KJS::Error::create):
866
867 === Safari-143 ===
868
869 2004-06-04  Darin Adler  <darin@apple.com>
870
871         * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
872
873 2004-06-04  Kevin Decker  <kdecker@apple.com>
874
875         Reviewed by Dave.
876
877         - ObjC bindings do not (yet) pass along sourceurl or line numbers
878         - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
879         - changed the wording of an error message
880         - the lexer, parser, and interpreter have been made "sourceURL aware"
881         - stored the url into Error
882          
883         * bindings/NP_jsobject.cpp:
884         (NPN_Evaluate):
885         * bindings/jni/jni_jsobject.cpp:
886         (JSObject::eval):
887         * bindings/objc/WebScriptObject.mm:
888         (-[WebScriptObject evaluateWebScript:]):
889         * kjs/function.cpp:
890         (GlobalFuncImp::call):
891         * kjs/function_object.cpp:
892         (FunctionObjectImp::construct):
893         * kjs/internal.cpp:
894         (Parser::parse):
895         (InterpreterImp::checkSyntax):
896         (InterpreterImp::evaluate):
897         * kjs/internal.h:
898         * kjs/interpreter.cpp:
899         (Interpreter::evaluate):
900         * kjs/interpreter.h:
901         * kjs/lexer.cpp:
902         (Lexer::setCode):
903         * kjs/lexer.h:
904         (KJS::Lexer::sourceURL):
905         * kjs/nodes.cpp:
906         (Node::Node):
907         (Node::throwError):
908         (FunctionCallNode::evaluate):
909         * kjs/nodes.h:
910         * kjs/object.cpp:
911         (KJS::Error::create):
912         * kjs/object.h:
913
914 2004-06-04  Richard Williamson   <rjw@apple.com>
915
916         Fixed crash when attempting to access properties on nil
917         object.
918         
919         Reviewed by John.
920
921         * bindings/objc/objc_instance.mm:
922         (ObjcInstance::getClass):
923         * bindings/runtime_object.cpp:
924         (RuntimeObjectImp::get):
925         * bindings/testM.js:
926         * bindings/testbindings.mm:
927         (-[MyFirstInterface getString]):
928
929 2004-05-27  Kevin Decker  <kdecker@apple.com>
930
931         Reviewed by Ken.
932
933         -revised generated error message content
934         
935         * kjs/error_object.cpp:
936         (ErrorProtoFuncImp::call):
937         * kjs/internal.cpp:
938         (Parser::parse):
939         * kjs/object.cpp:
940         (KJS::Error::create):
941
942 === Safari-142 ===
943
944 2004-05-27  Richard Williamson   <rjw@apple.com>
945
946         Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
947
948         Reviewed by Chris.
949
950         * bindings/objc/WebScriptObject.h:
951
952 2004-05-27  Darin Adler  <darin@apple.com>
953
954         Reviewed by Maciej.
955
956         - moved to new symlink technique for embedding frameworks
957
958         * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
959         because we don't need it any more.
960
961 2004-05-24  Richard Williamson   <rjw@apple.com>
962
963         Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
964         fixed ClassInfo to correctly reflect inheritance.  This is required
965         because of the runtime checks in JSC for arrays, i.e. in
966         the Function objects apply method.
967
968         Reviewed by Ken.
969
970         * bindings/jni/jni_runtime.cpp:
971         (JavaArray::convertJObjectToArray):
972         * bindings/objc/objc_utility.mm:
973         (KJS::Bindings::convertObjcValueToValue):
974         * bindings/runtime_array.cpp:
975         (RuntimeArrayImp::RuntimeArrayImp):
976         * bindings/runtime_array.h:
977         * bindings/testM.js: Added.
978         * bindings/testbindings.mm:
979         (+[MyFirstInterface webScriptNameForSelector:]):
980         (-[MyFirstInterface logMessages:]):
981         (-[MyFirstInterface logMessage:prefix:]):
982         (-[MyFirstInterface callJSObject::]):
983
984 2004-05-22  Darin Adler  <darin@apple.com>
985
986         Reviewed by Maciej.
987
988         - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
989
990         * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
991         with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
992         CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
993         it hasn't been set explicitly.
994
995 === Safari-141 ===
996
997 2004-05-20  Richard Williamson   <rjw@apple.com>
998
999         Implemented WebScriptObject/DOM wrapper voodoo.  DOM wrappers
1000         can now be referenced like any other WebScriptObject, meaning
1001         you can do JS operations on them.
1002
1003         All added implementation of finalizeForWebScript.
1004
1005         Reviewed by Ken.
1006
1007         * bindings/objc/WebScriptObject.h:
1008         * bindings/objc/WebScriptObject.mm:
1009         (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1010         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1011         (-[WebScriptObject KJS::]):
1012         (-[WebScriptObject dealloc]):
1013         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1014         (-[WebScriptObject evaluateWebScript:]):
1015         (-[WebScriptObject setValue:forKey:]):
1016         (-[WebScriptObject valueForKey:]):
1017         (-[WebScriptObject stringRepresentation]):
1018         * bindings/objc/WebScriptObjectPrivate.h:
1019         * bindings/objc/objc_instance.mm:
1020         (ObjcInstance::~ObjcInstance):
1021
1022 2004-05-19  Richard Williamson   <rjw@apple.com>
1023
1024         Removed extraneous tabs that were added (by XCode?).
1025
1026         * bindings/objc/WebScriptObject.h:
1027
1028 2004-05-19  Darin Adler  <darin@apple.com>
1029
1030         - fixed headers with licenses mangled by Xcode auto-indenting
1031
1032         * bindings/jni/jni_jsobject.cpp:
1033         * bindings/jni/jni_jsobject.h:
1034         * bindings/runtime_array.h:
1035         * bindings/runtime_root.cpp:
1036         * bindings/runtime_root.h:
1037
1038 2004-05-18  Richard Williamson   <rjw@apple.com>
1039
1040         Added exception logging.  Also check for exception and
1041         set results as appropriate.
1042
1043         Reviewed by Maciej (partially reviewed).
1044
1045         * bindings/objc/WebScriptObject.mm:
1046         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1047         (-[WebScriptObject evaluateWebScript:]):
1048         (-[WebScriptObject setValue:forKey:]):
1049         (-[WebScriptObject valueForKey:]):
1050
1051 2004-05-18  Richard Williamson   <rjw@apple.com>
1052
1053         Finsished implementing support for windowScriptObject.
1054         Had to make WebScriptObjectPrivate.h accessible from
1055         WebCore.
1056
1057         Reviewed by Maciej.
1058
1059         * JavaScriptCore.pbproj/project.pbxproj:
1060         * bindings/objc/WebScriptObjectPrivate.h:
1061
1062 2004-05-18  Richard Williamson   <rjw@apple.com>
1063
1064         Use KVC to set/get values instead of directly accessing
1065         ivars.
1066
1067         Reviewed by Maciej.
1068
1069         * bindings/objc/WebScriptObject.mm:
1070         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1071         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1072         * bindings/objc/objc_runtime.mm:
1073         (ObjcField::valueFromInstance):
1074         (convertValueToObjcObject):
1075         (ObjcField::setValueToInstance):
1076
1077 2004-05-17  Richard Williamson   <rjw@apple.com>
1078
1079         Implemented new API for WebScriptObject.
1080
1081         Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
1082         Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object)  (w/ help from Vicki)
1083
1084         Reviewed by Hyatt.
1085
1086         * JavaScriptCore.pbproj/project.pbxproj:
1087         * bindings/c/c_instance.cpp:
1088         (CInstance::invokeMethod):
1089         * bindings/jni/jni_instance.cpp:
1090         (JavaInstance::invokeMethod):
1091         * bindings/jni/jni_jsobject.cpp:
1092         (JSObject::convertValueToJObject):
1093         * bindings/jni/jni_utility.cpp:
1094         (KJS::Bindings::getJNIField):
1095         * bindings/objc/WebScriptObject.mm:
1096         (_didExecute):
1097         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1098         (-[WebScriptObject KJS::]):
1099         (-[WebScriptObject dealloc]):
1100         (+[WebScriptObject throwException:]):
1101         (listFromNSArray):
1102         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1103         (-[WebScriptObject evaluateWebScript:]):
1104         (-[WebScriptObject setValue:forKey:]):
1105         (-[WebScriptObject valueForKey:]):
1106         (-[WebScriptObject stringRepresentation]):
1107         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1108         (+[WebUndefined undefined]):
1109         (-[WebUndefined initWithCoder:]):
1110         (-[WebUndefined encodeWithCoder:]):
1111         (-[WebUndefined copyWithZone:]):
1112         (-[WebUndefined retain]):
1113         (-[WebUndefined release]):
1114         (-[WebUndefined retainCount]):
1115         (-[WebUndefined autorelease]):
1116         (-[WebUndefined dealloc]):
1117         (-[WebUndefined copy]):
1118         (-[WebUndefined replacementObjectForPortCoder:]):
1119         * bindings/objc/WebScriptObjectPrivate.h: Added.
1120         * bindings/objc/objc_class.mm:
1121         (ObjcClass::methodsNamed):
1122         (ObjcClass::fieldNamed):
1123         * bindings/objc/objc_instance.mm:
1124         (ObjcInstance::invokeMethod):
1125         * bindings/objc/objc_jsobject.h:
1126         * bindings/objc/objc_jsobject.mm:
1127         * bindings/objc/objc_runtime.mm:
1128         (ObjcField::valueFromInstance):
1129         * bindings/objc/objc_utility.mm:
1130         (KJS::Bindings::JSMethodNameToObjCMethodName):
1131         (KJS::Bindings::convertValueToObjcValue):
1132         (KJS::Bindings::convertObjcValueToValue):
1133         * bindings/runtime.cpp:
1134         (Instance::setDidExecuteFunction):
1135         (Instance::didExecuteFunction):
1136         (Instance::setValueOfField):
1137         * bindings/runtime.h:
1138         * bindings/testbindings.mm:
1139         (+[MyFirstInterface webScriptNameForSelector:]):
1140         (-[MyFirstInterface callJSObject::]):
1141
1142 2004-05-14  Vicki Murley  <vicki@apple.com>
1143
1144         Reviewed by mjs.
1145  
1146         <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
1147
1148         * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
1149
1150 === Safari-140 ===
1151
1152 2004-05-13  Richard Williamson   <rjw@apple.com>
1153
1154         Fixed indentation.
1155
1156         Reviewed by Chris.
1157
1158         * ChangeLog:
1159         * bindings/objc/WebScriptObject.h:
1160
1161 2004-05-13  Richard Williamson   <rjw@apple.com>
1162
1163         Approved API changes.  Currently unimplemented.
1164
1165         Reviewed by Chris.
1166
1167         * ChangeLog:
1168         * JavaScriptCore.pbproj/project.pbxproj:
1169         * bindings/objc/WebScriptObject.h: Added.
1170         * bindings/objc/WebScriptObject.mm: Added.
1171         (+[WebScriptObject throwException:]):
1172         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1173         (-[WebScriptObject evaluateWebScript:]):
1174         (-[WebScriptObject stringRepresentation]):
1175         (+[WebUndefined undefined]):
1176         (-[WebUndefined initWithCoder:]):
1177         (-[WebUndefined encodeWithCoder:]):
1178         (-[WebUndefined copyWithZone:]):
1179
1180 2004-05-07  Vicki Murley  <vicki@apple.com>
1181
1182         Reviewed by darin.
1183
1184         Turn off GC since it uses ppc only instructions (which breaks 
1185         the B&I build).   
1186     
1187         * kjs/value.h: set USE_CONSERVATIVE_GC to 0
1188
1189 === Safari-139 ===
1190
1191 2004-05-07  Maciej Stachowiak  <mjs@apple.com>
1192
1193         Reviewed by Darin.
1194
1195         - add -funroll-loops=16 compiler option for approx .5% speedup on
1196         HTML iBench and .5-1% speedup on JS iBench.
1197         
1198         * JavaScriptCore.pbproj/project.pbxproj:
1199
1200 2004-04-25  Maciej Stachowiak  <mjs@apple.com>
1201
1202         Reviewed by Darin.
1203
1204         Enable full conservative GC mode in addition to test mode. When
1205         conservative GC is enabled, we now get an 11% speed improvement on
1206         the iBench. Also fix some spots I missed before.
1207
1208         Specific noteworth changes:
1209         
1210         * kjs/collector.cpp:
1211         (KJS::Collector::markStackObjectsConservatively): Check possible
1212         cell pointers for 8-byte aligment and verify they are not 0.
1213
1214         * kjs/protected_values.cpp:
1215         (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
1216         (KJS::ProtectedValues::decreaseProtectCount): ...and here...
1217         * kjs/protect.h:
1218         (KJS::gcProtectNullTolerant): ...to here...
1219         (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
1220         tolerance, and doing the check is expensive.
1221
1222         * kjs/protected_values.cpp:
1223         (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
1224         that is still very good.
1225
1226         * kjs/protect.h:
1227         (KJS::gcProtect):
1228         (KJS::gcUnprotect):
1229         (KJS::ProtectedValue::ProtectedValue):
1230         (KJS::ProtectedValue::~ProtectedValue):
1231         (KJS::ProtectedValue::operator=):
1232         (KJS::ProtectedObject::ProtectedObject):
1233         (KJS::ProtectedObject::~ProtectedObject):
1234         (KJS::ProtectedObject::operator=):
1235         (KJS::ProtectedReference::ProtectedReference):
1236         (KJS::ProtectedReference::~ProtectedReference):
1237         (KJS::ProtectedReference::operator=):
1238         * kjs/protected_values.cpp:
1239         (KJS::ProtectedValues::getProtectCount):
1240         (KJS::ProtectedValues::increaseProtectCount):
1241         (KJS::ProtectedValues::decreaseProtectCount):
1242         (KJS::ProtectedValues::computeHash):
1243         * bindings/runtime_root.cpp:
1244         (KJS::Bindings::addNativeReference):
1245         (KJS::Bindings::removeNativeReference):
1246         (RootObject::removeAllNativeReferences):
1247         * bindings/runtime_root.h:
1248         (KJS::Bindings::RootObject::~RootObject):
1249         (KJS::Bindings::RootObject::setRootObjectImp):
1250         * kjs/collector.cpp:
1251         (KJS::Collector::allocate):
1252         (KJS::Collector::collect):
1253         * kjs/collector.h:
1254         * kjs/internal.cpp:
1255         (NumberImp::create):
1256         (InterpreterImp::globalInit):
1257         (InterpreterImp::globalClear):
1258         (InterpreterImp::mark):
1259         * kjs/list.cpp:
1260         (KJS::List::derefValues):
1261         (KJS::List::refValues):
1262         (KJS::List::append):
1263         * kjs/object.cpp:
1264         (KJS::ObjectImp::setInternalValue):
1265         (KJS::ObjectImp::putDirect):
1266         * kjs/value.cpp:
1267         (ValueImp::mark):
1268         (ValueImp::marked):
1269         * kjs/value.h:
1270         (KJS::ValueImp::ValueImp):
1271         (KJS::ValueImp::~ValueImp):
1272         (KJS::ValueImp::):
1273         (KJS::Value::Value):
1274         (KJS::Value::~Value):
1275         (KJS::Value::operator=):
1276
1277 2004-04-30  Richard Williamson   <rjw@apple.com>
1278
1279         Asking an NSInvocation for it's return value when return type
1280         is void throws an exception.  Added check for void return types
1281         to avoid this exception.
1282
1283         Reviewed by Ken.
1284
1285         * bindings/objc/objc_instance.mm:
1286         (ObjcInstance::invokeMethod):
1287
1288 2004-04-29  Richard Williamson   <rjw@apple.com>
1289
1290         Fixed several bad problems with the ObjC bindings.  In particular, conversion
1291         to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
1292
1293         Reviewed by Chris.
1294
1295         * bindings/objc/objc_jsobject.h:
1296         * bindings/objc/objc_jsobject.mm:
1297         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
1298         (-[JavaScriptObject KJS::]):
1299         (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1300         (-[JavaScriptObject call:arguments:]):
1301         (-[JavaScriptObject evaluate:]):
1302         (-[JavaScriptObject getMember:]):
1303         (-[JavaScriptObject getSlot:]):
1304         * bindings/objc/objc_runtime.mm:
1305         (ObjcField::valueFromInstance):
1306         (ObjcField::setValueToInstance):
1307         * bindings/objc/objc_utility.mm:
1308         (KJS::Bindings::convertValueToObjcValue):
1309         (KJS::Bindings::convertObjcValueToValue):
1310         * bindings/runtime.h:
1311         * bindings/runtime_root.cpp:
1312         (KJS::Bindings::rootForInterpreter):
1313         (KJS::Bindings::addNativeReference):
1314         (KJS::Bindings::removeNativeReference):
1315         * bindings/runtime_root.h:
1316         * bindings/testbindings.mm:
1317         (-[MyFirstInterface logMessage:]):
1318         (-[MyFirstInterface setJSObject:]):
1319         (-[MyFirstInterface callJSObject::]):
1320
1321 2004-04-24  Darin Adler  <darin@apple.com>
1322
1323         Reviewed by Dave.
1324
1325         * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
1326         that is 2x too big.
1327
1328 2004-04-23  Maciej Stachowiak  <mjs@apple.com>
1329
1330         Reviewed by Darin.
1331
1332         Implementation of conservative GC, based partly on code from
1333         Darin. It's turned off for now, so it shouldn't have any effect on
1334         the normal build.
1335         
1336         * JavaScriptCore.pbproj/project.pbxproj:
1337         * kjs/collector.cpp:
1338         (KJS::Collector::markStackObjectsConservatively):
1339         (KJS::Collector::markProtectedObjects):
1340         (KJS::Collector::collect):
1341         * kjs/collector.h:
1342         * kjs/protect.h:
1343         (KJS::gcProtect):
1344         (KJS::gcUnprotect):
1345         * kjs/protected_values.cpp: Added.
1346         (KJS::ProtectedValues::getProtectCount):
1347         (KJS::ProtectedValues::increaseProtectCount):
1348         (KJS::ProtectedValues::insert):
1349         (KJS::ProtectedValues::decreaseProtectCount):
1350         (KJS::ProtectedValues::expand):
1351         (KJS::ProtectedValues::shrink):
1352         (KJS::ProtectedValues::rehash):
1353         (KJS::ProtectedValues::computeHash):
1354         * kjs/protected_values.h: Added.
1355         * kjs/value.cpp:
1356         (ValueImp::useConservativeMark):
1357         (ValueImp::mark):
1358         (ValueImp::marked):
1359         * kjs/value.h:
1360         (KJS::ValueImp::):
1361
1362 === Safari-138 ===
1363
1364 2004-04-22  Richard Williamson   <rjw@apple.com>
1365
1366         Fixed build snafu (re-declaration of NPBool in npruntime.h and
1367         npapi.h).
1368
1369         * bindings/npruntime.h:
1370
1371 2004-04-22  Richard Williamson   <rjw@apple.com>
1372
1373         Updated plugin binding API to reflect latest revision from
1374         working group.
1375         
1376         Biggest change is the introduction of NPVariant used to represent
1377         value types.  NPVariant replaces the use of NPObject for the
1378         exchange of values between scripting environment and native code.
1379
1380         Reviewed by John.
1381
1382         * JavaScriptCore.pbproj/project.pbxproj:
1383         * bindings/NP_jsobject.cpp:
1384         (identiferFromNPIdentifier):
1385         (NPN_Call):
1386         (NPN_Evaluate):
1387         (NPN_GetProperty):
1388         (NPN_SetProperty):
1389         (NPN_ToString):
1390         (NPN_GetPropertyAtIndex):
1391         (NPN_SetPropertyAtIndex):
1392         * bindings/c/c_class.cpp:
1393         (CClass::methodsNamed):
1394         (CClass::fieldNamed):
1395         * bindings/c/c_instance.cpp:
1396         (CInstance::invokeMethod):
1397         (CInstance::defaultValue):
1398         * bindings/c/c_runtime.cpp:
1399         (CField::valueFromInstance):
1400         (CField::setValueToInstance):
1401         * bindings/c/c_utility.cpp:
1402         (convertNPStringToUTF16):
1403         (convertUTF8ToUTF16):
1404         (coerceValueToNPVariantStringType):
1405         (convertValueToNPVariant):
1406         (convertNPVariantToValue):
1407         * bindings/c/c_utility.h:
1408         * bindings/npruntime.cpp:
1409         (NPN_GetIdentifier):
1410         (NPN_GetIdentifiers):
1411         (NPN_UTF8FromIdentifier):
1412         (NPN_VariantIsVoid):
1413         (NPN_VariantIsNull):
1414         (NPN_VariantIsUndefined):
1415         (NPN_VariantIsBool):
1416         (NPN_VariantIsInt32):
1417         (NPN_VariantIsDouble):
1418         (NPN_VariantIsString):
1419         (NPN_VariantIsObject):
1420         (NPN_VariantToBool):
1421         (NPN_VariantToString):
1422         (NPN_VariantToInt32):
1423         (NPN_VariantToDouble):
1424         (NPN_VariantToObject):
1425         (NPN_InitializeVariantAsVoid):
1426         (NPN_InitializeVariantAsNull):
1427         (NPN_InitializeVariantAsUndefined):
1428         (NPN_InitializeVariantWithBool):
1429         (NPN_InitializeVariantWithInt32):
1430         (NPN_InitializeVariantWithDouble):
1431         (NPN_InitializeVariantWithString):
1432         (NPN_InitializeVariantWithStringCopy):
1433         (NPN_InitializeVariantWithObject):
1434         (NPN_InitializeVariantWithVariant):
1435         (NPN_ReleaseVariantValue):
1436         (NPN_CreateObject):
1437         (NPN_RetainObject):
1438         (NPN_ReleaseObject):
1439         (NPN_IsKindOfClass):
1440         (NPN_SetExceptionWithUTF8):
1441         (NPN_SetException):
1442         * bindings/npruntime.h:
1443         (_NPString::):
1444         (_NPString::_NPVariant::):
1445         * bindings/testbindings.cpp:
1446         (logMessage):
1447         (setDoubleValue):
1448         (setIntValue):
1449         (setStringValue):
1450         (setBooleanValue):
1451         (getDoubleValue):
1452         (getIntValue):
1453         (getStringValue):
1454         (getBooleanValue):
1455         (myGetProperty):
1456         (mySetProperty):
1457         (myInvoke):
1458         (myAllocate):
1459
1460 2004-04-22  Darin Adler  <darin@apple.com>
1461
1462         Reviewed by Maciej.
1463
1464         - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
1465
1466         * kjs/ustring.cpp:
1467         (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
1468         Was resulting in a buffer 2x the needed size.
1469         (KJS::UString::expandPreCapacity): Ditto.
1470         (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
1471
1472 2004-04-21  Maciej Stachowiak  <mjs@apple.com>
1473
1474         Reviewed by Darin.
1475
1476         Preliminary change for conservative GC. Create "protected"
1477         subclasses to GC-protect objects when on heap, since we will soon
1478         remove the built-in refcounting of the normal wrapper classes. Use
1479         them where needed.
1480         
1481         * JavaScriptCore.pbproj/project.pbxproj:
1482         * kjs/context.h:
1483         * kjs/internal.h:
1484         (KJS::InterpreterImp::globalObject):
1485         * kjs/interpreter.h:
1486         * kjs/property_map.cpp:
1487         * kjs/reference.h:
1488         * kjs/reference_list.cpp:
1489
1490 2004-04-19  Maciej Stachowiak  <mjs@apple.com>
1491
1492         Reviewed by Dave.
1493
1494         Optimize prepend using the shared substring optimization. Also,
1495         limit the applicability of shared append and shared prepend. If
1496         you overdo it, it does more harm than good, because you create a
1497         bunch of strings that are disqualified from future shared
1498         append/prepend, for not much immediate savings in allocate/copy
1499         expense.
1500         
1501         * kjs/ustring.cpp:
1502         (KJS::):
1503         (KJS::UString::Rep::create):
1504         (KJS::UString::expandedSize):
1505         (KJS::UString::usedPreCapacity):
1506         (KJS::UString::expandCapacity):
1507         (KJS::UString::expandPreCapacity):
1508         (KJS::UString::UString):
1509         (KJS::UString::append):
1510         (KJS::UString::operator=):
1511         * kjs/ustring.h:
1512         (KJS::UString::Rep::data):
1513
1514 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
1515         Reviewed by Richard.
1516
1517         No more need for Completion or Reference to privately inherit from
1518         Value, none of the superclass functionality is used.
1519
1520         * kjs/completion.h:
1521         * kjs/reference.h:
1522
1523 === Safari-137 ===
1524
1525 2004-04-16  Richard Williamson   <rjw@apple.com>
1526
1527         Added interpreter lock protection around object creation.
1528
1529         Reviewed by Chris.
1530
1531         * bindings/runtime.cpp:
1532         (Instance::createRuntimeObject):
1533
1534 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
1535
1536         Reviewed by Ken.
1537
1538         Another JavaScript speed improvement: use the mechanism from
1539         string append optimization to make taking a substring fast, again
1540         sharing the buffer.
1541
1542         A further 22% improvement on the 24fun string speed test.
1543         
1544         * kjs/ustring.cpp:
1545         (KJS::):
1546         (KJS::UString::Rep::create):
1547         (KJS::UString::UString):
1548         (KJS::UString::append):
1549         (KJS::UString::operator=):
1550         (KJS::UString::substr):
1551         * kjs/ustring.h:
1552         (KJS::UString::Rep::data):
1553
1554 2004-04-13  Maciej Stachowiak  <mjs@apple.com>
1555
1556         Reviewed by Darin.
1557
1558         - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
1559         - fixed <rdar://problem/3600691>: Table generation test is really slow
1560         - fixed <rdar://problem/3600661>: 24fun date test is really slow
1561
1562         80% speedup on the string test, lesser speedups on the other two.
1563         
1564         Two different optimizations here:
1565
1566         1) Avoid large overhead of scanning strings to see if they are all
1567         ASCII before numeric conversion.
1568         
1569         * kjs/nodes.cpp:
1570         (AssignNode::evaluate): Don't convert to integer until we know for
1571         sure the operation will need it. Attempting to convert strings to
1572         numbers is a waste when they are being appended with +=.
1573
1574         2) Avoid huge cost of appending strings.
1575
1576         This is done by allowing multiple strings to share a buffer but
1577         actually use different ranges of it. The first time a string is
1578         appended to, we start leaving at least 10% extra space in the
1579         buffer, so doing N appends to the same string takes O(log N)
1580         mallocs instead of O(N).
1581         
1582         * kjs/identifier.cpp:
1583         (KJS::Identifier::equal):
1584         (KJS::Identifier::add):
1585         * kjs/ustring.cpp:
1586         (KJS::):
1587         (KJS::UCharReference::operator=):
1588         (KJS::UCharReference::ref):
1589         (KJS::UString::Rep::create):
1590         (KJS::UString::Rep::destroy):
1591         (KJS::UString::expandedSize):
1592         (KJS::UString::usedCapacity):
1593         (KJS::UString::expandCapacity):
1594         (KJS::UString::UString):
1595         (KJS::UString::null):
1596         (KJS::UString::append):
1597         (KJS::UString::operator=):
1598         (KJS::UString::toStrictUInt32):
1599         (KJS::UString::detach):
1600         (KJS::KJS::operator==):
1601         * kjs/ustring.h:
1602         (KJS::UString::Rep::data):
1603         (KJS::UString::Rep::hash):
1604
1605 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
1606
1607         Reviewed by John.
1608
1609         - fix deployment build by avoiding deployment-only warning.
1610
1611         * kjs/scope_chain.cpp:
1612         (KJS::ScopeChain::bottom):
1613
1614 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
1615
1616         Reviewed by John.
1617
1618         Changed things so that newly created objects get a prototype based
1619         on the scope chain of the current function, rather than the
1620         interpreter that started execution. This fixes the following bugs:
1621         
1622         <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
1623         <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
1624
1625         * JavaScriptCore.pbproj/project.pbxproj:
1626         * kjs/array_object.cpp:
1627         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1628         (ArrayProtoFuncImp::ArrayProtoFuncImp):
1629         (ArrayProtoFuncImp::call):
1630         (ArrayObjectImp::construct):
1631         * kjs/bool_object.cpp:
1632         (BooleanObjectImp::construct):
1633         * kjs/date_object.cpp:
1634         (DateProtoFuncImp::DateProtoFuncImp):
1635         (DateProtoFuncImp::call):
1636         (DateObjectImp::construct):
1637         * kjs/error_object.cpp:
1638         (ErrorObjectImp::construct):
1639         * kjs/function.cpp:
1640         (FunctionImp::FunctionImp):
1641         (FunctionImp::call):
1642         (DeclaredFunctionImp::construct):
1643         (ArgumentsImp::ArgumentsImp):
1644         (GlobalFuncImp::call):
1645         * kjs/function_object.cpp:
1646         (FunctionProtoFuncImp::call):
1647         (FunctionObjectImp::construct):
1648         * kjs/internal.cpp:
1649         (BooleanImp::toObject):
1650         (StringImp::toObject):
1651         (NumberImp::toObject):
1652         (InterpreterImp::InterpreterImp):
1653         (InterpreterImp::clear):
1654         (InterpreterImp::interpreterWithGlobalObject):
1655         * kjs/internal.h:
1656         * kjs/interpreter.cpp:
1657         (ExecState::lexicalInterpreter):
1658         * kjs/interpreter.h:
1659         (KJS::ExecState::dynamicInterpreter):
1660         (KJS::ExecState::interpreter):
1661         * kjs/math_object.cpp:
1662         (MathFuncImp::MathFuncImp):
1663         * kjs/nodes.cpp:
1664         (StatementNode::hitStatement):
1665         (StatementNode::abortStatement):
1666         (RegExpNode::evaluate):
1667         (ElementNode::evaluate):
1668         (ArrayNode::evaluate):
1669         (ObjectLiteralNode::evaluate):
1670         (PropertyValueNode::evaluate):
1671         (FunctionCallNode::evaluate):
1672         (FuncDeclNode::processFuncDecl):
1673         (FuncExprNode::evaluate):
1674         * kjs/number_object.cpp:
1675         (NumberObjectImp::construct):
1676         * kjs/object.cpp:
1677         (KJS::ObjectImp::defaultValue):
1678         (KJS::Error::create):
1679         * kjs/object_object.cpp:
1680         (ObjectObjectImp::construct):
1681         * kjs/reference.cpp:
1682         (Reference::putValue):
1683         * kjs/regexp_object.cpp:
1684         (RegExpProtoFuncImp::call):
1685         (RegExpObjectImp::arrayOfMatches):
1686         (RegExpObjectImp::construct):
1687         * kjs/scope_chain.cpp:
1688         (KJS::ScopeChain::bottom):
1689         * kjs/scope_chain.h:
1690         * kjs/string_object.cpp:
1691         (StringProtoFuncImp::StringProtoFuncImp):
1692         (StringProtoFuncImp::call):
1693         (StringObjectImp::construct):
1694
1695 === Safari-136 ===
1696
1697 === Safari-135 ===
1698
1699 2004-03-31  Richard Williamson   <rjw@apple.com>
1700
1701         Tedious renames based on feedback from plugin-futures list.
1702         NP_ functions are renamed with NPN_ prefix.
1703         Types prefix renamed from NP_ to NP.
1704         NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated. 
1705         
1706         No review because this was just a renaming patch.
1707
1708         * bindings/NP_jsobject.cpp:
1709         (listFromNPArray):
1710         (jsAllocate):
1711         (identiferFromNPIdentifier):
1712         (NPN_Call):
1713         (NPN_Evaluate):
1714         (NPN_GetProperty):
1715         (NPN_SetProperty):
1716         (NPN_RemoveProperty):
1717         (NPN_ToString):
1718         (NPN_GetPropertyAtIndex):
1719         (NPN_SetPropertyAtIndex):
1720         * bindings/NP_jsobject.h:
1721         * bindings/c/c_class.cpp:
1722         (CClass::_commonInit):
1723         (CClass::classForIsA):
1724         (CClass::CClass):
1725         (CClass::methodsNamed):
1726         (CClass::fieldNamed):
1727         * bindings/c/c_class.h:
1728         * bindings/c/c_instance.cpp:
1729         (CInstance::CInstance):
1730         (CInstance::~CInstance):
1731         (CInstance::operator=):
1732         (CInstance::invokeMethod):
1733         (CInstance::defaultValue):
1734         * bindings/c/c_instance.h:
1735         (KJS::Bindings::CInstance::getObject):
1736         * bindings/c/c_runtime.cpp:
1737         (CField::valueFromInstance):
1738         (CField::setValueToInstance):
1739         * bindings/c/c_runtime.h:
1740         (KJS::Bindings::CField::CField):
1741         (KJS::Bindings::CField::name):
1742         (KJS::Bindings::CMethod::CMethod):
1743         (KJS::Bindings::CMethod::name):
1744         * bindings/c/c_utility.cpp:
1745         (coerceValueToNPString):
1746         (convertValueToNPValueType):
1747         (convertNPValueTypeToValue):
1748         * bindings/c/c_utility.h:
1749         * bindings/npruntime.cpp:
1750         (NPN_IdentifierFromUTF8):
1751         (NPN_IsValidIdentifier):
1752         (NPN_GetIdentifiers):
1753         (NPN_UTF8FromIdentifier):
1754         (NPN_CreateObject):
1755         (NPN_RetainObject):
1756         (NPN_ReleaseObject):
1757         (NPN_IsKindOfClass):
1758         (NPN_SetExceptionWithUTF8):
1759         (NPN_SetException):
1760         (numberAllocate):
1761         (NPN_CreateNumberWithInt):
1762         (NPN_CreateNumberWithFloat):
1763         (NPN_CreateNumberWithDouble):
1764         (NPN_IntFromNumber):
1765         (NPN_FloatFromNumber):
1766         (NPN_DoubleFromNumber):
1767         (stringAllocate):
1768         (NPN_CreateStringWithUTF8):
1769         (NPN_CreateStringWithUTF16):
1770         (NPN_DeallocateUTF8):
1771         (NPN_UTF8FromString):
1772         (NPN_UTF16FromString):
1773         (NPN_StringLength):
1774         (booleanAllocate):
1775         (NPN_CreateBoolean):
1776         (NPN_BoolFromBoolean):
1777         (nullAllocate):
1778         (NPN_GetNull):
1779         (undefinedAllocate):
1780         (NPN_GetUndefined):
1781         (arrayAllocate):
1782         (arrayDeallocate):
1783         (NPN_CreateArray):
1784         (NPN_CreateArrayV):
1785         (NPN_ObjectAtIndex):
1786         * bindings/npruntime.h:
1787         * bindings/runtime.cpp:
1788         (Instance::createBindingForLanguageInstance):
1789         * bindings/testbindings.cpp:
1790         (initializeIdentifiers):
1791         (myHasProperty):
1792         (myHasMethod):
1793         (myGetProperty):
1794         (mySetProperty):
1795         (logMessage):
1796         (setDoubleValue):
1797         (setIntValue):
1798         (setStringValue):
1799         (setBooleanValue):
1800         (getDoubleValue):
1801         (getIntValue):
1802         (getStringValue):
1803         (getBooleanValue):
1804         (myInvoke):
1805         (myAllocate):
1806         (myInvalidate):
1807         (myDeallocate):
1808         (main):
1809
1810 2004-03-31  Richard Williamson   <rjw@apple.com>
1811
1812         Changed references to NP_runtime.h to npruntime.h
1813         
1814         * JavaScriptCore.pbproj/project.pbxproj:
1815         * bindings/NP_jsobject.h:
1816         * bindings/c/c_class.h:
1817         * bindings/c/c_instance.h:
1818         * bindings/c/c_runtime.h:
1819         * bindings/c/c_utility.h:
1820         * bindings/npruntime.cpp:
1821
1822 2004-03-31  Richard Williamson   <rjw@apple.com>
1823
1824         Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
1825
1826         * JavaScriptCore.pbproj/project.pbxproj:
1827         * bindings/NP_jsobject.h:
1828         * bindings/npruntime.cpp:
1829
1830 === Safari-134 ===
1831
1832 2004-03-23  Richard Williamson   <rjw@apple.com>
1833
1834         Added implementation of KJS::Value <-> NP_Object conversion functions.
1835         Augmented test program for 'C' bindings.
1836         Added asserts and parameter checking to all public API.        
1837
1838         Reviewed by Ken.
1839
1840         * JavaScriptCore.pbproj/project.pbxproj:
1841         * bindings/NP_jsobject.cpp:
1842         (NP_ToString):
1843         * bindings/NP_jsobject.h: Added.
1844         * bindings/NP_runtime.cpp:
1845         (NP_IdentifierFromUTF8):
1846         (NP_IsValidIdentifier):
1847         (NP_GetIdentifiers):
1848         (NP_CreateObject):
1849         (NP_RetainObject):
1850         (NP_ReleaseObject):
1851         (NP_IsKindOfClass):
1852         (NP_SetExceptionWithUTF8):
1853         (NP_SetException):
1854         (NP_IntFromNumber):
1855         (NP_FloatFromNumber):
1856         (NP_DoubleFromNumber):
1857         (NP_CreateStringWithUTF8):
1858         (NP_CreateStringWithUTF16):
1859         (NP_DeallocateUTF8):
1860         (NP_UTF8FromString):
1861         (NP_UTF16FromString):
1862         (NP_StringLength):
1863         (NP_BoolFromBoolean):
1864         * bindings/NP_runtime.h:
1865         * bindings/c/c_instance.cpp:
1866         (CInstance::invokeMethod):
1867         * bindings/c/c_utility.cpp:
1868         (coerceValueToNPString):
1869         (convertValueToNPValueType):
1870         (convertNPValueTypeToValue):
1871         * bindings/c/c_utility.h:
1872         * bindings/test.js:
1873         * bindings/testC.js: Added.
1874         * bindings/testbindings.cpp:
1875         (logMessage):
1876         (setDoubleValue):
1877         (setIntValue):
1878         (setStringValue):
1879         (setBooleanValue):
1880         (getDoubleValue):
1881         (getIntValue):
1882         (getStringValue):
1883         (getBooleanValue):
1884         (myInterfaceInvoke):
1885         (myInterfaceAllocate):
1886
1887 === Safari-133 ===
1888
1889 2004-03-19  Darin Adler  <darin@apple.com>
1890
1891         Reviewed by Ken.
1892
1893         - fixed problem with methods like setUTCHour
1894
1895         * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
1896         GMT vs. local time function based on the utc flag.
1897
1898 2004-03-17  Richard Williamson   <rjw@apple.com>
1899
1900         Added a context parameter to result callbacks use by JavaScriptObject functions.  This was a change requested by Eric Carlson on the QT plugin team.
1901
1902         Reviewed by Ken.
1903
1904         * bindings/NP_jsobject.cpp:
1905         (NP_Call):
1906         (NP_Evaluate):
1907         (NP_GetProperty):
1908         (NP_ToString):
1909         (NP_GetPropertyAtIndex):
1910         * bindings/NP_runtime.h:
1911
1912 2004-03-16  Richard Williamson   <rjw@apple.com>
1913
1914         Fixed 3590169.  Regression (crash) caused by the switch to MethodLists.  Crash when attempting to invoke a method from JavaScript to Java that is not implemented.
1915
1916         Reviewed by John.
1917
1918         * bindings/jni/jni_class.cpp:
1919         (JavaClass::methodsNamed):
1920
1921 2004-03-15  Richard Williamson   <rjw@apple.com>
1922
1923         Fixed 3570854.  Don't attempt to convert Null to strings.  We
1924         were incorrectly converting to "Null".
1925
1926         Actually fixed by Scott Kovatch.
1927
1928         Reviewed by Richard.
1929
1930         * bindings/jni/jni_utility.cpp:
1931         (KJS::Bindings::convertValueToJValue):
1932
1933 === Safari-132 ===
1934
1935 2004-03-11  Richard Williamson   <rjw@apple.com>
1936
1937         Stitched together the NP stuff to our language independent
1938         JavaScript binding stuff.  Very close to being done.
1939         
1940         Added program to test C bindings (and NP stuff).  Just tests
1941         properties.  Will add methods and JavaScript access, etc.
1942
1943         Updated Makefile.am to account for new bindings/c directory.
1944
1945         Change NP_UTF8 from "const char *" to "char" to allow for
1946         declarations like "const NP_UTF8 *" and "NP_UTF8 *".  Ditto
1947         for NP_UTF16.
1948
1949         Added NP_IsValidIdentifier().
1950
1951         Reviewed by Chris.
1952
1953         * JavaScriptCore.pbproj/project.pbxproj:
1954         * Makefile.am:
1955         * bindings/NP_jsobject.cpp:
1956         (identiferFromNPIdentifier):
1957         (NP_Evaluate):
1958         * bindings/NP_runtime.cpp:
1959         (NP_IdentifierFromUTF8):
1960         (NP_IsValidIdentifier):
1961         (NP_GetIdentifiers):
1962         (NP_UTF8FromIdentifier):
1963         (NP_SetExceptionWithUTF8):
1964         (NP_SetException):
1965         (NP_CreateStringWithUTF8):
1966         (NP_CreateStringWithUTF16):
1967         (NP_UTF8FromString):
1968         (NP_UTF16FromString):
1969         * bindings/NP_runtime.h:
1970         * bindings/c/c_class.cpp: Added.
1971         (CClass::_commonDelete):
1972         (CClass::_commonCopy):
1973         (CClass::_commonInit):
1974         (_createClassesByIsAIfNecessary):
1975         (CClass::classForIsA):
1976         (CClass::CClass):
1977         (CClass::name):
1978         (CClass::methodsNamed):
1979         (CClass::fieldNamed):
1980         * bindings/c/c_class.h: Added.
1981         (KJS::Bindings::CClass::~CClass):
1982         (KJS::Bindings::CClass::CClass):
1983         (KJS::Bindings::CClass::operator=):
1984         (KJS::Bindings::CClass::constructorAt):
1985         (KJS::Bindings::CClass::numConstructors):
1986         * bindings/c/c_instance.cpp: Added.
1987         (CInstance::CInstance):
1988         (CInstance::~CInstance):
1989         (CInstance::operator=):
1990         (CInstance::getClass):
1991         (CInstance::begin):
1992         (CInstance::end):
1993         (CInstance::invokeMethod):
1994         (CInstance::defaultValue):
1995         (CInstance::stringValue):
1996         (CInstance::numberValue):
1997         (CInstance::booleanValue):
1998         (CInstance::valueOf):
1999         * bindings/c/c_instance.h: Added.
2000         (KJS::Bindings::CInstance::getObject):
2001         * bindings/c/c_runtime.cpp: Added.
2002         (CField::valueFromInstance):
2003         (CField::setValueToInstance):
2004         * bindings/c/c_runtime.h: Added.
2005         (KJS::Bindings::CField::CField):
2006         (KJS::Bindings::CField::name):
2007         (KJS::Bindings::CField::type):
2008         (KJS::Bindings::CMethod::CMethod):
2009         (KJS::Bindings::CMethod::name):
2010         (KJS::Bindings::CMethod::numParameters):
2011         * bindings/c/c_utility.cpp: Added.
2012         (coerceValueToNPValueType):
2013         (convertValueToNPValueType):
2014         (convertNPValueTypeToValue):
2015         * bindings/c/c_utility.h: Added.
2016         * bindings/make_testbindings:
2017         * bindings/runtime.cpp:
2018         (Instance::createBindingForLanguageInstance):
2019         * bindings/runtime.h:
2020         (KJS::Bindings::Instance::):
2021         * bindings/testbindings.cpp: Added.
2022         (initializeIdentifiers):
2023         (myInterfaceHasProperty):
2024         (myInterfaceHasMethod):
2025         (myInterfaceGetProperty):
2026         (myInterfaceSetProperty):
2027         (myInterfaceInvoke):
2028         (myInterfaceAllocate):
2029         (myInterfaceInvalidate):
2030         (myInterfaceDeallocate):
2031         (GlobalImp::className):
2032         (readJavaScriptFromFile):
2033         (main):
2034
2035 2004-03-10  Richard Williamson   <rjw@apple.com>
2036
2037         Made changes to support new asychronous approach to calls from
2038         plugin to JavaScript
2039
2040         Reviewed by Chris.
2041
2042         * bindings/NP_jsobject.cpp:
2043         (NP_Call):
2044         (NP_Evaluate):
2045         (NP_GetProperty):
2046         (NP_ToString):
2047         (NP_GetPropertyAtIndex):
2048         * bindings/NP_runtime.h:
2049         * bindings/make_testbindings:
2050         * bindings/runtime.cpp:
2051         (Instance::createBindingForLanguageInstance):
2052
2053 2004-03-10  Richard Williamson   <rjw@apple.com>
2054
2055         Updated header to include proposed changes from
2056         plugin-futures list.  Calls from plugin to JavaScript
2057         are now asynchronous.
2058
2059         Reviewed by Chris.
2060
2061         * bindings/NP_runtime.h:
2062
2063 === Safari-131 ===
2064
2065 2004-03-04  Richard Williamson   <rjw@apple.com>
2066
2067         Implementation of NP_JavaScriptObject.  This is the 'C' class
2068         that wraps a JavaScript object.
2069
2070         Reviewed by Chris.
2071
2072         * JavaScriptCore.pbproj/project.pbxproj:
2073         * bindings/NP_jsobject.cpp: Added.
2074         (coerceValueToNPValueType):
2075         (convertValueToNPValueType):
2076         (convertNPValueTypeToValue):
2077         (listFromNPArray):
2078         (jsAllocate):
2079         (jsDeallocate):
2080         (identiferFromNPIdentifier):
2081         (NP_Call):
2082         (NP_Evaluate):
2083         (NP_GetProperty):
2084         (NP_SetProperty):
2085         (NP_RemoveProperty):
2086         (NP_ToString):
2087         (NP_GetPropertyAtIndex):
2088         (NP_SetPropertyAtIndex):
2089         * bindings/NP_runtime.cpp:
2090         (NP_ObjectAtIndex):
2091         * bindings/NP_runtime.h:
2092         * bindings/runtime_object.h:
2093
2094 2004-03-04  Richard Williamson   <rjw@apple.com>
2095
2096         Added NP_Array implementation.  
2097
2098         Changed NP_Boolean to just depend on two static instances, no
2099         space is required for values.
2100
2101         Reviewed by Chris.
2102
2103         * bindings/NP_runtime.cpp:
2104         (NP_CreateBoolean):
2105         (NP_BoolFromBoolean):
2106         (arrayAllocate):
2107         (arrayDeallocate):
2108         (NP_CreateArray):
2109         (NP_CreateArrayV):
2110         (NP_ObjectAtIndex):
2111         * bindings/NP_runtime.h:
2112
2113 2004-03-03  Darin Adler  <darin@apple.com>
2114
2115         Reviewed by Vicki.
2116
2117         * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
2118         copyright string, and that's all that was in here.
2119         * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
2120
2121 2004-03-03  Richard Williamson   <rjw@apple.com>
2122
2123         More 'C' binding implementation.  Fleshed out all the
2124         'primitive' data types.
2125
2126         Reviewed by Chris.
2127
2128         * bindings/NP_runtime.cpp:
2129         (NP_ReleaseObject):
2130         (numberAllocate):
2131         (stringAllocate):
2132         (stringDeallocate):
2133         (NP_CreateStringWithUTF8):
2134         (NP_CreateStringWithUTF16):
2135         (NP_UTF8FromString):
2136         (NP_UTF16FromString):
2137         (NP_StringLength):
2138         (booleanAllocate):
2139         (booleanDeallocate):
2140         (NP_CreateBoolean):
2141         (NP_BoolFromBoolean):
2142         (nullAllocate):
2143         (nullDeallocate):
2144         (NP_GetNull):
2145         (undefinedAllocate):
2146         (undefinedDeallocate):
2147         (NP_GetUndefined):
2148         * bindings/NP_runtime.h:
2149
2150 2004-03-03  Richard Williamson   <rjw@apple.com>
2151
2152         More 'C' binding implementation.
2153
2154         Reviewed by Chris.
2155
2156         * bindings/NP_runtime.cpp:
2157         (identifierEqual):
2158         (identifierHash):
2159         (getIdentifierDictionary):
2160         (NP_IdentifierFromUTF8):
2161         (NP_UTF8FromIdentifier):
2162         (NP_CreateObject):
2163         (NP_ReleaseObject):
2164         (NP_IsKindOfClass):
2165         (numberCreate):
2166         (NP_CreateNumberWithInt):
2167         (NP_CreateNumberWithFloat):
2168         (NP_CreateNumberWithDouble):
2169         (NP_IntFromNumber):
2170         (NP_FloatFromNumber):
2171         (NP_DoubleFromNumber):
2172         * bindings/NP_runtime.h:
2173
2174 2004-03-02  Richard Williamson   <rjw@apple.com>
2175
2176         Removed retain/release from NP_Class.  Classes will not be allowed to implement their
2177         own customer retain/release scheme.
2178
2179         Reviewed by Chris.
2180
2181         * bindings/NP_runtime.cpp:
2182         (NP_RetainObject):
2183         (NP_ReleaseObject):
2184         * bindings/NP_runtime.h:
2185
2186 2004-03-02  Richard Williamson   <rjw@apple.com>
2187
2188         C binding API.  Partial implementation.
2189
2190         Completed ObjectiveC bindings (not based on the C API).  These will re-implemented over the C binding API, but I wanted to get this code in the tree.
2191
2192         Factored root object reference counting scheme.  It is now useful independent
2193         of LiveConnect.
2194
2195         Reviewed by Chris.
2196
2197         * JavaScriptCore.pbproj/project.pbxproj:
2198         * bindings/NP_runtime.cpp: Added.
2199         (NP_IdentifierFromUTF8):
2200         (NP_GetIdentifiers):
2201         (NP_UTF8FromIdentifier):
2202         (NP_CreateObject):
2203         (NP_RetainObject):
2204         (NP_ReleaseObject):
2205         (NP_IsKindOfClass):
2206         (NP_SetException):
2207         (NP_Call):
2208         (NP_Evaluate):
2209         (NP_GetProperty):
2210         (NP_SetProperty):
2211         (NP_RemoveProperty):
2212         (NP_ToString):
2213         (NP_GetPropertyAtIndex):
2214         (NP_SetPropertyAtIndex):
2215         (NP_CreateNumberWithInt):
2216         (NP_CreateNumberWithFloat):
2217         (NP_CreateNumberWithDouble):
2218         (NP_IntFromNumber):
2219         (NP_FloatFromNumber):
2220         (NP_DoubleFromNumber):
2221         (NP_CreateStringWithUTF8):
2222         (NP_CreateStringWithUTF16):
2223         (NP_UTF8FromString):
2224         (NP_UTF16FromString):
2225         (NP_CreateBoolean):
2226         (NP_BoolFromBoolean):
2227         (NP_GetNull):
2228         (NP_GetUndefined):
2229         (NP_CreateArray):
2230         (NP_CreateArrayV):
2231         (NP_ObjectAtIndex):
2232         * bindings/NP_runtime.h: Added.
2233         * bindings/jni/jni_jsobject.cpp:
2234         (JSObject::invoke):
2235         (JSObject::finalize):
2236         (JSObject::createNative):
2237         (JSObject::convertValueToJObject):
2238         * bindings/jni/jni_jsobject.h:
2239         * bindings/objc/objc_jsobject.h:
2240         * bindings/objc/objc_jsobject.mm:
2241         (rootForView):
2242         (windowJavaScriptObject):
2243         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2244         (-[JavaScriptObject dealloc]):
2245         (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
2246         (-[JavaScriptObject call:arguments:]):
2247         (-[JavaScriptObject evaluate:]):
2248         (-[JavaScriptObject getMember:]):
2249         (-[JavaScriptObject setMember:value:]):
2250         (-[JavaScriptObject removeMember:]):
2251         (-[JavaScriptObject toString]):
2252         (-[JavaScriptObject getSlot:]):
2253         (-[JavaScriptObject setSlot:value:]):
2254         * bindings/objc/objc_utility.h:
2255         * bindings/objc/objc_utility.mm:
2256         (KJS::Bindings::convertValueToObjcValue):
2257         * bindings/runtime_root.cpp: Added.
2258         (getReferencesByRootDictionary):
2259         (getReferencesDictionary):
2260         (KJS::Bindings::findReferenceDictionary):
2261         (KJS::Bindings::rootForImp):
2262         (KJS::Bindings::addNativeReference):
2263         (KJS::Bindings::removeNativeReference):
2264         (completedJavaScriptAccess):
2265         (initializeJavaScriptAccessLock):
2266         (lockJavaScriptAccess):
2267         (unlockJavaScriptAccess):
2268         (RootObject::dispatchToJavaScriptThread):
2269         (performJavaScriptAccess):
2270         (RootObject::setFindRootObjectForNativeHandleFunction):
2271         (RootObject::removeAllNativeReferences):
2272         * bindings/runtime_root.h: Added.
2273         (KJS::Bindings::RootObject::RootObject):
2274         (KJS::Bindings::RootObject::~RootObject):
2275         (KJS::Bindings::RootObject::setRootObjectImp):
2276         (KJS::Bindings::RootObject::rootObjectImp):
2277         (KJS::Bindings::RootObject::setInterpreter):
2278         (KJS::Bindings::RootObject::interpreter):
2279         (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
2280         (KJS::Bindings::RootObject::runLoop):
2281         (KJS::Bindings::RootObject::performJavaScriptSource):
2282
2283 === Safari-130 ===
2284
2285 === Safari-129 ===
2286
2287 2004-02-18  Richard Williamson   <rjw@apple.com>
2288
2289         Added NSNumber/Number conversion.
2290
2291         Removed some unnecessary KJS:: namespace specifiers.
2292
2293         Reviewed by Ken.
2294
2295         * bindings/objc/objc_utility.mm:
2296         (KJS::Bindings::convertValueToObjcValue):
2297         (KJS::Bindings::convertObjcValueToValue):
2298         * bindings/runtime_array.h:
2299
2300 2004-02-18  Richard Williamson   <rjw@apple.com>
2301
2302         Added support for export NSArrays.
2303
2304         Updated valueAt() to take an ExecState so we can throw
2305         JS exceptions.
2306
2307         Implemented excludeSelectorFromJavaScript: in ObjcClass.  This allows
2308         ObjectiveC classes to control the visibility of their methods in 
2309         JavaScript.
2310
2311         Reviewed by Ken.
2312
2313         * bindings/jni/jni_runtime.cpp:
2314         (JavaField::valueFromInstance):
2315         (JavaArray::valueAt):
2316         * bindings/jni/jni_runtime.h:
2317         * bindings/objc/objc_class.mm:
2318         (ObjcClass::methodsNamed):
2319         * bindings/objc/objc_runtime.h:
2320         (KJS::Bindings::ObjcArray::getObjcArray):
2321         * bindings/objc/objc_runtime.mm:
2322         (ObjcField::valueFromInstance):
2323         (ObjcField::setValueToInstance):
2324         (ObjcArray::ObjcArray):
2325         (ObjcArray::~ObjcArray):
2326         (ObjcArray::operator=):
2327         (ObjcArray::setValueAt):
2328         (ObjcArray::valueAt):
2329         (ObjcArray::getLength):
2330         * bindings/objc/objc_utility.mm:
2331         (KJS::Bindings::convertValueToObjcValue):
2332         (KJS::Bindings::convertObjcValueToValue):
2333         * bindings/runtime.cpp:
2334         (Instance::getValueOfField):
2335         * bindings/runtime.h:
2336         * bindings/runtime_array.cpp:
2337         (RuntimeArrayImp::get):
2338         * bindings/runtime_object.cpp:
2339         (RuntimeObjectImp::get):
2340
2341 2004-02-17  Richard Williamson   <rjw@apple.com>
2342
2343         Added String <-> NSString conversion.
2344         Added tests of String <-> NSString conversion to test program.
2345
2346         Reviewed by Chris.
2347
2348         * bindings/objc/objc_utility.mm:
2349         (KJS::Bindings::convertValueToObjcValue):
2350         (KJS::Bindings::convertObjcValueToValue):
2351         * bindings/test.js:
2352         * bindings/testbindings.mm:
2353         (-[MyFirstInterface getString]):
2354
2355 2004-02-15  Darin Adler  <darin@apple.com>
2356
2357         Reviewed by Dave.
2358
2359         * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
2360         and removing redundant settings of things that match defaults in other build styles.
2361
2362 2004-02-13  Richard Williamson   <rjw@apple.com>
2363
2364         Work towards the JavaScript ObjC bindings.  The bindings now work for 
2365         simple scalar types.  testbindings.mm is an illustration of how the 
2366         bindings work.
2367
2368         Reviewed by Ken.
2369
2370         * JavaScriptCore.pbproj/project.pbxproj:
2371         * Makefile.am:
2372         * bindings/jni/jni_class.cpp:
2373         (JavaClass::methodsNamed):
2374         * bindings/jni/jni_class.h:
2375         * bindings/jni/jni_instance.cpp:
2376         (JavaInstance::invokeMethod):
2377         * bindings/jni/jni_instance.h:
2378         * bindings/jni/jni_runtime.h:
2379         (KJS::Bindings::JavaMethod::returnType):
2380         * bindings/make_testbindings: Added.
2381         * bindings/objc/objc_class.h: Added.
2382         (KJS::Bindings::ObjcClass::~ObjcClass):
2383         (KJS::Bindings::ObjcClass::ObjcClass):
2384         (KJS::Bindings::ObjcClass::operator=):
2385         (KJS::Bindings::ObjcClass::constructorAt):
2386         (KJS::Bindings::ObjcClass::numConstructors):
2387         * bindings/objc/objc_class.mm: Added.
2388         (ObjcClass::_commonDelete):
2389         (ObjcClass::_commonCopy):
2390         (ObjcClass::_commonInit):
2391         (_createClassesByIsAIfNecessary):
2392         (ObjcClass::classForIsA):
2393         (ObjcClass::ObjcClass):
2394         (ObjcClass::name):
2395         (ObjcClass::methodsNamed):
2396         (ObjcClass::fieldNamed):
2397         * bindings/objc/objc_header.h: Added.
2398         * bindings/objc/objc_instance.h: Added.
2399         (KJS::Bindings::ObjcInstance::getObject):
2400         * bindings/objc/objc_instance.mm: Added.
2401         (ObjcInstance::ObjcInstance):
2402         (ObjcInstance::~ObjcInstance):
2403         (ObjcInstance::operator=):
2404         (ObjcInstance::begin):
2405         (ObjcInstance::end):
2406         (ObjcInstance::getClass):
2407         (ObjcInstance::invokeMethod):
2408         (ObjcInstance::defaultValue):
2409         (ObjcInstance::stringValue):
2410         (ObjcInstance::numberValue):
2411         (ObjcInstance::booleanValue):
2412         (ObjcInstance::valueOf):
2413         * bindings/objc/objc_jsobject.h: Added.
2414         * bindings/objc/objc_jsobject.mm: Added.
2415         * bindings/objc/objc_runtime.h:
2416         (KJS::Bindings::ObjcField::~ObjcField):
2417         (KJS::Bindings::ObjcField::ObjcField):
2418         (KJS::Bindings::ObjcField::operator=):
2419         (KJS::Bindings::ObjcMethod::ObjcMethod):
2420         (KJS::Bindings::ObjcMethod::~ObjcMethod):
2421         (KJS::Bindings::ObjcMethod::operator=):
2422         * bindings/objc/objc_runtime.mm: Added.
2423         (ObjcMethod::ObjcMethod):
2424         (ObjcMethod::name):
2425         (ObjcMethod::numParameters):
2426         (ObjcMethod::getMethodSignature):
2427         (ObjcField::ObjcField):
2428         (ObjcField::name):
2429         (ObjcField::type):
2430         (ObjcField::valueFromInstance):
2431         (ObjcField::setValueToInstance):
2432         * bindings/objc/objc_utility.h: Added.
2433         (KJS::Bindings::):
2434         * bindings/objc/objc_utility.mm: Added.
2435         (KJS::Bindings::JSMethodNameToObjCMethodName):
2436         (KJS::Bindings::convertValueToObjcValue):
2437         (KJS::Bindings::convertObjcValueToValue):
2438         (KJS::Bindings::objcValueTypeForType):
2439         * bindings/runtime.cpp:
2440         (MethodList::MethodList):
2441         (MethodList::operator=):
2442         (Instance::setValueOfField):
2443         (Instance::createBindingForLanguageInstance):
2444         (Instance::createRuntimeObject):
2445         * bindings/runtime.h:
2446         * bindings/runtime_method.cpp:
2447         (RuntimeMethodImp::RuntimeMethodImp):
2448         (RuntimeMethodImp::get):
2449         (RuntimeMethodImp::call):
2450         * bindings/runtime_method.h:
2451         * bindings/runtime_object.cpp:
2452         (RuntimeObjectImp::get):
2453         (RuntimeObjectImp::hasProperty):
2454         * bindings/test.js: Added.
2455         * bindings/testbindings.mm: Added.
2456         (-[MySecondInterface init]):
2457         (-[MyFirstInterface init]):
2458         (-[MyFirstInterface dealloc]):
2459         (+[MyFirstInterface JavaScriptNameForSelector:]):
2460         (-[MyFirstInterface getInt]):
2461         (-[MyFirstInterface setInt:]):
2462         (-[MyFirstInterface getMySecondInterface]):
2463         (-[MyFirstInterface logMessage:]):
2464         (GlobalImp::className):
2465         (readJavaScriptFromFile):
2466         (main):
2467
2468 === Safari-128 ===
2469
2470 2004-02-08  Darin Adler  <darin@apple.com>
2471
2472         Reviewed by Dave.
2473
2474         - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
2475
2476         * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
2477         macros from working right in C++ code that uses the <cctype> header.
2478
2479         * kjs/ustring.cpp:
2480         (KJS::inlineUTF8SequenceLengthNonASCII): Added.
2481         (KJS::UTF8SequenceLengthNonASCII): Added.
2482         (KJS::inlineUTF8SequenceLength): Added.
2483         (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
2484         (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2485         (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
2486         (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2487         (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2488
2489         - fixed the test program so it won't hit the interpreter lock assertion
2490
2491         * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
2492
2493 === Safari-127 ===
2494
2495 2004-02-06  Richard Williamson   <rjw@apple.com>
2496
2497         Fixed 3550242 and 3546977.  The first diff prevents an assert from firing.  The second diff prevents a JavaScript exception, caused be an invalid conversion, which has a downstream consequence of preventing a valid conversion.
2498
2499         Reviewed by John.
2500
2501         * bindings/jni/jni_jsobject.cpp:
2502         (JSObject::toString):
2503         * bindings/jni/jni_utility.cpp:
2504         (KJS::Bindings::convertValueToJValue):
2505
2506 2004-02-02  Darin Adler  <darin@apple.com>
2507
2508         Reviewed by Maciej.
2509
2510         - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
2511
2512         * kjs/array_object.cpp:
2513         (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
2514         we start putting values in. This prevents new Array(2147483647) from causing trouble.
2515         (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
2516         number is out of range. This prevents new Array(-1) from causing trouble.
2517
2518         - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
2519
2520         * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
2521         casting to int. Results now match those in other browsers.
2522
2523 2004-02-02  Darin Adler  <darin@apple.com>
2524
2525         Reviewed by Maciej.
2526
2527         - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
2528         - fixed other related overflow issues
2529
2530         * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
2531         * kjs/value.cpp:
2532         (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
2533         must not restrict values to the range of a particular integer type.
2534         (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
2535         proper handling for negative results from fmod.
2536         (ValueImp::toUInt32): Ditto.
2537         (ValueImp::toUInt16): Ditto.
2538         (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
2539
2540         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
2541         out-of-integer-range values better in the slice function.
2542         * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
2543         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
2544         out-of-integer-range values better in the toString function.
2545         * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
2546         out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
2547         and substr functions.
2548
2549 === Safari-126 ===
2550
2551 2004-01-30  Richard Williamson   <rjw@apple.com>
2552
2553         Fixed 3542044.  Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
2554
2555         Reviewed by Darin.
2556
2557         * bindings/jni/jni_instance.cpp:
2558         (JavaInstance::stringValue):
2559
2560 2004-01-26  Darin Adler  <darin@apple.com>
2561
2562         * Makefile.am: Switch from pbxbuild to xcodebuild.
2563
2564 2004-01-22  Richard Williamson   <rjw@apple.com>
2565
2566         Added stubs for ObjC language binding to JavaScript.
2567
2568         * JavaScriptCore.pbproj/project.pbxproj:
2569         * bindings/jni/jni_runtime.h:
2570         * bindings/objc/objc_runtime.h: Added.
2571         (KJS::Bindings::ObjcParameter::ObjcParameter):
2572         (KJS::Bindings::ObjcParameter::~ObjcParameter):
2573         (KJS::Bindings::ObjcParameter::operator=):
2574         (KJS::Bindings::ObjcParameter::type):
2575         (KJS::Bindings::ObjcConstructor::ObjcConstructor):
2576         (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
2577         (KJS::Bindings::ObjcConstructor::_commonCopy):
2578         (KJS::Bindings::ObjcConstructor::operator=):
2579         (KJS::Bindings::ObjcConstructor::value):
2580         (KJS::Bindings::ObjcConstructor::parameterAt):
2581         (KJS::Bindings::ObjcConstructor::numParameters):
2582         (KJS::Bindings::ObjcField::ObjcField):
2583         (KJS::Bindings::ObjcField::~ObjcField):
2584         * bindings/runtime.h:
2585
2586 2004-01-22  Richard Williamson   <rjw@apple.com>
2587
2588         Simplified JavaString by using UString as backing store.  This
2589         revealed a bug in CString's assignment operator which I fixed.
2590
2591         Removed some dead code.
2592  
2593         Reviewed by John.
2594
2595         * bindings/jni/jni_runtime.h:
2596         (KJS::Bindings::JavaString::JavaString):
2597         (KJS::Bindings::JavaString::_commonInit):
2598         (KJS::Bindings::JavaString::UTF8String):
2599         (KJS::Bindings::JavaString::uchars):
2600         (KJS::Bindings::JavaString::length):
2601         (KJS::Bindings::JavaString::ustring):
2602         * bindings/runtime_object.cpp:
2603         (RuntimeObjectImp::RuntimeObjectImp):
2604         * bindings/runtime_object.h:
2605         * kjs/ustring.cpp:
2606         (KJS::CString::CString):
2607         (KJS::CString::operator=):
2608
2609 === Safari-125 ===
2610
2611 === Safari-124 ===
2612
2613 2004-01-16  Richard Williamson   <rjw@apple.com>
2614
2615         Fixed 3525853.  We weren't handling mapping to overloaded Java
2616         methods very well.  Even though this is undefined the other
2617         browsers support it.  Also fixed a bug with returning arrays
2618         from Java functions.
2619
2620         Reviewed by John.
2621
2622         * bindings/jni/jni_class.cpp:
2623         (JavaClass::_commonInit):
2624         (JavaClass::methodsNamed):
2625         * bindings/jni/jni_class.h:
2626         * bindings/jni/jni_instance.cpp:
2627         (JavaInstance::invokeMethod):
2628         * bindings/jni/jni_instance.h:
2629         * bindings/jni/jni_runtime.cpp:
2630         (JavaArray::convertJObjectToArray):
2631         (JavaField::valueFromInstance):
2632         (JavaMethod::signature):
2633         (JavaArray::valueAt):
2634         * bindings/jni/jni_runtime.h:
2635         * bindings/jni_jsobject.cpp:
2636         (JSObject::call):
2637         (JSObject::convertJObjectToValue):
2638         * bindings/runtime.cpp:
2639         (MethodList::addMethod):
2640         (MethodList::length):
2641         (MethodList::methodAt):
2642         (MethodList::~MethodList):
2643         * bindings/runtime.h:
2644         (KJS::Bindings::MethodList::MethodList):
2645         * bindings/runtime_method.cpp:
2646         (RuntimeMethodImp::RuntimeMethodImp):
2647         (RuntimeMethodImp::get):
2648         (RuntimeMethodImp::call):
2649         * bindings/runtime_method.h:
2650         * bindings/runtime_object.cpp:
2651         (RuntimeObjectImp::get):
2652         (RuntimeObjectImp::hasProperty):
2653
2654 2004-01-16  Richard Williamson   <rjw@apple.com>
2655
2656         Fixed 3531229.  Another place that needs the  Push/PopLocalFrame
2657         protection implemented for 3530401.
2658
2659         Reviewed by John.
2660
2661         * bindings/runtime_method.cpp:
2662         (RuntimeMethodImp::call):
2663
2664 2004-01-15  Richard Williamson   <rjw@apple.com>
2665
2666         Fixed 3530401.  JNI doesn't cleanup local refs created on the
2667         main thread.   IMO this is a bad bug in our JMI implementation.
2668
2669         To work-around the problem I explicitly delete all local refs.
2670         Further, I've added Push/PopLocalFrame calls to catch any refs
2671         that I may have missed.  This will guarantee that we don't leak
2672         any Java references.
2673
2674         Reviewed by John.
2675
2676         * bindings/jni/jni_class.cpp:
2677         (JavaClass::_commonInit):
2678         (JavaClass::JavaClass):
2679         * bindings/jni/jni_instance.cpp:
2680         (JavaInstance::begin):
2681         (JavaInstance::end):
2682         * bindings/jni/jni_instance.h:
2683         * bindings/jni/jni_runtime.cpp:
2684         (JavaConstructor::JavaConstructor):
2685         (JavaMethod::JavaMethod):
2686         * bindings/jni_jsobject.cpp:
2687         (JSObject::listFromJArray):
2688         * bindings/runtime.h:
2689         (KJS::Bindings::Instance::begin):
2690         (KJS::Bindings::Instance::end):
2691         * bindings/runtime_object.cpp:
2692         (RuntimeObjectImp::get):
2693         (RuntimeObjectImp::put):
2694         (RuntimeObjectImp::canPut):
2695         (RuntimeObjectImp::hasProperty):
2696         (RuntimeObjectImp::defaultValue):
2697
2698 2004-01-15  Vicki Murley  <vicki@apple.com>
2699
2700         Reviewed by Darin.
2701
2702         * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
2703
2704 2004-01-14  Richard Williamson   <rjw@apple.com>
2705         
2706         Fixed 3529466.  With recent changes to Java plugin we must no
2707         longer call DeleteLocalRef().  Not a problem, it was an optimization anyway.
2708
2709         Reviewed by John.
2710
2711         * bindings/jni/jni_instance.cpp:
2712         (JObjectWrapper::JObjectWrapper):
2713
2714 === Safari-122 ===
2715
2716 2004-01-14  Richard Williamson   <rjw@apple.com>
2717
2718         Fixed 3529010.
2719
2720         Finalize may be called on an JSObject after we've already remove all our references.  The assert in this case is firing because we've received a finalize call from Java for an instance that we no longer know about.  The fix is to check in finalize that we're getting a call on an instance that we still care about.
2721
2722         Reviewed by John.
2723
2724         * bindings/jni_jsobject.cpp:
2725         (addJavaReference):
2726         (removeJavaReference):
2727         (RootObject::removeAllJavaReferencesForRoot):
2728         (JSObject::invoke):
2729
2730 2004-01-13  Richard Williamson   <rjw@apple.com>
2731
2732         Fixed 3528324. 
2733
2734         The run loop that is used to execute JavaScript (in practice, always the main run loop) is held in a class variable.  It is set and retained once and should not be released.  Unfortunately is it being released when the 'root' object on a LiveConnect applet is released.  This has the symptom of eventually causing an deallocation of the main run loop!  Usually after about 5 instantiations/destructions of a LiveConnect applet.  The CFRelease of the run loop was removed.
2735
2736         Reviewed by Hyatt.
2737
2738         * bindings/jni_jsobject.h:
2739         (KJS::Bindings::RootObject::~RootObject):
2740
2741 === Safari-121 ===
2742
2743 === Safari-120 ===
2744
2745 2004-01-06  Richard Williamson   <rjw@apple.com>
2746
2747         Fixed 3521814.  Finalize messages weren't being dispatched!
2748
2749         Reviewed by John.
2750
2751         * bindings/jni_jsobject.cpp:
2752         (JSObject::invoke):
2753
2754 2004-01-05  Richard Williamson   <rjw@apple.com>
2755
2756         Added cache of JNI method IDs to minimize allocations.  This mitigates the problem
2757         described by 3515579.
2758
2759         Also cleanup up logging of Java exceptions.
2760
2761         Reviewed by John.
2762
2763         * bindings/jni/jni_class.cpp:
2764         (JavaClass::classForInstance):
2765         * bindings/jni/jni_instance.cpp:
2766         (JavaInstance::JavaInstance):
2767         (JavaInstance::getClass):
2768         (JavaInstance::invokeMethod):
2769         (JObjectWrapper::JObjectWrapper):
2770         (JObjectWrapper::~JObjectWrapper):
2771         * bindings/jni/jni_instance.h:
2772         (KJS::Bindings::JavaInstance::operator=):
2773         * bindings/jni/jni_runtime.cpp:
2774         (JavaMethod::JavaMethod):
2775         (JavaMethod::methodID):
2776         * bindings/jni/jni_runtime.h:
2777         (KJS::Bindings::JavaMethod::JavaMethod):
2778         * bindings/jni/jni_utility.cpp:
2779         (callJNIMethod):
2780         (callJNIMethodIDA):
2781         (callJNIMethodA):
2782         (KJS::Bindings::getMethodID):
2783         (KJS::Bindings::callJNIVoidMethodIDA):
2784         (KJS::Bindings::callJNIObjectMethodIDA):
2785         (KJS::Bindings::callJNIByteMethodIDA):
2786         (KJS::Bindings::callJNICharMethodIDA):
2787         (KJS::Bindings::callJNIShortMethodIDA):
2788         (KJS::Bindings::callJNIIntMethodIDA):
2789         (KJS::Bindings::callJNILongMethodIDA):
2790         (KJS::Bindings::callJNIFloatMethodIDA):
2791         (KJS::Bindings::callJNIDoubleMethodIDA):
2792         (KJS::Bindings::callJNIBooleanMethodIDA):
2793         (KJS::Bindings::getCharactersFromJStringInEnv):
2794         (KJS::Bindings::getUCharactersFromJStringInEnv):
2795         (KJS::Bindings::getJNIField):
2796         * bindings/jni/jni_utility.h:
2797
2798 l2003-12-23  John Sullivan  <sullivan@apple.com>
2799
2800         * JavaScriptCore.pbproj/project.pbxproj:
2801         Xcode version wars, harmless
2802
2803 2003-12-23  Darin Adler  <darin@apple.com>
2804
2805         Reviewed by John (concept, not code, which is just the old code coming back).
2806
2807         - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
2808
2809         * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
2810         mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
2811
2812 2003-12-19  Richard Williamson   <rjw@apple.com>
2813
2814         Fixed 3515597.  When an error occurs we need
2815         to make sure result values are zeroed.
2816
2817         Cleaned up logs by adding a newline.
2818
2819         Reviewed by John.
2820
2821         * bindings/jni/jni_utility.cpp:
2822         (KJS::Bindings::getJavaVM):
2823         (KJS::Bindings::getJNIEnv):
2824         (callJNIMethod):
2825         (callJNIMethodA):
2826         (KJS::Bindings::getJNIField):
2827         * bindings/jni_jsobject.cpp:
2828         (JSObject::convertValueToJObject):
2829
2830 === Safari-119 ===
2831
2832 2003-12-17  Richard Williamson   <rjw@apple.com>
2833
2834         Ensure that all the symbols we export are in the KJS
2835         namespace (3512245).
2836
2837         Also renamed JavaString.characters() to JavaString.UTF8String()
2838         for enhanced clarity.
2839
2840         Added some sanity checking to constructor of JObjectWrapper.
2841
2842         Reviewed by Dave.
2843
2844         * ChangeLog:
2845         * bindings/jni/jni_class.cpp:
2846         * bindings/jni/jni_class.h:
2847         * bindings/jni/jni_instance.cpp:
2848         (JavaInstance::invokeMethod):
2849         (JObjectWrapper::JObjectWrapper):
2850         * bindings/jni/jni_instance.h:
2851         * bindings/jni/jni_runtime.cpp:
2852         (JavaParameter::JavaParameter):
2853         (JavaField::JavaField):
2854         (JavaMethod::JavaMethod):
2855         (JavaMethod::signature):
2856         * bindings/jni/jni_runtime.h:
2857         (KJS::Bindings::JavaString::ascii):
2858         (KJS::Bindings::JavaString::UTF8String):
2859         (KJS::Bindings::JavaString::JavaString):
2860         (KJS::Bindings::JavaString::_commonInit):
2861         (KJS::Bindings::JavaString::uchars):
2862         (KJS::Bindings::JavaString::length):
2863         (KJS::Bindings::JavaString::ustring):
2864         (KJS::Bindings::JavaParameter::type):
2865         (KJS::Bindings::JavaField::name):
2866         (KJS::Bindings::JavaField::type):
2867         (KJS::Bindings::JavaMethod::name):
2868         (KJS::Bindings::JavaMethod::returnType):
2869         * bindings/jni/jni_utility.cpp:
2870         (KJS::Bindings::getJavaVM):
2871         (KJS::Bindings::getJNIEnv):
2872         (KJS::Bindings::callJNIVoidMethod):
2873         (KJS::Bindings::callJNIObjectMethod):
2874         (KJS::Bindings::callJNIBooleanMethod):
2875         (KJS::Bindings::callJNIByteMethod):
2876         (KJS::Bindings::callJNICharMethod):
2877         (KJS::Bindings::callJNIShortMethod):
2878         (KJS::Bindings::callJNIIntMethod):
2879         (KJS::Bindings::callJNILongMethod):
2880         (KJS::Bindings::callJNIFloatMethod):
2881         (KJS::Bindings::callJNIDoubleMethod):
2882         (KJS::Bindings::callJNIVoidMethodA):
2883         (KJS::Bindings::callJNIObjectMethodA):
2884         (KJS::Bindings::callJNIByteMethodA):
2885         (KJS::Bindings::callJNICharMethodA):
2886         (KJS::Bindings::callJNIShortMethodA):
2887         (KJS::Bindings::callJNIIntMethodA):
2888         (KJS::Bindings::callJNILongMethodA):
2889         (KJS::Bindings::callJNIFloatMethodA):
2890         (KJS::Bindings::callJNIDoubleMethodA):
2891         (KJS::Bindings::callJNIBooleanMethodA):
2892         (KJS::Bindings::getCharactersFromJString):
2893         (KJS::Bindings::releaseCharactersForJString):
2894         (KJS::Bindings::getCharactersFromJStringInEnv):
2895         (KJS::Bindings::releaseCharactersForJStringInEnv):
2896         (KJS::Bindings::getUCharactersFromJStringInEnv):
2897         (KJS::Bindings::releaseUCharactersForJStringInEnv):
2898         (KJS::Bindings::JNITypeFromClassName):
2899         (KJS::Bindings::signatureFromPrimitiveType):
2900         (KJS::Bindings::JNITypeFromPrimitiveType):
2901         (KJS::Bindings::getJNIField):
2902         (KJS::Bindings::convertValueToJValue):
2903         * bindings/jni/jni_utility.h:
2904         * bindings/jni_jsobject.cpp:
2905         (KJS::Bindings::JSObject::invoke):
2906         (KJS::Bindings::JSObject::JSObject):
2907         (KJS::Bindings::JSObject::call):
2908         (KJS::Bindings::JSObject::eval):
2909         (KJS::Bindings::JSObject::getMember):
2910         (KJS::Bindings::JSObject::setMember):
2911         (KJS::Bindings::JSObject::removeMember):
2912         (KJS::Bindings::JSObject::getSlot):
2913         (KJS::Bindings::JSObject::setSlot):
2914         (KJS::Bindings::JSObject::toString):
2915         (KJS::Bindings::JSObject::finalize):
2916         (KJS::Bindings::JSObject::createNative):
2917         (KJS::Bindings::JSObject::convertValueToJObject):
2918         (KJS::Bindings::JSObject::convertJObjectToValue):
2919         (KJS::Bindings::JSObject::listFromJArray):
2920         * bindings/jni_jsobject.h:
2921         * bindings/runtime.cpp:
2922         * bindings/runtime.h:
2923         * bindings/runtime_method.cpp:
2924         * bindings/runtime_method.h:
2925
2926 === Safari-118 ===
2927
2928 2003-12-16  Richard Williamson   <rjw@apple.com>
2929
2930         Ack!  More assertions.  Lock ALL entry points into the interpreter!
2931         (3511733).
2932
2933         Reviewed by Ken.
2934
2935         * bindings/jni_jsobject.cpp:
2936         (Bindings::JSObject::call):
2937         (Bindings::JSObject::eval):
2938         (Bindings::JSObject::getMember):
2939         (Bindings::JSObject::setMember):
2940         (Bindings::JSObject::removeMember):
2941         (Bindings::JSObject::getSlot):
2942         (Bindings::JSObject::setSlot):
2943         (Bindings::JSObject::convertJObjectToValue):
2944
2945 2003-12-15  Richard Williamson   <rjw@apple.com>
2946
2947         Fixed a couple of snafus and removed some logging.
2948
2949         Reviewed by Maciej.
2950
2951         * bindings/jni_jsobject.cpp:
2952         (Bindings::performJavaScriptAccess):
2953         (Bindings::completedJavaScriptAccess):
2954         (Bindings::dispatchToJavaScriptThread):
2955         Removed some annoying JS_LOG clutter.
2956
2957         (Bindings::RootObject::removeAllJavaReferencesForRoot):
2958         Fixed allocation of key buffer that was called after it was needed.
2959
2960         (Bindings::JSObject::invoke):
2961         (Bindings::JSObject::JSObject):
2962         (Bindings::JSObject::getMember):
2963         (Bindings::JSObject::getSlot):
2964         Added additional interpreter locks around getMember and getSlot. 
2965         These functions may cause allocation of JS impls.  
2966
2967 2003-12-15  Richard Williamson   <rjw@apple.com>
2968
2969         args weren't passed to 'call' invocation.  d'oh.
2970         lock interpreter when we create instances of JS impls.        
2971
2972         Reviewed by Maciej.
2973
2974         * bindings/jni_jsobject.cpp:
2975         (Bindings::JSObject::call):
2976         (Bindings::JSObject::eval):
2977         (Bindings::JSObject::getMember):
2978         (Bindings::JSObject::setMember):
2979         (Bindings::JSObject::getSlot):
2980         (Bindings::JSObject::convertValueToJObject):
2981         (Bindings::JSObject::convertJObjectToValue):
2982         (Bindings::JSObject::listFromJArray):
2983         * bindings/jni_jsobject.h:
2984
2985 2003-12-15  Richard Williamson   <rjw@apple.com>
2986
2987         Last piece of LiveConnect!  This checkin adds implementation
2988         of the Java to JavaScript object conversion functions.
2989
2990         Reviewed by John.
2991
2992         * bindings/jni/jni_instance.cpp:
2993         (JavaInstance::invokeMethod):
2994         * bindings/jni/jni_utility.cpp:
2995         * bindings/jni/jni_utility.h:
2996         * bindings/jni_jsobject.cpp:
2997         (Bindings::JSObject::invoke):
2998         (Bindings::JSObject::call):
2999         (Bindings::JSObject::eval):
3000         (Bindings::JSObject::getMember):
3001         (Bindings::JSObject::setMember):
3002         (Bindings::JSObject::getSlot):
3003         (Bindings::JSObject::setSlot):
3004         (Bindings::JSObject::createNative):
3005         (Bindings::JSObject::convertValueToJObject):
3006         (Bindings::JSObject::convertJObjectToValue):
3007         (Bindings::JSObject::listFromJArray):
3008         * bindings/jni_jsobject.h:
3009         (Bindings::):
3010         * bindings/runtime_method.cpp:
3011         (RuntimeMethodImp::get):
3012         (RuntimeMethodImp::codeType):
3013         (RuntimeMethodImp::execute):
3014
3015 2003-12-12  Richard Williamson   <rjw@apple.com>
3016
3017         Added implementation of stubs in JSObject.  All that
3018         remains is a couple of simple conversion functions stubs and
3019         we're done with LiveConnect.  Also, changed string passing to
3020         JS to use uchars instead of chars.  
3021
3022         Reviewed by Maciej.
3023
3024         * bindings/jni/jni_runtime.h:
3025         (Bindings::JavaString::JavaString):
3026         (Bindings::JavaString::_commonInit):
3027         (Bindings::JavaString::_commonCopy):
3028         (Bindings::JavaString::_commonDelete):
3029         (Bindings::JavaString::~JavaString):
3030         (Bindings::JavaString::operator=):
3031         (Bindings::JavaString::uchars):
3032         (Bindings::JavaString::length):
3033         (Bindings::JavaString::ustring):
3034         * bindings/jni/jni_utility.cpp:
3035         (getUCharactersFromJStringInEnv):
3036         (releaseUCharactersForJStringInEnv):
3037         (convertValueToJObject):
3038         (convertJObjectToValue):
3039         * bindings/jni/jni_utility.h:
3040         * bindings/jni_jsobject.cpp:
3041         (Bindings::JSObject::invoke):
3042         (Bindings::JSObject::call):
3043         (Bindings::JSObject::eval):
3044         (Bindings::JSObject::getMember):
3045         (Bindings::JSObject::setMember):
3046         (Bindings::JSObject::removeMember):
3047         (Bindings::JSObject::getSlot):
3048         (Bindings::JSObject::setSlot):
3049         * bindings/jni_jsobject.h:
3050
3051 2003-12-12  Richard Williamson   <rjw@apple.com>
3052
3053         Ensure that all calls from Java into JavaScript are
3054         performed on a designated thread (the main thread).
3055
3056         Reviewed by Ken.
3057
3058         * bindings/jni_jsobject.cpp:
3059         (isJavaScriptThread):
3060         (rootForImp):
3061         (Bindings::performJavaScriptAccess):
3062         (Bindings::completedJavaScriptAccess):
3063         (Bindings::initializeJavaScriptAccessLock):
3064         (Bindings::lockJavaScriptAccess):
3065         (Bindings::unlockJavaScriptAccess):
3066         (Bindings::dispatchToJavaScriptThread):
3067         (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
3068         (Bindings::RootObject::removeAllJavaReferencesForRoot):
3069         (Bindings::JSObject::invoke):
3070         (Bindings::JSObject::JSObject):
3071         (Bindings::JSObject::call):
3072         (Bindings::JSObject::eval):
3073         (Bindings::JSObject::getMember):
3074         (Bindings::JSObject::setMember):
3075         (Bindings::JSObject::removeMember):
3076         (Bindings::JSObject::getSlot):
3077         (Bindings::JSObject::setSlot):
3078         (Bindings::JSObject::toString):
3079         (Bindings::JSObject::finalize):
3080         (Bindings::JSObject::getWindow):
3081         * bindings/jni_jsobject.h:
3082         (Bindings::RootObject::~RootObject):
3083         (Bindings::RootObject::findRootObjectForNativeHandleFunction):
3084         (Bindings::RootObject::runLoop):
3085         (Bindings::RootObject::performJavaScriptSource):
3086         (Bindings::):
3087
3088 2003-12-11  Richard Williamson   <rjw@apple.com>
3089
3090         Added support for calling a JavaScript function from
3091         Java.  Right now this only works for void func(void)
3092         functions, but the conversion of args and return values
3093         will come shortly.
3094
3095         Cleaned up and verified reference counting scheme, and
3096         dereferencing of vended JavaScript objects when applet is
3097         destroyed (actually when part is destroyed).
3098         
3099         Removed link hack for testkjs now that the Java folks think
3100         they have a solution for the 1.4.2 JavaVM link problem.  Although
3101         Greg B. thinks his solution may cause problems for the 1.3.1
3102         version of the VM!?!
3103
3104         Reviewed by Ken.
3105
3106         * Makefile.am:
3107         * bindings/jni/jni_runtime.h:
3108         (Bindings::JavaString::JavaString):
3109         * bindings/jni/jni_utility.cpp:
3110         (convertValueToJValue):
3111         (convertValueToJObject):
3112         (listFromJArray):
3113         * bindings/jni/jni_utility.h:
3114         * bindings/jni_jsobject.cpp:
3115         (KJS_setFindRootObjectForNativeHandleFunction):
3116         (KJS_findRootObjectForNativeHandleFunction):
3117         (getReferencesByRootDictionary):
3118         (getReferencesDictionary):
3119         (findReferenceDictionary):
3120         (rootForImp):
3121         (addJavaReference):
3122         (removeJavaReference):
3123         * bindings/jni_jsobject.h:
3124         (Bindings::RootObject::RootObject):
3125         (Bindings::RootObject::~RootObject):
3126         (Bindings::RootObject::setRootObjectImp):
3127         (Bindings::RootObject::rootObjectImp):
3128         (Bindings::RootObject::setInterpreter):
3129         (Bindings::RootObject::interpreter):
3130
3131 === Safari-117 ===
3132
3133 2003-12-10  Darin Adler  <darin@apple.com>
3134
3135         Reviewed by Maciej.
3136
3137         - fixed regression in JavaScript tests reported by the KDE guys
3138         - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
3139
3140         * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
3141         * kjs/ustring.cpp:
3142         (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
3143         tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
3144         and binary compatibility than default parameter values.
3145         (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
3146
3147         * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
3148         "tolerate empty string" parameter.
3149
3150 2003-12-10  Richard Williamson   <rjw@apple.com>
3151
3152         Added code to manage reference counting of JavaScript
3153         objects passed to Java.   Also added implementation of
3154         KJS_JSCreateNativeJSObject.  This is the function that
3155         provides the root object to Java (KJS::Window).
3156
3157         Reviewed by Hyatt.
3158
3159         * JavaScriptCore.pbproj/project.pbxproj:
3160         * bindings/jni_jsobject.cpp:
3161         (KJS_setFindObjectForNativeHandleFunction):
3162         (KJS_findObjectForNativeHandleFunction):
3163         (getReferencesByOwnerDictionary):
3164         (getReferencesDictionary):
3165         (findReferenceDictionary):
3166         (addJavaReference):
3167         (removeJavaReference):
3168         (removeAllJavaReferencesForOwner):
3169         * bindings/jni_jsobject.h:
3170
3171 2003-12-09  Richard Williamson   <rjw@apple.com>
3172
3173         LiveConnect stubs that correspond to the native methods
3174         on JSObject.  These will be called from the new Java plugin
3175         when an instance of JSObject is instantiated and messaged.
3176         When these are implemented the Java will be able to originate
3177         calls into JavaScript.
3178
3179         Also a temporary work-around added to Makefile.am to solve
3180         a link problem.  The 1.4.2 JavaVM accidentally links against
3181         libobjc.  This call a failure linking testkjs.  Mike Hay is
3182         working with someone to fix the problem (3505587).
3183
3184         Reviewed by Chris.
3185
3186         * JavaScriptCore.pbproj/project.pbxproj:
3187         * Makefile.am:
3188         * bindings/jni_jsobject.cpp: Added.
3189         (KJS_JSCreateNativeJSObject):
3190         (KJS_JSObject_JSFinalize):
3191         (KJS_JSObject_JSObjectCall):
3192         (KJS_JSObject_JSObjectEval):
3193         (KJS_JSObject_JSObjectGetMember):
3194         (KJS_JSObject_JSObjectSetMember):
3195         (KJS_JSObject_JSObjectRemoveMember):
3196         (KJS_JSObject_JSObjectGetSlot):
3197         (KJS_JSObject_JSObjectSetSlot):
3198         (KJS_JSObject_JSObjectToString):
3199         * bindings/jni_jsobject.h: Added.
3200
3201 2003-12-09  Maciej Stachowiak  <mjs@apple.com>
3202
3203         Reviewed by John.
3204
3205         <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
3206
3207         * kjs/collector.cpp:
3208         (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
3209         (KJS::Collector::collect): likewise
3210
3211 2003-12-08  Richard Williamson   <rjw@apple.com>
3212
3213         LiveConnect:  The last piece of the JavaScript side of the
3214         LiveConnect implementation.  This change adds support for
3215         setting/getting values from Java arrays in JavaScript.
3216
3217         Reviewed by John.
3218
3219         * bindings/jni/jni_instance.h:
3220         * bindings/jni/jni_runtime.cpp:
3221         (JavaField::JavaField):
3222         (convertJObjectToArray):
3223         (JavaArray::JavaArray):
3224         (JavaArray::~JavaArray):
3225         (JavaArray::setValueAt):
3226         (JavaArray::valueAt):
3227         (JavaArray::getLength):
3228         * bindings/jni/jni_runtime.h:
3229         (Bindings::JavaArray::operator=):
3230         (Bindings::JavaArray::javaArray):
3231         * bindings/jni/jni_utility.cpp:
3232         (JNITypeFromPrimitiveType):
3233         (convertValueToJValue):
3234         * bindings/jni/jni_utility.h:
3235         * bindings/runtime.h:
3236         * bindings/runtime_array.cpp:
3237         (RuntimeArrayImp::RuntimeArrayImp):
3238         (RuntimeArrayImp::~RuntimeArrayImp):
3239         (RuntimeArrayImp::get):
3240         (RuntimeArrayImp::put):
3241         (RuntimeArrayImp::hasProperty):
3242         * bindings/runtime_array.h:
3243         (KJS::RuntimeArrayImp::getLength):
3244         (KJS::RuntimeArrayImp::getConcreteArray):
3245         * bindings/runtime_object.cpp:
3246         (RuntimeObjectImp::get):
3247         (RuntimeObjectImp::canPut):
3248         (RuntimeObjectImp::hasProperty):
3249
3250 2003-12-05  Richard Williamson   <rjw@apple.com>
3251
3252         LiveConnect:  Part 1 of supporting JS bindings to
3253         native language arrays.
3254
3255         Reviewed by Chris.
3256
3257         * JavaScriptCore.pbproj/project.pbxproj:
3258         * bindings/jni/jni_runtime.cpp:
3259         (JavaField::JavaField):
3260         (convertJObjectToArray):
3261         (JavaField::valueFromInstance):
3262         (JavaField::setValueToInstance):
3263         * bindings/jni/jni_runtime.h:
3264         * bindings/runtime.cpp:
3265         (Instance::setValueOfField):
3266         * bindings/runtime.h:
3267         (Bindings::Array::~Array):
3268
3269 2003-12-04  Richard Williamson   <rjw@apple.com>
3270
3271         LiveConnect:  Moved defaultValue into concrete implementation because
3272         more intelligent conversion can be perform with knowledge
3273         of the class of the original instance.
3274
3275         Reviewed by Chris.
3276
3277         * bindings/jni/jni_class.cpp:
3278         (JavaClass::isNumberClass):
3279         (JavaClass::isBooleanClass):
3280         (JavaClass::isStringClass):
3281         * bindings/jni/jni_class.h:
3282         * bindings/jni/jni_instance.cpp:
3283         (JavaInstance::defaultValue):
3284         (JavaInstance::valueOf):
3285         * bindings/jni/jni_instance.h:
3286         (Bindings::JavaInstance::javaInstance):
3287         * bindings/runtime.h:
3288         * bindings/runtime_object.cpp:
3289         (RuntimeObjectImp::defaultValue):
3290
3291 2003-12-04  Richard Williamson   <rjw@apple.com>
3292
3293         LiveConnect:  Added support for setting the value of Java
3294         fields.
3295
3296         Reviewed by Chris.
3297
3298         * bindings/jni/jni_instance.cpp:
3299         (JavaInstance::invokeMethod):
3300         * bindings/jni/jni_runtime.cpp:
3301         (JavaParameter::JavaParameter):
3302         (JavaField::JavaField):
3303         (JavaField::valueFromInstance):
3304         (JavaField::setValueToInstance):
3305         (JavaMethod::JavaMethod):
3306         * bindings/jni/jni_runtime.h:
3307         (Bindings::JavaField::getJNIType):
3308         * bindings/jni/jni_utility.cpp:
3309         (JNITypeFromClassName):
3310         (convertValueToJValue):
3311         * bindings/jni/jni_utility.h:
3312         * bindings/runtime.cpp:
3313         (Instance::setValueOfField):
3314         * bindings/runtime.h:
3315         * bindings/runtime_object.cpp:
3316         (RuntimeObjectImp::get):
3317         (RuntimeObjectImp::put):
3318         (RuntimeObjectImp::defaultValue):
3319
3320 2003-12-04  Richard Williamson   <rjw@apple.com>
3321
3322         Added support for string conversions.
3323         Changed various JavaString member variables to be inline.
3324         Implemented defaultValue for context relevant type coercion.
3325
3326         Reviewed by Chris.
3327
3328         * bindings/jni/jni_class.cpp:
3329         (JavaClass::JavaClass):
3330         (JavaClass::setClassName):
3331         (JavaClass::classForInstance):
3332         * bindings/jni/jni_class.h:
3333         * bindings/jni/jni_instance.cpp:
3334         (JavaInstance::stringValue):
3335         (JavaInstance::numberValue):
3336         (JavaInstance::booleanValue):
3337         (JavaInstance::invokeMethod):
3338         * bindings/jni/jni_instance.h:
3339         * bindings/jni/jni_runtime.cpp:
3340         (JavaParameter::JavaParameter):
3341         (JavaField::JavaField):
3342         (JavaMethod::JavaMethod):
3343         (appendClassName):
3344         (JavaMethod::signature):
3345         * bindings/jni/jni_runtime.h:
3346         (Bindings::JavaString::JavaString):
3347         (Bindings::JavaString::~JavaString):
3348         (Bindings::JavaString::operator=):
3349         (Bindings::JavaString::characters):
3350         (Bindings::JavaParameter::JavaParameter):
3351         (Bindings::JavaParameter::~JavaParameter):
3352         (Bindings::JavaParameter::operator=):
3353         (Bindings::JavaParameter::type):
3354         (Bindings::JavaField::JavaField):
3355         (Bindings::JavaField::~JavaField):
3356         (Bindings::JavaField::operator=):
3357         (Bindings::JavaField::name):
3358         (Bindings::JavaField::type):
3359         (Bindings::JavaMethod::JavaMethod):
3360         (Bindings::JavaMethod::_commonDelete):
3361         (Bindings::JavaMethod::name):
3362         (Bindings::JavaMethod::returnType):
3363         * bindings/jni/jni_utility.cpp:
3364         (convertValueToJValue):
3365         * bindings/runtime.h:
3366         (Bindings::Instance::valueOf):
3367         * bindings/runtime_method.cpp:
3368         (RuntimeMethodImp::call):
3369         * bindings/runtime_object.cpp:
3370         (RuntimeObjectImp::RuntimeObjectImp):
3371         (RuntimeObjectImp::get):
3372         (RuntimeObjectImp::defaultValue):
3373         * bindings/runtime_object.h:
3374         (KJS::RuntimeObjectImp::classInfo):
3375
3376 === Safari-116 ===
3377
3378 2003-12-03  Richard Williamson   <rjw@apple.com>
3379
3380         LiveConnect:  Added support for parameter passing to Java and conversion
3381         of return values.
3382
3383         Reviewed by Chris.
3384
3385         * bindings/jni/jni_instance.cpp:
3386         (JavaInstance::invokeMethod):
3387         * bindings/jni/jni_instance.h:
3388         * bindings/jni/jni_runtime.cpp:
3389         (JavaParameter::JavaParameter):
3390         (JavaMethod::JavaMethod):
3391         (JavaMethod::signature):
3392         * bindings/jni/jni_runtime.h:
3393         (Bindings::JavaParameter::JavaParameter):
3394         (Bindings::JavaParameter::operator=):
3395         (Bindings::JavaParameter::getJNIType):
3396         * bindings/jni/jni_utility.cpp:
3397         (callJNIBooleanMethodA):
3398         (convertValueToJValue):
3399         * bindings/jni/jni_utility.h:
3400         * bindings/runtime.h:
3401         * bindings/runtime_method.cpp:
3402         (RuntimeMethodImp::call):
3403         * bindings/runtime_object.cpp:
3404         (RuntimeObjectImp::get):
3405
3406 2003-12-02  Richard Williamson   <rjw@apple.com>
3407
3408         Added support for calling simple methods in Java from JavaScript.
3409         (void return and no parameters).  Yay, LiveConnect lives.
3410
3411         Still need write argument and return value conversion code.
3412
3413         Reviewed by Chris.
3414
3415         * JavaScriptCore.pbproj/project.pbxproj:
3416         * bindings/jni/jni_instance.cpp:
3417         (JavaInstance::getClass):
3418         (JavaInstance::invokeMethod):
3419         * bindings/jni/jni_instance.h:
3420         * bindings/jni/jni_runtime.cpp:
3421         (JavaMethod::JavaMethod):
3422         (JavaMethod::signature):
3423         (JavaMethod::JNIReturnType):
3424         * bindings/jni/jni_runtime.h:
3425         (Bindings::JavaMethod::_commonDelete):
3426         (Bindings::JavaMethod::_commonCopy):
3427         (Bindings::JavaMethod::name):
3428         * bindings/jni/jni_utility.cpp:
3429         (signatureFromPrimitiveType):
3430         * bindings/jni/jni_utility.h:
3431         * bindings/runtime.h:
3432         * bindings/runtime_method.cpp: Added.
3433         (RuntimeMethodImp::RuntimeMethodImp):
3434         (RuntimeMethodImp::~RuntimeMethodImp):
3435         (RuntimeMethodImp::get):
3436         (RuntimeMethodImp::implementsCall):
3437         (RuntimeMethodImp::call):
3438         (RuntimeMethodImp::codeType):
3439         (RuntimeMethodImp::execute):
3440         * bindings/runtime_method.h: Added.
3441         * bindings/runtime_object.cpp:
3442         (RuntimeObjectImp::RuntimeObjectImp):
3443         (RuntimeObjectImp::get):
3444         * bindings/runtime_object.h:
3445         * kjs/function.cpp:
3446         (FunctionImp::FunctionImp):
3447         * kjs/interpreter.h:
3448
3449 2003-12-01  Darin Adler  <darin@apple.com>
3450
3451         Reviewed by Maciej.
3452
3453         - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
3454
3455         * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
3456         This indirectly caused the string.replace bug.
3457
3458 2003-12-02  Maciej Stachowiak  <mjs@apple.com>
3459
3460         Merged patches from Harri Porten and David Faure to fix:
3461
3462         <rdar://problem/3497643>: reproducible crash printing self-referential array
3463         
3464         * kjs/array_object.cpp:
3465         (ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown.
3466         * kjs/nodes.cpp:
3467         (FunctionCallNode::evaluate): Move function call depth check from here...
3468         * kjs/object.cpp:
3469         (KJS::Object::call): ...to here.
3470         * kjs/object.h: Un-inline Object::call now that it does more.
3471
3472 2003-12-01  Richard Williamson   <rjw@apple.com>
3473
3474         Fixed mistake in method signatures used to get boolean and integer fields.
3475
3476         Reviewed by Chris.
3477
3478         * bindings/jni/jni_runtime.cpp:
3479         (JavaField::valueFromInstance):
3480
3481 2003-12-01  Richard Williamson   <rjw@apple.com>
3482
3483 Fixed parameter passing to applet.  Child elements are NOT valid in setStyle().  So we now create the widget before needed with createWidgetIfNecessary.  This either happens when doing the first layout, or when JavaScript first references the applet element.
3484
3485 Fixed early delete of the the main applet instance.  When the JS collector cleaned up the last JS object referring to the applet instance we were deleting the java instance.  This caused the applet instance cached on the applet element to be invalid.  The applet instance is the only Java object not to be cleaned up by the JS collector.
3486
3487 Added support for getting at Java object fields.
3488
3489         Reviewed by Chris.
3490
3491         * JavaScriptCore.pbproj/project.pbxproj:
3492         * Makefile.am:
3493         * bindings/jni/jni_instance.cpp:
3494         (JObjectWrapper::JObjectWrapper):
3495         * bindings/jni/jni_instance.h:
3496         (Bindings::JObjectWrapper::~JObjectWrapper):
3497         * bindings/jni/jni_runtime.cpp:
3498         (JavaField::valueFromInstance):
3499         * bindings/runtime_object.cpp:
3500         (RuntimeObjectImp::~RuntimeObjectImp):
3501         (RuntimeObjectImp::RuntimeObjectImp):
3502         (RuntimeObjectImp::get):
3503         (RuntimeObjectImp::deleteProperty):
3504         * bindings/runtime_object.h:
3505
3506 === Safari-115 ===
3507
3508 2003-11-21  Maciej Stachowiak  <mjs@apple.com>
3509
3510         Patch from Harri Porten, reviewed by me.
3511
3512         - fixed 3491712 - String slice with negative arguments does not offset from end of string
3513         
3514         * kjs/string_object.cpp:
3515         (StringProtoFuncImp::call): Handle negative arguments as offsets from end by
3516         adding length and clamping to [0,length-1].
3517
3518 2003-11-21  Maciej Stachowiak  <mjs@apple.com>
3519
3520         Patch from Harri Porten, reviewed by me.
3521
3522         - fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash
3523         
3524         * kjs/function_object.cpp:
3525         (FunctionProtoFuncImp::call): Nest parentheses properly.
3526
3527 2003-11-20  Richard Williamson   <rjw@apple.com>
3528
3529         More LiveConnect stuff.  Primitive Java fields are now
3530         accessible from JavaScript!  Yay!
3531
3532         Reviewed by Maciej.
3533
3534         * bindings/jni/jni_class.cpp:
3535         (JavaClass::methodNamed):
3536         (JavaClass::fieldNamed):
3537         * bindings/jni/jni_class.h:
3538         (Bindings::JavaClass::_commonDelete):
3539         * bindings/jni/jni_instance.cpp:
3540         (JavaInstance::JavaInstance):
3541         (JavaInstance::~JavaInstance):
3542         (JavaInstance::getClass):
3543         * bindings/jni/jni_instance.h:
3544         (Bindings::JavaInstance::javaInstance):
3545         * bindings/jni/jni_runtime.cpp:
3546         (JavaField::JavaField):
3547         (JavaField::valueFromInstance):
3548         * bindings/jni/jni_runtime.h:
3549         (Bindings::JavaField::JavaField):
3550         (Bindings::JavaField::~JavaField):
3551         (Bindings::JavaField::operator=):
3552         * bindings/jni/jni_utility.cpp:
3553         (callJNIMethod):
3554         (callJNIMethodA):
3555         (callJNIVoidMethod):
3556         (callJNIObjectMethod):
3557         (callJNIBooleanMethod):
3558         (callJNIByteMethod):
3559         (callJNICharMethod):
3560         (callJNIShortMethod):
3561         (callJNIIntMethod):
3562         (callJNILongMethod):
3563         (callJNIFloatMethod):
3564         (callJNIDoubleMethod):
3565         (callJNIVoidMethodA):
3566         (callJNIObjectMethodA):
3567         (callJNIByteMethodA):
3568         (callJNICharMethodA):
3569         (callJNIShortMethodA):
3570         (callJNIIntMethodA):
3571         (callJNILongMethodA):
3572         (callJNIFloatMethodA):
3573         (callJNIDoubleMethodA):
3574         (releaseCharactersForJStringInEnv):
3575         (primitiveTypeFromClassName):
3576         (getJNIField):
3577         * bindings/jni/jni_utility.h:
3578         * bindings/runtime.cpp:
3579         (Instance::createBindingForLanguageInstance):
3580         (Instance::getValueOfField):
3581         * bindings/runtime.h:
3582         * bindings/runtime_object.cpp:
3583         (RuntimeObjectImp::get):
3584
3585 2003-11-20  Richard Williamson   <rjw@apple.com>
3586
3587         More LiveConnect stuff.
3588
3589         Reviewed by Chris.
3590
3591         * bindings/jni/jni_class.cpp:
3592         (JavaClass::classForName):
3593         (JavaClass::classForInstance):
3594         * bindings/jni/jni_instance.cpp:
3595         (JavaInstance::getValueOfField):
3596         * bindings/jni/jni_instance.h:
3597         (Bindings::JObjectWrapper::JObjectWrapper):
3598         * bindings/jni/jni_runtime.h:
3599         (Bindings::JavaConstructor::~JavaConstructor):
3600         (Bindings::JavaConstructor::operator=):
3601         (Bindings::JavaMethod::JavaMethod):
3602         (Bindings::JavaMethod::_commonDelete):
3603         (Bindings::JavaMethod::signature):
3604         * bindings/jni/jni_utility.cpp:
3605         (getJNIEnv):
3606         (attachToJavaVM):
3607         * bindings/jni/jni_utility.h:
3608         * bindings/runtime.h:
3609         * bindings/runtime_object.cpp:
3610         (RuntimeObjectImp::~RuntimeObjectImp):
3611         (RuntimeObjectImp::get):
3612         * bindings/runtime_object.h:
3613
3614 2003-11-19  Richard Williamson   <rjw@apple.com>
3615
3616         More LiveConnect stuff.
3617
3618         Reviewed by Ken.
3619
3620         * JavaScriptCore.pbproj/project.pbxproj:
3621         * bindings/jni/jni_class.cpp: Added.
3622         (JavaClass::_commonInit):
3623         (JavaClass::JavaClass):
3624         (_createClassesByNameIfNecessary):
3625         (JavaClass::classForName):
3626         (JavaClass::classForInstance):
3627         (JavaClass::methodNamed):
3628         (JavaClass::fieldNamed):
3629         * bindings/jni/jni_class.h: Added.
3630         (Bindings::JavaClass::_commonDelete):
3631         (Bindings::JavaClass::~JavaClass):
3632         (Bindings::JavaClass::_commonCopy):
3633         (Bindings::JavaClass::JavaClass):
3634         (Bindings::JavaClass::operator=):
3635         (Bindings::JavaClass::name):
3636         (Bindings::JavaClass::constructorAt):
3637         (Bindings::JavaClass::numConstructors):
3638         * bindings/jni/jni_instance.cpp: Added.
3639         (JavaInstance::JavaInstance):
3640         (JavaInstance::~JavaInstance):
3641         * bindings/jni/jni_instance.h: Added.
3642         (Bindings::JObjectWrapper::JObjectWrapper):
3643         (Bindings::JObjectWrapper::~JObjectWrapper):
3644         (Bindings::JObjectWrapper::ref):
3645         (Bindings::JObjectWrapper::deref):
3646         (Bindings::JavaInstance::getClass):
3647         (Bindings::JavaInstance::operator=):
3648         * bindings/jni/jni_runtime.cpp:
3649         (JavaMethod::JavaMethod):
3650         * bindings/jni/jni_runtime.h:
3651         (Bindings::JavaString::JavaString):
3652         (Bindings::JavaString::~JavaString):
3653         (Bindings::JavaString::operator=):
3654         * bindings/jni/jni_utility.cpp:
3655         (getJavaVM):
3656         (getJNIEnv):
3657         (getCharactersFromJString):
3658         (releaseCharactersForJString):
3659         (getCharactersFromJStringInEnv):
3660         (releaseCharactersForJStringInEnv):
3661         * bindings/jni/jni_utility.h:
3662         * bindings/runtime.cpp:
3663         (Instance::createBindingForLanguageInstance):
3664         * bindings/runtime.h:
3665         (Bindings::Instance::):
3666
3667 2003-11-18  Richard Williamson   <rjw@apple.com>
3668
3669         More live connect stubs.  We're getting close.
3670
3671         Reviewed by Chris.
3672
3673         * JavaScriptCore.pbproj/project.pbxproj:
3674         * bindings/jni/jni_runtime.cpp:
3675         (JavaClass::JavaClass):
3676         (JavaInstance::JavaInstance):
3677         (JavaInstance::~JavaInstance):
3678         * bindings/jni/jni_runtime.h:
3679         (Bindings::JavaConstructor::value):
3680         (Bindings::JavaField::value):
3681         (Bindings::JavaMethod::value):
3682         (Bindings::JavaClass::_commonDelete):
3683         (Bindings::JavaClass::_commonCopy):
3684         (Bindings::JavaClass::methodNamed):
3685         (Bindings::JavaClass::fieldNamed):
3686         (Bindings::JavaInstance::getClass):
3687         * bindings/runtime.cpp: Added.
3688         * bindings/runtime.h:
3689         (Bindings::Instance::~Instance):
3690         * bindings/runtime_object.cpp: Added.
3691         (RuntimeObjectImp::classInfo):
3692         (RuntimeObjectImp::RuntimeObjectImp):
3693         (RuntimeObjectImp::get):
3694         (RuntimeObjectImp::put):
3695         (RuntimeObjectImp::canPut):
3696         (RuntimeObjectImp::hasProperty):
3697         (RuntimeObjectImp::deleteProperty):
3698         (RuntimeObjectImp::defaultValue):
3699         (RuntimeObjectImp::_initializeClassInfoFromInstance):
3700         * bindings/runtime_object.h: Added.
3701         (KJS::RuntimeObjectImp::setInternalInstance):
3702         (KJS::RuntimeObjectImp::getInternalInstance):
3703         * kjs/object.cpp:
3704         (KJS::ObjectImp::get):
3705         (KJS::ObjectImp::hasProperty):
3706         * kjs/value.h:
3707         (KJS::):
3708
3709 2003-11-17  Maciej Stachowiak  <mjs@apple.com>
3710
3711         Patch from Harri, reviewed by me.
3712
3713         - fixed 3487375 - backwards array slice causes infinite loop
3714         
3715         * kjs/array_object.cpp:
3716         (ArrayProtoFuncImp::call):
3717
3718 2003-11-17  Maciej Stachowiak  <mjs@apple.com>
3719
3720         Patch from Harri Porten reviewed by me.
3721
3722         - fixed 3487371 - operator precedence for bitwise or, xor and and is wrong
3723
3724         * kjs/grammar.y: Correct the precedence.
3725
3726 2003-11-16  Maciej Stachowiak  <mjs@apple.com>
3727
3728         Reviewed by John.
3729
3730         - fixed 3483829 - JavaScriptCore needs workaround to compile on Merlot
3731         
3732         * JavaScriptCore.pbproj/project.pbxproj: Add -Wno-long-double to
3733         warning flags.
3734
3735 === Safari-114 ===
3736
3737 2003-11-13  Richard Williamson   <rjw@apple.com>
3738
3739         Factored common code between copy constructor and assignment operator.
3740
3741         Reviewed by Chris.
3742
3743         * ChangeLog:
3744         * bindings/jni/jni_runtime.h:
3745         (Bindings::JavaConstructor::_commonCopy):
3746         (Bindings::JavaConstructor::JavaConstructor):
3747         (Bindings::JavaConstructor::operator=):
3748         (Bindings::JavaField::type):
3749         * bindings/runtime.h:
3750
3751 2003-11-13  Richard Williamson   <rjw@apple.com>
3752
3753         More LiveConnect stuff.  This checkin adds abstract classes to model
3754         language runtimes and a JNI based set of concrete implementations for
3755         Java.
3756
3757         Reviewed by Chris.
3758
3759         * JavaScriptCore.pbproj/project.pbxproj:
3760         * Makefile.am:
3761         * bindings/Makefile.am: Removed.
3762         * bindings/jni/Makefile.am: Removed.
3763         * bindings/jni/jni_runtime.cpp: Added.
3764         (JavaField::JavaField):
3765         (JavaConstructor::JavaConstructor):
3766         (JavaMethod::JavaMethod):
3767         (JavaClass::JavaClass):
3768         * bindings/jni/jni_runtime.h: Added.
3769         (Bindings::JavaString::JavaString):
3770         (Bindings::JavaString::~JavaString):
3771         (Bindings::JavaString::operator=):
3772         (Bindings::JavaString::characters):
3773         (Bindings::JavaParameter::JavaParameter):
3774         (Bindings::JavaParameter::~JavaParameter):
3775         (Bindings::JavaParameter::operator=):
3776         (Bindings::JavaParameter::type):
3777         (Bindings::JavaConstructor::JavaConstructor):
3778         (Bindings::JavaConstructor::~JavaConstructor):
3779         (Bindings::JavaConstructor::operator=):
3780         (Bindings::JavaConstructor::parameterAt):
3781         (Bindings::JavaConstructor::numParameters):
3782         (Bindings::JavaField::JavaField):
3783         (Bindings::JavaField::~JavaField):
3784         (Bindings::JavaField::operator=):
3785         (Bindings::JavaField::name):
3786         (Bindings::JavaField::type):
3787         (Bindings::JavaMethod::JavaMethod):
3788         (Bindings::JavaMethod::_commonDelete):
3789         (Bindings::JavaMethod::~JavaMethod):
3790         (Bindings::JavaMethod::_commonCopy):
3791         (Bindings::JavaMethod::operator=):
3792         (Bindings::JavaMethod::name):
3793         (Bindings::JavaMethod::returnType):
3794         (Bindings::JavaMethod::parameterAt):
3795         (Bindings::JavaMethod::numParameters):
3796         (Bindings::JavaClass::_commonDelete):
3797         (Bindings::JavaClass::~JavaClass):
3798         (Bindings::JavaClass::_commonCopy):
3799         (Bindings::JavaClass::JavaClass):
3800         (Bindings::JavaClass::operator=):
3801         (Bindings::JavaClass::name):
3802         (Bindings::JavaClass::methodAt):
3803         (Bindings::JavaClass::numMethods):
3804         (Bindings::JavaClass::constructorAt):
3805         (Bindings::JavaClass::numConstructors):
3806         (Bindings::JavaClass::fieldAt):
3807         (Bindings::JavaClass::numFields):
3808         * bindings/jni/jni_utility.cpp:
3809         (callJNIMethod):
3810         (callJNIMethodA):
3811         (callJNIObjectMethod):
3812         (callJNIByteMethod):
3813         (callJNICharMethod):
3814         (callJNIShortMethod):
3815         (callJNIIntMethod):
3816         (callJNILongMethod):
3817         (callJNIFloatMethod):
3818         (callJNIDoubleMethod):
3819         (callJNIVoidMethodA):
3820         (callJNIObjectMethodA):
3821         (callJNIByteMethodA):
3822         (callJNICharMethodA):
3823         (callJNIShortMethodA):
3824         (callJNIIntMethodA):
3825         (callJNILongMethodA):
3826         (callJNIFloatMethodA):
3827         (callJNIDoubleMethodA):
3828         (getCharactersFromJString):
3829         (releaseCharactersForJString):
3830         * bindings/jni/jni_utility.h:
3831         * bindings/objc/Makefile.am: Removed.
3832         * bindings/runtime.h: Added.
3833         (Bindings::Parameter::~Parameter):
3834         (Bindings::Constructor::~Constructor):
3835         (Bindings::Field::~Field):
3836         (Bindings::Method::~Method):
3837         (Bindings::Class::~Class):
3838
3839 2003-11-13  Maciej Stachowiak  <mjs@apple.com>
3840
3841         Reviewed by John.
3842
3843         - fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions
3844         
3845         * kjs/nodes.cpp:
3846         (ForInNode::execute): If the in value is null or undefined, bail
3847         out early, since attempting to iterate its properties will throw
3848         an exception.
3849
3850 2003-11-12  Darin Adler  <darin@apple.com>
3851
3852         - fixed the build
3853
3854         * Makefile.am: Fix the build by removing the bindings directory from SUBDIRS.
3855         Later, we can either add this back and add the Makefile.am files to the top
3856         level configure.in or leave it out and remove the Makefile.am files.
3857
3858 2003-11-12  Richard Williamson   <rjw@apple.com>
3859
3860         Added utility functions for calling JNI methods.
3861
3862         Reviewed by Chris.
3863
3864         * JavaScriptCore.pbproj/project.pbxproj:
3865         * Makefile.am:
3866         * bindings/Makefile.am: Added.
3867         * bindings/jni/Makefile.am: Added.
3868         * bindings/jni/jni_utility.cpp: Added.
3869         (attachToJavaVM):
3870         (callJNIMethod):
3871         (callJNIVoidMethod):
3872         (callJNIObjectMethod):
3873         (callJNIByteMethod):
3874         (callJNICharMethod):
3875         (callJNIShortMethod):
3876         (callJNIIntMethod):
3877         (callJNILongMethod):
3878         (callJNIFloatMethod):
3879         (callJNIDoubleMethod):
3880         * bindings/jni/jni_utility.h: Added.
3881         * bindings/objc/Makefile.am: Added.
3882
3883 2003-11-08  Darin Adler  <darin@apple.com>
3884
3885         Reviewed by John.
3886
3887         - fixed 3477528 -- array.sort(function) fails if the function returns a non-zero value that rounds to zero
3888
3889         * kjs/array_object.cpp:
3890         (compareByStringForQSort): Added checks for undefined values to match what the specification calls for.
3891         (compareWithCompareFunctionForQSort): Added checks for undefined values as above, and also changed the
3892         code that looks at the compare function result to look at the number returned without rounding to an integer.
3893         (ArrayProtoFuncImp::call): Changed the code that looks at the compare function result to look at the number
3894         returned without rounding to an integer.
3895
3896 === Safari-113 ===
3897
3898 2003-11-03  Vicki Murley <vicki@apple.com>
3899
3900         Reviewed by kocienda.
3901
3902         - fixed <rdar://problem/3471096>: non-B&I builds should not use order files, because they cause false "regressions" in perf.
3903
3904         * JavaScriptCore.pbproj/project.pbxproj: added empty SECTORDER_FLAGS variables to the Development and Deployment build styles
3905
3906 2003-11-02  Darin Adler  <darin@apple.com>
3907
3908         Reviewed by Maciej.
3909
3910         - changed list manipulation to use Harri Porten's idea of a circular
3911           linked list that is built from head to tail rather than building the
3912           list backwards and reversing the list when done
3913
3914         * kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way.
3915         Change many places that passed 0L to pass nothing at all, or to pass 0.
3916
3917         * kjs/nodes.h:
3918         (KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated
3919         backwards list.
3920         (KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list.
3921         (KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the
3922         inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated
3923         backwards list. Made the case for the first node separate so we don't need a nil check.
3924         (KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of
3925         reversing the list.
3926         (KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated
3927         backwards list. Also, made the constructors inline (moved here from .cpp file).
3928         (KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of
3929         reversing the list.
3930         (KJS::NewExprNode::NewExprNode): Changed a 0L to 0.
3931         (KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into
3932         .cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated
3933         backwards list.
3934         (KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated
3935         backwards list.
3936         (KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing
3937         the list.
3938         (KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file).
3939         The one in the .cpp file breaks the list instead of reversing it.
3940         (KJS::ForNode::ForNode): Break the circular list instead of reversing the list.
3941         (KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the
3942         list.
3943         (KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated
3944         backwards list.
3945         (KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into
3946         .cpp file). The one in the .cpp file breaks the list instead of reversing it.
3947         (KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and
3948         finally nodes rather than just Node.
3949         (KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated
3950         backwards list.
3951         (KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the
3952         list.
3953         (KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the
3954         list.
3955
3956         * kjs/nodes.cpp:
3957         (StatListNode::StatListNode): Moved this constructor here, no longer inline.
3958         Did the "break circular list" thing instead of the "reverse list" thing.
3959         Added setLoc calls to match KJS in the KDE tree; since we don't currently
3960         use the JavaScript debugging support, it's unclear whether there's any benefit, but
3961         later we might be using it and it's good to be as close as possible.
3962         (BlockNode::BlockNode): Moved this constructor here, no longer inline.
3963         Did the "break circular list" thing instead of the "reverse list" thing.
3964         Added setLoc calls.
3965         (CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline.
3966         Did the "break circular list" thing instead of the "reverse list" thing.
3967         (SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline.
3968         Did the "break circular list" thing instead of the "reverse list" thing.
3969         Added setLoc calls.
3970
3971         * kjs/grammar.cpp: Regenerated.
3972         * kjs/grammar.cpp.h: Regenerated.
3973         * kjs/grammar.h: Regenerated.
3974
3975 === Safari-112 ===
3976
3977 2003-10-30  Maciej Stachowiak  <mjs@apple.com>
3978
3979         Reviewed by Ken.
3980
3981         - fixed 3427069 - browsing mp3.com causes leaks (KJS)
3982         
3983         * kjs/string_object.cpp:
3984         (StringProtoFuncImp::call): Don't do an early return, since that
3985         could leak a temporary regexp.
3986
3987 2003-10-29  Maciej Stachowiak  <mjs@apple.com>
3988
3989         Reviewed by Darin.
3990
3991         - fixed 3426076 - Leak of JS lexer data visiting http://www.ebay.com
3992         
3993         * kjs/grammar.cpp:
3994         (yyerror): Updated the commented code.
3995         * kjs/grammar.y: Don't delete string and identifier tokens when done
3996         with them any more, they'll get cleaned up by the lexer now.
3997         * kjs/internal.cpp:
3998         (Parser::parse): Tell lexer when done parsing.
3999         * kjs/lexer.cpp:
4000         (Lexer::Lexer): Initialize new data members.
4001         (Lexer::lex): Use new methods to make strings and identifiers, and
4002         save them.
4003         (Lexer::makeIdentifier): Make a new Identifier and save it in an
4004         auto-growing array.
4005         (Lexer::makeUString): Likewise for UStrings.
4006         (Lexer::doneParsing): Clean up arrays of Ifentifiers and UStrings.
4007         * kjs/lexer.h:
4008
4009 2003-10-28  Maciej Stachowiak  <mjs@apple.com>
4010
4011         Reviewed by Ken.
4012
4013         - fixed 3413962 -  malicious web pages can kill all future JavaScript execution by breaking recursion limit check
4014         
4015         * kjs/nodes.cpp:
4016         (FunctionCallNode::evaluate): If we're going to return early due
4017         to breaking the recursion limit, make sure to lower it again, or
4018         it will creep up by one each time it's exceeded.
4019
4020 2003-10-26  Darin Adler  <darin@apple.com>
4021
4022         * JavaScriptCorePrefix.h: Added a C case to the NULL definition since we use C as well
4023         as C++ in this project.
4024
4025 2003-10-26  Darin Adler  <darin@apple.com>
4026
4027         - rolled in some CString changes Harri Porten did on the KDE side
4028
4029         * kjs/ustring.cpp:
4030         (KJS::CString::CString): Use memcpy instead of strcpy for speed. Fix an off by one error
4031         in the copy constructor.
4032         (KJS::CString::operator=): Use memcpy instead of strcpy for speed.
4033
4034         * JavaScriptCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
4035         __null feature even if the system C library doesn't.
4036
4037 == Rolled over to ChangeLog-2003-10-25 ==