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