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