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