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