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