Updated plugin binding API to reflect latest revision from
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2004-04-22  Richard Williamson   <rjw@apple.com>
2
3         Updated plugin binding API to reflect latest revision from
4         working group.
5         
6         Biggest change is the introduction of NPVariant used to represent
7         value types.  NPVariant replaces the use of NPObject for the
8         exchange of values between scripting environment and native code.
9
10         Reviewed by John.
11
12         * JavaScriptCore.pbproj/project.pbxproj:
13         * bindings/NP_jsobject.cpp:
14         (identiferFromNPIdentifier):
15         (NPN_Call):
16         (NPN_Evaluate):
17         (NPN_GetProperty):
18         (NPN_SetProperty):
19         (NPN_ToString):
20         (NPN_GetPropertyAtIndex):
21         (NPN_SetPropertyAtIndex):
22         * bindings/c/c_class.cpp:
23         (CClass::methodsNamed):
24         (CClass::fieldNamed):
25         * bindings/c/c_instance.cpp:
26         (CInstance::invokeMethod):
27         (CInstance::defaultValue):
28         * bindings/c/c_runtime.cpp:
29         (CField::valueFromInstance):
30         (CField::setValueToInstance):
31         * bindings/c/c_utility.cpp:
32         (convertNPStringToUTF16):
33         (convertUTF8ToUTF16):
34         (coerceValueToNPVariantStringType):
35         (convertValueToNPVariant):
36         (convertNPVariantToValue):
37         * bindings/c/c_utility.h:
38         * bindings/npruntime.cpp:
39         (NPN_GetIdentifier):
40         (NPN_GetIdentifiers):
41         (NPN_UTF8FromIdentifier):
42         (NPN_VariantIsVoid):
43         (NPN_VariantIsNull):
44         (NPN_VariantIsUndefined):
45         (NPN_VariantIsBool):
46         (NPN_VariantIsInt32):
47         (NPN_VariantIsDouble):
48         (NPN_VariantIsString):
49         (NPN_VariantIsObject):
50         (NPN_VariantToBool):
51         (NPN_VariantToString):
52         (NPN_VariantToInt32):
53         (NPN_VariantToDouble):
54         (NPN_VariantToObject):
55         (NPN_InitializeVariantAsVoid):
56         (NPN_InitializeVariantAsNull):
57         (NPN_InitializeVariantAsUndefined):
58         (NPN_InitializeVariantWithBool):
59         (NPN_InitializeVariantWithInt32):
60         (NPN_InitializeVariantWithDouble):
61         (NPN_InitializeVariantWithString):
62         (NPN_InitializeVariantWithStringCopy):
63         (NPN_InitializeVariantWithObject):
64         (NPN_InitializeVariantWithVariant):
65         (NPN_ReleaseVariantValue):
66         (NPN_CreateObject):
67         (NPN_RetainObject):
68         (NPN_ReleaseObject):
69         (NPN_IsKindOfClass):
70         (NPN_SetExceptionWithUTF8):
71         (NPN_SetException):
72         * bindings/npruntime.h:
73         (_NPString::):
74         (_NPString::_NPVariant::):
75         * bindings/testbindings.cpp:
76         (logMessage):
77         (setDoubleValue):
78         (setIntValue):
79         (setStringValue):
80         (setBooleanValue):
81         (getDoubleValue):
82         (getIntValue):
83         (getStringValue):
84         (getBooleanValue):
85         (myGetProperty):
86         (mySetProperty):
87         (myInvoke):
88         (myAllocate):
89
90 2004-04-22  Darin Adler  <darin@apple.com>
91
92         Reviewed by Maciej.
93
94         - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
95
96         * kjs/ustring.cpp:
97         (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
98         Was resulting in a buffer 2x the needed size.
99         (KJS::UString::expandPreCapacity): Ditto.
100         (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
101
102 2004-04-21  Maciej Stachowiak  <mjs@apple.com>
103
104         Reviewed by Darin.
105
106         Preliminary change for conservative GC. Create "protected"
107         subclasses to GC-protect objects when on heap, since we will soon
108         remove the built-in refcounting of the normal wrapper classes. Use
109         them where needed.
110         
111         * JavaScriptCore.pbproj/project.pbxproj:
112         * kjs/context.h:
113         * kjs/internal.h:
114         (KJS::InterpreterImp::globalObject):
115         * kjs/interpreter.h:
116         * kjs/property_map.cpp:
117         * kjs/reference.h:
118         * kjs/reference_list.cpp:
119
120 2004-04-19  Maciej Stachowiak  <mjs@apple.com>
121
122         Reviewed by Dave.
123
124         Optimize prepend using the shared substring optimization. Also,
125         limit the applicability of shared append and shared prepend. If
126         you overdo it, it does more harm than good, because you create a
127         bunch of strings that are disqualified from future shared
128         append/prepend, for not much immediate savings in allocate/copy
129         expense.
130         
131         * kjs/ustring.cpp:
132         (KJS::):
133         (KJS::UString::Rep::create):
134         (KJS::UString::expandedSize):
135         (KJS::UString::usedPreCapacity):
136         (KJS::UString::expandCapacity):
137         (KJS::UString::expandPreCapacity):
138         (KJS::UString::UString):
139         (KJS::UString::append):
140         (KJS::UString::operator=):
141         * kjs/ustring.h:
142         (KJS::UString::Rep::data):
143
144 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
145         Reviewed by Richard.
146
147         No more need for Completion or Reference to privately inherit from
148         Value, none of the superclass functionality is used.
149
150         * kjs/completion.h:
151         * kjs/reference.h:
152
153 === Safari-137 ===
154
155 2004-04-16  Richard Williamson   <rjw@apple.com>
156
157         Added interpreter lock protection around object creation.
158
159         Reviewed by Chris.
160
161         * bindings/runtime.cpp:
162         (Instance::createRuntimeObject):
163
164 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
165
166         Reviewed by Ken.
167
168         Another JavaScript speed improvement: use the mechanism from
169         string append optimization to make taking a substring fast, again
170         sharing the buffer.
171
172         A further 22% improvement on the 24fun string speed test.
173         
174         * kjs/ustring.cpp:
175         (KJS::):
176         (KJS::UString::Rep::create):
177         (KJS::UString::UString):
178         (KJS::UString::append):
179         (KJS::UString::operator=):
180         (KJS::UString::substr):
181         * kjs/ustring.h:
182         (KJS::UString::Rep::data):
183
184 2004-04-13  Maciej Stachowiak  <mjs@apple.com>
185
186         Reviewed by Darin.
187
188         - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
189         - fixed <rdar://problem/3600691>: Table generation test is really slow
190         - fixed <rdar://problem/3600661>: 24fun date test is really slow
191
192         80% speedup on the string test, lesser speedups on the other two.
193         
194         Two different optimizations here:
195
196         1) Avoid large overhead of scanning strings to see if they are all
197         ASCII before numeric conversion.
198         
199         * kjs/nodes.cpp:
200         (AssignNode::evaluate): Don't convert to integer until we know for
201         sure the operation will need it. Attempting to convert strings to
202         numbers is a waste when they are being appended with +=.
203
204         2) Avoid huge cost of appending strings.
205
206         This is done by allowing multiple strings to share a buffer but
207         actually use different ranges of it. The first time a string is
208         appended to, we start leaving at least 10% extra space in the
209         buffer, so doing N appends to the same string takes O(log N)
210         mallocs instead of O(N).
211         
212         * kjs/identifier.cpp:
213         (KJS::Identifier::equal):
214         (KJS::Identifier::add):
215         * kjs/ustring.cpp:
216         (KJS::):
217         (KJS::UCharReference::operator=):
218         (KJS::UCharReference::ref):
219         (KJS::UString::Rep::create):
220         (KJS::UString::Rep::destroy):
221         (KJS::UString::expandedSize):
222         (KJS::UString::usedCapacity):
223         (KJS::UString::expandCapacity):
224         (KJS::UString::UString):
225         (KJS::UString::null):
226         (KJS::UString::append):
227         (KJS::UString::operator=):
228         (KJS::UString::toStrictUInt32):
229         (KJS::UString::detach):
230         (KJS::KJS::operator==):
231         * kjs/ustring.h:
232         (KJS::UString::Rep::data):
233         (KJS::UString::Rep::hash):
234
235 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
236
237         Reviewed by John.
238
239         - fix deployment build by avoiding deployment-only warning.
240
241         * kjs/scope_chain.cpp:
242         (KJS::ScopeChain::bottom):
243
244 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
245
246         Reviewed by John.
247
248         Changed things so that newly created objects get a prototype based
249         on the scope chain of the current function, rather than the
250         interpreter that started execution. This fixes the following bugs:
251         
252         <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
253         <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
254
255         * JavaScriptCore.pbproj/project.pbxproj:
256         * kjs/array_object.cpp:
257         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
258         (ArrayProtoFuncImp::ArrayProtoFuncImp):
259         (ArrayProtoFuncImp::call):
260         (ArrayObjectImp::construct):
261         * kjs/bool_object.cpp:
262         (BooleanObjectImp::construct):
263         * kjs/date_object.cpp:
264         (DateProtoFuncImp::DateProtoFuncImp):
265         (DateProtoFuncImp::call):
266         (DateObjectImp::construct):
267         * kjs/error_object.cpp:
268         (ErrorObjectImp::construct):
269         * kjs/function.cpp:
270         (FunctionImp::FunctionImp):
271         (FunctionImp::call):
272         (DeclaredFunctionImp::construct):
273         (ArgumentsImp::ArgumentsImp):
274         (GlobalFuncImp::call):
275         * kjs/function_object.cpp:
276         (FunctionProtoFuncImp::call):
277         (FunctionObjectImp::construct):
278         * kjs/internal.cpp:
279         (BooleanImp::toObject):
280         (StringImp::toObject):
281         (NumberImp::toObject):
282         (InterpreterImp::InterpreterImp):
283         (InterpreterImp::clear):
284         (InterpreterImp::interpreterWithGlobalObject):
285         * kjs/internal.h:
286         * kjs/interpreter.cpp:
287         (ExecState::lexicalInterpreter):
288         * kjs/interpreter.h:
289         (KJS::ExecState::dynamicInterpreter):
290         (KJS::ExecState::interpreter):
291         * kjs/math_object.cpp:
292         (MathFuncImp::MathFuncImp):
293         * kjs/nodes.cpp:
294         (StatementNode::hitStatement):
295         (StatementNode::abortStatement):
296         (RegExpNode::evaluate):
297         (ElementNode::evaluate):
298         (ArrayNode::evaluate):
299         (ObjectLiteralNode::evaluate):
300         (PropertyValueNode::evaluate):
301         (FunctionCallNode::evaluate):
302         (FuncDeclNode::processFuncDecl):
303         (FuncExprNode::evaluate):
304         * kjs/number_object.cpp:
305         (NumberObjectImp::construct):
306         * kjs/object.cpp:
307         (KJS::ObjectImp::defaultValue):
308         (KJS::Error::create):
309         * kjs/object_object.cpp:
310         (ObjectObjectImp::construct):
311         * kjs/reference.cpp:
312         (Reference::putValue):
313         * kjs/regexp_object.cpp:
314         (RegExpProtoFuncImp::call):
315         (RegExpObjectImp::arrayOfMatches):
316         (RegExpObjectImp::construct):
317         * kjs/scope_chain.cpp:
318         (KJS::ScopeChain::bottom):
319         * kjs/scope_chain.h:
320         * kjs/string_object.cpp:
321         (StringProtoFuncImp::StringProtoFuncImp):
322         (StringProtoFuncImp::call):
323         (StringObjectImp::construct):
324
325 === Safari-136 ===
326
327 === Safari-135 ===
328
329 2004-03-31  Richard Williamson   <rjw@apple.com>
330
331         Tedious renames based on feedback from plugin-futures list.
332         NP_ functions are renamed with NPN_ prefix.
333         Types prefix renamed from NP_ to NP.
334         NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated. 
335         
336         No review because this was just a renaming patch.
337
338         * bindings/NP_jsobject.cpp:
339         (listFromNPArray):
340         (jsAllocate):
341         (identiferFromNPIdentifier):
342         (NPN_Call):
343         (NPN_Evaluate):
344         (NPN_GetProperty):
345         (NPN_SetProperty):
346         (NPN_RemoveProperty):
347         (NPN_ToString):
348         (NPN_GetPropertyAtIndex):
349         (NPN_SetPropertyAtIndex):
350         * bindings/NP_jsobject.h:
351         * bindings/c/c_class.cpp:
352         (CClass::_commonInit):
353         (CClass::classForIsA):
354         (CClass::CClass):
355         (CClass::methodsNamed):
356         (CClass::fieldNamed):
357         * bindings/c/c_class.h:
358         * bindings/c/c_instance.cpp:
359         (CInstance::CInstance):
360         (CInstance::~CInstance):
361         (CInstance::operator=):
362         (CInstance::invokeMethod):
363         (CInstance::defaultValue):
364         * bindings/c/c_instance.h:
365         (KJS::Bindings::CInstance::getObject):
366         * bindings/c/c_runtime.cpp:
367         (CField::valueFromInstance):
368         (CField::setValueToInstance):
369         * bindings/c/c_runtime.h:
370         (KJS::Bindings::CField::CField):
371         (KJS::Bindings::CField::name):
372         (KJS::Bindings::CMethod::CMethod):
373         (KJS::Bindings::CMethod::name):
374         * bindings/c/c_utility.cpp:
375         (coerceValueToNPString):
376         (convertValueToNPValueType):
377         (convertNPValueTypeToValue):
378         * bindings/c/c_utility.h:
379         * bindings/npruntime.cpp:
380         (NPN_IdentifierFromUTF8):
381         (NPN_IsValidIdentifier):
382         (NPN_GetIdentifiers):
383         (NPN_UTF8FromIdentifier):
384         (NPN_CreateObject):
385         (NPN_RetainObject):
386         (NPN_ReleaseObject):
387         (NPN_IsKindOfClass):
388         (NPN_SetExceptionWithUTF8):
389         (NPN_SetException):
390         (numberAllocate):
391         (NPN_CreateNumberWithInt):
392         (NPN_CreateNumberWithFloat):
393         (NPN_CreateNumberWithDouble):
394         (NPN_IntFromNumber):
395         (NPN_FloatFromNumber):
396         (NPN_DoubleFromNumber):
397         (stringAllocate):
398         (NPN_CreateStringWithUTF8):
399         (NPN_CreateStringWithUTF16):
400         (NPN_DeallocateUTF8):
401         (NPN_UTF8FromString):
402         (NPN_UTF16FromString):
403         (NPN_StringLength):
404         (booleanAllocate):
405         (NPN_CreateBoolean):
406         (NPN_BoolFromBoolean):
407         (nullAllocate):
408         (NPN_GetNull):
409         (undefinedAllocate):
410         (NPN_GetUndefined):
411         (arrayAllocate):
412         (arrayDeallocate):
413         (NPN_CreateArray):
414         (NPN_CreateArrayV):
415         (NPN_ObjectAtIndex):
416         * bindings/npruntime.h:
417         * bindings/runtime.cpp:
418         (Instance::createBindingForLanguageInstance):
419         * bindings/testbindings.cpp:
420         (initializeIdentifiers):
421         (myHasProperty):
422         (myHasMethod):
423         (myGetProperty):
424         (mySetProperty):
425         (logMessage):
426         (setDoubleValue):
427         (setIntValue):
428         (setStringValue):
429         (setBooleanValue):
430         (getDoubleValue):
431         (getIntValue):
432         (getStringValue):
433         (getBooleanValue):
434         (myInvoke):
435         (myAllocate):
436         (myInvalidate):
437         (myDeallocate):
438         (main):
439
440 2004-03-31  Richard Williamson   <rjw@apple.com>
441
442         Changed references to NP_runtime.h to npruntime.h
443         
444         * JavaScriptCore.pbproj/project.pbxproj:
445         * bindings/NP_jsobject.h:
446         * bindings/c/c_class.h:
447         * bindings/c/c_instance.h:
448         * bindings/c/c_runtime.h:
449         * bindings/c/c_utility.h:
450         * bindings/npruntime.cpp:
451
452 2004-03-31  Richard Williamson   <rjw@apple.com>
453
454         Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
455
456         * JavaScriptCore.pbproj/project.pbxproj:
457         * bindings/NP_jsobject.h:
458         * bindings/npruntime.cpp:
459
460 === Safari-134 ===
461
462 2004-03-23  Richard Williamson   <rjw@apple.com>
463
464         Added implementation of KJS::Value <-> NP_Object conversion functions.
465         Augmented test program for 'C' bindings.
466         Added asserts and parameter checking to all public API. 
467
468         Reviewed by Ken.
469
470         * JavaScriptCore.pbproj/project.pbxproj:
471         * bindings/NP_jsobject.cpp:
472         (NP_ToString):
473         * bindings/NP_jsobject.h: Added.
474         * bindings/NP_runtime.cpp:
475         (NP_IdentifierFromUTF8):
476         (NP_IsValidIdentifier):
477         (NP_GetIdentifiers):
478         (NP_CreateObject):
479         (NP_RetainObject):
480         (NP_ReleaseObject):
481         (NP_IsKindOfClass):
482         (NP_SetExceptionWithUTF8):
483         (NP_SetException):
484         (NP_IntFromNumber):
485         (NP_FloatFromNumber):
486         (NP_DoubleFromNumber):
487         (NP_CreateStringWithUTF8):
488         (NP_CreateStringWithUTF16):
489         (NP_DeallocateUTF8):
490         (NP_UTF8FromString):
491         (NP_UTF16FromString):
492         (NP_StringLength):
493         (NP_BoolFromBoolean):
494         * bindings/NP_runtime.h:
495         * bindings/c/c_instance.cpp:
496         (CInstance::invokeMethod):
497         * bindings/c/c_utility.cpp:
498         (coerceValueToNPString):
499         (convertValueToNPValueType):
500         (convertNPValueTypeToValue):
501         * bindings/c/c_utility.h:
502         * bindings/test.js:
503         * bindings/testC.js: Added.
504         * bindings/testbindings.cpp:
505         (logMessage):
506         (setDoubleValue):
507         (setIntValue):
508         (setStringValue):
509         (setBooleanValue):
510         (getDoubleValue):
511         (getIntValue):
512         (getStringValue):
513         (getBooleanValue):
514         (myInterfaceInvoke):
515         (myInterfaceAllocate):
516
517 === Safari-133 ===
518
519 2004-03-19  Darin Adler  <darin@apple.com>
520
521         Reviewed by Ken.
522
523         - fixed problem with methods like setUTCHour
524
525         * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
526         GMT vs. local time function based on the utc flag.
527
528 2004-03-17  Richard Williamson   <rjw@apple.com>
529
530         Added a context parameter to result callbacks use by JavaScriptObject functions.  This was a change requested by Eric Carlson on the QT plugin team.
531
532         Reviewed by Ken.
533
534         * bindings/NP_jsobject.cpp:
535         (NP_Call):
536         (NP_Evaluate):
537         (NP_GetProperty):
538         (NP_ToString):
539         (NP_GetPropertyAtIndex):
540         * bindings/NP_runtime.h:
541
542 2004-03-16  Richard Williamson   <rjw@apple.com>
543
544         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.
545
546         Reviewed by John.
547
548         * bindings/jni/jni_class.cpp:
549         (JavaClass::methodsNamed):
550
551 2004-03-15  Richard Williamson   <rjw@apple.com>
552
553         Fixed 3570854.  Don't attempt to convert Null to strings.  We
554         were incorrectly converting to "Null".
555
556         Actually fixed by Scott Kovatch.
557
558         Reviewed by Richard.
559
560         * bindings/jni/jni_utility.cpp:
561         (KJS::Bindings::convertValueToJValue):
562
563 === Safari-132 ===
564
565 2004-03-11  Richard Williamson   <rjw@apple.com>
566
567         Stitched together the NP stuff to our language independent
568         JavaScript binding stuff.  Very close to being done.
569         
570         Added program to test C bindings (and NP stuff).  Just tests
571         properties.  Will add methods and JavaScript access, etc.
572
573         Updated Makefile.am to account for new bindings/c directory.
574
575         Change NP_UTF8 from "const char *" to "char" to allow for
576         declarations like "const NP_UTF8 *" and "NP_UTF8 *".  Ditto
577         for NP_UTF16.
578
579         Added NP_IsValidIdentifier().
580
581         Reviewed by Chris.
582
583         * JavaScriptCore.pbproj/project.pbxproj:
584         * Makefile.am:
585         * bindings/NP_jsobject.cpp:
586         (identiferFromNPIdentifier):
587         (NP_Evaluate):
588         * bindings/NP_runtime.cpp:
589         (NP_IdentifierFromUTF8):
590         (NP_IsValidIdentifier):
591         (NP_GetIdentifiers):
592         (NP_UTF8FromIdentifier):
593         (NP_SetExceptionWithUTF8):
594         (NP_SetException):
595         (NP_CreateStringWithUTF8):
596         (NP_CreateStringWithUTF16):
597         (NP_UTF8FromString):
598         (NP_UTF16FromString):
599         * bindings/NP_runtime.h:
600         * bindings/c/c_class.cpp: Added.
601         (CClass::_commonDelete):
602         (CClass::_commonCopy):
603         (CClass::_commonInit):
604         (_createClassesByIsAIfNecessary):
605         (CClass::classForIsA):
606         (CClass::CClass):
607         (CClass::name):
608         (CClass::methodsNamed):
609         (CClass::fieldNamed):
610         * bindings/c/c_class.h: Added.
611         (KJS::Bindings::CClass::~CClass):
612         (KJS::Bindings::CClass::CClass):
613         (KJS::Bindings::CClass::operator=):
614         (KJS::Bindings::CClass::constructorAt):
615         (KJS::Bindings::CClass::numConstructors):
616         * bindings/c/c_instance.cpp: Added.
617         (CInstance::CInstance):
618         (CInstance::~CInstance):
619         (CInstance::operator=):
620         (CInstance::getClass):
621         (CInstance::begin):
622         (CInstance::end):
623         (CInstance::invokeMethod):
624         (CInstance::defaultValue):
625         (CInstance::stringValue):
626         (CInstance::numberValue):
627         (CInstance::booleanValue):
628         (CInstance::valueOf):
629         * bindings/c/c_instance.h: Added.
630         (KJS::Bindings::CInstance::getObject):
631         * bindings/c/c_runtime.cpp: Added.
632         (CField::valueFromInstance):
633         (CField::setValueToInstance):
634         * bindings/c/c_runtime.h: Added.
635         (KJS::Bindings::CField::CField):
636         (KJS::Bindings::CField::name):
637         (KJS::Bindings::CField::type):
638         (KJS::Bindings::CMethod::CMethod):
639         (KJS::Bindings::CMethod::name):
640         (KJS::Bindings::CMethod::numParameters):
641         * bindings/c/c_utility.cpp: Added.
642         (coerceValueToNPValueType):
643         (convertValueToNPValueType):
644         (convertNPValueTypeToValue):
645         * bindings/c/c_utility.h: Added.
646         * bindings/make_testbindings:
647         * bindings/runtime.cpp:
648         (Instance::createBindingForLanguageInstance):
649         * bindings/runtime.h:
650         (KJS::Bindings::Instance::):
651         * bindings/testbindings.cpp: Added.
652         (initializeIdentifiers):
653         (myInterfaceHasProperty):
654         (myInterfaceHasMethod):
655         (myInterfaceGetProperty):
656         (myInterfaceSetProperty):
657         (myInterfaceInvoke):
658         (myInterfaceAllocate):
659         (myInterfaceInvalidate):
660         (myInterfaceDeallocate):
661         (GlobalImp::className):
662         (readJavaScriptFromFile):
663         (main):
664
665 2004-03-10  Richard Williamson   <rjw@apple.com>
666
667         Made changes to support new asychronous approach to calls from
668         plugin to JavaScript
669
670         Reviewed by Chris.
671
672         * bindings/NP_jsobject.cpp:
673         (NP_Call):
674         (NP_Evaluate):
675         (NP_GetProperty):
676         (NP_ToString):
677         (NP_GetPropertyAtIndex):
678         * bindings/NP_runtime.h:
679         * bindings/make_testbindings:
680         * bindings/runtime.cpp:
681         (Instance::createBindingForLanguageInstance):
682
683 2004-03-10  Richard Williamson   <rjw@apple.com>
684
685         Updated header to include proposed changes from
686         plugin-futures list.  Calls from plugin to JavaScript
687         are now asynchronous.
688
689         Reviewed by Chris.
690
691         * bindings/NP_runtime.h:
692
693 === Safari-131 ===
694
695 2004-03-04  Richard Williamson   <rjw@apple.com>
696
697         Implementation of NP_JavaScriptObject.  This is the 'C' class
698         that wraps a JavaScript object.
699
700         Reviewed by Chris.
701
702         * JavaScriptCore.pbproj/project.pbxproj:
703         * bindings/NP_jsobject.cpp: Added.
704         (coerceValueToNPValueType):
705         (convertValueToNPValueType):
706         (convertNPValueTypeToValue):
707         (listFromNPArray):
708         (jsAllocate):
709         (jsDeallocate):
710         (identiferFromNPIdentifier):
711         (NP_Call):
712         (NP_Evaluate):
713         (NP_GetProperty):
714         (NP_SetProperty):
715         (NP_RemoveProperty):
716         (NP_ToString):
717         (NP_GetPropertyAtIndex):
718         (NP_SetPropertyAtIndex):
719         * bindings/NP_runtime.cpp:
720         (NP_ObjectAtIndex):
721         * bindings/NP_runtime.h:
722         * bindings/runtime_object.h:
723
724 2004-03-04  Richard Williamson   <rjw@apple.com>
725
726         Added NP_Array implementation.  
727
728         Changed NP_Boolean to just depend on two static instances, no
729         space is required for values.
730
731         Reviewed by Chris.
732
733         * bindings/NP_runtime.cpp:
734         (NP_CreateBoolean):
735         (NP_BoolFromBoolean):
736         (arrayAllocate):
737         (arrayDeallocate):
738         (NP_CreateArray):
739         (NP_CreateArrayV):
740         (NP_ObjectAtIndex):
741         * bindings/NP_runtime.h:
742
743 2004-03-03  Darin Adler  <darin@apple.com>
744
745         Reviewed by Vicki.
746
747         * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
748         copyright string, and that's all that was in here.
749         * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
750
751 2004-03-03  Richard Williamson   <rjw@apple.com>
752
753         More 'C' binding implementation.  Fleshed out all the
754         'primitive' data types.
755
756         Reviewed by Chris.
757
758         * bindings/NP_runtime.cpp:
759         (NP_ReleaseObject):
760         (numberAllocate):
761         (stringAllocate):
762         (stringDeallocate):
763         (NP_CreateStringWithUTF8):
764         (NP_CreateStringWithUTF16):
765         (NP_UTF8FromString):
766         (NP_UTF16FromString):
767         (NP_StringLength):
768         (booleanAllocate):
769         (booleanDeallocate):
770         (NP_CreateBoolean):
771         (NP_BoolFromBoolean):
772         (nullAllocate):
773         (nullDeallocate):
774         (NP_GetNull):
775         (undefinedAllocate):
776         (undefinedDeallocate):
777         (NP_GetUndefined):
778         * bindings/NP_runtime.h:
779
780 2004-03-03  Richard Williamson   <rjw@apple.com>
781
782         More 'C' binding implementation.
783
784         Reviewed by Chris.
785
786         * bindings/NP_runtime.cpp:
787         (identifierEqual):
788         (identifierHash):
789         (getIdentifierDictionary):
790         (NP_IdentifierFromUTF8):
791         (NP_UTF8FromIdentifier):
792         (NP_CreateObject):
793         (NP_ReleaseObject):
794         (NP_IsKindOfClass):
795         (numberCreate):
796         (NP_CreateNumberWithInt):
797         (NP_CreateNumberWithFloat):
798         (NP_CreateNumberWithDouble):
799         (NP_IntFromNumber):
800         (NP_FloatFromNumber):
801         (NP_DoubleFromNumber):
802         * bindings/NP_runtime.h:
803
804 2004-03-02  Richard Williamson   <rjw@apple.com>
805
806         Removed retain/release from NP_Class.  Classes will not be allowed to implement their
807         own customer retain/release scheme.
808
809         Reviewed by Chris.
810
811         * bindings/NP_runtime.cpp:
812         (NP_RetainObject):
813         (NP_ReleaseObject):
814         * bindings/NP_runtime.h:
815
816 2004-03-02  Richard Williamson   <rjw@apple.com>
817
818         C binding API.  Partial implementation.
819
820         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.
821
822         Factored root object reference counting scheme.  It is now useful independent
823         of LiveConnect.
824
825         Reviewed by Chris.
826
827         * JavaScriptCore.pbproj/project.pbxproj:
828         * bindings/NP_runtime.cpp: Added.
829         (NP_IdentifierFromUTF8):
830         (NP_GetIdentifiers):
831         (NP_UTF8FromIdentifier):
832         (NP_CreateObject):
833         (NP_RetainObject):
834         (NP_ReleaseObject):
835         (NP_IsKindOfClass):
836         (NP_SetException):
837         (NP_Call):
838         (NP_Evaluate):
839         (NP_GetProperty):
840         (NP_SetProperty):
841         (NP_RemoveProperty):
842         (NP_ToString):
843         (NP_GetPropertyAtIndex):
844         (NP_SetPropertyAtIndex):
845         (NP_CreateNumberWithInt):
846         (NP_CreateNumberWithFloat):
847         (NP_CreateNumberWithDouble):
848         (NP_IntFromNumber):
849         (NP_FloatFromNumber):
850         (NP_DoubleFromNumber):
851         (NP_CreateStringWithUTF8):
852         (NP_CreateStringWithUTF16):
853         (NP_UTF8FromString):
854         (NP_UTF16FromString):
855         (NP_CreateBoolean):
856         (NP_BoolFromBoolean):
857         (NP_GetNull):
858         (NP_GetUndefined):
859         (NP_CreateArray):
860         (NP_CreateArrayV):
861         (NP_ObjectAtIndex):
862         * bindings/NP_runtime.h: Added.
863         * bindings/jni/jni_jsobject.cpp:
864         (JSObject::invoke):
865         (JSObject::finalize):
866         (JSObject::createNative):
867         (JSObject::convertValueToJObject):
868         * bindings/jni/jni_jsobject.h:
869         * bindings/objc/objc_jsobject.h:
870         * bindings/objc/objc_jsobject.mm:
871         (rootForView):
872         (windowJavaScriptObject):
873         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
874         (-[JavaScriptObject dealloc]):
875         (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
876         (-[JavaScriptObject call:arguments:]):
877         (-[JavaScriptObject evaluate:]):
878         (-[JavaScriptObject getMember:]):
879         (-[JavaScriptObject setMember:value:]):
880         (-[JavaScriptObject removeMember:]):
881         (-[JavaScriptObject toString]):
882         (-[JavaScriptObject getSlot:]):
883         (-[JavaScriptObject setSlot:value:]):
884         * bindings/objc/objc_utility.h:
885         * bindings/objc/objc_utility.mm:
886         (KJS::Bindings::convertValueToObjcValue):
887         * bindings/runtime_root.cpp: Added.
888         (getReferencesByRootDictionary):
889         (getReferencesDictionary):
890         (KJS::Bindings::findReferenceDictionary):
891         (KJS::Bindings::rootForImp):
892         (KJS::Bindings::addNativeReference):
893         (KJS::Bindings::removeNativeReference):
894         (completedJavaScriptAccess):
895         (initializeJavaScriptAccessLock):
896         (lockJavaScriptAccess):
897         (unlockJavaScriptAccess):
898         (RootObject::dispatchToJavaScriptThread):
899         (performJavaScriptAccess):
900         (RootObject::setFindRootObjectForNativeHandleFunction):
901         (RootObject::removeAllNativeReferences):
902         * bindings/runtime_root.h: Added.
903         (KJS::Bindings::RootObject::RootObject):
904         (KJS::Bindings::RootObject::~RootObject):
905         (KJS::Bindings::RootObject::setRootObjectImp):
906         (KJS::Bindings::RootObject::rootObjectImp):
907         (KJS::Bindings::RootObject::setInterpreter):
908         (KJS::Bindings::RootObject::interpreter):
909         (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
910         (KJS::Bindings::RootObject::runLoop):
911         (KJS::Bindings::RootObject::performJavaScriptSource):
912
913 === Safari-130 ===
914
915 === Safari-129 ===
916
917 2004-02-18  Richard Williamson   <rjw@apple.com>
918
919         Added NSNumber/Number conversion.
920
921         Removed some unnecessary KJS:: namespace specifiers.
922
923         Reviewed by Ken.
924
925         * bindings/objc/objc_utility.mm:
926         (KJS::Bindings::convertValueToObjcValue):
927         (KJS::Bindings::convertObjcValueToValue):
928         * bindings/runtime_array.h:
929
930 2004-02-18  Richard Williamson   <rjw@apple.com>
931
932         Added support for export NSArrays.
933
934         Updated valueAt() to take an ExecState so we can throw
935         JS exceptions.
936
937         Implemented excludeSelectorFromJavaScript: in ObjcClass.  This allows
938         ObjectiveC classes to control the visibility of their methods in 
939         JavaScript.
940
941         Reviewed by Ken.
942
943         * bindings/jni/jni_runtime.cpp:
944         (JavaField::valueFromInstance):
945         (JavaArray::valueAt):
946         * bindings/jni/jni_runtime.h:
947         * bindings/objc/objc_class.mm:
948         (ObjcClass::methodsNamed):
949         * bindings/objc/objc_runtime.h:
950         (KJS::Bindings::ObjcArray::getObjcArray):
951         * bindings/objc/objc_runtime.mm:
952         (ObjcField::valueFromInstance):
953         (ObjcField::setValueToInstance):
954         (ObjcArray::ObjcArray):
955         (ObjcArray::~ObjcArray):
956         (ObjcArray::operator=):
957         (ObjcArray::setValueAt):
958         (ObjcArray::valueAt):
959         (ObjcArray::getLength):
960         * bindings/objc/objc_utility.mm:
961         (KJS::Bindings::convertValueToObjcValue):
962         (KJS::Bindings::convertObjcValueToValue):
963         * bindings/runtime.cpp:
964         (Instance::getValueOfField):
965         * bindings/runtime.h:
966         * bindings/runtime_array.cpp:
967         (RuntimeArrayImp::get):
968         * bindings/runtime_object.cpp:
969         (RuntimeObjectImp::get):
970
971 2004-02-17  Richard Williamson   <rjw@apple.com>
972
973         Added String <-> NSString conversion.
974         Added tests of String <-> NSString conversion to test program.
975
976         Reviewed by Chris.
977
978         * bindings/objc/objc_utility.mm:
979         (KJS::Bindings::convertValueToObjcValue):
980         (KJS::Bindings::convertObjcValueToValue):
981         * bindings/test.js:
982         * bindings/testbindings.mm:
983         (-[MyFirstInterface getString]):
984
985 2004-02-15  Darin Adler  <darin@apple.com>
986
987         Reviewed by Dave.
988
989         * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
990         and removing redundant settings of things that match defaults in other build styles.
991
992 2004-02-13  Richard Williamson   <rjw@apple.com>
993
994         Work towards the JavaScript ObjC bindings.  The bindings now work for 
995         simple scalar types.  testbindings.mm is an illustration of how the 
996         bindings work.
997
998         Reviewed by Ken.
999
1000         * JavaScriptCore.pbproj/project.pbxproj:
1001         * Makefile.am:
1002         * bindings/jni/jni_class.cpp:
1003         (JavaClass::methodsNamed):
1004         * bindings/jni/jni_class.h:
1005         * bindings/jni/jni_instance.cpp:
1006         (JavaInstance::invokeMethod):
1007         * bindings/jni/jni_instance.h:
1008         * bindings/jni/jni_runtime.h:
1009         (KJS::Bindings::JavaMethod::returnType):
1010         * bindings/make_testbindings: Added.
1011         * bindings/objc/objc_class.h: Added.
1012         (KJS::Bindings::ObjcClass::~ObjcClass):
1013         (KJS::Bindings::ObjcClass::ObjcClass):
1014         (KJS::Bindings::ObjcClass::operator=):
1015         (KJS::Bindings::ObjcClass::constructorAt):
1016         (KJS::Bindings::ObjcClass::numConstructors):
1017         * bindings/objc/objc_class.mm: Added.
1018         (ObjcClass::_commonDelete):
1019         (ObjcClass::_commonCopy):
1020         (ObjcClass::_commonInit):
1021         (_createClassesByIsAIfNecessary):
1022         (ObjcClass::classForIsA):
1023         (ObjcClass::ObjcClass):
1024         (ObjcClass::name):
1025         (ObjcClass::methodsNamed):
1026         (ObjcClass::fieldNamed):
1027         * bindings/objc/objc_header.h: Added.
1028         * bindings/objc/objc_instance.h: Added.
1029         (KJS::Bindings::ObjcInstance::getObject):
1030         * bindings/objc/objc_instance.mm: Added.
1031         (ObjcInstance::ObjcInstance):
1032         (ObjcInstance::~ObjcInstance):
1033         (ObjcInstance::operator=):
1034         (ObjcInstance::begin):
1035         (ObjcInstance::end):
1036         (ObjcInstance::getClass):
1037         (ObjcInstance::invokeMethod):
1038         (ObjcInstance::defaultValue):
1039         (ObjcInstance::stringValue):
1040         (ObjcInstance::numberValue):
1041         (ObjcInstance::booleanValue):
1042         (ObjcInstance::valueOf):
1043         * bindings/objc/objc_jsobject.h: Added.
1044         * bindings/objc/objc_jsobject.mm: Added.
1045         * bindings/objc/objc_runtime.h:
1046         (KJS::Bindings::ObjcField::~ObjcField):
1047         (KJS::Bindings::ObjcField::ObjcField):
1048         (KJS::Bindings::ObjcField::operator=):
1049         (KJS::Bindings::ObjcMethod::ObjcMethod):
1050         (KJS::Bindings::ObjcMethod::~ObjcMethod):
1051         (KJS::Bindings::ObjcMethod::operator=):
1052         * bindings/objc/objc_runtime.mm: Added.
1053         (ObjcMethod::ObjcMethod):
1054         (ObjcMethod::name):
1055         (ObjcMethod::numParameters):
1056         (ObjcMethod::getMethodSignature):
1057         (ObjcField::ObjcField):
1058         (ObjcField::name):
1059         (ObjcField::type):
1060         (ObjcField::valueFromInstance):
1061         (ObjcField::setValueToInstance):
1062         * bindings/objc/objc_utility.h: Added.
1063         (KJS::Bindings::):
1064         * bindings/objc/objc_utility.mm: Added.
1065         (KJS::Bindings::JSMethodNameToObjCMethodName):
1066         (KJS::Bindings::convertValueToObjcValue):
1067         (KJS::Bindings::convertObjcValueToValue):
1068         (KJS::Bindings::objcValueTypeForType):
1069         * bindings/runtime.cpp:
1070         (MethodList::MethodList):
1071         (MethodList::operator=):
1072         (Instance::setValueOfField):
1073         (Instance::createBindingForLanguageInstance):
1074         (Instance::createRuntimeObject):
1075         * bindings/runtime.h:
1076         * bindings/runtime_method.cpp:
1077         (RuntimeMethodImp::RuntimeMethodImp):
1078         (RuntimeMethodImp::get):
1079         (RuntimeMethodImp::call):
1080         * bindings/runtime_method.h:
1081         * bindings/runtime_object.cpp:
1082         (RuntimeObjectImp::get):
1083         (RuntimeObjectImp::hasProperty):
1084         * bindings/test.js: Added.
1085         * bindings/testbindings.mm: Added.
1086         (-[MySecondInterface init]):
1087         (-[MyFirstInterface init]):
1088         (-[MyFirstInterface dealloc]):
1089         (+[MyFirstInterface JavaScriptNameForSelector:]):
1090         (-[MyFirstInterface getInt]):
1091         (-[MyFirstInterface setInt:]):
1092         (-[MyFirstInterface getMySecondInterface]):
1093         (-[MyFirstInterface logMessage:]):
1094         (GlobalImp::className):
1095         (readJavaScriptFromFile):
1096         (main):
1097
1098 === Safari-128 ===
1099
1100 2004-02-08  Darin Adler  <darin@apple.com>
1101
1102         Reviewed by Dave.
1103
1104         - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
1105
1106         * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
1107         macros from working right in C++ code that uses the <cctype> header.
1108
1109         * kjs/ustring.cpp:
1110         (KJS::inlineUTF8SequenceLengthNonASCII): Added.
1111         (KJS::UTF8SequenceLengthNonASCII): Added.
1112         (KJS::inlineUTF8SequenceLength): Added.
1113         (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
1114         (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
1115         (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
1116         (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
1117         (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
1118
1119         - fixed the test program so it won't hit the interpreter lock assertion
1120
1121         * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
1122
1123 === Safari-127 ===
1124
1125 2004-02-06  Richard Williamson   <rjw@apple.com>
1126
1127         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.
1128
1129         Reviewed by John.
1130
1131         * bindings/jni/jni_jsobject.cpp:
1132         (JSObject::toString):
1133         * bindings/jni/jni_utility.cpp:
1134         (KJS::Bindings::convertValueToJValue):
1135
1136 2004-02-02  Darin Adler  <darin@apple.com>
1137
1138         Reviewed by Maciej.
1139
1140         - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
1141
1142         * kjs/array_object.cpp:
1143         (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
1144         we start putting values in. This prevents new Array(2147483647) from causing trouble.
1145         (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
1146         number is out of range. This prevents new Array(-1) from causing trouble.
1147
1148         - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
1149
1150         * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
1151         casting to int. Results now match those in other browsers.
1152
1153 2004-02-02  Darin Adler  <darin@apple.com>
1154
1155         Reviewed by Maciej.
1156
1157         - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
1158         - fixed other related overflow issues
1159
1160         * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
1161         * kjs/value.cpp:
1162         (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
1163         must not restrict values to the range of a particular integer type.
1164         (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
1165         proper handling for negative results from fmod.
1166         (ValueImp::toUInt32): Ditto.
1167         (ValueImp::toUInt16): Ditto.
1168         (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
1169
1170         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
1171         out-of-integer-range values better in the slice function.
1172         * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
1173         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
1174         out-of-integer-range values better in the toString function.
1175         * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
1176         out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
1177         and substr functions.
1178
1179 === Safari-126 ===
1180
1181 2004-01-30  Richard Williamson   <rjw@apple.com>
1182
1183         Fixed 3542044.  Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
1184
1185         Reviewed by Darin.
1186
1187         * bindings/jni/jni_instance.cpp:
1188         (JavaInstance::stringValue):
1189
1190 2004-01-26  Darin Adler  <darin@apple.com>
1191
1192         * Makefile.am: Switch from pbxbuild to xcodebuild.
1193
1194 2004-01-22  Richard Williamson   <rjw@apple.com>
1195
1196         Added stubs for ObjC language binding to JavaScript.
1197
1198         * JavaScriptCore.pbproj/project.pbxproj:
1199         * bindings/jni/jni_runtime.h:
1200         * bindings/objc/objc_runtime.h: Added.
1201         (KJS::Bindings::ObjcParameter::ObjcParameter):
1202         (KJS::Bindings::ObjcParameter::~ObjcParameter):
1203         (KJS::Bindings::ObjcParameter::operator=):
1204         (KJS::Bindings::ObjcParameter::type):
1205         (KJS::Bindings::ObjcConstructor::ObjcConstructor):
1206         (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
1207         (KJS::Bindings::ObjcConstructor::_commonCopy):
1208         (KJS::Bindings::ObjcConstructor::operator=):
1209         (KJS::Bindings::ObjcConstructor::value):
1210         (KJS::Bindings::ObjcConstructor::parameterAt):
1211         (KJS::Bindings::ObjcConstructor::numParameters):
1212         (KJS::Bindings::ObjcField::ObjcField):
1213         (KJS::Bindings::ObjcField::~ObjcField):
1214         * bindings/runtime.h:
1215
1216 2004-01-22  Richard Williamson   <rjw@apple.com>
1217
1218         Simplified JavaString by using UString as backing store.  This
1219         revealed a bug in CString's assignment operator which I fixed.
1220
1221         Removed some dead code.
1222  
1223         Reviewed by John.
1224
1225         * bindings/jni/jni_runtime.h:
1226         (KJS::Bindings::JavaString::JavaString):
1227         (KJS::Bindings::JavaString::_commonInit):
1228         (KJS::Bindings::JavaString::UTF8String):
1229         (KJS::Bindings::JavaString::uchars):
1230         (KJS::Bindings::JavaString::length):
1231         (KJS::Bindings::JavaString::ustring):
1232         * bindings/runtime_object.cpp:
1233         (RuntimeObjectImp::RuntimeObjectImp):
1234         * bindings/runtime_object.h:
1235         * kjs/ustring.cpp:
1236         (KJS::CString::CString):
1237         (KJS::CString::operator=):
1238
1239 === Safari-125 ===
1240
1241 === Safari-124 ===
1242
1243 2004-01-16  Richard Williamson   <rjw@apple.com>
1244
1245         Fixed 3525853.  We weren't handling mapping to overloaded Java
1246         methods very well.  Even though this is undefined the other
1247         browsers support it.  Also fixed a bug with returning arrays
1248         from Java functions.
1249
1250         Reviewed by John.
1251
1252         * bindings/jni/jni_class.cpp:
1253         (JavaClass::_commonInit):
1254         (JavaClass::methodsNamed):
1255         * bindings/jni/jni_class.h:
1256         * bindings/jni/jni_instance.cpp:
1257         (JavaInstance::invokeMethod):
1258         * bindings/jni/jni_instance.h:
1259         * bindings/jni/jni_runtime.cpp:
1260         (JavaArray::convertJObjectToArray):
1261         (JavaField::valueFromInstance):
1262         (JavaMethod::signature):
1263         (JavaArray::valueAt):
1264         * bindings/jni/jni_runtime.h:
1265         * bindings/jni_jsobject.cpp:
1266         (JSObject::call):
1267         (JSObject::convertJObjectToValue):
1268         * bindings/runtime.cpp:
1269         (MethodList::addMethod):
1270         (MethodList::length):
1271         (MethodList::methodAt):
1272         (MethodList::~MethodList):
1273         * bindings/runtime.h:
1274         (KJS::Bindings::MethodList::MethodList):
1275         * bindings/runtime_method.cpp:
1276         (RuntimeMethodImp::RuntimeMethodImp):
1277         (RuntimeMethodImp::get):
1278         (RuntimeMethodImp::call):
1279         * bindings/runtime_method.h:
1280         * bindings/runtime_object.cpp:
1281         (RuntimeObjectImp::get):
1282         (RuntimeObjectImp::hasProperty):
1283
1284 2004-01-16  Richard Williamson   <rjw@apple.com>
1285
1286         Fixed 3531229.  Another place that needs the  Push/PopLocalFrame
1287         protection implemented for 3530401.
1288
1289         Reviewed by John.
1290
1291         * bindings/runtime_method.cpp:
1292         (RuntimeMethodImp::call):
1293
1294 2004-01-15  Richard Williamson   <rjw@apple.com>
1295
1296         Fixed 3530401.  JNI doesn't cleanup local refs created on the
1297         main thread.   IMO this is a bad bug in our JMI implementation.
1298
1299         To work-around the problem I explicitly delete all local refs.
1300         Further, I've added Push/PopLocalFrame calls to catch any refs
1301         that I may have missed.  This will guarantee that we don't leak
1302         any Java references.
1303
1304         Reviewed by John.
1305
1306         * bindings/jni/jni_class.cpp:
1307         (JavaClass::_commonInit):
1308         (JavaClass::JavaClass):
1309         * bindings/jni/jni_instance.cpp:
1310         (JavaInstance::begin):
1311         (JavaInstance::end):
1312         * bindings/jni/jni_instance.h:
1313         * bindings/jni/jni_runtime.cpp:
1314         (JavaConstructor::JavaConstructor):
1315         (JavaMethod::JavaMethod):
1316         * bindings/jni_jsobject.cpp:
1317         (JSObject::listFromJArray):
1318         * bindings/runtime.h:
1319         (KJS::Bindings::Instance::begin):
1320         (KJS::Bindings::Instance::end):
1321         * bindings/runtime_object.cpp:
1322         (RuntimeObjectImp::get):
1323         (RuntimeObjectImp::put):
1324         (RuntimeObjectImp::canPut):
1325         (RuntimeObjectImp::hasProperty):
1326         (RuntimeObjectImp::defaultValue):
1327
1328 2004-01-15  Vicki Murley  <vicki@apple.com>
1329
1330         Reviewed by Darin.
1331
1332         * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
1333
1334 2004-01-14  Richard Williamson   <rjw@apple.com>
1335         
1336         Fixed 3529466.  With recent changes to Java plugin we must no
1337         longer call DeleteLocalRef().  Not a problem, it was an optimization anyway.
1338
1339         Reviewed by John.
1340
1341         * bindings/jni/jni_instance.cpp:
1342         (JObjectWrapper::JObjectWrapper):
1343
1344 === Safari-122 ===
1345
1346 2004-01-14  Richard Williamson   <rjw@apple.com>
1347
1348         Fixed 3529010.
1349
1350         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.
1351
1352         Reviewed by John.
1353
1354         * bindings/jni_jsobject.cpp:
1355         (addJavaReference):
1356         (removeJavaReference):
1357         (RootObject::removeAllJavaReferencesForRoot):
1358         (JSObject::invoke):
1359
1360 2004-01-13  Richard Williamson   <rjw@apple.com>
1361
1362         Fixed 3528324. 
1363
1364         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.
1365
1366         Reviewed by Hyatt.
1367
1368         * bindings/jni_jsobject.h:
1369         (KJS::Bindings::RootObject::~RootObject):
1370
1371 === Safari-121 ===
1372
1373 === Safari-120 ===
1374
1375 2004-01-06  Richard Williamson   <rjw@apple.com>
1376
1377         Fixed 3521814.  Finalize messages weren't being dispatched!
1378
1379         Reviewed by John.
1380
1381         * bindings/jni_jsobject.cpp:
1382         (JSObject::invoke):
1383
1384 2004-01-05  Richard Williamson   <rjw@apple.com>
1385
1386         Added cache of JNI method IDs to minimize allocations.  This mitigates the problem
1387         described by 3515579.
1388
1389         Also cleanup up logging of Java exceptions.
1390
1391         Reviewed by John.
1392
1393         * bindings/jni/jni_class.cpp:
1394         (JavaClass::classForInstance):
1395         * bindings/jni/jni_instance.cpp:
1396         (JavaInstance::JavaInstance):
1397         (JavaInstance::getClass):
1398         (JavaInstance::invokeMethod):
1399         (JObjectWrapper::JObjectWrapper):
1400         (JObjectWrapper::~JObjectWrapper):
1401         * bindings/jni/jni_instance.h:
1402         (KJS::Bindings::JavaInstance::operator=):
1403         * bindings/jni/jni_runtime.cpp:
1404         (JavaMethod::JavaMethod):
1405         (JavaMethod::methodID):
1406         * bindings/jni/jni_runtime.h:
1407         (KJS::Bindings::JavaMethod::JavaMethod):
1408         * bindings/jni/jni_utility.cpp:
1409         (callJNIMethod):
1410         (callJNIMethodIDA):
1411         (callJNIMethodA):
1412         (KJS::Bindings::getMethodID):
1413         (KJS::Bindings::callJNIVoidMethodIDA):
1414         (KJS::Bindings::callJNIObjectMethodIDA):
1415         (KJS::Bindings::callJNIByteMethodIDA):
1416         (KJS::Bindings::callJNICharMethodIDA):
1417         (KJS::Bindings::callJNIShortMethodIDA):
1418         (KJS::Bindings::callJNIIntMethodIDA):
1419         (KJS::Bindings::callJNILongMethodIDA):
1420         (KJS::Bindings::callJNIFloatMethodIDA):
1421         (KJS::Bindings::callJNIDoubleMethodIDA):
1422         (KJS::Bindings::callJNIBooleanMethodIDA):
1423         (KJS::Bindings::getCharactersFromJStringInEnv):
1424         (KJS::Bindings::getUCharactersFromJStringInEnv):
1425         (KJS::Bindings::getJNIField):
1426         * bindings/jni/jni_utility.h:
1427
1428 l2003-12-23  John Sullivan  <sullivan@apple.com>
1429
1430         * JavaScriptCore.pbproj/project.pbxproj:
1431         Xcode version wars, harmless
1432
1433 2003-12-23  Darin Adler  <darin@apple.com>
1434
1435         Reviewed by John (concept, not code, which is just the old code coming back).
1436
1437         - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
1438
1439         * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
1440         mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
1441
1442 2003-12-19  Richard Williamson   <rjw@apple.com>
1443
1444         Fixed 3515597.  When an error occurs we need
1445         to make sure result values are zeroed.
1446
1447         Cleaned up logs by adding a newline.
1448
1449         Reviewed by John.
1450
1451         * bindings/jni/jni_utility.cpp:
1452         (KJS::Bindings::getJavaVM):
1453         (KJS::Bindings::getJNIEnv):
1454         (callJNIMethod):
1455         (callJNIMethodA):
1456         (KJS::Bindings::getJNIField):
1457         * bindings/jni_jsobject.cpp:
1458         (JSObject::convertValueToJObject):
1459
1460 === Safari-119 ===
1461
1462 2003-12-17  Richard Williamson   <rjw@apple.com>
1463
1464         Ensure that all the symbols we export are in the KJS
1465         namespace (3512245).
1466
1467         Also renamed JavaString.characters() to JavaString.UTF8String()
1468         for enhanced clarity.
1469
1470         Added some sanity checking to constructor of JObjectWrapper.
1471
1472         Reviewed by Dave.
1473
1474         * ChangeLog:
1475         * bindings/jni/jni_class.cpp:
1476         * bindings/jni/jni_class.h:
1477         * bindings/jni/jni_instance.cpp:
1478         (JavaInstance::invokeMethod):
1479         (JObjectWrapper::JObjectWrapper):
1480         * bindings/jni/jni_instance.h:
1481         * bindings/jni/jni_runtime.cpp:
1482         (JavaParameter::JavaParameter):
1483         (JavaField::JavaField):
1484         (JavaMethod::JavaMethod):
1485         (JavaMethod::signature):
1486         * bindings/jni/jni_runtime.h:
1487         (KJS::Bindings::JavaString::ascii):
1488         (KJS::Bindings::JavaString::UTF8String):
1489         (KJS::Bindings::JavaString::JavaString):
1490         (KJS::Bindings::JavaString::_commonInit):
1491         (KJS::Bindings::JavaString::uchars):
1492         (KJS::Bindings::JavaString::length):
1493         (KJS::Bindings::JavaString::ustring):
1494         (KJS::Bindings::JavaParameter::type):
1495         (KJS::Bindings::JavaField::name):
1496         (KJS::Bindings::JavaField::type):
1497         (KJS::Bindings::JavaMethod::name):
1498         (KJS::Bindings::JavaMethod::returnType):
1499         * bindings/jni/jni_utility.cpp:
1500         (KJS::Bindings::getJavaVM):
1501         (KJS::Bindings::getJNIEnv):
1502         (KJS::Bindings::callJNIVoidMethod):
1503         (KJS::Bindings::callJNIObjectMethod):
1504         (KJS::Bindings::callJNIBooleanMethod):
1505         (KJS::Bindings::callJNIByteMethod):
1506         (KJS::Bindings::callJNICharMethod):
1507         (KJS::Bindings::callJNIShortMethod):
1508         (KJS::Bindings::callJNIIntMethod):
1509         (KJS::Bindings::callJNILongMethod):
1510         (KJS::Bindings::callJNIFloatMethod):
1511         (KJS::Bindings::callJNIDoubleMethod):
1512         (KJS::Bindings::callJNIVoidMethodA):
1513         (KJS::Bindings::callJNIObjectMethodA):
1514         (KJS::Bindings::callJNIByteMethodA):
1515         (KJS::Bindings::callJNICharMethodA):
1516         (KJS::Bindings::callJNIShortMethodA):
1517         (KJS::Bindings::callJNIIntMethodA):
1518         (KJS::Bindings::callJNILongMethodA):
1519         (KJS::Bindings::callJNIFloatMethodA):
1520         (KJS::Bindings::callJNIDoubleMethodA):
1521         (KJS::Bindings::callJNIBooleanMethodA):
1522         (KJS::Bindings::getCharactersFromJString):
1523         (KJS::Bindings::releaseCharactersForJString):
1524         (KJS::Bindings::getCharactersFromJStringInEnv):
1525         (KJS::Bindings::releaseCharactersForJStringInEnv):
1526         (KJS::Bindings::getUCharactersFromJStringInEnv):
1527         (KJS::Bindings::releaseUCharactersForJStringInEnv):
1528         (KJS::Bindings::JNITypeFromClassName):
1529         (KJS::Bindings::signatureFromPrimitiveType):
1530         (KJS::Bindings::JNITypeFromPrimitiveType):
1531         (KJS::Bindings::getJNIField):
1532         (KJS::Bindings::convertValueToJValue):
1533         * bindings/jni/jni_utility.h:
1534         * bindings/jni_jsobject.cpp:
1535         (KJS::Bindings::JSObject::invoke):
1536         (KJS::Bindings::JSObject::JSObject):
1537         (KJS::Bindings::JSObject::call):
1538         (KJS::Bindings::JSObject::eval):
1539         (KJS::Bindings::JSObject::getMember):
1540         (KJS::Bindings::JSObject::setMember):
1541         (KJS::Bindings::JSObject::removeMember):
1542         (KJS::Bindings::JSObject::getSlot):
1543         (KJS::Bindings::JSObject::setSlot):
1544         (KJS::Bindings::JSObject::toString):
1545         (KJS::Bindings::JSObject::finalize):
1546         (KJS::Bindings::JSObject::createNative):
1547         (KJS::Bindings::JSObject::convertValueToJObject):
1548         (KJS::Bindings::JSObject::convertJObjectToValue):
1549         (KJS::Bindings::JSObject::listFromJArray):
1550         * bindings/jni_jsobject.h:
1551         * bindings/runtime.cpp:
1552         * bindings/runtime.h:
1553         * bindings/runtime_method.cpp:
1554         * bindings/runtime_method.h:
1555
1556 === Safari-118 ===
1557
1558 2003-12-16  Richard Williamson   <rjw@apple.com>
1559
1560         Ack!  More assertions.  Lock ALL entry points into the interpreter!
1561         (3511733).
1562
1563         Reviewed by Ken.
1564
1565         * bindings/jni_jsobject.cpp:
1566         (Bindings::JSObject::call):
1567         (Bindings::JSObject::eval):
1568         (Bindings::JSObject::getMember):
1569         (Bindings::JSObject::setMember):
1570         (Bindings::JSObject::removeMember):
1571         (Bindings::JSObject::getSlot):
1572         (Bindings::JSObject::setSlot):
1573         (Bindings::JSObject::convertJObjectToValue):
1574
1575 2003-12-15  Richard Williamson   <rjw@apple.com>
1576
1577         Fixed a couple of snafus and removed some logging.
1578
1579         Reviewed by Maciej.
1580
1581         * bindings/jni_jsobject.cpp:
1582         (Bindings::performJavaScriptAccess):
1583         (Bindings::completedJavaScriptAccess):
1584         (Bindings::dispatchToJavaScriptThread):
1585         Removed some annoying JS_LOG clutter.
1586
1587         (Bindings::RootObject::removeAllJavaReferencesForRoot):
1588         Fixed allocation of key buffer that was called after it was needed.
1589
1590         (Bindings::JSObject::invoke):
1591         (Bindings::JSObject::JSObject):
1592         (Bindings::JSObject::getMember):
1593         (Bindings::JSObject::getSlot):
1594         Added additional interpreter locks around getMember and getSlot. 
1595         These functions may cause allocation of JS impls.  
1596
1597 2003-12-15  Richard Williamson   <rjw@apple.com>
1598
1599         args weren't passed to 'call' invocation.  d'oh.
1600         lock interpreter when we create instances of JS impls.  
1601
1602         Reviewed by Maciej.
1603
1604         * bindings/jni_jsobject.cpp:
1605         (Bindings::JSObject::call):
1606         (Bindings::JSObject::eval):
1607         (Bindings::JSObject::getMember):
1608         (Bindings::JSObject::setMember):
1609         (Bindings::JSObject::getSlot):
1610         (Bindings::JSObject::convertValueToJObject):
1611         (Bindings::JSObject::convertJObjectToValue):
1612         (Bindings::JSObject::listFromJArray):
1613         * bindings/jni_jsobject.h:
1614
1615 2003-12-15  Richard Williamson   <rjw@apple.com>
1616
1617         Last piece of LiveConnect!  This checkin adds implementation
1618         of the Java to JavaScript object conversion functions.
1619
1620         Reviewed by John.
1621
1622         * bindings/jni/jni_instance.cpp:
1623         (JavaInstance::invokeMethod):
1624         * bindings/jni/jni_utility.cpp:
1625         * bindings/jni/jni_utility.h:
1626         * bindings/jni_jsobject.cpp:
1627         (Bindings::JSObject::invoke):
1628         (Bindings::JSObject::call):
1629         (Bindings::JSObject::eval):
1630         (Bindings::JSObject::getMember):
1631         (Bindings::JSObject::setMember):
1632         (Bindings::JSObject::getSlot):
1633         (Bindings::JSObject::setSlot):
1634         (Bindings::JSObject::createNative):
1635         (Bindings::JSObject::convertValueToJObject):
1636         (Bindings::JSObject::convertJObjectToValue):
1637         (Bindings::JSObject::listFromJArray):
1638         * bindings/jni_jsobject.h:
1639         (Bindings::):
1640         * bindings/runtime_method.cpp:
1641         (RuntimeMethodImp::get):
1642         (RuntimeMethodImp::codeType):
1643         (RuntimeMethodImp::execute):
1644
1645 2003-12-12  Richard Williamson   <rjw@apple.com>
1646
1647         Added implementation of stubs in JSObject.  All that
1648         remains is a couple of simple conversion functions stubs and
1649         we're done with LiveConnect.  Also, changed string passing to
1650         JS to use uchars instead of chars.  
1651
1652         Reviewed by Maciej.
1653
1654         * bindings/jni/jni_runtime.h:
1655         (Bindings::JavaString::JavaString):
1656         (Bindings::JavaString::_commonInit):
1657         (Bindings::JavaString::_commonCopy):
1658         (Bindings::JavaString::_commonDelete):
1659         (Bindings::JavaString::~JavaString):
1660         (Bindings::JavaString::operator=):
1661         (Bindings::JavaString::uchars):
1662         (Bindings::JavaString::length):
1663         (Bindings::JavaString::ustring):
1664         * bindings/jni/jni_utility.cpp:
1665         (getUCharactersFromJStringInEnv):
1666         (releaseUCharactersForJStringInEnv):
1667         (convertValueToJObject):
1668         (convertJObjectToValue):
1669         * bindings/jni/jni_utility.h:
1670         * bindings/jni_jsobject.cpp:
1671         (Bindings::JSObject::invoke):
1672         (Bindings::JSObject::call):
1673         (Bindings::JSObject::eval):
1674         (Bindings::JSObject::getMember):
1675         (Bindings::JSObject::setMember):
1676         (Bindings::JSObject::removeMember):
1677         (Bindings::JSObject::getSlot):
1678         (Bindings::JSObject::setSlot):
1679         * bindings/jni_jsobject.h:
1680
1681 2003-12-12  Richard Williamson   <rjw@apple.com>
1682
1683         Ensure that all calls from Java into JavaScript are
1684         performed on a designated thread (the main thread).
1685
1686         Reviewed by Ken.
1687
1688         * bindings/jni_jsobject.cpp:
1689         (isJavaScriptThread):
1690         (rootForImp):
1691         (Bindings::performJavaScriptAccess):
1692         (Bindings::completedJavaScriptAccess):
1693         (Bindings::initializeJavaScriptAccessLock):
1694         (Bindings::lockJavaScriptAccess):
1695         (Bindings::unlockJavaScriptAccess):
1696         (Bindings::dispatchToJavaScriptThread):
1697         (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
1698         (Bindings::RootObject::removeAllJavaReferencesForRoot):
1699         (Bindings::JSObject::invoke):
1700         (Bindings::JSObject::JSObject):
1701         (Bindings::JSObject::call):
1702         (Bindings::JSObject::eval):
1703         (Bindings::JSObject::getMember):
1704         (Bindings::JSObject::setMember):
1705         (Bindings::JSObject::removeMember):
1706         (Bindings::JSObject::getSlot):
1707         (Bindings::JSObject::setSlot):
1708         (Bindings::JSObject::toString):
1709         (Bindings::JSObject::finalize):
1710         (Bindings::JSObject::getWindow):
1711         * bindings/jni_jsobject.h:
1712         (Bindings::RootObject::~RootObject):
1713         (Bindings::RootObject::findRootObjectForNativeHandleFunction):
1714         (Bindings::RootObject::runLoop):
1715         (Bindings::RootObject::performJavaScriptSource):
1716         (Bindings::):
1717
1718 2003-12-11  Richard Williamson   <rjw@apple.com>
1719
1720         Added support for calling a JavaScript function from
1721         Java.  Right now this only works for void func(void)
1722         functions, but the conversion of args and return values
1723         will come shortly.
1724
1725         Cleaned up and verified reference counting scheme, and
1726         dereferencing of vended JavaScript objects when applet is
1727         destroyed (actually when part is destroyed).
1728         
1729         Removed link hack for testkjs now that the Java folks think
1730         they have a solution for the 1.4.2 JavaVM link problem.  Although
1731         Greg B. thinks his solution may cause problems for the 1.3.1
1732         version of the VM!?!
1733
1734         Reviewed by Ken.
1735
1736         * Makefile.am:
1737         * bindings/jni/jni_runtime.h:
1738         (Bindings::JavaString::JavaString):
1739         * bindings/jni/jni_utility.cpp:
1740         (convertValueToJValue):
1741         (convertValueToJObject):
1742         (listFromJArray):
1743         * bindings/jni/jni_utility.h:
1744         * bindings/jni_jsobject.cpp:
1745         (KJS_setFindRootObjectForNativeHandleFunction):
1746         (KJS_findRootObjectForNativeHandleFunction):
1747         (getReferencesByRootDictionary):
1748         (getReferencesDictionary):
1749         (findReferenceDictionary):
1750         (rootForImp):
1751         (addJavaReference):
1752         (removeJavaReference):
1753         * bindings/jni_jsobject.h:
1754         (Bindings::RootObject::RootObject):
1755         (Bindings::RootObject::~RootObject):
1756         (Bindings::RootObject::setRootObjectImp):
1757         (Bindings::RootObject::rootObjectImp):
1758         (Bindings::RootObject::setInterpreter):
1759         (Bindings::RootObject::interpreter):
1760
1761 === Safari-117 ===
1762
1763 2003-12-10  Darin Adler  <darin@apple.com>
1764
1765         Reviewed by Maciej.
1766
1767         - fixed regression in JavaScript tests reported by the KDE guys
1768         - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
1769
1770         * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
1771         * kjs/ustring.cpp:
1772         (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
1773         tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
1774         and binary compatibility than default parameter values.
1775         (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
1776
1777         * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
1778         "tolerate empty string" parameter.
1779
1780 2003-12-10  Richard Williamson   <rjw@apple.com>
1781
1782         Added code to manage reference counting of JavaScript
1783         objects passed to Java.   Also added implementation of
1784         KJS_JSCreateNativeJSObject.  This is the function that
1785         provides the root object to Java (KJS::Window).
1786
1787         Reviewed by Hyatt.
1788
1789         * JavaScriptCore.pbproj/project.pbxproj:
1790         * bindings/jni_jsobject.cpp:
1791         (KJS_setFindObjectForNativeHandleFunction):
1792         (KJS_findObjectForNativeHandleFunction):
1793         (getReferencesByOwnerDictionary):
1794         (getReferencesDictionary):
1795         (findReferenceDictionary):
1796         (addJavaReference):
1797         (removeJavaReference):
1798         (removeAllJavaReferencesForOwner):
1799         * bindings/jni_jsobject.h:
1800
1801 2003-12-09  Richard Williamson   <rjw@apple.com>
1802
1803         LiveConnect stubs that correspond to the native methods
1804         on JSObject.  These will be called from the new Java plugin
1805         when an instance of JSObject is instantiated and messaged.
1806         When these are implemented the Java will be able to originate
1807         calls into JavaScript.
1808
1809         Also a temporary work-around added to Makefile.am to solve
1810         a link problem.  The 1.4.2 JavaVM accidentally links against
1811         libobjc.  This call a failure linking testkjs.  Mike Hay is
1812         working with someone to fix the problem (3505587).
1813
1814         Reviewed by Chris.
1815
1816         * JavaScriptCore.pbproj/project.pbxproj:
1817         * Makefile.am:
1818         * bindings/jni_jsobject.cpp: Added.
1819         (KJS_JSCreateNativeJSObject):
1820         (KJS_JSObject_JSFinalize):
1821         (KJS_JSObject_JSObjectCall):
1822         (KJS_JSObject_JSObjectEval):
1823         (KJS_JSObject_JSObjectGetMember):
1824         (KJS_JSObject_JSObjectSetMember):
1825         (KJS_JSObject_JSObjectRemoveMember):
1826         (KJS_JSObject_JSObjectGetSlot):
1827         (KJS_JSObject_JSObjectSetSlot):
1828         (KJS_JSObject_JSObjectToString):
1829         * bindings/jni_jsobject.h: Added.
1830
1831 2003-12-09  Maciej Stachowiak  <mjs@apple.com>
1832
1833         Reviewed by John.
1834
1835         <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
1836
1837         * kjs/collector.cpp:
1838         (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
1839         (KJS::Collector::collect): likewise
1840
1841 2003-12-08  Richard Williamson   <rjw@apple.com>
1842
1843         LiveConnect:  The last piece of the JavaScript side of the
1844         LiveConnect implementation.  This change adds support for
1845         setting/getting values from Java arrays in JavaScript.
1846
1847         Reviewed by John.
1848
1849         * bindings/jni/jni_instance.h:
1850         * bindings/jni/jni_runtime.cpp:
1851         (JavaField::JavaField):
1852         (convertJObjectToArray):
1853         (JavaArray::JavaArray):
1854         (JavaArray::~JavaArray):
1855         (JavaArray::setValueAt):
1856         (JavaArray::valueAt):
1857         (JavaArray::getLength):
1858         * bindings/jni/jni_runtime.h:
1859         (Bindings::JavaArray::operator=):
1860         (Bindings::JavaArray::javaArray):
1861         * bindings/jni/jni_utility.cpp:
1862         (JNITypeFromPrimitiveType):
1863         (convertValueToJValue):
1864         * bindings/jni/jni_utility.h:
1865         * bindings/runtime.h:
1866         * bindings/runtime_array.cpp:
1867         (RuntimeArrayImp::RuntimeArrayImp):
1868         (RuntimeArrayImp::~RuntimeArrayImp):
1869         (RuntimeArrayImp::get):
1870         (RuntimeArrayImp::put):
1871         (RuntimeArrayImp::hasProperty):
1872         * bindings/runtime_array.h:
1873         (KJS::RuntimeArrayImp::getLength):
1874         (KJS::RuntimeArrayImp::getConcreteArray):
1875         * bindings/runtime_object.cpp:
1876         (RuntimeObjectImp::get):
1877         (RuntimeObjectImp::canPut):
1878         (RuntimeObjectImp::hasProperty):
1879
1880 2003-12-05  Richard Williamson   <rjw@apple.com>
1881
1882         LiveConnect:  Part 1 of supporting JS bindings to
1883         native language arrays.
1884
1885         Reviewed by Chris.
1886
1887         * JavaScriptCore.pbproj/project.pbxproj:
1888         * bindings/jni/jni_runtime.cpp:
1889         (JavaField::JavaField):
1890         (convertJObjectToArray):
1891         (JavaField::valueFromInstance):
1892         (JavaField::setValueToInstance):
1893         * bindings/jni/jni_runtime.h:
1894         * bindings/runtime.cpp:
1895         (Instance::setValueOfField):
1896         * bindings/runtime.h:
1897         (Bindings::Array::~Array):
1898
1899 2003-12-04  Richard Williamson   <rjw@apple.com>
1900
1901         LiveConnect:  Moved defaultValue into concrete implementation because
1902         more intelligent conversion can be perform with knowledge
1903         of the class of the original instance.
1904
1905         Reviewed by Chris.
1906
1907         * bindings/jni/jni_class.cpp:
1908         (JavaClass::isNumberClass):
1909         (JavaClass::isBooleanClass):
1910         (JavaClass::isStringClass):
1911         * bindings/jni/jni_class.h:
1912         * bindings/jni/jni_instance.cpp:
1913         (JavaInstance::defaultValue):
1914         (JavaInstance::valueOf):
1915         * bindings/jni/jni_instance.h:
1916         (Bindings::JavaInstance::javaInstance):
1917         * bindings/runtime.h:
1918         * bindings/runtime_object.cpp:
1919         (RuntimeObjectImp::defaultValue):
1920
1921 2003-12-04  Richard Williamson   <rjw@apple.com>
1922
1923         LiveConnect:  Added support for setting the value of Java
1924         fields.
1925
1926         Reviewed by Chris.
1927
1928         * bindings/jni/jni_instance.cpp:
1929         (JavaInstance::invokeMethod):
1930         * bindings/jni/jni_runtime.cpp:
1931         (JavaParameter::JavaParameter):
1932         (JavaField::JavaField):
1933         (JavaField::valueFromInstance):
1934         (JavaField::setValueToInstance):
1935         (JavaMethod::JavaMethod):
1936         * bindings/jni/jni_runtime.h:
1937         (Bindings::JavaField::getJNIType):
1938         * bindings/jni/jni_utility.cpp:
1939         (JNITypeFromClassName):
1940         (convertValueToJValue):
1941         * bindings/jni/jni_utility.h:
1942         * bindings/runtime.cpp:
1943         (Instance::setValueOfField):
1944         * bindings/runtime.h:
1945         * bindings/runtime_object.cpp:
1946         (RuntimeObjectImp::get):
1947         (RuntimeObjectImp::put):
1948         (RuntimeObjectImp::defaultValue):
1949
1950 2003-12-04  Richard Williamson   <rjw@apple.com>
1951
1952         Added support for string conversions.
1953         Changed various JavaString member variables to be inline.
1954         Implemented defaultValue for context relevant type coercion.
1955
1956         Reviewed by Chris.
1957
1958         * bindings/jni/jni_class.cpp:
1959         (JavaClass::JavaClass):
1960         (JavaClass::setClassName):
1961         (JavaClass::classForInstance):
1962         * bindings/jni/jni_class.h:
1963         * bindings/jni/jni_instance.cpp:
1964         (JavaInstance::stringValue):
1965         (JavaInstance::numberValue):
1966         (JavaInstance::booleanValue):
1967         (JavaInstance::invokeMethod):
1968         * bindings/jni/jni_instance.h:
1969         * bindings/jni/jni_runtime.cpp:
1970         (JavaParameter::JavaParameter):
1971         (JavaField::JavaField):
1972         (JavaMethod::JavaMethod):
1973         (appendClassName):
1974         (JavaMethod::signature):
1975         * bindings/jni/jni_runtime.h:
1976         (Bindings::JavaString::JavaString):
1977         (Bindings::JavaString::~JavaString):
1978         (Bindings::JavaString::operator=):
1979         (Bindings::JavaString::characters):
1980         (Bindings::JavaParameter::JavaParameter):
1981         (Bindings::JavaParameter::~JavaParameter):
1982         (Bindings::JavaParameter::operator=):
1983         (Bindings::JavaParameter::type):
1984         (Bindings::JavaField::JavaField):
1985         (Bindings::JavaField::~JavaField):
1986         (Bindings::JavaField::operator=):
1987         (Bindings::JavaField::name):
1988         (Bindings::JavaField::type):
1989         (Bindings::JavaMethod::JavaMethod):
1990         (Bindings::JavaMethod::_commonDelete):
1991         (Bindings::JavaMethod::name):
1992         (Bindings::JavaMethod::returnType):
1993         * bindings/jni/jni_utility.cpp:
1994         (convertValueToJValue):
1995         * bindings/runtime.h:
1996         (Bindings::Instance::valueOf):
1997         * bindings/runtime_method.cpp:
1998         (RuntimeMethodImp::call):
1999         * bindings/runtime_object.cpp:
2000         (RuntimeObjectImp::RuntimeObjectImp):
2001         (RuntimeObjectImp::get):
2002         (RuntimeObjectImp::defaultValue):
2003         * bindings/runtime_object.h:
2004         (KJS::RuntimeObjectImp::classInfo):
2005
2006 === Safari-116 ===
2007
2008 2003-12-03  Richard Williamson   <rjw@apple.com>
2009
2010         LiveConnect:  Added support for parameter passing to Java and conversion
2011         of return values.
2012
2013         Reviewed by Chris.
2014
2015         * bindings/jni/jni_instance.cpp:
2016         (JavaInstance::invokeMethod):
2017         * bindings/jni/jni_instance.h:
2018         * bindings/jni/jni_runtime.cpp:
2019         (JavaParameter::JavaParameter):
2020         (JavaMethod::JavaMethod):
2021         (JavaMethod::signature):
2022         * bindings/jni/jni_runtime.h:
2023         (Bindings::JavaParameter::JavaParameter):
2024         (Bindings::JavaParameter::operator=):
2025         (Bindings::JavaParameter::getJNIType):
2026         * bindings/jni/jni_utility.cpp:
2027         (callJNIBooleanMethodA):
2028         (convertValueToJValue):
2029         * bindings/jni/jni_utility.h:
2030         * bindings/runtime.h:
2031         * bindings/runtime_method.cpp:
2032         (RuntimeMethodImp::call):
2033         * bindings/runtime_object.cpp:
2034         (RuntimeObjectImp::get):
2035
2036 2003-12-02  Richard Williamson   <rjw@apple.com>
2037
2038         Added support for calling simple methods in Java from JavaScript.
2039         (void return and no parameters).  Yay, LiveConnect lives.
2040
2041         Still need write argument and return value conversion code.
2042
2043         Reviewed by Chris.
2044
2045         * JavaScriptCore.pbproj/project.pbxproj:
2046         * bindings/jni/jni_instance.cpp:
2047         (JavaInstance::getClass):
2048         (JavaInstance::invokeMethod):
2049         * bindings/jni/jni_instance.h:
2050         * bindings/jni/jni_runtime.cpp:
2051         (JavaMethod::JavaMethod):
2052         (JavaMethod::signature):
2053         (JavaMethod::JNIReturnType):
2054         * bindings/jni/jni_runtime.h:
2055         (Bindings::JavaMethod::_commonDelete):
2056         (Bindings::JavaMethod::_commonCopy):
2057         (Bindings::JavaMethod::name):
2058         * bindings/jni/jni_utility.cpp:
2059         (signatureFromPrimitiveType):
2060         * bindings/jni/jni_utility.h:
2061         * bindings/runtime.h:
2062         * bindings/runtime_method.cpp: Added.
2063         (RuntimeMethodImp::RuntimeMethodImp):
2064         (RuntimeMethodImp::~RuntimeMethodImp):
2065         (RuntimeMethodImp::get):
2066         (RuntimeMethodImp::implementsCall):
2067         (RuntimeMethodImp::call):
2068         (RuntimeMethodImp::codeType):
2069         (RuntimeMethodImp::execute):
2070         * bindings/runtime_method.h: Added.
2071         * bindings/runtime_object.cpp:
2072         (RuntimeObjectImp::RuntimeObjectImp):
2073         (RuntimeObjectImp::get):
2074         * bindings/runtime_object.h:
2075         * kjs/function.cpp:
2076         (FunctionImp::FunctionImp):
2077         * kjs/interpreter.h:
2078
2079 2003-12-01  Darin Adler  <darin@apple.com>
2080
2081         Reviewed by Maciej.
2082
2083         - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
2084
2085         * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
2086         This indirectly caused the string.replace bug.
2087
2088 2003-12-02  Maciej Stachowiak  <mjs@apple.com>
2089
2090         Merged patches from Harri Porten and David Faure to fix:
2091
2092         <rdar://problem/3497643>: reproducible crash printing self-referential array
2093         
2094         * kjs/array_object.cpp:
2095         (ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown.
2096         * kjs/nodes.cpp:
2097         (FunctionCallNode::evaluate): Move function call depth check from here...
2098         * kjs/object.cpp:
2099         (KJS::Object::call): ...to here.
2100         * kjs/object.h: Un-inline Object::call now that it does more.
2101
2102 2003-12-01  Richard Williamson   <rjw@apple.com>
2103
2104         Fixed mistake in method signatures used to get boolean and integer fields.
2105
2106         Reviewed by Chris.
2107
2108         * bindings/jni/jni_runtime.cpp:
2109         (JavaField::valueFromInstance):
2110
2111 2003-12-01  Richard Williamson   <rjw@apple.com>
2112
2113 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.
2114
2115 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.
2116
2117 Added support for getting at Java object fields.
2118
2119         Reviewed by Chris.
2120
2121         * JavaScriptCore.pbproj/project.pbxproj:
2122         * Makefile.am:
2123         * bindings/jni/jni_instance.cpp:
2124         (JObjectWrapper::JObjectWrapper):
2125         * bindings/jni/jni_instance.h:
2126         (Bindings::JObjectWrapper::~JObjectWrapper):
2127         * bindings/jni/jni_runtime.cpp:
2128         (JavaField::valueFromInstance):
2129         * bindings/runtime_object.cpp:
2130         (RuntimeObjectImp::~RuntimeObjectImp):
2131         (RuntimeObjectImp::RuntimeObjectImp):
2132         (RuntimeObjectImp::get):
2133         (RuntimeObjectImp::deleteProperty):
2134         * bindings/runtime_object.h:
2135
2136 === Safari-115 ===
2137
2138 2003-11-21  Maciej Stachowiak  <mjs@apple.com>
2139
2140         Patch from Harri Porten, reviewed by me.
2141
2142         - fixed 3491712 - String slice with negative arguments does not offset from end of string
2143         
2144         * kjs/string_object.cpp:
2145         (StringProtoFuncImp::call): Handle negative arguments as offsets from end by
2146         adding length and clamping to [0,length-1].
2147
2148 2003-11-21  Maciej Stachowiak  <mjs@apple.com>
2149
2150         Patch from Harri Porten, reviewed by me.
2151
2152         - fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash
2153         
2154         * kjs/function_object.cpp:
2155         (FunctionProtoFuncImp::call): Nest parentheses properly.
2156
2157 2003-11-20  Richard Williamson   <rjw@apple.com>
2158
2159         More LiveConnect stuff.  Primitive Java fields are now
2160         accessible from JavaScript!  Yay!
2161
2162         Reviewed by Maciej.
2163
2164         * bindings/jni/jni_class.cpp:
2165         (JavaClass::methodNamed):
2166         (JavaClass::fieldNamed):
2167         * bindings/jni/jni_class.h:
2168         (Bindings::JavaClass::_commonDelete):
2169         * bindings/jni/jni_instance.cpp:
2170         (JavaInstance::JavaInstance):
2171         (JavaInstance::~JavaInstance):
2172         (JavaInstance::getClass):
2173         * bindings/jni/jni_instance.h:
2174         (Bindings::JavaInstance::javaInstance):
2175         * bindings/jni/jni_runtime.cpp:
2176         (JavaField::JavaField):
2177         (JavaField::valueFromInstance):
2178         * bindings/jni/jni_runtime.h:
2179         (Bindings::JavaField::JavaField):
2180         (Bindings::JavaField::~JavaField):
2181         (Bindings::JavaField::operator=):
2182         * bindings/jni/jni_utility.cpp:
2183         (callJNIMethod):
2184         (callJNIMethodA):
2185         (callJNIVoidMethod):
2186         (callJNIObjectMethod):
2187         (callJNIBooleanMethod):
2188         (callJNIByteMethod):
2189         (callJNICharMethod):
2190         (callJNIShortMethod):
2191         (callJNIIntMethod):
2192         (callJNILongMethod):
2193         (callJNIFloatMethod):
2194         (callJNIDoubleMethod):
2195         (callJNIVoidMethodA):
2196         (callJNIObjectMethodA):
2197         (callJNIByteMethodA):
2198         (callJNICharMethodA):
2199         (callJNIShortMethodA):
2200         (callJNIIntMethodA):
2201         (callJNILongMethodA):
2202         (callJNIFloatMethodA):
2203         (callJNIDoubleMethodA):
2204         (releaseCharactersForJStringInEnv):
2205         (primitiveTypeFromClassName):
2206         (getJNIField):
2207         * bindings/jni/jni_utility.h:
2208         * bindings/runtime.cpp:
2209         (Instance::createBindingForLanguageInstance):
2210         (Instance::getValueOfField):
2211         * bindings/runtime.h:
2212         * bindings/runtime_object.cpp:
2213         (RuntimeObjectImp::get):
2214
2215 2003-11-20  Richard Williamson   <rjw@apple.com>
2216
2217         More LiveConnect stuff.
2218
2219         Reviewed by Chris.
2220
2221         * bindings/jni/jni_class.cpp:
2222         (JavaClass::classForName):
2223         (JavaClass::classForInstance):
2224         * bindings/jni/jni_instance.cpp:
2225         (JavaInstance::getValueOfField):
2226         * bindings/jni/jni_instance.h:
2227         (Bindings::JObjectWrapper::JObjectWrapper):
2228         * bindings/jni/jni_runtime.h:
2229         (Bindings::JavaConstructor::~JavaConstructor):
2230         (Bindings::JavaConstructor::operator=):
2231         (Bindings::JavaMethod::JavaMethod):
2232         (Bindings::JavaMethod::_commonDelete):
2233         (Bindings::JavaMethod::signature):
2234         * bindings/jni/jni_utility.cpp:
2235         (getJNIEnv):
2236         (attachToJavaVM):
2237         * bindings/jni/jni_utility.h:
2238         * bindings/runtime.h:
2239         * bindings/runtime_object.cpp:
2240         (RuntimeObjectImp::~RuntimeObjectImp):
2241         (RuntimeObjectImp::get):
2242         * bindings/runtime_object.h:
2243
2244 2003-11-19  Richard Williamson   <rjw@apple.com>
2245
2246         More LiveConnect stuff.
2247
2248         Reviewed by Ken.
2249
2250         * JavaScriptCore.pbproj/project.pbxproj:
2251         * bindings/jni/jni_class.cpp: Added.
2252         (JavaClass::_commonInit):
2253         (JavaClass::JavaClass):
2254         (_createClassesByNameIfNecessary):
2255         (JavaClass::classForName):
2256         (JavaClass::classForInstance):
2257         (JavaClass::methodNamed):
2258         (JavaClass::fieldNamed):
2259         * bindings/jni/jni_class.h: Added.
2260         (Bindings::JavaClass::_commonDelete):
2261         (Bindings::JavaClass::~JavaClass):
2262         (Bindings::JavaClass::_commonCopy):
2263         (Bindings::JavaClass::JavaClass):
2264         (Bindings::JavaClass::operator=):
2265         (Bindings::JavaClass::name):
2266         (Bindings::JavaClass::constructorAt):
2267         (Bindings::JavaClass::numConstructors):
2268         * bindings/jni/jni_instance.cpp: Added.
2269         (JavaInstance::JavaInstance):
2270         (JavaInstance::~JavaInstance):
2271         * bindings/jni/jni_instance.h: Added.
2272         (Bindings::JObjectWrapper::JObjectWrapper):
2273         (Bindings::JObjectWrapper::~JObjectWrapper):
2274         (Bindings::JObjectWrapper::ref):
2275         (Bindings::JObjectWrapper::deref):
2276         (Bindings::JavaInstance::getClass):
2277         (Bindings::JavaInstance::operator=):
2278         * bindings/jni/jni_runtime.cpp:
2279         (JavaMethod::JavaMethod):
2280         * bindings/jni/jni_runtime.h:
2281         (Bindings::JavaString::JavaString):
2282         (Bindings::JavaString::~JavaString):
2283         (Bindings::JavaString::operator=):
2284         * bindings/jni/jni_utility.cpp:
2285         (getJavaVM):
2286         (getJNIEnv):
2287         (getCharactersFromJString):
2288         (releaseCharactersForJString):
2289         (getCharactersFromJStringInEnv):
2290         (releaseCharactersForJStringInEnv):
2291         * bindings/jni/jni_utility.h:
2292         * bindings/runtime.cpp:
2293         (Instance::createBindingForLanguageInstance):
2294         * bindings/runtime.h:
2295         (Bindings::Instance::):
2296
2297 2003-11-18  Richard Williamson   <rjw@apple.com>
2298
2299         More live connect stubs.  We're getting close.
2300
2301         Reviewed by Chris.
2302
2303         * JavaScriptCore.pbproj/project.pbxproj:
2304         * bindings/jni/jni_runtime.cpp:
2305         (JavaClass::JavaClass):
2306         (JavaInstance::JavaInstance):
2307         (JavaInstance::~JavaInstance):
2308         * bindings/jni/jni_runtime.h:
2309         (Bindings::JavaConstructor::value):
2310         (Bindings::JavaField::value):
2311         (Bindings::JavaMethod::value):
2312         (Bindings::JavaClass::_commonDelete):
2313         (Bindings::JavaClass::_commonCopy):
2314         (Bindings::JavaClass::methodNamed):
2315         (Bindings::JavaClass::fieldNamed):
2316         (Bindings::JavaInstance::getClass):
2317         * bindings/runtime.cpp: Added.
2318         * bindings/runtime.h:
2319         (Bindings::Instance::~Instance):
2320         * bindings/runtime_object.cpp: Added.
2321         (RuntimeObjectImp::classInfo):
2322         (RuntimeObjectImp::RuntimeObjectImp):
2323         (RuntimeObjectImp::get):
2324         (RuntimeObjectImp::put):
2325         (RuntimeObjectImp::canPut):
2326         (RuntimeObjectImp::hasProperty):
2327         (RuntimeObjectImp::deleteProperty):
2328         (RuntimeObjectImp::defaultValue):
2329         (RuntimeObjectImp::_initializeClassInfoFromInstance):
2330         * bindings/runtime_object.h: Added.
2331         (KJS::RuntimeObjectImp::setInternalInstance):
2332         (KJS::RuntimeObjectImp::getInternalInstance):
2333         * kjs/object.cpp:
2334         (KJS::ObjectImp::get):
2335         (KJS::ObjectImp::hasProperty):
2336         * kjs/value.h:
2337         (KJS::):
2338
2339 2003-11-17  Maciej Stachowiak  <mjs@apple.com>
2340
2341         Patch from Harri, reviewed by me.
2342
2343         - fixed 3487375 - backwards array slice causes infinite loop
2344         
2345         * kjs/array_object.cpp:
2346         (ArrayProtoFuncImp::call):
2347
2348 2003-11-17  Maciej Stachowiak  <mjs@apple.com>
2349
2350         Patch from Harri Porten reviewed by me.
2351
2352         - fixed 3487371 - operator precedence for bitwise or, xor and and is wrong
2353
2354         * kjs/grammar.y: Correct the precedence.
2355
2356 2003-11-16  Maciej Stachowiak  <mjs@apple.com>
2357
2358         Reviewed by John.
2359
2360         - fixed 3483829 - JavaScriptCore needs workaround to compile on Merlot
2361         
2362         * JavaScriptCore.pbproj/project.pbxproj: Add -Wno-long-double to
2363         warning flags.
2364
2365 === Safari-114 ===
2366
2367 2003-11-13  Richard Williamson   <rjw@apple.com>
2368
2369         Factored common code between copy constructor and assignment operator.
2370
2371         Reviewed by Chris.
2372
2373         * ChangeLog:
2374         * bindings/jni/jni_runtime.h:
2375         (Bindings::JavaConstructor::_commonCopy):
2376         (Bindings::JavaConstructor::JavaConstructor):
2377         (Bindings::JavaConstructor::operator=):
2378         (Bindings::JavaField::type):
2379         * bindings/runtime.h:
2380
2381 2003-11-13  Richard Williamson   <rjw@apple.com>
2382
2383         More LiveConnect stuff.  This checkin adds abstract classes to model
2384         language runtimes and a JNI based set of concrete implementations for
2385         Java.
2386
2387         Reviewed by Chris.
2388
2389         * JavaScriptCore.pbproj/project.pbxproj:
2390         * Makefile.am:
2391         * bindings/Makefile.am: Removed.
2392         * bindings/jni/Makefile.am: Removed.
2393         * bindings/jni/jni_runtime.cpp: Added.
2394         (JavaField::JavaField):
2395         (JavaConstructor::JavaConstructor):
2396         (JavaMethod::JavaMethod):
2397         (JavaClass::JavaClass):
2398         * bindings/jni/jni_runtime.h: Added.
2399         (Bindings::JavaString::JavaString):
2400         (Bindings::JavaString::~JavaString):
2401         (Bindings::JavaString::operator=):
2402         (Bindings::JavaString::characters):
2403         (Bindings::JavaParameter::JavaParameter):
2404         (Bindings::JavaParameter::~JavaParameter):
2405         (Bindings::JavaParameter::operator=):
2406         (Bindings::JavaParameter::type):
2407         (Bindings::JavaConstructor::JavaConstructor):
2408         (Bindings::JavaConstructor::~JavaConstructor):
2409         (Bindings::JavaConstructor::operator=):
2410         (Bindings::JavaConstructor::parameterAt):
2411         (Bindings::JavaConstructor::numParameters):
2412         (Bindings::JavaField::JavaField):
2413         (Bindings::JavaField::~JavaField):
2414         (Bindings::JavaField::operator=):
2415         (Bindings::JavaField::name):
2416         (Bindings::JavaField::type):
2417         (Bindings::JavaMethod::JavaMethod):
2418         (Bindings::JavaMethod::_commonDelete):
2419         (Bindings::JavaMethod::~JavaMethod):
2420         (Bindings::JavaMethod::_commonCopy):
2421         (Bindings::JavaMethod::operator=):
2422         (Bindings::JavaMethod::name):
2423         (Bindings::JavaMethod::returnType):
2424         (Bindings::JavaMethod::parameterAt):
2425         (Bindings::JavaMethod::numParameters):
2426         (Bindings::JavaClass::_commonDelete):
2427         (Bindings::JavaClass::~JavaClass):
2428         (Bindings::JavaClass::_commonCopy):
2429         (Bindings::JavaClass::JavaClass):
2430         (Bindings::JavaClass::operator=):
2431         (Bindings::JavaClass::name):
2432         (Bindings::JavaClass::methodAt):
2433         (Bindings::JavaClass::numMethods):
2434         (Bindings::JavaClass::constructorAt):
2435         (Bindings::JavaClass::numConstructors):
2436         (Bindings::JavaClass::fieldAt):
2437         (Bindings::JavaClass::numFields):
2438         * bindings/jni/jni_utility.cpp:
2439         (callJNIMethod):
2440         (callJNIMethodA):
2441         (callJNIObjectMethod):
2442         (callJNIByteMethod):
2443         (callJNICharMethod):
2444         (callJNIShortMethod):
2445         (callJNIIntMethod):
2446         (callJNILongMethod):
2447         (callJNIFloatMethod):
2448         (callJNIDoubleMethod):
2449         (callJNIVoidMethodA):
2450         (callJNIObjectMethodA):
2451         (callJNIByteMethodA):
2452         (callJNICharMethodA):
2453         (callJNIShortMethodA):
2454         (callJNIIntMethodA):
2455         (callJNILongMethodA):
2456         (callJNIFloatMethodA):
2457         (callJNIDoubleMethodA):
2458         (getCharactersFromJString):
2459         (releaseCharactersForJString):
2460         * bindings/jni/jni_utility.h:
2461         * bindings/objc/Makefile.am: Removed.
2462         * bindings/runtime.h: Added.
2463         (Bindings::Parameter::~Parameter):
2464         (Bindings::Constructor::~Constructor):
2465         (Bindings::Field::~Field):
2466         (Bindings::Method::~Method):
2467         (Bindings::Class::~Class):
2468
2469 2003-11-13  Maciej Stachowiak  <mjs@apple.com>
2470
2471         Reviewed by John.
2472
2473         - fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions
2474         
2475         * kjs/nodes.cpp:
2476         (ForInNode::execute): If the in value is null or undefined, bail
2477         out early, since attempting to iterate its properties will throw
2478         an exception.
2479
2480 2003-11-12  Darin Adler  <darin@apple.com>
2481
2482         - fixed the build
2483
2484         * Makefile.am: Fix the build by removing the bindings directory from SUBDIRS.
2485         Later, we can either add this back and add the Makefile.am files to the top
2486         level configure.in or leave it out and remove the Makefile.am files.
2487
2488 2003-11-12  Richard Williamson   <rjw@apple.com>
2489
2490         Added utility functions for calling JNI methods.
2491
2492         Reviewed by Chris.
2493
2494         * JavaScriptCore.pbproj/project.pbxproj:
2495         * Makefile.am:
2496         * bindings/Makefile.am: Added.
2497         * bindings/jni/Makefile.am: Added.
2498         * bindings/jni/jni_utility.cpp: Added.
2499         (attachToJavaVM):
2500         (callJNIMethod):
2501         (callJNIVoidMethod):
2502         (callJNIObjectMethod):
2503         (callJNIByteMethod):
2504         (callJNICharMethod):
2505         (callJNIShortMethod):
2506         (callJNIIntMethod):
2507         (callJNILongMethod):
2508         (callJNIFloatMethod):
2509         (callJNIDoubleMethod):
2510         * bindings/jni/jni_utility.h: Added.
2511         * bindings/objc/Makefile.am: Added.
2512
2513 2003-11-08  Darin Adler  <darin@apple.com>
2514
2515         Reviewed by John.
2516
2517         - fixed 3477528 -- array.sort(function) fails if the function returns a non-zero value that rounds to zero
2518
2519         * kjs/array_object.cpp:
2520         (compareByStringForQSort): Added checks for undefined values to match what the specification calls for.
2521         (compareWithCompareFunctionForQSort): Added checks for undefined values as above, and also changed the
2522         code that looks at the compare function result to look at the number returned without rounding to an integer.
2523         (ArrayProtoFuncImp::call): Changed the code that looks at the compare function result to look at the number
2524         returned without rounding to an integer.
2525
2526 === Safari-113 ===
2527
2528 2003-11-03  Vicki Murley <vicki@apple.com>
2529
2530         Reviewed by kocienda.
2531
2532         - fixed <rdar://problem/3471096>: non-B&I builds should not use order files, because they cause false "regressions" in perf.
2533
2534         * JavaScriptCore.pbproj/project.pbxproj: added empty SECTORDER_FLAGS variables to the Development and Deployment build styles
2535
2536 2003-11-02  Darin Adler  <darin@apple.com>
2537
2538         Reviewed by Maciej.
2539
2540         - changed list manipulation to use Harri Porten's idea of a circular
2541           linked list that is built from head to tail rather than building the
2542           list backwards and reversing the list when done
2543
2544         * kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way.
2545         Change many places that passed 0L to pass nothing at all, or to pass 0.
2546
2547         * kjs/nodes.h:
2548         (KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated
2549         backwards list.
2550         (KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list.
2551         (KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the
2552         inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated
2553         backwards list. Made the case for the first node separate so we don't need a nil check.
2554         (KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of
2555         reversing the list.
2556         (KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated
2557         backwards list. Also, made the constructors inline (moved here from .cpp file).
2558         (KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of
2559         reversing the list.
2560         (KJS::NewExprNode::NewExprNode): Changed a 0L to 0.
2561         (KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into
2562         .cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated
2563         backwards list.
2564         (KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated
2565         backwards list.
2566         (KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing
2567         the list.
2568         (KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file).
2569         The one in the .cpp file breaks the list instead of reversing it.
2570         (KJS::ForNode::ForNode): Break the circular list instead of reversing the list.
2571         (KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the
2572         list.
2573         (KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated
2574         backwards list.
2575         (KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into
2576         .cpp file). The one in the .cpp file breaks the list instead of reversing it.
2577         (KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and
2578         finally nodes rather than just Node.
2579         (KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated
2580         backwards list.
2581         (KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the
2582         list.
2583         (KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the
2584         list.
2585
2586         * kjs/nodes.cpp:
2587         (StatListNode::StatListNode): Moved this constructor here, no longer inline.
2588         Did the "break circular list" thing instead of the "reverse list" thing.
2589         Added setLoc calls to match KJS in the KDE tree; since we don't currently
2590         use the JavaScript debugging support, it's unclear whether there's any benefit, but
2591         later we might be using it and it's good to be as close as possible.
2592         (BlockNode::BlockNode): Moved this constructor here, no longer inline.
2593         Did the "break circular list" thing instead of the "reverse list" thing.
2594         Added setLoc calls.
2595         (CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline.
2596         Did the "break circular list" thing instead of the "reverse list" thing.
2597         (SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline.
2598         Did the "break circular list" thing instead of the "reverse list" thing.
2599         Added setLoc calls.
2600
2601         * kjs/grammar.cpp: Regenerated.
2602         * kjs/grammar.cpp.h: Regenerated.
2603         * kjs/grammar.h: Regenerated.
2604
2605 === Safari-112 ===
2606
2607 2003-10-30  Maciej Stachowiak  <mjs@apple.com>
2608
2609         Reviewed by Ken.
2610
2611         - fixed 3427069 - browsing mp3.com causes leaks (KJS)
2612         
2613         * kjs/string_object.cpp:
2614         (StringProtoFuncImp::call): Don't do an early return, since that
2615         could leak a temporary regexp.
2616
2617 2003-10-29  Maciej Stachowiak  <mjs@apple.com>
2618
2619         Reviewed by Darin.
2620
2621         - fixed 3426076 - Leak of JS lexer data visiting http://www.ebay.com
2622         
2623         * kjs/grammar.cpp:
2624         (yyerror): Updated the commented code.
2625         * kjs/grammar.y: Don't delete string and identifier tokens when done
2626         with them any more, they'll get cleaned up by the lexer now.
2627         * kjs/internal.cpp:
2628         (Parser::parse): Tell lexer when done parsing.
2629         * kjs/lexer.cpp:
2630         (Lexer::Lexer): Initialize new data members.
2631         (Lexer::lex): Use new methods to make strings and identifiers, and
2632         save them.
2633         (Lexer::makeIdentifier): Make a new Identifier and save it in an
2634         auto-growing array.
2635         (Lexer::makeUString): Likewise for UStrings.
2636         (Lexer::doneParsing): Clean up arrays of Ifentifiers and UStrings.
2637         * kjs/lexer.h:
2638
2639 2003-10-28  Maciej Stachowiak  <mjs@apple.com>
2640
2641         Reviewed by Ken.
2642
2643         - fixed 3413962 -  malicious web pages can kill all future JavaScript execution by breaking recursion limit check
2644         
2645         * kjs/nodes.cpp:
2646         (FunctionCallNode::evaluate): If we're going to return early due
2647         to breaking the recursion limit, make sure to lower it again, or
2648         it will creep up by one each time it's exceeded.
2649
2650 2003-10-26  Darin Adler  <darin@apple.com>
2651
2652         * JavaScriptCorePrefix.h: Added a C case to the NULL definition since we use C as well
2653         as C++ in this project.
2654
2655 2003-10-26  Darin Adler  <darin@apple.com>
2656
2657         - rolled in some CString changes Harri Porten did on the KDE side
2658
2659         * kjs/ustring.cpp:
2660         (KJS::CString::CString): Use memcpy instead of strcpy for speed. Fix an off by one error
2661         in the copy constructor.
2662         (KJS::CString::operator=): Use memcpy instead of strcpy for speed.
2663
2664         * JavaScriptCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
2665         __null feature even if the system C library doesn't.
2666
2667 == Rolled over to ChangeLog-2003-10-25 ==