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