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