5ce937fcd29efe9c0377ac311b55cb75647864ac
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2005-02-21  Darin Adler  <darin@apple.com>
2
3         * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
4
5 2005-02-17  Richard Williamson   <rjw@apple.com>
6
7         Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
8
9         Added nil check.
10
11         Reviewed by John Sullivan.
12
13         * bindings/jni/jni_runtime.cpp:
14         (JavaField::valueFromInstance):
15
16 === Safari-187 ===
17
18 2005-02-11  Richard Williamson   <rjw@apple.com>
19
20         Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
21
22         Re-factored how 'native' wrappers for JS objects are created.  The interpreter now
23         creates these wrappers.  The WebCore subclass of the interpreter now overrides
24         createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
25
26         Reviewed by Ken.
27
28         * bindings/c/c_utility.cpp:
29         (convertValueToNPVariant):
30         * bindings/jni/jni_instance.cpp:
31         (JavaInstance::invokeMethod):
32         * bindings/jni/jni_objc.mm:
33         (KJS::Bindings::dispatchJNICall):
34         * bindings/jni/jni_runtime.cpp:
35         (JavaField::valueFromInstance):
36         (JavaArray::valueAt):
37         * bindings/objc/WebScriptObject.mm:
38         (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
39         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
40         * bindings/objc/WebScriptObjectPrivate.h:
41         * bindings/objc/objc_utility.h:
42         * bindings/objc/objc_utility.mm:
43         (KJS::Bindings::convertObjcValueToValue):
44         (KJS::Bindings::createObjcInstanceForValue):
45         * bindings/runtime.cpp:
46         (Instance::createBindingForLanguageInstance):
47         (Instance::createRuntimeObject):
48         (Instance::createLanguageInstanceForValue):
49         * bindings/runtime.h:
50         * kjs/interpreter.cpp:
51         (Interpreter::createLanguageInstanceForValue):
52         * kjs/interpreter.h:
53
54 === Safari-186 ===
55
56 2005-02-10  Darin Adler  <darin@apple.com>
57
58         "Reviewed" by Richard (he told me the file was obsolete).
59
60         - got rid of an obsolete file
61
62         * bindings/npsap.h: Removed.
63
64 === Safari-185 ===
65
66 === Safari-183 ===
67
68 2005-02-03  Richard Williamson   <rjw@apple.com>
69
70         Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
71
72         Revert to old (and correct) behavior of returning runtime object
73         when passed as a parameter, rather than it's corresponding DOM
74         object.
75
76         Reviewed by Chris.
77
78         * bindings/objc/WebScriptObject.mm:
79         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
80
81 === Safari-182 ===
82
83 2005-01-28  Richard Williamson   <rjw@apple.com>
84
85         Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
86
87         Only use special 'back door' property to get the runtime object if thisObj isn't
88         already a runtime object.
89
90         <gratuitous> Cleaned up a couple of strcmp on ClassInfo name.  Used == on
91         ClassInfo pointer instead.
92
93         Reviewed by Chris.
94
95         * bindings/c/c_utility.cpp:
96         (convertValueToNPVariant):
97         * bindings/objc/WebScriptObject.mm:
98         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
99         * bindings/runtime_method.cpp:
100         (RuntimeMethodImp::call):
101
102 === Safari-181 ===
103
104 2005-01-26  Richard Williamson   <rjw@apple.com>
105
106         Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
107
108         I added a member variable to ObjectImp.  This changed it's size and consequently
109         hampered the optimizations built into the garbage collector.  Objects no longer
110         fit within the allocators cell size, and thus allocation fell back to a slower
111         allocator.
112
113         As a result of this fix I also dramatically cleaned up how runtime objects are
114         accessed.  The path mostly *removes* code.
115         
116         Reviewed by Chris.
117
118         * bindings/runtime_method.cpp:
119         (RuntimeMethodImp::call):
120         * bindings/runtime_object.cpp:
121         (RuntimeObjectImp::get):
122         (RuntimeObjectImp::put):
123         (RuntimeObjectImp::canPut):
124         (RuntimeObjectImp::hasProperty):
125         (RuntimeObjectImp::defaultValue):
126         * bindings/runtime_object.h:
127         * kjs/object.cpp:
128         (KJS::ObjectImp::ObjectImp):
129         * kjs/object.h:
130
131 2005-01-20  Darin Adler  <darin@apple.com>
132
133         Reviewed by me, changes by Han Ming Ong.
134
135         - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
136
137         * bindings/objc/WebScriptObjectPrivate.h: Make members public.
138         * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
139
140 2005-01-20  Richard Williamson   <rjw@apple.com>
141
142         Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
143
144         The comprehensive fix for this problem requires new API, as described in 3965326.  However,
145         given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
146         like and Undefined object if  invokeUndefinedMethodFromWebScript:withArguments: isn't
147         implemented on the bound object.
148
149         Reviewed by Chris.
150
151         * bindings/objc/objc_runtime.h:
152         * bindings/objc/objc_runtime.mm:
153         (ObjcFallbackObjectImp::type):
154         (ObjcFallbackObjectImp::implementsCall):
155         (ObjcFallbackObjectImp::toBoolean):
156         * bindings/testbindings.mm:
157         (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
158         (+[MyFirstInterface isKeyExcludedFromWebScript:]):
159
160 === Safari-180 ===
161
162 2005-01-19  Richard Williamson   <rjw@apple.com>
163
164         Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
165
166         Fixed the following problems with LiveConnect that are demonstrated by the application
167         described in 3853676.
168
169         1.  If a nil object is passed in an array from Java to JavaScript we will crash.
170         2.  We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
171         3.  We will sometimes fail to find the correct static method ID.
172
173         Reviewed by Maciej.
174
175         * bindings/jni/jni_jsobject.cpp:
176         (JSObject::convertJObjectToValue):
177         (JSObject::listFromJArray):
178         * bindings/jni/jni_runtime.cpp:
179         (JavaField::valueFromInstance):
180         (JavaField::setValueToInstance):
181         * bindings/jni/jni_utility.cpp:
182         (KJS::Bindings::getMethodID):
183         (KJS::Bindings::convertValueToJValue):
184         * bindings/runtime_array.h:
185
186 2005-01-18  Richard Williamson   <rjw@apple.com>
187
188         Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
189
190         Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
191         Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
192         Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
193         Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
194
195         We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
196         tags.  Also, if any of these elements are named they can be accessed from the document or window objects.
197         Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
198
199         Reviewed by Chris.
200
201         * bindings/objc/objc_instance.h:
202         * bindings/objc/objc_instance.mm:
203         (ObjcInstance::supportsSetValueOfUndefinedField):
204         * bindings/runtime.h:
205         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
206         * bindings/runtime_object.cpp:
207         (RuntimeObjectImp::RuntimeObjectImp):
208         (RuntimeObjectImp::get):
209         (RuntimeObjectImp::put):
210         (RuntimeObjectImp::canPut):
211         (RuntimeObjectImp::hasProperty):
212         (RuntimeObjectImp::defaultValue):
213         * bindings/runtime_object.h:
214         (KJS::RuntimeObjectImp::fallbackObject):
215         * kjs/object.cpp:
216         (KJS::ObjectImp::ObjectImp):
217         * kjs/object.h:
218         (KJS::ObjectImp::forwardingScriptMessage):
219         (KJS::ObjectImp::setForwardingScriptMessage):
220
221 2005-01-18  Richard Williamson   <rjw@apple.com>
222
223         Back out a change that was incorrectly committed yesterday.
224
225         Reviewed by Chris.
226
227         * bindings/objc/objc_utility.mm:
228         (KJS::Bindings::convertValueToObjcValue):
229
230 2005-01-17  Richard Williamson   <rjw@apple.com>
231
232         Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
233
234         Keep track of originating execution context and target execution
235         context for native JS object wrappers, and perform appropriate
236         security checks.
237
238         Reviewed by David Harrison.
239
240         * bindings/NP_jsobject.cpp:
241         (_isSafeScript):
242         (_NPN_CreateScriptObject):
243         (_NPN_Invoke):
244         (_NPN_Evaluate):
245         (_NPN_GetProperty):
246         (_NPN_SetProperty):
247         (_NPN_RemoveProperty):
248         (_NPN_HasProperty):
249         (_NPN_HasMethod):
250         (_NPN_SetException):
251         * bindings/NP_jsobject.h:
252         * bindings/c/c_instance.cpp:
253         (CInstance::CInstance):
254         (CInstance::stringValue):
255         * bindings/c/c_instance.h:
256         * bindings/c/c_utility.cpp:
257         (convertValueToNPVariant):
258         * bindings/jni/jni_instance.cpp:
259         (JavaInstance::JavaInstance):
260         (JavaInstance::valueOf):
261         * bindings/jni/jni_instance.h:
262         * bindings/objc/WebScriptObject.mm:
263         (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
264         (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
265         (-[WebScriptObject KJS::Bindings::]):
266         (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
267         (-[WebScriptObject _isSafeScript]):
268         (-[WebScriptObject callWebScriptMethod:withArguments:]):
269         (-[WebScriptObject evaluateWebScript:]):
270         (-[WebScriptObject setValue:forKey:]):
271         (-[WebScriptObject valueForKey:]):
272         (-[WebScriptObject removeWebScriptKey:]):
273         (-[WebScriptObject stringRepresentation]):
274         (-[WebScriptObject webScriptValueAtIndex:]):
275         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
276         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
277         * bindings/objc/WebScriptObjectPrivate.h:
278         * bindings/objc/objc_instance.h:
279         * bindings/objc/objc_runtime.mm:
280         (convertValueToObjcObject):
281         * bindings/objc/objc_utility.mm:
282         (KJS::Bindings::convertValueToObjcValue):
283         * bindings/runtime.cpp:
284         (Instance::Instance):
285         (Instance::operator=):
286         * bindings/runtime.h:
287         (KJS::Bindings::Instance::Instance):
288         (KJS::Bindings::Instance::setExecutionContext):
289         (KJS::Bindings::Instance::executionContext):
290         * bindings/runtime_root.cpp:
291         (RootObject::setInterpreter):
292         * bindings/runtime_root.h:
293         * kjs/interpreter.h:
294         (KJS::Interpreter::isGlobalObject):
295         (KJS::Interpreter::interpreterForGlobalObject):
296         (KJS::Interpreter::isSafeScript):
297
298 === Safari-179 ===
299
300 2005-01-13  Vicki Murley <vicki@apple.com>
301
302         Reviewed by Adele.
303
304         - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
305  
306         * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
307
308 2005-01-12  Richard Williamson   <rjw@apple.com>
309
310         Avoid additional work on dealloc by adding early out to
311         removeNativeReference().  (This will save time on dealloc
312         for all ObjC DOM objects.)
313
314         Reviewed by Darin.
315
316         * bindings/runtime_root.cpp:
317         (KJS::Bindings::removeNativeReference):
318
319 2005-01-12  Richard Williamson   <rjw@apple.com>
320
321         Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
322
323         We were always returning the first "root" object for all runtime
324         objects.  Changed 0 in loop to i, the index.
325
326         Reviewed by David Harrison.
327
328         * bindings/runtime_root.cpp:
329         (KJS::Bindings::rootForImp):
330
331 2005-01-11  Richard Williamson   <rjw@apple.com>
332
333         Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
334
335         Use the new dispatching API to invoke JNI, rather than calling JNI
336         directly.
337
338         Reviewed by David Harrison.
339
340         * bindings/jni/jni_instance.cpp:
341         (JavaInstance::invokeMethod):
342         * bindings/jni/jni_runtime.cpp:
343         (JavaField::dispatchValueFromInstance):
344         (JavaField::valueFromInstance):
345         (JavaField::dispatchSetValueToInstance):
346         (JavaField::setValueToInstance):
347         * bindings/jni/jni_runtime.h:
348         * bindings/jni/jni_utility.cpp:
349         (KJS::Bindings::convertValueToJValue):
350
351 === Safari-178 ===
352
353 === Safari-177 ===
354
355 === Safari-176 ===
356
357 2004-12-17  Maciej Stachowiak  <mjs@apple.com>
358
359         Reviewed by Kevin.
360
361         <rdar://problem/3926869> Opening caches window after running PLT causes crash
362         
363         * kjs/protected_values.cpp:
364         (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
365         the protected value table.
366         (KJS::ProtectedValues::increaseProtectCount): Ditto.
367         (KJS::ProtectedValues::decreaseProtectCount): Ditto.
368
369 2004-12-16  Darin Adler  <darin@apple.com>
370
371         Reviewed by Maciej.
372
373         - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
374
375         * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
376         * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
377         non-locale-specific versions.
378         * kjs/string_object.lut.h: Regenerated.
379
380 2004-12-14  Richard Williamson   <rjw@apple.com>
381
382         Pass URL of plugin view when call into JNI.
383
384         Reviewed by Chris.
385
386         * bindings/jni/jni_objc.mm:
387         (KJS::Bindings::dispatchJNICall):
388
389 2004-12-13  Richard Williamson   <rjw@apple.com>
390
391         Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
392
393         Add support for calling static Java methods from JavaScript.
394
395         Reviewed by Maciej.
396
397         * bindings/jni/jni_instance.cpp:
398         (JavaInstance::invokeMethod):
399         * bindings/jni/jni_runtime.cpp:
400         (JavaMethod::JavaMethod):
401         * bindings/jni/jni_runtime.h:
402         (KJS::Bindings::JavaMethod::isStatic):
403         * bindings/jni/jni_utility.cpp:
404         (callJNIStaticMethod):
405         (KJS::Bindings::callJNIBooleanMethod):
406         (KJS::Bindings::callJNIStaticBooleanMethod):
407         * bindings/jni/jni_utility.h:
408
409 2004-12-13  Richard Williamson   <rjw@apple.com>
410
411         Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
412
413         Reviewed by John.
414
415         * bindings/jni/jni_instance.cpp:
416         (JavaInstance::invokeMethod):
417         * bindings/jni/jni_objc.mm:
418         (KJS::Bindings::dispatchJNICall):
419         * bindings/jni/jni_runtime.h:
420         * bindings/jni/jni_utility.h:
421
422 === Safari-175 ===
423
424 2004-12-07  Maciej Stachowiak  <mjs@apple.com>
425
426         Reviewed by Darin.
427
428         <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
429
430         The fix was to implement copy constructor and assignment operator,
431         the ones that worked on the base class did not replace the
432         defaults apparently!
433         
434         * kjs/protect.h:
435         (KJS::ProtectedValue::ProtectedValue):
436         (KJS::ProtectedValue::operator=):
437         (KJS::ProtectedObject::ProtectedObject):
438         (KJS::ProtectedObject::operator=):
439         
440         Also fixed a bug in the GC test mode that compares the results of
441         the old collector and the new collector.
442
443         * kjs/value.cpp:
444         (ValueImp::mark):
445
446 === Safari-173 ===
447
448 2004-11-23  Richard Williamson   <rjw@apple.com>
449
450         Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
451
452         Reviewed by Ken.
453
454         * bindings/c/c_class.cpp:
455         (CClass::_commonInit):
456
457 2004-11-21  Maciej Stachowiak  <mjs@apple.com>
458
459         Reviewed by Ken.
460
461         <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
462         
463         * kjs/collector.cpp:
464         (KJS::Collector::Thread::Thread):
465         (KJS::destroyRegisteredThread):
466         (KJS::initializeRegisteredThreadKey):
467         (KJS::Collector::registerThread):
468         (KJS::Collector::markStackObjectsConservatively):
469         (KJS::Collector::markCurrentThreadConservatively):
470         (KJS::Collector::markOtherThreadConservatively):
471         * kjs/collector.h:
472         * kjs/internal.cpp:
473         (lockInterpreter):
474         * kjs/value.h:
475
476 === Safari-172 ===
477
478 2004-11-15  Richard Williamson   <rjw@apple.com>
479
480         Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
481
482         Reviewed by Hyatt.
483
484         * bindings/objc/objc_instance.mm:
485         (ObjcInstance::stringValue):
486         * bindings/objc/objc_utility.h:
487         * bindings/objc/objc_utility.mm:
488         (KJS::Bindings::convertNSStringToString):
489         (KJS::Bindings::convertObjcValueToValue):
490
491 === Safari-171 ===
492
493 2004-11-09  Chris Blumenberg  <cblu@apple.com>
494
495         Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
496
497         Reviewed by rjw.
498
499         * ChangeLog:
500         * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
501         * bindings/softlinking.c: Added.
502         (loadFramework): new
503         (getFunctionPointer): new
504         (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
505
506 === Safari-170 ===
507
508 2004-11-04  Darin Adler  <darin@apple.com>
509
510         Reviewed by Ken.
511
512         - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
513         - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
514           and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
515           than allocating a new one
516
517         * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
518         (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
519         of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
520         actually allocate only the very first time it's called.
521         (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
522         shared instance since there can be only one).
523         (-[WebUndefined copyWithZone:]): Ditto.
524         (-[WebUndefined retain]): Ditto.
525         (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
526         of class).
527         (-[WebUndefined autorelease]): Simplified to just return self (see above).
528         (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
529         (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
530         a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
531         bug mentioned above).
532         (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
533         No need to call init, since that's a no-op for this class.
534
535 2004-11-03  David Harrison  <harrison@apple.com>
536
537         Reviewed by Darin.
538         
539         Eliminate the use of a marker file to determine how to build.
540
541         * .cvsignore:
542         * Makefile.am:
543
544 2004-11-01  Richard Williamson   <rjw@apple.com>
545
546         Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
547
548         Reviewed by Ken.
549
550         * bindings/c/c_instance.cpp:
551         (CInstance::invokeMethod):
552         (CInstance::invokeDefaultMethod):
553         Initialize out parameters to void type.
554
555         * bindings/c/c_runtime.cpp:
556         (CField::valueFromInstance):
557         (CField::setValueToInstance):
558         Initialize out parameters to void type.
559         Also added additional checks to protect against classes that 
560         don't implement all functions.
561
562 2004-11-01  Richard Williamson   <rjw@apple.com>
563
564         Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
565
566         Reviewed by John.
567
568         * ChangeLog:
569         * bindings/objc/WebScriptObject.mm:
570         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
571         Added additional conversion Undefined -> WebUndefined.
572         * bindings/objc/objc_utility.mm:
573         (KJS::Bindings::convertObjcValueToValue):
574         Added additional conversion WebUndefined -> Undefined.
575
576 2004-11-01  Darin Adler  <darin@apple.com>
577
578         - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
579
580         * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
581         this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
582         report to match the contents of the file.
583
584 === Safari-169 ===
585
586 === Safari-168 ===
587
588 2004-10-22  Ken Kocienda  <kocienda@apple.com>
589
590         Reviewed by me
591
592         * JavaScriptCore.pbproj/project.pbxproj:  
593         Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
594
595 === Safari-167 ===
596
597 2004-10-13  Richard Williamson   <rjw@apple.com>
598
599         Moved boolean checks prior to NSNumber checks.  booleans are
600         NSNumbers.
601
602         Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
603
604         Reviewed by John.
605
606         * bindings/objc/objc_utility.mm:
607         (KJS::Bindings::convertObjcValueToValue):
608
609 2004-10-12  Richard Williamson   <rjw@apple.com>
610
611         Fixed access to DOM object via WebScriptObject API.
612         The execution context for DOM objects wasn't being found.       
613         <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
614
615         Reviewed by Chris.
616
617         * bindings/objc/WebScriptObject.mm:
618         (_didExecute):
619         (-[WebScriptObject KJS::Bindings::]):
620         (-[WebScriptObject callWebScriptMethod:withArguments:]):
621         (-[WebScriptObject evaluateWebScript:]):
622         (-[WebScriptObject setValue:forKey:]):
623         (-[WebScriptObject valueForKey:]):
624         (-[WebScriptObject stringRepresentation]):
625         * bindings/objc/WebScriptObjectPrivate.h:
626
627 2004-10-09  Darin Adler  <darin@apple.com>
628
629         Reviewed by Kevin.
630
631         - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
632
633         * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
634         creating an init routine.
635
636         * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
637         require a global constructor that creates an init routine.
638
639 2004-10-09  Darin Adler  <darin@apple.com>
640
641         Reviewed by Kevin.
642
643         - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
644
645         * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
646         work with the window object of the page the function is in, not the page of the caller. This
647         is what all other browsers do. This code was hidden before by the "everything is defined on
648         window object" hack in WebCore.
649
650 2004-10-07  Richard Williamson   <rjw@apple.com>
651
652         Added simple JavaScript call tracing.  Very useful for
653         debugging complex pages.
654
655         Tracing is only available in development builds and is
656         enabled by:
657
658         (gdb) set traceJavaScript = 1
659
660         or programatically
661
662         setTraceJavaScript(true)
663
664         Function, args, and return values are printed to console.  Very
665         verbose.
666
667         Reviewed by Ken.
668
669         * kjs/function_object.cpp:
670         (FunctionProtoFuncImp::call):
671         * kjs/object.cpp:
672         (KJS::Object::call):
673
674 === Safari-166 ===
675
676 2004-10-05  Richard Williamson   <rjw@apple.com>
677
678         Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
679
680         Reviewed by Chris.
681
682         * bindings/NP_jsobject.cpp:
683         (_NPN_SetException):
684         * bindings/npruntime.cpp:
685         (_NPN_SetExceptionWithUTF8):
686         * bindings/objc/WebScriptObject.mm:
687         (+[WebScriptObject throwException:]):
688         * kjs/internal.h:
689         (KJS::InterpreterImp::context):
690
691 2004-10-05  Richard Williamson   <rjw@apple.com>
692
693         Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
694
695         Reviewed by Ken.
696
697         * bindings/objc/objc_utility.mm:
698         (KJS::Bindings::convertObjcValueToValue):
699
700 2004-10-04  Darin Adler  <darin@apple.com>
701
702         Reviewed by Ken.
703
704         - rolled in a fix the KDE folks did for the operations that generate HTML fragments
705
706         * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
707
708         - rolled out an old workaround we don't need any more
709
710         * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
711         required it is no longer there.
712
713 2004-09-30  Richard Williamson  <rjw@apple.com>
714
715         Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
716
717         Reviewed by Chris.
718
719         * bindings/NP_jsobject.cpp:
720         (_NPN_GetProperty):
721         (_NPN_HasProperty):
722         (_NPN_HasMethod):
723         * bindings/c/c_class.cpp:
724         (CClass::methodsNamed):
725         (CClass::fieldNamed):
726         * bindings/c/c_class.h:
727         * bindings/c/c_instance.cpp:
728         (CInstance::invokeMethod):
729         * bindings/jni/jni_class.cpp:
730         (JavaClass::methodsNamed):
731         * bindings/jni/jni_class.h:
732         * bindings/npruntime.h:
733         * bindings/objc/objc_class.h:
734         * bindings/objc/objc_class.mm:
735         (ObjcClass::methodsNamed):
736         * bindings/runtime.h:
737         * bindings/runtime_object.cpp:
738         (RuntimeObjectImp::get):
739         (RuntimeObjectImp::hasProperty):
740
741 2004-09-29  Chris Blumenberg  <cblu@apple.com>
742
743         Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
744
745         Reviewed by rjw.
746
747         * JavaScriptCore.pbproj/project.pbxproj:
748         * bindings/NP_jsobject.cpp:
749         (_NPN_CreateScriptObject):
750         (_NPN_InvokeDefault):
751         (_NPN_Invoke):
752         (_NPN_Evaluate):
753         (_NPN_GetProperty):
754         (_NPN_SetProperty):
755         (_NPN_RemoveProperty):
756         (_NPN_HasProperty):
757         (_NPN_HasMethod):
758         * bindings/c/c_class.cpp:
759         (CClass::methodsNamed):
760         (CClass::fieldNamed):
761         * bindings/c/c_instance.cpp:
762         (CInstance::CInstance):
763         (CInstance::~CInstance):
764         (CInstance::operator=):
765         (CInstance::invokeMethod):
766         (CInstance::invokeDefaultMethod):
767         * bindings/c/c_runtime.cpp:
768         * bindings/c/c_runtime.h:
769         (KJS::Bindings::CField::name):
770         (KJS::Bindings::CMethod::name):
771         * bindings/npruntime.cpp:
772         (_NPN_GetStringIdentifier):
773         (_NPN_GetStringIdentifiers):
774         (_NPN_GetIntIdentifier):
775         (_NPN_IdentifierIsString):
776         (_NPN_UTF8FromIdentifier):
777         (_NPN_IntFromIdentifier):
778         (NPN_InitializeVariantWithObject):
779         (_NPN_ReleaseVariantValue):
780         (_NPN_CreateObject):
781         (_NPN_RetainObject):
782         (_NPN_ReleaseObject):
783         (_NPN_SetExceptionWithUTF8):
784         (_NPN_SetException):
785
786 2004-09-26  Darin Adler  <darin@apple.com>
787
788         * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
789         low() to get Unicode value of character, and just use unicode().
790
791 2004-09-26  Darin Adler  <darin@apple.com>
792
793         - refine charAt/charCodeAt fix slightly
794
795         * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
796         omitted parameter, as we do everywhere else, and as other browsers do here.
797
798 2004-09-26  Darin Adler  <darin@apple.com>
799
800         Reviewed by Kevin.
801
802         - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
803
804         * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
805         the program. We were doing this properly for functions, but not entire programs.
806
807         - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
808
809         * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
810         and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
811
812         * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
813
814 === Safari-165 ===
815
816 === Safari-164 ===
817
818 2004-09-14  Richard Williamson   <rjw@apple.com>
819
820         1.  Add class parameter to object allocation function.  This is somewhat redundant, given that
821         the allocation function is in the class function vector, but people wanted to use the same
822         allocation function for different classes.
823         
824         2.  Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
825         
826         3.  Add support for a default function on an object.  This is a feature that ActiveX supports,
827         and will allow JavaScript code to be written that will look exactly the same for both ActiveX
828         plugins and Netscape or WebKit plugins.  There are implementations included for the 'C' and
829         'Objective-C' bindings.
830         
831         There bugs are covered by
832         
833         <rdar://problem/3776343> Support for default functions in the JavaScript bindings
834         <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
835         <rdar://problem/3674754> Need to implement latest npruntime.h
836
837         Reviewed by John.
838
839         * bindings/NP_jsobject.cpp:
840         (jsAllocate):
841         (NPN_InvokeDefault):
842         (NPN_Invoke):
843         * bindings/c/c_class.cpp:
844         * bindings/c/c_instance.cpp:
845         (CInstance::CInstance):
846         (CInstance::operator=):
847         (CInstance::invokeMethod):
848         (CInstance::invokeDefaultMethod):
849         * bindings/c/c_instance.h:
850         * bindings/c/c_runtime.cpp:
851         * bindings/c/c_runtime.h:
852         * bindings/jni/jni_instance.cpp:
853         (JavaInstance::invokeDefaultMethod):
854         * bindings/jni/jni_instance.h:
855         * bindings/npruntime.cpp:
856         (NPN_CreateObject):
857         * bindings/npruntime.h:
858         * bindings/objc/WebScriptObject.h:
859         * bindings/objc/objc_class.mm:
860         (ObjcClass::fallbackObject):
861         * bindings/objc/objc_instance.h:
862         * bindings/objc/objc_instance.mm:
863         (ObjcInstance::invokeDefaultMethod):
864         * bindings/objc/objc_runtime.h:
865         * bindings/objc/objc_runtime.mm:
866         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
867         (ObjcFallbackObjectImp::get):
868         (ObjcFallbackObjectImp::put):
869         (ObjcFallbackObjectImp::canPut):
870         (ObjcFallbackObjectImp::implementsCall):
871         (ObjcFallbackObjectImp::call):
872         (ObjcFallbackObjectImp::hasProperty):
873         (ObjcFallbackObjectImp::deleteProperty):
874         (ObjcFallbackObjectImp::defaultValue):
875         * bindings/runtime.h:
876         (KJS::Bindings::Class::fallbackObject):
877         (KJS::Bindings::Instance::getValueOfUndefinedField):
878         (KJS::Bindings::Instance::setValueOfUndefinedField):
879         (KJS::Bindings::Instance::valueOf):
880         * bindings/runtime_object.cpp:
881         (RuntimeObjectImp::implementsCall):
882         (RuntimeObjectImp::call):
883         * bindings/runtime_object.h:
884
885 2004-09-13  Maciej Stachowiak  <mjs@apple.com>
886
887         Reviewed by Darin.
888
889         <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
890         
891         * kjs/string_object.cpp:
892         (StringProtoFuncImp::call): Replaced implementation of replace()
893         method with function below...
894         (replace): In order to avoid excessive allocation and copying,
895         figure out the ranges of the original string and replacement
896         strings to be assembled, instead of constantly creating new
897         strings at each substitution. The old behavior is basically O(N^2)
898         for a global replace on a pattern that matches many places in the
899         string.
900         (regExpIsGlobal): Helper function for the above.
901         (expandSourceRanges): ditto
902         (pushSourceRange): ditto
903         (expandReplacements): ditto
904         (pushReplacement): ditto
905         * kjs/ustring.cpp:
906         (KJS::UString::spliceSubstringsWithSeparators): New method that
907         pieces together substring ranges of this string together with
908         specified separators, all at one go.
909         * kjs/ustring.h:
910         (KJS::UString::Range::Range): Added new helper class to represent
911         substring choices.
912
913 2004-09-14  Maciej Stachowiak  <mjs@apple.com>
914
915         Reviewed by Darin.
916
917         - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
918         
919         * kjs/function.cpp:
920         (KJS::GlobalFuncImp::call): Make sure to escape null
921         characters. This is a bug in the new code that made part of the
922         test fail.
923
924 2004-09-13  Darin Adler  <darin@apple.com>
925
926         Reviewed by Kevin and Maciej.
927
928         - new function to support fix for DIG bug in WebCore
929
930         * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
931         * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
932
933 2004-09-12  Darin Adler  <darin@apple.com>
934
935         * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
936         of escape and unescape.
937
938 2004-09-12  Darin Adler  <darin@apple.com>
939
940         Reviewed by Maciej.
941
942         - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
943
944         * kjs/date_object.cpp:
945         (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
946         uses CFDateFormatter.
947         (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
948
949 2004-09-09  Maciej Stachowiak  <mjs@apple.com>
950
951         Reviewed by Richard.
952
953         <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
954
955         * kjs/function.cpp:
956         (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
957         ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
958         * kjs/lexer.cpp:
959         (Lexer::isHexDigit): Made static and non-const.
960         * kjs/lexer.h:
961
962 === Safari-163 ===
963
964 2004-09-06  Darin Adler  <darin@apple.com>
965
966         * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
967
968 === Safari-162 ===
969
970 2004-09-01  Richard Williamson   <rjw@apple.com>
971
972         Add pid to exception messages (to help debug dashboard clients).
973
974         Reviewed by Chris.
975
976         * kjs/interpreter.cpp:
977         (Interpreter::evaluate):
978
979 === Safari-161 ===
980
981 2004-08-20  Richard Williamson   <rjw@apple.com>
982
983         Implemented new JNI abstraction.  We no longer invoke Java methods
984         directly with JNI, rather we call into the plugin.  This allows the
985         plugin to dispatch the call to the appropriate VM thread.  This
986         change should (will?) fix a whole class of threading related problems with
987         the Java VM.
988
989         Reviewed by Hyatt.
990
991         * JavaScriptCore.pbproj/project.pbxproj:
992         * bindings/c/c_instance.h:
993         (KJS::Bindings::CInstance::setExecutionContext):
994         (KJS::Bindings::CInstance::executionContext):
995         * bindings/jni/jni_instance.cpp:
996         (JavaInstance::JavaInstance):
997         (JavaInstance::invokeMethod):
998         (JavaInstance::setExecutionContext):
999         (JavaInstance::executionContext):
1000         * bindings/jni/jni_instance.h:
1001         * bindings/jni/jni_jsobject.cpp:
1002         (JSObject::convertJObjectToValue):
1003         * bindings/jni/jni_runtime.cpp:
1004         (JavaField::JavaField):
1005         (JavaArray::convertJObjectToArray):
1006         (JavaField::valueFromInstance):
1007         (JavaArray::JavaArray):
1008         (JavaArray::valueAt):
1009         * bindings/jni/jni_runtime.h:
1010         (KJS::Bindings::JavaArray::operator=):
1011         (KJS::Bindings::JavaArray::executionContext):
1012         * bindings/jni/jni_utility.h:
1013         * bindings/objc/objc_instance.h:
1014         (KJS::Bindings::ObjcInstance::setExecutionContext):
1015         (KJS::Bindings::ObjcInstance::executionContext):
1016         * bindings/runtime.cpp:
1017         (Instance::createBindingForLanguageInstance):
1018         * bindings/runtime.h:
1019         * bindings/runtime_root.h:
1020         (KJS::Bindings::RootObject::nativeHandle):
1021
1022 === Safari-158 ===
1023
1024 2004-08-19  Vicki Murley  <vicki@apple.com>
1025
1026         Reviewed by John.
1027
1028         * kjs/property_map.cpp:
1029         (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
1030
1031 2004-08-17  Darin Adler  <darin@apple.com>
1032
1033         Reviewed by Adele.
1034
1035         - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
1036
1037         * kjs/property_map.h: Added some private functions.
1038         * kjs/property_map.cpp:
1039         (KJS::PropertyMap::clear): Set sentinelCount to 0.
1040         (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
1041         Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
1042         (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
1043         (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
1044         (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
1045         deleted-element sentinels.
1046         (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
1047
1048 2004-08-16  Maciej Stachowiak  <mjs@apple.com>
1049
1050         Code change by Eric Albert, reviewd by me.
1051
1052         <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
1053
1054         * kjs/date_object.cpp:
1055         (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
1056         entirely would be even better, but is not required to fix this bug.
1057
1058 === Safari-157 ===
1059
1060 2004-08-16  Richard Williamson   <rjw@apple.com>
1061
1062         Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
1063
1064         Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
1065
1066         Reviewed by Chris.
1067
1068         * bindings/NP_jsobject.cpp:
1069         (NPN_Evaluate):
1070         * bindings/jni/jni_jsobject.cpp:
1071         (JSObject::eval):
1072         * bindings/objc/WebScriptObject.mm:
1073         (-[WebScriptObject evaluateWebScript:]):
1074
1075 2004-08-15  Richard Williamson   <rjw@apple.com>
1076
1077         More updates to np headers.  Implemented new NPN functions.
1078
1079         Reviewed by Darin.
1080
1081         * bindings/NP_jsobject.cpp:
1082         (NPN_HasProperty):
1083         (NPN_HasMethod):
1084         * bindings/npapi.h:
1085         * bindings/npruntime.h:
1086
1087 2004-08-13  Darin Adler  <darin@apple.com>
1088
1089         - fix build so we can compile again
1090
1091         * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
1092         is good enough so that we can compile, but it's only a stopgap measure, because I think
1093         Richard has a newer one he wants to check in.
1094
1095 2004-08-12  Richard Williamson   <rjw@apple.com>
1096
1097         Bring npruntime.h and friends closer to compliance with
1098         latest spec.
1099
1100         Reviewed by Maciej.
1101
1102         * JavaScriptCore.pbproj/project.pbxproj:
1103         * bindings/NP_jsobject.cpp:
1104         (jsAllocate):
1105         (_NPN_CreateScriptObject):
1106         (NPN_Call):
1107         (NPN_Evaluate):
1108         (NPN_GetProperty):
1109         (NPN_SetProperty):
1110         (NPN_RemoveProperty):
1111         * bindings/NP_jsobject.h:
1112         * bindings/c/c_instance.cpp:
1113         (CInstance::invokeMethod):
1114         * bindings/c/c_utility.cpp:
1115         (convertNPVariantToValue):
1116         * bindings/npruntime.cpp:
1117         (NPN_IdentifierIsString):
1118         (NPN_VariantIsVoid):
1119         (NPN_VariantIsNull):
1120         (NPN_VariantIsUndefined):
1121         (NPN_VariantIsBool):
1122         (NPN_VariantIsInt32):
1123         (NPN_VariantIsDouble):
1124         (NPN_VariantIsString):
1125         (NPN_VariantIsObject):
1126         (NPN_VariantToBool):
1127         (NPN_VariantToString):
1128         (NPN_VariantToInt32):
1129         (NPN_VariantToDouble):
1130         (NPN_VariantToObject):
1131         (NPN_InitializeVariantAsVoid):
1132         (NPN_InitializeVariantAsNull):
1133         (NPN_InitializeVariantAsUndefined):
1134         (NPN_InitializeVariantWithBool):
1135         (NPN_InitializeVariantWithInt32):
1136         (NPN_InitializeVariantWithDouble):
1137         (NPN_InitializeVariantWithString):
1138         (NPN_InitializeVariantWithStringCopy):
1139         (NPN_InitializeVariantWithObject):
1140         (NPN_InitializeVariantWithVariant):
1141         (NPN_ReleaseVariantValue):
1142         (NPN_CreateObject):
1143         * bindings/npruntime.h:
1144         (_NPString::):
1145         (_NPString::_NPVariant::):
1146         * bindings/npruntime_priv.h: Added.
1147
1148 2004-08-12  Darin Adler  <darin@apple.com>
1149
1150         Reviewed by Adele.
1151
1152         - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
1153
1154         * kjs/function.cpp:
1155         (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
1156         (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
1157         (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
1158         to skip leading "+" or "-".
1159
1160 === Safari-156 ===
1161
1162 2004-08-12  Darin Adler  <darin@apple.com>
1163
1164         Reviewed by Ken.
1165
1166         - fixed 43 Mozilla JavaScript tests
1167
1168         * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
1169         * kjs/date_object.cpp:
1170         (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
1171         than constructing a number object to pass to it.
1172         (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
1173         (KJS::parseDate): Change to return a double instead of creating the Number object here.
1174         (KJS::timeClip): Implement this as specified in the language standard.
1175
1176         * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
1177         flags on the prototype property.
1178
1179         * kjs/function.cpp:
1180         (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
1181         currently in scope.
1182         (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
1183         file later.
1184         (KJS::parseDigit): Added. Helper function for parseInt.
1185         (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
1186         strtoll can handle. Also matches standard more closely.
1187         (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
1188         instead of 0.
1189         (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
1190
1191         * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
1192
1193         * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
1194         * kjs/lexer.cpp:
1195         (Lexer::setCode): Clear error state.
1196         (Lexer::lex): Set error state if the lexer encounters an error
1197
1198         * kjs/internal.cpp:
1199         (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
1200         (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
1201
1202         * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
1203         Change round to round values between -0.5 and -0 to -0 instead of +0.
1204
1205         * kjs/nodes.h: Add evaluateReference function to GroupNode.
1206         * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
1207         expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
1208         would change x.y into a value that can't be deleted as a side effect.
1209
1210         * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
1211         the specification.
1212
1213         * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
1214         get rid of the fixed size limit for code.
1215
1216         * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
1217         returns the string without creating a new Rep, since I'm using substr in a place where it will
1218         often be passed a 0.
1219
1220         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
1221         the other day that was making a couple tests fail.
1222         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1223         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1224         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1225         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1226         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1227
1228         * kjs/string_object.lut.h: Regenerated.
1229
1230 2004-08-11  Darin Adler  <darin@apple.com>
1231
1232         - fixed a tiny problem with the UTF-16 PCRE check-in
1233
1234         * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
1235         the ctype_meta flag to get set in items that should not have it.
1236
1237         * pcre/chartables.c: Regenerated.
1238
1239 2004-08-10  Richard Williamson   <rjw@apple.com>
1240
1241         Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
1242
1243         The following WebScripting methods are now supported on bound
1244         objects:
1245
1246         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
1247         - (void)setValue:(id)value forUndefinedKey:(NSString *)key
1248         - (id)valueForUndefinedKey:(NSString *)key
1249
1250         Reviewed by Chris.
1251
1252         * bindings/c/c_class.cpp:
1253         (CClass::fieldNamed):
1254         * bindings/c/c_class.h:
1255         * bindings/jni/jni_class.cpp:
1256         (JavaClass::fieldNamed):
1257         * bindings/jni/jni_class.h:
1258         * bindings/objc/objc_class.h:
1259         (KJS::Bindings::ObjcClass::isa):
1260         * bindings/objc/objc_class.mm:
1261         (ObjcClass::methodsNamed):
1262         (ObjcClass::fieldNamed):
1263         (ObjcClass::fallbackObject):
1264         * bindings/objc/objc_instance.h:
1265         * bindings/objc/objc_instance.mm:
1266         (ObjcInstance::invokeMethod):
1267         (ObjcInstance::setValueOfField):
1268         (ObjcInstance::setValueOfUndefinedField):
1269         (ObjcInstance::getValueOfField):
1270         (ObjcInstance::getValueOfUndefinedField):
1271         * bindings/objc/objc_runtime.h:
1272         (KJS::Bindings::ObjcField::~ObjcField):
1273         (KJS::Bindings::ObjcField::ObjcField):
1274         (KJS::Bindings::ObjcField::operator=):
1275         (KJS::Bindings::FallbackObjectImp::classInfo):
1276         * bindings/objc/objc_runtime.mm:
1277         (ObjcField::ObjcField):
1278         (ObjcField::name):
1279         (ObjcField::type):
1280         (ObjcField::valueFromInstance):
1281         (ObjcField::setValueToInstance):
1282         (FallbackObjectImp::FallbackObjectImp):
1283         (FallbackObjectImp::get):
1284         (FallbackObjectImp::put):
1285         (FallbackObjectImp::canPut):
1286         (FallbackObjectImp::implementsCall):
1287         (FallbackObjectImp::call):
1288         (FallbackObjectImp::hasProperty):
1289         (FallbackObjectImp::deleteProperty):
1290         (FallbackObjectImp::defaultValue):
1291         * bindings/runtime.h:
1292         (KJS::Bindings::Class::fallbackObject):
1293         (KJS::Bindings::Instance::getValueOfUndefinedField):
1294         (KJS::Bindings::Instance::setValueOfUndefinedField):
1295         * bindings/runtime_object.cpp:
1296         (RuntimeObjectImp::get):
1297         (RuntimeObjectImp::put):
1298         (RuntimeObjectImp::canPut):
1299         (RuntimeObjectImp::hasProperty):
1300         * bindings/testbindings.mm:
1301         (-[MyFirstInterface valueForUndefinedKey:]):
1302         (-[MyFirstInterface setValue:forUndefinedKey:]):
1303
1304 2004-08-10  Darin Adler  <darin@apple.com>
1305
1306         Reviewed by Dave.
1307
1308         - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
1309
1310         * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
1311         or uint16_t depending on the mode, and used appropriate in the 7 public functions
1312         that need to use it.
1313         * pcre/pcre.c: Add UTF-16 support to all functions.
1314         * pcre/study.c: Ditto.
1315
1316         * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
1317         the mode. Changed declarations to use symbolic constants and typedefs so we size
1318         things to ichar when needed.
1319
1320         * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
1321         sized to 16-bit characters instead of 8-bit.
1322
1323         * pcre/get.c:
1324         (pcre_copy_substring): Use pcre_char instead of char.
1325         (pcre_get_substring_list): Ditto.
1326         (pcre_free_substring_list): Ditto.
1327         (pcre_get_substring): Ditto.
1328         (pcre_free_substring): Ditto.
1329
1330         * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
1331         of hard-coding 8-bit table sizes.
1332
1333         * pcre/chartables.c: Regenerated.
1334
1335         * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
1336         * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
1337         is not null. The null string still has a null pointer. This prevents us from
1338         passing a null through to the regular expression engine (which results in a null
1339         error even when the string length is 0).
1340
1341         * kjs/regexp.cpp:
1342         (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
1343         (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
1344
1345 2004-08-09  Darin Adler  <darin@apple.com>
1346
1347         Reviewed by Maciej.
1348
1349         - fixed 28 Mozilla JavaScript tests
1350
1351         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
1352         checking the number of arguments for the join method.
1353
1354         * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
1355         than integers, so we aren't limited to 32 bits.
1356
1357         * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
1358         the implementation of the pow operation. Also simplied a case that was handling positive
1359         and negative infinity separately.
1360
1361         * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
1362         putting them in a long, so that unsigned shift will work properly.
1363
1364         * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
1365
1366         * kjs/operations.cpp:
1367         (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
1368         sign of isinf; our isinf function returns +1 even for negative infinity.
1369         (KJS::isNegInf): And again.
1370         (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
1371         Our floating point already handles the various infinity cases correctly.
1372
1373         * kjs/regexp_object.cpp:
1374         (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
1375         (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
1376         array in cases where we did not match.
1377         (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
1378         "global", "ignoreCase", "multiline", and "source".
1379
1380         * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
1381         string into undefined rather than an empty string. For the slice method, handle an
1382         undefined parameter for the limit properly as decribed in the specification, and add
1383         the limit to one case that didn't have the limit at all. For the methods that generate
1384         HTML strings, use lowercase tags instead of uppercase.
1385
1386         * kjs/ustring.cpp:
1387         (KJS::UChar::toLower): Use u_tolower from the ICU library.
1388         (KJS::UChar::toUpper): Use u_toupper from the ICU library.
1389         (KJS::UString::append): Fix some math that caused a buffer overflow.
1390         (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
1391         flag) rather than converting them all to 0.
1392         (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
1393
1394         * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
1395
1396         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
1397         the Unicode specification in a few cases where it was wrong before.
1398         * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
1399         * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
1400         * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
1401         * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
1402         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1403         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1404         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1405         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1406         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1407
1408         * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
1409
1410         * kjs/number_object.lut.h: Regenerated.
1411
1412 2004-08-09  Darin Adler  <darin@apple.com>
1413
1414         Reviewed by Maciej.
1415
1416         - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
1417
1418         * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
1419         we get a buffer overflow.
1420
1421 === Safari-155 ===
1422
1423 2004-08-05  Richard Williamson   <rjw@apple.com>
1424
1425         Fixed part of 3674747.  The QT guys need this for feature freeze.
1426
1427         This patch implements support for the
1428
1429         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
1430
1431         method of objects bound to JavaScript.
1432
1433         Reviewed by John.
1434
1435         * ChangeLog:
1436         * bindings/objc/objc_class.mm:
1437         (ObjcClass::methodsNamed):
1438         (ObjcClass::fieldNamed):
1439         * bindings/objc/objc_instance.mm:
1440         (ObjcInstance::invokeMethod):
1441         * bindings/objc/objc_runtime.h:
1442         (KJS::Bindings::ObjcMethod::~ObjcMethod):
1443         (KJS::Bindings::ObjcMethod::isFallbackMethod):
1444         (KJS::Bindings::ObjcMethod::javaScriptName):
1445         * bindings/objc/objc_runtime.mm:
1446         (ObjcMethod::ObjcMethod):
1447         (ObjcMethod::getMethodSignature):
1448         (ObjcMethod::setJavaScriptName):
1449         * bindings/testbindings.mm:
1450
1451 2004-08-04  Vicki Murley  <vicki@apple.com>
1452
1453         Reviewed by mjs.
1454  
1455         - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error        
1456
1457         * kjs/lexer.cpp:
1458         (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
1459         go to the next line and continue parsing the string (instead of failing).  This matches 
1460         behavior in Mac IE and Mozilla.
1461
1462 2004-08-03  Kevin Decker  <kdecker@apple.com>
1463
1464         Reviewed by Darin.
1465
1466         Rolled in changes from the latest KJS sources that support additional 
1467         Number.prototype functions. 
1468
1469         Specifically this patch covers the follow parts of the ECMA 3 spec:
1470         15.7.4.5, 15.7.4.6, and 15.7.4.7 
1471         
1472         Fixes:
1473         <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
1474         <rdar://problem/3749492> missing Number.toPrecision prototype implementation
1475         <rdar://problem/3749591> missing Number.toExponential prototype implementation
1476
1477         * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
1478         list of supported identifiers (a macro).
1479         * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
1480         and toExponential(). 
1481         (NumberPrototypeImp::NumberPrototypeImp):
1482         (NumberProtoFuncImp::call):
1483         * kjs/number_object.h: Added property names for toFixed, toPrecision,
1484         and toExponential. 
1485         (KJS::NumberProtoFuncImp::):
1486         * tests/mozilla/expected.html: Update results.
1487
1488 2004-08-03  Darin Adler  <darin@apple.com>
1489
1490         Reviewed by Ken.
1491
1492         - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
1493
1494         * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
1495         we are supposed to just copy the regular expression object, and do so.
1496         Also tighten up arguments check to handle case where an actual "undefined"
1497         is passed rather than just omitting an argument.
1498
1499         * tests/mozilla/expected.html: Update results.
1500
1501 2004-08-02  Darin Adler  <darin@apple.com>
1502
1503         * tests/mozilla/.cvsignore: Added.
1504         * tests/mozilla/expected.html: Update results.
1505
1506 2004-08-02  Darin Adler  <darin@apple.com>
1507
1508         Reviewed by Ken.
1509
1510         - fixed RegExp.toString so 3 more Mozilla regexp tests pass
1511
1512         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
1513         Append the flags here so more tests paseed.
1514
1515 2004-08-02  Darin Adler  <darin@apple.com>
1516
1517         Reviewed by Ken.
1518
1519         - fixed a couple things making 5 Mozilla regexp tests pass
1520
1521         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
1522         for the prototype.
1523         (RegExpObjectImp::construct): Fix bug where the string "undefined" would
1524         be used as the flags string when no parameter was passed.
1525
1526         * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
1527         Added a class info object for RegExp prototype so it can return
1528         a string instead of raising an exception when converting to a string.
1529
1530         * tests/mozilla/expected.html: Update results.
1531
1532 2004-08-02  Darin Adler  <darin@apple.com>
1533
1534         Reviewed by Kevin.
1535
1536         - fix crashes in mozilla tests due to mishandling NaN
1537
1538         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
1539         calls to toInteger so that NaN will get turned into something that fits in an integer.
1540         These were the ones John already fixed, but his fix used isnan and the new fix is
1541         more efficient.
1542
1543         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
1544         after a call to toInteger to handle NaN properly. Also removed separate check
1545         for undefined that's not needed.
1546
1547         * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
1548         as in the above two files, but for a lot more functions. Also changed one place with
1549         an explicit check for undefined to instead just check isNaN.
1550
1551         * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
1552         like me who don't keep $SYMROOTS in their $PATH.
1553
1554 === Safari-154 ===
1555
1556 === Safari-153 ===
1557
1558 2004-07-26  Kevin Decker  <kdecker@apple.com>
1559
1560         Changes done by Darin, reviewed by Kevin.
1561
1562         - changed testkjs to build in Xcode rather than from Makefile
1563
1564         * .cvsignore: Removed obsolete files from this list.
1565         * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
1566         Changed to build target "All" rather than default target. This makes us
1567         build the testkjs test tool.
1568         * dummy.cpp: Removed.
1569         * kjs/.cvsignore: Removed obsolete files from this list, including
1570         the testkjs tool, which is now built in the symroots directory.
1571         * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
1572         changed this file. Also this has the nice side effect of causing the tool
1573         to be rebuilt in the new location even if there are no other changes in
1574         your tree when you check this out.
1575         * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
1576         without setting the execute bit on jsDriver.pl.
1577
1578 2004-07-22  Kevin Decker  <kdecker@apple.com>
1579
1580         Reviewed by Darin
1581         
1582         Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions). 
1583
1584         * kjs/function_object.cpp:
1585         (FunctionObjectImp::construct):
1586         * kjs/function_object.h:
1587         * kjs/object.cpp:
1588         (KJS::ObjectImp::construct):
1589         * kjs/object.h:
1590         (KJS::Object::construct):
1591
1592 2004-07-21  Darin Adler  <darin@apple.com>
1593
1594         * bindings/npruntime.h: Fixed typo.
1595
1596 2004-07-19  John Sullivan  <sullivan@apple.com>
1597
1598         Reviewed by Maciej.
1599         
1600         - bulletproofed array.slice() against NAN arguments. Harri noticed this
1601         vulnerability in my patch for 3714644
1602
1603         * kjs/array_object.cpp:
1604         (ArrayProtoFuncImp::call):
1605         handle NAN parameters passed to slice() by clamping to 0 and length.
1606
1607 2004-07-19  Richard Williamson   <rjw@apple.com>
1608
1609         Fixed 3733349.  Prevent Java applet callbacks into JavaScript after applet
1610         has been destroyed.
1611
1612         Reviewed by John.
1613
1614         * bindings/jni/jni_jsobject.cpp:
1615         (JSObject::invoke):
1616         (JSObject::JSObject):
1617
1618 2004-07-16  John Sullivan  <sullivan@apple.com>
1619
1620         Reviewed by Maciej.
1621         
1622         - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link 
1623         hangs browser with javascript
1624
1625         * kjs/array_object.cpp:
1626         (ArrayProtoFuncImp::call):
1627         Check for undefined type for args[0] the same way we were already checking
1628         for args[1]. In this case, args was zero-length, but we were treating
1629         args[0] like an integer anyway. Resulted in some code looping from a NAN
1630         value to 4, taking approximately forever.
1631
1632         * JavaScriptCore.pbproj/project.pbxproj:
1633         version wars
1634         
1635 === Safari-152 ===
1636
1637 2004-07-14  Maciej Stachowiak  <mjs@apple.com>
1638
1639         Reviewed by John.
1640
1641         <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
1642         <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
1643
1644         * kjs/number_object.cpp:
1645         (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
1646
1647 2004-07-13  Kevin Decker  <kdecker@apple.com>
1648
1649         Reviewed by kocienda.
1650
1651         - made testkjs and JavaScriptCore a subtarget of 'All'
1652         - testkjs now builds in $SYMROOTS
1653
1654         * JavaScriptCore.pbproj/project.pbxproj:
1655
1656 === Safari-151 ===
1657
1658 2004-06-24  Chris Blumenberg  <cblu@apple.com>
1659
1660         Ignore .mode1 files in JavaScriptCore.pbproj
1661
1662         Reviewed by kocienda.
1663
1664         * JavaScriptCore.pbproj/.cvsignore:
1665
1666 2004-06-23  Richard Williamson   <rjw@apple.com>
1667
1668         Implemented changes for latest npruntime.h.
1669         
1670         Reviewed by Chris.
1671
1672         * JavaScriptCore.pbproj/project.pbxproj:
1673         * bindings/NP_jsobject.cpp:
1674         (listFromVariantArgs):
1675         (identiferFromNPIdentifier):
1676         (_NPN_CreateScriptObject):
1677         (NPN_Call):
1678         (NPN_Evaluate):
1679         (NPN_GetProperty):
1680         (NPN_SetProperty):
1681         (NPN_RemoveProperty):
1682         * bindings/NP_jsobject.h:
1683         * bindings/c/c_class.cpp:
1684         (CClass::methodsNamed):
1685         (CClass::fieldNamed):
1686         * bindings/c/c_instance.cpp:
1687         (CInstance::invokeMethod):
1688         * bindings/c/c_utility.cpp:
1689         (convertNPVariantToValue):
1690         * bindings/c/c_utility.h:
1691         * bindings/npruntime.cpp:
1692         (stringIdentifierEqual):
1693         (stringIdentifierHash):
1694         (getStringIdentifierDictionary):
1695         (intIdentifierEqual):
1696         (intIdentifierHash):
1697         (getIntIdentifierDictionary):
1698         (NPN_GetStringIdentifier):
1699         (NPN_GetStringIdentifiers):
1700         (NPN_GetIntIdentifier):
1701         (NPN_IdentifierIsString):
1702         (NPN_UTF8FromIdentifier):
1703         (NPN_VariantToInt32):
1704         (NPN_VariantToDouble):
1705         (NPN_SetException):
1706         * bindings/npruntime.h:
1707         * bindings/objc/WebScriptObject.mm:
1708         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1709         * bindings/runtime_object.cpp:
1710         (RuntimeObjectImp::~RuntimeObjectImp):
1711         * bindings/runtime_root.cpp:
1712         (KJS::Bindings::rootForInterpreter):
1713         * bindings/testbindings.cpp:
1714         (initializeIdentifiers):
1715         (logMessage):
1716         (setDoubleValue):
1717         (setIntValue):
1718         (setBooleanValue):
1719
1720 === JavaScriptCore-146.1 ===
1721
1722 2004-06-16  Richard Williamson   <rjw@apple.com>
1723
1724         Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1725
1726         This turned out to be a show stopper for Dashboard.  Accessing a nil
1727         ObjC property from JS caused a crash.  Similar to the problem
1728         3696112 fixed below.
1729         
1730         Reviewed by Trey.
1731
1732         * bindings/objc/objc_runtime.mm:
1733         (KJS::Bindings::ObjcField::valueFromInstance):
1734
1735 === Safari-146 ===
1736
1737 2004-06-16  Richard Williamson   <rjw@apple.com>
1738
1739         Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1740
1741         This turned out to be a show stopper for Dashboard.  We now
1742         return Undefined() when nil is returned from a ObjC method
1743         that returns an object type.
1744         
1745         Reviewed by Maciej.
1746
1747         * bindings/objc/objc_utility.mm:
1748         (KJS::Bindings::convertObjcValueToValue):
1749
1750 === Safari-145 ===
1751
1752 2004-06-15  Richard Williamson   <rjw@apple.com>
1753
1754         Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1755
1756         No longer need to check respondsToSelector: for
1757         isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1758         because these now have a default implementation on NSObject.
1759
1760         Reviewed by Trey.
1761
1762         * bindings/objc/objc_class.mm:
1763         (ObjcClass::methodsNamed):
1764         (ObjcClass::fieldNamed):
1765
1766 2004-06-14  Darin Adler  <darin@apple.com>
1767
1768         Reviewed by Maciej.
1769
1770         - fixed some things for GC that Patrick missed, or that happened after the branch
1771
1772         * bindings/objc/WebScriptObject.mm:
1773         (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1774         (-[WebScriptObject finalize]): Added.
1775
1776         - added some missing nil checks
1777
1778         * bindings/objc/objc_instance.mm:
1779         (ObjcInstance::ObjcInstance): Check for nil.
1780         (ObjcInstance::~ObjcInstance): Check for nil.
1781         (ObjcInstance::operator=): Check for nil.
1782
1783 2004-06-14  Darin Adler  <darin@apple.com>
1784
1785         Reviewed by me, code changes by Patrick Beard.
1786
1787         - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1788
1789         * bindings/objc/objc_instance.mm:
1790         (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1791         (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1792         (ObjcInstance::operator=): More of the same.
1793         (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1794
1795         * bindings/objc/objc_runtime.mm:
1796         (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1797         (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1798         (ObjcArray::operator=): More of the same.
1799
1800         * bindings/testbindings.mm: Fixed incorrect license.
1801         (main): Use [pool drain] if compiling on Tiger.
1802
1803 === Safari-144 ===
1804
1805 2004-06-10  Kevin Decker  <kdecker@apple.com>
1806
1807         Reviewed by John.
1808
1809         * kjs/lexer.cpp: 
1810         (Lexer::setCode):
1811             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1812         * kjs/lexer.h:
1813         (KJS::Lexer::lineNo):
1814             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1815
1816 === JavaScriptCore-143.2 ===
1817
1818 2004-06-07  Darin Adler  <darin@apple.com>
1819
1820         - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1821
1822         * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1823         * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1824
1825 === JavaScriptCore-143.1 ===
1826
1827 2004-06-04  Kevin Decker  <kdecker@apple.com>
1828
1829         Reviewed by Darin
1830         
1831         - fixed <rdar://problem/3680594>
1832
1833         * kjs/object.cpp:
1834         (KJS::Error::create):
1835
1836 === Safari-143 ===
1837
1838 2004-06-04  Darin Adler  <darin@apple.com>
1839
1840         * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1841
1842 2004-06-04  Kevin Decker  <kdecker@apple.com>
1843
1844         Reviewed by Dave.
1845
1846         - ObjC bindings do not (yet) pass along sourceurl or line numbers
1847         - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1848         - changed the wording of an error message
1849         - the lexer, parser, and interpreter have been made "sourceURL aware"
1850         - stored the url into Error
1851          
1852         * bindings/NP_jsobject.cpp:
1853         (NPN_Evaluate):
1854         * bindings/jni/jni_jsobject.cpp:
1855         (JSObject::eval):
1856         * bindings/objc/WebScriptObject.mm:
1857         (-[WebScriptObject evaluateWebScript:]):
1858         * kjs/function.cpp:
1859         (GlobalFuncImp::call):
1860         * kjs/function_object.cpp:
1861         (FunctionObjectImp::construct):
1862         * kjs/internal.cpp:
1863         (Parser::parse):
1864         (InterpreterImp::checkSyntax):
1865         (InterpreterImp::evaluate):
1866         * kjs/internal.h:
1867         * kjs/interpreter.cpp:
1868         (Interpreter::evaluate):
1869         * kjs/interpreter.h:
1870         * kjs/lexer.cpp:
1871         (Lexer::setCode):
1872         * kjs/lexer.h:
1873         (KJS::Lexer::sourceURL):
1874         * kjs/nodes.cpp:
1875         (Node::Node):
1876         (Node::throwError):
1877         (FunctionCallNode::evaluate):
1878         * kjs/nodes.h:
1879         * kjs/object.cpp:
1880         (KJS::Error::create):
1881         * kjs/object.h:
1882
1883 2004-06-04  Richard Williamson   <rjw@apple.com>
1884
1885         Fixed crash when attempting to access properties on nil
1886         object.
1887         
1888         Reviewed by John.
1889
1890         * bindings/objc/objc_instance.mm:
1891         (ObjcInstance::getClass):
1892         * bindings/runtime_object.cpp:
1893         (RuntimeObjectImp::get):
1894         * bindings/testM.js:
1895         * bindings/testbindings.mm:
1896         (-[MyFirstInterface getString]):
1897
1898 2004-05-27  Kevin Decker  <kdecker@apple.com>
1899
1900         Reviewed by Ken.
1901
1902         -revised generated error message content
1903         
1904         * kjs/error_object.cpp:
1905         (ErrorProtoFuncImp::call):
1906         * kjs/internal.cpp:
1907         (Parser::parse):
1908         * kjs/object.cpp:
1909         (KJS::Error::create):
1910
1911 === Safari-142 ===
1912
1913 2004-05-27  Richard Williamson   <rjw@apple.com>
1914
1915         Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1916
1917         Reviewed by Chris.
1918
1919         * bindings/objc/WebScriptObject.h:
1920
1921 2004-05-27  Darin Adler  <darin@apple.com>
1922
1923         Reviewed by Maciej.
1924
1925         - moved to new symlink technique for embedding frameworks
1926
1927         * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1928         because we don't need it any more.
1929
1930 2004-05-24  Richard Williamson   <rjw@apple.com>
1931
1932         Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1933         fixed ClassInfo to correctly reflect inheritance.  This is required
1934         because of the runtime checks in JSC for arrays, i.e. in
1935         the Function objects apply method.
1936
1937         Reviewed by Ken.
1938
1939         * bindings/jni/jni_runtime.cpp:
1940         (JavaArray::convertJObjectToArray):
1941         * bindings/objc/objc_utility.mm:
1942         (KJS::Bindings::convertObjcValueToValue):
1943         * bindings/runtime_array.cpp:
1944         (RuntimeArrayImp::RuntimeArrayImp):
1945         * bindings/runtime_array.h:
1946         * bindings/testM.js: Added.
1947         * bindings/testbindings.mm:
1948         (+[MyFirstInterface webScriptNameForSelector:]):
1949         (-[MyFirstInterface logMessages:]):
1950         (-[MyFirstInterface logMessage:prefix:]):
1951         (-[MyFirstInterface callJSObject::]):
1952
1953 2004-05-22  Darin Adler  <darin@apple.com>
1954
1955         Reviewed by Maciej.
1956
1957         - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
1958
1959         * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
1960         with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
1961         CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
1962         it hasn't been set explicitly.
1963
1964 === Safari-141 ===
1965
1966 2004-05-20  Richard Williamson   <rjw@apple.com>
1967
1968         Implemented WebScriptObject/DOM wrapper voodoo.  DOM wrappers
1969         can now be referenced like any other WebScriptObject, meaning
1970         you can do JS operations on them.
1971
1972         All added implementation of finalizeForWebScript.
1973
1974         Reviewed by Ken.
1975
1976         * bindings/objc/WebScriptObject.h:
1977         * bindings/objc/WebScriptObject.mm:
1978         (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1979         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1980         (-[WebScriptObject KJS::]):
1981         (-[WebScriptObject dealloc]):
1982         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1983         (-[WebScriptObject evaluateWebScript:]):
1984         (-[WebScriptObject setValue:forKey:]):
1985         (-[WebScriptObject valueForKey:]):
1986         (-[WebScriptObject stringRepresentation]):
1987         * bindings/objc/WebScriptObjectPrivate.h:
1988         * bindings/objc/objc_instance.mm:
1989         (ObjcInstance::~ObjcInstance):
1990
1991 2004-05-19  Richard Williamson   <rjw@apple.com>
1992
1993         Removed extraneous tabs that were added (by XCode?).
1994
1995         * bindings/objc/WebScriptObject.h:
1996
1997 2004-05-19  Darin Adler  <darin@apple.com>
1998
1999         - fixed headers with licenses mangled by Xcode auto-indenting
2000
2001         * bindings/jni/jni_jsobject.cpp:
2002         * bindings/jni/jni_jsobject.h:
2003         * bindings/runtime_array.h:
2004         * bindings/runtime_root.cpp:
2005         * bindings/runtime_root.h:
2006
2007 2004-05-18  Richard Williamson   <rjw@apple.com>
2008
2009         Added exception logging.  Also check for exception and
2010         set results as appropriate.
2011
2012         Reviewed by Maciej (partially reviewed).
2013
2014         * bindings/objc/WebScriptObject.mm:
2015         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2016         (-[WebScriptObject evaluateWebScript:]):
2017         (-[WebScriptObject setValue:forKey:]):
2018         (-[WebScriptObject valueForKey:]):
2019
2020 2004-05-18  Richard Williamson   <rjw@apple.com>
2021
2022         Finsished implementing support for windowScriptObject.
2023         Had to make WebScriptObjectPrivate.h accessible from
2024         WebCore.
2025
2026         Reviewed by Maciej.
2027
2028         * JavaScriptCore.pbproj/project.pbxproj:
2029         * bindings/objc/WebScriptObjectPrivate.h:
2030
2031 2004-05-18  Richard Williamson   <rjw@apple.com>
2032
2033         Use KVC to set/get values instead of directly accessing
2034         ivars.
2035
2036         Reviewed by Maciej.
2037
2038         * bindings/objc/WebScriptObject.mm:
2039         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2040         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2041         * bindings/objc/objc_runtime.mm:
2042         (ObjcField::valueFromInstance):
2043         (convertValueToObjcObject):
2044         (ObjcField::setValueToInstance):
2045
2046 2004-05-17  Richard Williamson   <rjw@apple.com>
2047
2048         Implemented new API for WebScriptObject.
2049
2050         Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
2051         Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object)  (w/ help from Vicki)
2052
2053         Reviewed by Hyatt.
2054
2055         * JavaScriptCore.pbproj/project.pbxproj:
2056         * bindings/c/c_instance.cpp:
2057         (CInstance::invokeMethod):
2058         * bindings/jni/jni_instance.cpp:
2059         (JavaInstance::invokeMethod):
2060         * bindings/jni/jni_jsobject.cpp:
2061         (JSObject::convertValueToJObject):
2062         * bindings/jni/jni_utility.cpp:
2063         (KJS::Bindings::getJNIField):
2064         * bindings/objc/WebScriptObject.mm:
2065         (_didExecute):
2066         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2067         (-[WebScriptObject KJS::]):
2068         (-[WebScriptObject dealloc]):
2069         (+[WebScriptObject throwException:]):
2070         (listFromNSArray):
2071         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2072         (-[WebScriptObject evaluateWebScript:]):
2073         (-[WebScriptObject setValue:forKey:]):
2074         (-[WebScriptObject valueForKey:]):
2075         (-[WebScriptObject stringRepresentation]):
2076         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2077         (+[WebUndefined undefined]):
2078         (-[WebUndefined initWithCoder:]):
2079         (-[WebUndefined encodeWithCoder:]):
2080         (-[WebUndefined copyWithZone:]):
2081         (-[WebUndefined retain]):
2082         (-[WebUndefined release]):
2083         (-[WebUndefined retainCount]):
2084         (-[WebUndefined autorelease]):
2085         (-[WebUndefined dealloc]):
2086         (-[WebUndefined copy]):
2087         (-[WebUndefined replacementObjectForPortCoder:]):
2088         * bindings/objc/WebScriptObjectPrivate.h: Added.
2089         * bindings/objc/objc_class.mm:
2090         (ObjcClass::methodsNamed):
2091         (ObjcClass::fieldNamed):
2092         * bindings/objc/objc_instance.mm:
2093         (ObjcInstance::invokeMethod):
2094         * bindings/objc/objc_jsobject.h:
2095         * bindings/objc/objc_jsobject.mm:
2096         * bindings/objc/objc_runtime.mm:
2097         (ObjcField::valueFromInstance):
2098         * bindings/objc/objc_utility.mm:
2099         (KJS::Bindings::JSMethodNameToObjCMethodName):
2100         (KJS::Bindings::convertValueToObjcValue):
2101         (KJS::Bindings::convertObjcValueToValue):
2102         * bindings/runtime.cpp:
2103         (Instance::setDidExecuteFunction):
2104         (Instance::didExecuteFunction):
2105         (Instance::setValueOfField):
2106         * bindings/runtime.h:
2107         * bindings/testbindings.mm:
2108         (+[MyFirstInterface webScriptNameForSelector:]):
2109         (-[MyFirstInterface callJSObject::]):
2110
2111 2004-05-14  Vicki Murley  <vicki@apple.com>
2112
2113         Reviewed by mjs.
2114  
2115         <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
2116
2117         * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
2118
2119 === Safari-140 ===
2120
2121 2004-05-13  Richard Williamson   <rjw@apple.com>
2122
2123         Fixed indentation.
2124
2125         Reviewed by Chris.
2126
2127         * ChangeLog:
2128         * bindings/objc/WebScriptObject.h:
2129
2130 2004-05-13  Richard Williamson   <rjw@apple.com>
2131
2132         Approved API changes.  Currently unimplemented.
2133
2134         Reviewed by Chris.
2135
2136         * ChangeLog:
2137         * JavaScriptCore.pbproj/project.pbxproj:
2138         * bindings/objc/WebScriptObject.h: Added.
2139         * bindings/objc/WebScriptObject.mm: Added.
2140         (+[WebScriptObject throwException:]):
2141         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2142         (-[WebScriptObject evaluateWebScript:]):
2143         (-[WebScriptObject stringRepresentation]):
2144         (+[WebUndefined undefined]):
2145         (-[WebUndefined initWithCoder:]):
2146         (-[WebUndefined encodeWithCoder:]):
2147         (-[WebUndefined copyWithZone:]):
2148
2149 2004-05-07  Vicki Murley  <vicki@apple.com>
2150
2151         Reviewed by darin.
2152
2153         Turn off GC since it uses ppc only instructions (which breaks 
2154         the B&I build).   
2155     
2156         * kjs/value.h: set USE_CONSERVATIVE_GC to 0
2157
2158 === Safari-139 ===
2159
2160 2004-05-07  Maciej Stachowiak  <mjs@apple.com>
2161
2162         Reviewed by Darin.
2163
2164         - add -funroll-loops=16 compiler option for approx .5% speedup on
2165         HTML iBench and .5-1% speedup on JS iBench.
2166         
2167         * JavaScriptCore.pbproj/project.pbxproj:
2168
2169 2004-04-25  Maciej Stachowiak  <mjs@apple.com>
2170
2171         Reviewed by Darin.
2172
2173         Enable full conservative GC mode in addition to test mode. When
2174         conservative GC is enabled, we now get an 11% speed improvement on
2175         the iBench. Also fix some spots I missed before.
2176
2177         Specific noteworth changes:
2178         
2179         * kjs/collector.cpp:
2180         (KJS::Collector::markStackObjectsConservatively): Check possible
2181         cell pointers for 8-byte aligment and verify they are not 0.
2182
2183         * kjs/protected_values.cpp:
2184         (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
2185         (KJS::ProtectedValues::decreaseProtectCount): ...and here...
2186         * kjs/protect.h:
2187         (KJS::gcProtectNullTolerant): ...to here...
2188         (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
2189         tolerance, and doing the check is expensive.
2190
2191         * kjs/protected_values.cpp:
2192         (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
2193         that is still very good.
2194
2195         * kjs/protect.h:
2196         (KJS::gcProtect):
2197         (KJS::gcUnprotect):
2198         (KJS::ProtectedValue::ProtectedValue):
2199         (KJS::ProtectedValue::~ProtectedValue):
2200         (KJS::ProtectedValue::operator=):
2201         (KJS::ProtectedObject::ProtectedObject):
2202         (KJS::ProtectedObject::~ProtectedObject):
2203         (KJS::ProtectedObject::operator=):
2204         (KJS::ProtectedReference::ProtectedReference):
2205         (KJS::ProtectedReference::~ProtectedReference):
2206         (KJS::ProtectedReference::operator=):
2207         * kjs/protected_values.cpp:
2208         (KJS::ProtectedValues::getProtectCount):
2209         (KJS::ProtectedValues::increaseProtectCount):
2210         (KJS::ProtectedValues::decreaseProtectCount):
2211         (KJS::ProtectedValues::computeHash):
2212         * bindings/runtime_root.cpp:
2213         (KJS::Bindings::addNativeReference):
2214         (KJS::Bindings::removeNativeReference):
2215         (RootObject::removeAllNativeReferences):
2216         * bindings/runtime_root.h:
2217         (KJS::Bindings::RootObject::~RootObject):
2218         (KJS::Bindings::RootObject::setRootObjectImp):
2219         * kjs/collector.cpp:
2220         (KJS::Collector::allocate):
2221         (KJS::Collector::collect):
2222         * kjs/collector.h:
2223         * kjs/internal.cpp:
2224         (NumberImp::create):
2225         (InterpreterImp::globalInit):
2226         (InterpreterImp::globalClear):
2227         (InterpreterImp::mark):
2228         * kjs/list.cpp:
2229         (KJS::List::derefValues):
2230         (KJS::List::refValues):
2231         (KJS::List::append):
2232         * kjs/object.cpp:
2233         (KJS::ObjectImp::setInternalValue):
2234         (KJS::ObjectImp::putDirect):
2235         * kjs/value.cpp:
2236         (ValueImp::mark):
2237         (ValueImp::marked):
2238         * kjs/value.h:
2239         (KJS::ValueImp::ValueImp):
2240         (KJS::ValueImp::~ValueImp):
2241         (KJS::ValueImp::):
2242         (KJS::Value::Value):
2243         (KJS::Value::~Value):
2244         (KJS::Value::operator=):
2245
2246 2004-04-30  Richard Williamson   <rjw@apple.com>
2247
2248         Asking an NSInvocation for it's return value when return type
2249         is void throws an exception.  Added check for void return types
2250         to avoid this exception.
2251
2252         Reviewed by Ken.
2253
2254         * bindings/objc/objc_instance.mm:
2255         (ObjcInstance::invokeMethod):
2256
2257 2004-04-29  Richard Williamson   <rjw@apple.com>
2258
2259         Fixed several bad problems with the ObjC bindings.  In particular, conversion
2260         to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
2261
2262         Reviewed by Chris.
2263
2264         * bindings/objc/objc_jsobject.h:
2265         * bindings/objc/objc_jsobject.mm:
2266         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2267         (-[JavaScriptObject KJS::]):
2268         (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2269         (-[JavaScriptObject call:arguments:]):
2270         (-[JavaScriptObject evaluate:]):
2271         (-[JavaScriptObject getMember:]):
2272         (-[JavaScriptObject getSlot:]):
2273         * bindings/objc/objc_runtime.mm:
2274         (ObjcField::valueFromInstance):
2275         (ObjcField::setValueToInstance):
2276         * bindings/objc/objc_utility.mm:
2277         (KJS::Bindings::convertValueToObjcValue):
2278         (KJS::Bindings::convertObjcValueToValue):
2279         * bindings/runtime.h:
2280         * bindings/runtime_root.cpp:
2281         (KJS::Bindings::rootForInterpreter):
2282         (KJS::Bindings::addNativeReference):
2283         (KJS::Bindings::removeNativeReference):
2284         * bindings/runtime_root.h:
2285         * bindings/testbindings.mm:
2286         (-[MyFirstInterface logMessage:]):
2287         (-[MyFirstInterface setJSObject:]):
2288         (-[MyFirstInterface callJSObject::]):
2289
2290 2004-04-24  Darin Adler  <darin@apple.com>
2291
2292         Reviewed by Dave.
2293
2294         * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
2295         that is 2x too big.
2296
2297 2004-04-23  Maciej Stachowiak  <mjs@apple.com>
2298
2299         Reviewed by Darin.
2300
2301         Implementation of conservative GC, based partly on code from
2302         Darin. It's turned off for now, so it shouldn't have any effect on
2303         the normal build.
2304         
2305         * JavaScriptCore.pbproj/project.pbxproj:
2306         * kjs/collector.cpp:
2307         (KJS::Collector::markStackObjectsConservatively):
2308         (KJS::Collector::markProtectedObjects):
2309         (KJS::Collector::collect):
2310         * kjs/collector.h:
2311         * kjs/protect.h:
2312         (KJS::gcProtect):
2313         (KJS::gcUnprotect):
2314         * kjs/protected_values.cpp: Added.
2315         (KJS::ProtectedValues::getProtectCount):
2316         (KJS::ProtectedValues::increaseProtectCount):
2317         (KJS::ProtectedValues::insert):
2318         (KJS::ProtectedValues::decreaseProtectCount):
2319         (KJS::ProtectedValues::expand):
2320         (KJS::ProtectedValues::shrink):
2321         (KJS::ProtectedValues::rehash):
2322         (KJS::ProtectedValues::computeHash):
2323         * kjs/protected_values.h: Added.
2324         * kjs/value.cpp:
2325         (ValueImp::useConservativeMark):
2326         (ValueImp::mark):
2327         (ValueImp::marked):
2328         * kjs/value.h:
2329         (KJS::ValueImp::):
2330
2331 === Safari-138 ===
2332
2333 2004-04-22  Richard Williamson   <rjw@apple.com>
2334
2335         Fixed build snafu (re-declaration of NPBool in npruntime.h and
2336         npapi.h).
2337
2338         * bindings/npruntime.h:
2339
2340 2004-04-22  Richard Williamson   <rjw@apple.com>
2341
2342         Updated plugin binding API to reflect latest revision from
2343         working group.
2344         
2345         Biggest change is the introduction of NPVariant used to represent
2346         value types.  NPVariant replaces the use of NPObject for the
2347         exchange of values between scripting environment and native code.
2348
2349         Reviewed by John.
2350
2351         * JavaScriptCore.pbproj/project.pbxproj:
2352         * bindings/NP_jsobject.cpp:
2353         (identiferFromNPIdentifier):
2354         (NPN_Call):
2355         (NPN_Evaluate):
2356         (NPN_GetProperty):
2357         (NPN_SetProperty):
2358         (NPN_ToString):
2359         (NPN_GetPropertyAtIndex):
2360         (NPN_SetPropertyAtIndex):
2361         * bindings/c/c_class.cpp:
2362         (CClass::methodsNamed):
2363         (CClass::fieldNamed):
2364         * bindings/c/c_instance.cpp:
2365         (CInstance::invokeMethod):
2366         (CInstance::defaultValue):
2367         * bindings/c/c_runtime.cpp:
2368         (CField::valueFromInstance):
2369         (CField::setValueToInstance):
2370         * bindings/c/c_utility.cpp:
2371         (convertNPStringToUTF16):
2372         (convertUTF8ToUTF16):
2373         (coerceValueToNPVariantStringType):
2374         (convertValueToNPVariant):
2375         (convertNPVariantToValue):
2376         * bindings/c/c_utility.h:
2377         * bindings/npruntime.cpp:
2378         (NPN_GetIdentifier):
2379         (NPN_GetIdentifiers):
2380         (NPN_UTF8FromIdentifier):
2381         (NPN_VariantIsVoid):
2382         (NPN_VariantIsNull):
2383         (NPN_VariantIsUndefined):
2384         (NPN_VariantIsBool):
2385         (NPN_VariantIsInt32):
2386         (NPN_VariantIsDouble):
2387         (NPN_VariantIsString):
2388         (NPN_VariantIsObject):
2389         (NPN_VariantToBool):
2390         (NPN_VariantToString):
2391         (NPN_VariantToInt32):
2392         (NPN_VariantToDouble):
2393         (NPN_VariantToObject):
2394         (NPN_InitializeVariantAsVoid):
2395         (NPN_InitializeVariantAsNull):
2396         (NPN_InitializeVariantAsUndefined):
2397         (NPN_InitializeVariantWithBool):
2398         (NPN_InitializeVariantWithInt32):
2399         (NPN_InitializeVariantWithDouble):
2400         (NPN_InitializeVariantWithString):
2401         (NPN_InitializeVariantWithStringCopy):
2402         (NPN_InitializeVariantWithObject):
2403         (NPN_InitializeVariantWithVariant):
2404         (NPN_ReleaseVariantValue):
2405         (NPN_CreateObject):
2406         (NPN_RetainObject):
2407         (NPN_ReleaseObject):
2408         (NPN_IsKindOfClass):
2409         (NPN_SetExceptionWithUTF8):
2410         (NPN_SetException):
2411         * bindings/npruntime.h:
2412         (_NPString::):
2413         (_NPString::_NPVariant::):
2414         * bindings/testbindings.cpp:
2415         (logMessage):
2416         (setDoubleValue):
2417         (setIntValue):
2418         (setStringValue):
2419         (setBooleanValue):
2420         (getDoubleValue):
2421         (getIntValue):
2422         (getStringValue):
2423         (getBooleanValue):
2424         (myGetProperty):
2425         (mySetProperty):
2426         (myInvoke):
2427         (myAllocate):
2428
2429 2004-04-22  Darin Adler  <darin@apple.com>
2430
2431         Reviewed by Maciej.
2432
2433         - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
2434
2435         * kjs/ustring.cpp:
2436         (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
2437         Was resulting in a buffer 2x the needed size.
2438         (KJS::UString::expandPreCapacity): Ditto.
2439         (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
2440
2441 2004-04-21  Maciej Stachowiak  <mjs@apple.com>
2442
2443         Reviewed by Darin.
2444
2445         Preliminary change for conservative GC. Create "protected"
2446         subclasses to GC-protect objects when on heap, since we will soon
2447         remove the built-in refcounting of the normal wrapper classes. Use
2448         them where needed.
2449         
2450         * JavaScriptCore.pbproj/project.pbxproj:
2451         * kjs/context.h:
2452         * kjs/internal.h:
2453         (KJS::InterpreterImp::globalObject):
2454         * kjs/interpreter.h:
2455         * kjs/property_map.cpp:
2456         * kjs/reference.h:
2457         * kjs/reference_list.cpp:
2458
2459 2004-04-19  Maciej Stachowiak  <mjs@apple.com>
2460
2461         Reviewed by Dave.
2462
2463         Optimize prepend using the shared substring optimization. Also,
2464         limit the applicability of shared append and shared prepend. If
2465         you overdo it, it does more harm than good, because you create a
2466         bunch of strings that are disqualified from future shared
2467         append/prepend, for not much immediate savings in allocate/copy
2468         expense.
2469         
2470         * kjs/ustring.cpp:
2471         (KJS::):
2472         (KJS::UString::Rep::create):
2473         (KJS::UString::expandedSize):
2474         (KJS::UString::usedPreCapacity):
2475         (KJS::UString::expandCapacity):
2476         (KJS::UString::expandPreCapacity):
2477         (KJS::UString::UString):
2478         (KJS::UString::append):
2479         (KJS::UString::operator=):
2480         * kjs/ustring.h:
2481         (KJS::UString::Rep::data):
2482
2483 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
2484         Reviewed by Richard.
2485
2486         No more need for Completion or Reference to privately inherit from
2487         Value, none of the superclass functionality is used.
2488
2489         * kjs/completion.h:
2490         * kjs/reference.h:
2491
2492 === Safari-137 ===
2493
2494 2004-04-16  Richard Williamson   <rjw@apple.com>
2495
2496         Added interpreter lock protection around object creation.
2497
2498         Reviewed by Chris.
2499
2500         * bindings/runtime.cpp:
2501         (Instance::createRuntimeObject):
2502
2503 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
2504
2505         Reviewed by Ken.
2506
2507         Another JavaScript speed improvement: use the mechanism from
2508         string append optimization to make taking a substring fast, again
2509         sharing the buffer.
2510
2511         A further 22% improvement on the 24fun string speed test.
2512         
2513         * kjs/ustring.cpp:
2514         (KJS::):
2515         (KJS::UString::Rep::create):
2516         (KJS::UString::UString):
2517         (KJS::UString::append):
2518         (KJS::UString::operator=):
2519         (KJS::UString::substr):
2520         * kjs/ustring.h:
2521         (KJS::UString::Rep::data):
2522
2523 2004-04-13  Maciej Stachowiak  <mjs@apple.com>
2524
2525         Reviewed by Darin.
2526
2527         - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
2528         - fixed <rdar://problem/3600691>: Table generation test is really slow
2529         - fixed <rdar://problem/3600661>: 24fun date test is really slow
2530
2531         80% speedup on the string test, lesser speedups on the other two.
2532         
2533         Two different optimizations here:
2534
2535         1) Avoid large overhead of scanning strings to see if they are all
2536         ASCII before numeric conversion.
2537         
2538         * kjs/nodes.cpp:
2539         (AssignNode::evaluate): Don't convert to integer until we know for
2540         sure the operation will need it. Attempting to convert strings to
2541         numbers is a waste when they are being appended with +=.
2542
2543         2) Avoid huge cost of appending strings.
2544
2545         This is done by allowing multiple strings to share a buffer but
2546         actually use different ranges of it. The first time a string is
2547         appended to, we start leaving at least 10% extra space in the
2548         buffer, so doing N appends to the same string takes O(log N)
2549         mallocs instead of O(N).
2550         
2551         * kjs/identifier.cpp:
2552         (KJS::Identifier::equal):
2553         (KJS::Identifier::add):
2554         * kjs/ustring.cpp:
2555         (KJS::):
2556         (KJS::UCharReference::operator=):
2557         (KJS::UCharReference::ref):
2558         (KJS::UString::Rep::create):
2559         (KJS::UString::Rep::destroy):
2560         (KJS::UString::expandedSize):
2561         (KJS::UString::usedCapacity):
2562         (KJS::UString::expandCapacity):
2563         (KJS::UString::UString):
2564         (KJS::UString::null):
2565         (KJS::UString::append):
2566         (KJS::UString::operator=):
2567         (KJS::UString::toStrictUInt32):
2568         (KJS::UString::detach):
2569         (KJS::KJS::operator==):
2570         * kjs/ustring.h:
2571         (KJS::UString::Rep::data):
2572         (KJS::UString::Rep::hash):
2573
2574 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
2575
2576         Reviewed by John.
2577
2578         - fix deployment build by avoiding deployment-only warning.
2579
2580         * kjs/scope_chain.cpp:
2581         (KJS::ScopeChain::bottom):
2582
2583 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
2584
2585         Reviewed by John.
2586
2587         Changed things so that newly created objects get a prototype based
2588         on the scope chain of the current function, rather than the
2589         interpreter that started execution. This fixes the following bugs:
2590         
2591         <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
2592         <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
2593
2594         * JavaScriptCore.pbproj/project.pbxproj:
2595         * kjs/array_object.cpp:
2596         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2597         (ArrayProtoFuncImp::ArrayProtoFuncImp):
2598         (ArrayProtoFuncImp::call):
2599         (ArrayObjectImp::construct):
2600         * kjs/bool_object.cpp:
2601         (BooleanObjectImp::construct):
2602         * kjs/date_object.cpp:
2603         (DateProtoFuncImp::DateProtoFuncImp):
2604         (DateProtoFuncImp::call):
2605         (DateObjectImp::construct):
2606         * kjs/error_object.cpp:
2607         (ErrorObjectImp::construct):
2608         * kjs/function.cpp:
2609         (FunctionImp::FunctionImp):
2610         (FunctionImp::call):
2611         (DeclaredFunctionImp::construct):
2612         (ArgumentsImp::ArgumentsImp):
2613         (GlobalFuncImp::call):
2614         * kjs/function_object.cpp:
2615         (FunctionProtoFuncImp::call):
2616         (FunctionObjectImp::construct):
2617         * kjs/internal.cpp:
2618         (BooleanImp::toObject):
2619         (StringImp::toObject):
2620         (NumberImp::toObject):
2621         (InterpreterImp::InterpreterImp):
2622         (InterpreterImp::clear):
2623         (InterpreterImp::interpreterWithGlobalObject):
2624         * kjs/internal.h:
2625         * kjs/interpreter.cpp:
2626         (ExecState::lexicalInterpreter):
2627         * kjs/interpreter.h:
2628         (KJS::ExecState::dynamicInterpreter):
2629         (KJS::ExecState::interpreter):
2630         * kjs/math_object.cpp:
2631         (MathFuncImp::MathFuncImp):
2632         * kjs/nodes.cpp:
2633         (StatementNode::hitStatement):
2634         (StatementNode::abortStatement):
2635         (RegExpNode::evaluate):
2636         (ElementNode::evaluate):
2637         (ArrayNode::evaluate):
2638         (ObjectLiteralNode::evaluate):
2639         (PropertyValueNode::evaluate):
2640         (FunctionCallNode::evaluate):
2641         (FuncDeclNode::processFuncDecl):
2642         (FuncExprNode::evaluate):
2643         * kjs/number_object.cpp:
2644         (NumberObjectImp::construct):
2645         * kjs/object.cpp:
2646         (KJS::ObjectImp::defaultValue):
2647         (KJS::Error::create):
2648         * kjs/object_object.cpp:
2649         (ObjectObjectImp::construct):
2650         * kjs/reference.cpp:
2651         (Reference::putValue):
2652         * kjs/regexp_object.cpp:
2653         (RegExpProtoFuncImp::call):
2654         (RegExpObjectImp::arrayOfMatches):
2655         (RegExpObjectImp::construct):
2656         * kjs/scope_chain.cpp:
2657         (KJS::ScopeChain::bottom):
2658         * kjs/scope_chain.h:
2659         * kjs/string_object.cpp:
2660         (StringProtoFuncImp::StringProtoFuncImp):
2661         (StringProtoFuncImp::call):
2662         (StringObjectImp::construct):
2663
2664 === Safari-136 ===
2665
2666 === Safari-135 ===
2667
2668 2004-03-31  Richard Williamson   <rjw@apple.com>
2669
2670         Tedious renames based on feedback from plugin-futures list.
2671         NP_ functions are renamed with NPN_ prefix.
2672         Types prefix renamed from NP_ to NP.
2673         NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated. 
2674         
2675         No review because this was just a renaming patch.
2676
2677         * bindings/NP_jsobject.cpp:
2678         (listFromNPArray):
2679         (jsAllocate):
2680         (identiferFromNPIdentifier):
2681         (NPN_Call):
2682         (NPN_Evaluate):
2683         (NPN_GetProperty):
2684         (NPN_SetProperty):
2685         (NPN_RemoveProperty):
2686         (NPN_ToString):
2687         (NPN_GetPropertyAtIndex):
2688         (NPN_SetPropertyAtIndex):
2689         * bindings/NP_jsobject.h:
2690         * bindings/c/c_class.cpp:
2691         (CClass::_commonInit):
2692         (CClass::classForIsA):
2693         (CClass::CClass):
2694         (CClass::methodsNamed):
2695         (CClass::fieldNamed):
2696         * bindings/c/c_class.h:
2697         * bindings/c/c_instance.cpp:
2698         (CInstance::CInstance):
2699         (CInstance::~CInstance):
2700         (CInstance::operator=):
2701         (CInstance::invokeMethod):
2702         (CInstance::defaultValue):
2703         * bindings/c/c_instance.h:
2704         (KJS::Bindings::CInstance::getObject):
2705         * bindings/c/c_runtime.cpp:
2706         (CField::valueFromInstance):
2707         (CField::setValueToInstance):
2708         * bindings/c/c_runtime.h:
2709         (KJS::Bindings::CField::CField):
2710         (KJS::Bindings::CField::name):
2711         (KJS::Bindings::CMethod::CMethod):
2712         (KJS::Bindings::CMethod::name):
2713         * bindings/c/c_utility.cpp:
2714         (coerceValueToNPString):
2715         (convertValueToNPValueType):
2716         (convertNPValueTypeToValue):
2717         * bindings/c/c_utility.h:
2718         * bindings/npruntime.cpp:
2719         (NPN_IdentifierFromUTF8):
2720         (NPN_IsValidIdentifier):
2721         (NPN_GetIdentifiers):
2722         (NPN_UTF8FromIdentifier):
2723         (NPN_CreateObject):
2724         (NPN_RetainObject):
2725         (NPN_ReleaseObject):
2726         (NPN_IsKindOfClass):
2727         (NPN_SetExceptionWithUTF8):
2728         (NPN_SetException):
2729         (numberAllocate):
2730         (NPN_CreateNumberWithInt):
2731         (NPN_CreateNumberWithFloat):
2732         (NPN_CreateNumberWithDouble):
2733         (NPN_IntFromNumber):
2734         (NPN_FloatFromNumber):
2735         (NPN_DoubleFromNumber):
2736         (stringAllocate):
2737         (NPN_CreateStringWithUTF8):
2738         (NPN_CreateStringWithUTF16):
2739         (NPN_DeallocateUTF8):
2740         (NPN_UTF8FromString):
2741         (NPN_UTF16FromString):
2742         (NPN_StringLength):
2743         (booleanAllocate):
2744         (NPN_CreateBoolean):
2745         (NPN_BoolFromBoolean):
2746         (nullAllocate):
2747         (NPN_GetNull):
2748         (undefinedAllocate):
2749         (NPN_GetUndefined):
2750         (arrayAllocate):
2751         (arrayDeallocate):
2752         (NPN_CreateArray):
2753         (NPN_CreateArrayV):
2754         (NPN_ObjectAtIndex):
2755         * bindings/npruntime.h:
2756         * bindings/runtime.cpp:
2757         (Instance::createBindingForLanguageInstance):
2758         * bindings/testbindings.cpp:
2759         (initializeIdentifiers):
2760         (myHasProperty):
2761         (myHasMethod):
2762         (myGetProperty):
2763         (mySetProperty):
2764         (logMessage):
2765         (setDoubleValue):
2766         (setIntValue):
2767         (setStringValue):
2768         (setBooleanValue):
2769         (getDoubleValue):
2770         (getIntValue):
2771         (getStringValue):
2772         (getBooleanValue):
2773         (myInvoke):
2774         (myAllocate):
2775         (myInvalidate):
2776         (myDeallocate):
2777         (main):
2778
2779 2004-03-31  Richard Williamson   <rjw@apple.com>
2780
2781         Changed references to NP_runtime.h to npruntime.h
2782         
2783         * JavaScriptCore.pbproj/project.pbxproj:
2784         * bindings/NP_jsobject.h:
2785         * bindings/c/c_class.h:
2786         * bindings/c/c_instance.h:
2787         * bindings/c/c_runtime.h:
2788         * bindings/c/c_utility.h:
2789         * bindings/npruntime.cpp:
2790
2791 2004-03-31  Richard Williamson   <rjw@apple.com>
2792
2793         Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2794
2795         * JavaScriptCore.pbproj/project.pbxproj:
2796         * bindings/NP_jsobject.h:
2797         * bindings/npruntime.cpp:
2798
2799 === Safari-134 ===
2800
2801 2004-03-23  Richard Williamson   <rjw@apple.com>
2802
2803         Added implementation of KJS::Value <-> NP_Object conversion functions.
2804         Augmented test program for 'C' bindings.
2805         Added asserts and parameter checking to all public API.        
2806
2807         Reviewed by Ken.
2808
2809         * JavaScriptCore.pbproj/project.pbxproj:
2810         * bindings/NP_jsobject.cpp:
2811         (NP_ToString):
2812         * bindings/NP_jsobject.h: Added.
2813         * bindings/NP_runtime.cpp:
2814         (NP_IdentifierFromUTF8):
2815         (NP_IsValidIdentifier):
2816         (NP_GetIdentifiers):
2817         (NP_CreateObject):
2818         (NP_RetainObject):
2819         (NP_ReleaseObject):
2820         (NP_IsKindOfClass):
2821         (NP_SetExceptionWithUTF8):
2822         (NP_SetException):
2823         (NP_IntFromNumber):
2824         (NP_FloatFromNumber):
2825         (NP_DoubleFromNumber):
2826         (NP_CreateStringWithUTF8):
2827         (NP_CreateStringWithUTF16):
2828         (NP_DeallocateUTF8):
2829         (NP_UTF8FromString):
2830         (NP_UTF16FromString):
2831         (NP_StringLength):
2832         (NP_BoolFromBoolean):
2833         * bindings/NP_runtime.h:
2834         * bindings/c/c_instance.cpp:
2835         (CInstance::invokeMethod):
2836         * bindings/c/c_utility.cpp:
2837         (coerceValueToNPString):
2838         (convertValueToNPValueType):
2839         (convertNPValueTypeToValue):
2840         * bindings/c/c_utility.h:
2841         * bindings/test.js:
2842         * bindings/testC.js: Added.
2843         * bindings/testbindings.cpp:
2844         (logMessage):
2845         (setDoubleValue):
2846         (setIntValue):
2847         (setStringValue):
2848         (setBooleanValue):
2849         (getDoubleValue):
2850         (getIntValue):
2851         (getStringValue):
2852         (getBooleanValue):
2853         (myInterfaceInvoke):
2854         (myInterfaceAllocate):
2855
2856 === Safari-133 ===
2857
2858 2004-03-19  Darin Adler  <darin@apple.com>
2859
2860         Reviewed by Ken.
2861
2862         - fixed problem with methods like setUTCHour
2863
2864         * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2865         GMT vs. local time function based on the utc flag.
2866
2867 2004-03-17  Richard Williamson   <rjw@apple.com>
2868
2869         Added a context parameter to result callbacks use by JavaScriptObject functions.  This was a change requested by Eric Carlson on the QT plugin team.
2870
2871         Reviewed by Ken.
2872
2873         * bindings/NP_jsobject.cpp:
2874         (NP_Call):
2875         (NP_Evaluate):
2876         (NP_GetProperty):
2877         (NP_ToString):
2878         (NP_GetPropertyAtIndex):
2879         * bindings/NP_runtime.h:
2880
2881 2004-03-16  Richard Williamson   <rjw@apple.com>
2882
2883         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.
2884
2885         Reviewed by John.
2886
2887         * bindings/jni/jni_class.cpp:
2888         (JavaClass::methodsNamed):
2889
2890 2004-03-15  Richard Williamson   <rjw@apple.com>
2891
2892         Fixed 3570854.  Don't attempt to convert Null to strings.  We
2893         were incorrectly converting to "Null".
2894
2895         Actually fixed by Scott Kovatch.
2896
2897         Reviewed by Richard.
2898
2899         * bindings/jni/jni_utility.cpp:
2900         (KJS::Bindings::convertValueToJValue):
2901
2902 === Safari-132 ===
2903
2904 2004-03-11  Richard Williamson   <rjw@apple.com>
2905
2906         Stitched together the NP stuff to our language independent
2907         JavaScript binding stuff.  Very close to being done.
2908         
2909         Added program to test C bindings (and NP stuff).  Just tests
2910         properties.  Will add methods and JavaScript access, etc.
2911
2912         Updated Makefile.am to account for new bindings/c directory.
2913
2914         Change NP_UTF8 from "const char *" to "char" to allow for
2915         declarations like "const NP_UTF8 *" and "NP_UTF8 *".  Ditto
2916         for NP_UTF16.
2917
2918         Added NP_IsValidIdentifier().
2919
2920         Reviewed by Chris.
2921
2922         * JavaScriptCore.pbproj/project.pbxproj:
2923         * Makefile.am:
2924         * bindings/NP_jsobject.cpp:
2925         (identiferFromNPIdentifier):
2926         (NP_Evaluate):
2927         * bindings/NP_runtime.cpp:
2928         (NP_IdentifierFromUTF8):
2929         (NP_IsValidIdentifier):
2930         (NP_GetIdentifiers):
2931         (NP_UTF8FromIdentifier):
2932         (NP_SetExceptionWithUTF8):
2933         (NP_SetException):
2934         (NP_CreateStringWithUTF8):
2935         (NP_CreateStringWithUTF16):
2936         (NP_UTF8FromString):
2937         (NP_UTF16FromString):
2938         * bindings/NP_runtime.h:
2939         * bindings/c/c_class.cpp: Added.
2940         (CClass::_commonDelete):
2941         (CClass::_commonCopy):
2942         (CClass::_commonInit):
2943         (_createClassesByIsAIfNecessary):
2944         (CClass::classForIsA):
2945         (CClass::CClass):
2946         (CClass::name):
2947         (CClass::methodsNamed):
2948         (CClass::fieldNamed):
2949         * bindings/c/c_class.h: Added.
2950         (KJS::Bindings::CClass::~CClass):
2951         (KJS::Bindings::CClass::CClass):
2952         (KJS::Bindings::CClass::operator=):
2953         (KJS::Bindings::CClass::constructorAt):
2954         (KJS::Bindings::CClass::numConstructors):
2955         * bindings/c/c_instance.cpp: Added.
2956         (CInstance::CInstance):
2957         (CInstance::~CInstance):
2958         (CInstance::operator=):
2959         (CInstance::getClass):
2960         (CInstance::begin):
2961         (CInstance::end):
2962         (CInstance::invokeMethod):
2963         (CInstance::defaultValue):
2964         (CInstance::stringValue):
2965         (CInstance::numberValue):
2966         (CInstance::booleanValue):
2967         (CInstance::valueOf):
2968         * bindings/c/c_instance.h: Added.
2969         (KJS::Bindings::CInstance::getObject):
2970         * bindings/c/c_runtime.cpp: Added.
2971         (CField::valueFromInstance):
2972         (CField::setValueToInstance):
2973         * bindings/c/c_runtime.h: Added.
2974         (KJS::Bindings::CField::CField):
2975         (KJS::Bindings::CField::name):
2976         (KJS::Bindings::CField::type):
2977         (KJS::Bindings::CMethod::CMethod):
2978         (KJS::Bindings::CMethod::name):
2979         (KJS::Bindings::CMethod::numParameters):
2980         * bindings/c/c_utility.cpp: Added.
2981         (coerceValueToNPValueType):
2982         (convertValueToNPValueType):
2983         (convertNPValueTypeToValue):
2984         * bindings/c/c_utility.h: Added.
2985         * bindings/make_testbindings:
2986         * bindings/runtime.cpp:
2987         (Instance::createBindingForLanguageInstance):
2988         * bindings/runtime.h:
2989         (KJS::Bindings::Instance::):
2990         * bindings/testbindings.cpp: Added.
2991         (initializeIdentifiers):
2992         (myInterfaceHasProperty):
2993         (myInterfaceHasMethod):
2994         (myInterfaceGetProperty):
2995         (myInterfaceSetProperty):
2996         (myInterfaceInvoke):
2997         (myInterfaceAllocate):
2998         (myInterfaceInvalidate):
2999         (myInterfaceDeallocate):
3000         (GlobalImp::className):
3001         (readJavaScriptFromFile):
3002         (main):
3003
3004 2004-03-10  Richard Williamson   <rjw@apple.com>
3005
3006         Made changes to support new asychronous approach to calls from
3007         plugin to JavaScript
3008
3009         Reviewed by Chris.
3010
3011         * bindings/NP_jsobject.cpp:
3012         (NP_Call):
3013         (NP_Evaluate):
3014         (NP_GetProperty):
3015         (NP_ToString):
3016         (NP_GetPropertyAtIndex):
3017         * bindings/NP_runtime.h:
3018         * bindings/make_testbindings:
3019         * bindings/runtime.cpp:
3020         (Instance::createBindingForLanguageInstance):
3021
3022 2004-03-10  Richard Williamson   <rjw@apple.com>
3023
3024         Updated header to include proposed changes from
3025         plugin-futures list.  Calls from plugin to JavaScript
3026         are now asynchronous.
3027
3028         Reviewed by Chris.
3029
3030         * bindings/NP_runtime.h:
3031
3032 === Safari-131 ===
3033
3034 2004-03-04  Richard Williamson   <rjw@apple.com>
3035
3036         Implementation of NP_JavaScriptObject.  This is the 'C' class
3037         that wraps a JavaScript object.
3038
3039         Reviewed by Chris.
3040
3041         * JavaScriptCore.pbproj/project.pbxproj:
3042         * bindings/NP_jsobject.cpp: Added.
3043         (coerceValueToNPValueType):
3044         (convertValueToNPValueType):
3045         (convertNPValueTypeToValue):
3046         (listFromNPArray):
3047         (jsAllocate):
3048         (jsDeallocate):
3049         (identiferFromNPIdentifier):
3050         (NP_Call):
3051         (NP_Evaluate):
3052         (NP_GetProperty):
3053         (NP_SetProperty):
3054         (NP_RemoveProperty):
3055         (NP_ToString):
3056         (NP_GetPropertyAtIndex):
3057         (NP_SetPropertyAtIndex):
3058         * bindings/NP_runtime.cpp:
3059         (NP_ObjectAtIndex):
3060         * bindings/NP_runtime.h:
3061         * bindings/runtime_object.h:
3062
3063 2004-03-04  Richard Williamson   <rjw@apple.com>
3064
3065         Added NP_Array implementation.  
3066
3067         Changed NP_Boolean to just depend on two static instances, no
3068         space is required for values.
3069
3070         Reviewed by Chris.
3071
3072         * bindings/NP_runtime.cpp:
3073         (NP_CreateBoolean):
3074         (NP_BoolFromBoolean):
3075         (arrayAllocate):
3076         (arrayDeallocate):
3077         (NP_CreateArray):
3078         (NP_CreateArrayV):
3079         (NP_ObjectAtIndex):
3080         * bindings/NP_runtime.h:
3081
3082 2004-03-03  Darin Adler  <darin@apple.com>
3083
3084         Reviewed by Vicki.
3085
3086         * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
3087         copyright string, and that's all that was in here.
3088         * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
3089
3090 2004-03-03  Richard Williamson   <rjw@apple.com>
3091
3092         More 'C' binding implementation.  Fleshed out all the
3093         'primitive' data types.
3094
3095         Reviewed by Chris.
3096
3097         * bindings/NP_runtime.cpp:
3098         (NP_ReleaseObject):
3099         (numberAllocate):
3100         (stringAllocate):
3101         (stringDeallocate):
3102         (NP_CreateStringWithUTF8):
3103         (NP_CreateStringWithUTF16):
3104         (NP_UTF8FromString):
3105         (NP_UTF16FromString):
3106         (NP_StringLength):
3107         (booleanAllocate):
3108         (booleanDeallocate):
3109         (NP_CreateBoolean):
3110         (NP_BoolFromBoolean):
3111         (nullAllocate):
3112         (nullDeallocate):
3113         (NP_GetNull):
3114         (undefinedAllocate):
3115         (undefinedDeallocate):
3116         (NP_GetUndefined):
3117         * bindings/NP_runtime.h:
3118
3119 2004-03-03  Richard Williamson   <rjw@apple.com>
3120
3121         More 'C' binding implementation.
3122
3123         Reviewed by Chris.
3124
3125         * bindings/NP_runtime.cpp:
3126         (identifierEqual):
3127         (identifierHash):
3128         (getIdentifierDictionary):
3129         (NP_IdentifierFromUTF8):
3130         (NP_UTF8FromIdentifier):
3131         (NP_CreateObject):
3132         (NP_ReleaseObject):
3133         (NP_IsKindOfClass):
3134         (numberCreate):
3135         (NP_CreateNumberWithInt):
3136         (NP_CreateNumberWithFloat):
3137         (NP_CreateNumberWithDouble):
3138         (NP_IntFromNumber):
3139         (NP_FloatFromNumber):
3140         (NP_DoubleFromNumber):
3141         * bindings/NP_runtime.h:
3142
3143 2004-03-02  Richard Williamson   <rjw@apple.com>
3144
3145         Removed retain/release from NP_Class.  Classes will not be allowed to implement their
3146         own customer retain/release scheme.
3147
3148         Reviewed by Chris.
3149
3150         * bindings/NP_runtime.cpp:
3151         (NP_RetainObject):
3152         (NP_ReleaseObject):
3153         * bindings/NP_runtime.h:
3154
3155 2004-03-02  Richard Williamson   <rjw@apple.com>
3156
3157         C binding API.  Partial implementation.
3158
3159         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.
3160
3161         Factored root object reference counting scheme.  It is now useful independent
3162         of LiveConnect.
3163
3164         Reviewed by Chris.
3165
3166         * JavaScriptCore.pbproj/project.pbxproj:
3167         * bindings/NP_runtime.cpp: Added.
3168         (NP_IdentifierFromUTF8):
3169         (NP_GetIdentifiers):
3170         (NP_UTF8FromIdentifier):
3171         (NP_CreateObject):
3172         (NP_RetainObject):
3173         (NP_ReleaseObject):
3174         (NP_IsKindOfClass):
3175         (NP_SetException):
3176         (NP_Call):
3177         (NP_Evaluate):
3178         (NP_GetProperty):
3179         (NP_SetProperty):
3180         (NP_RemoveProperty):
3181         (NP_ToString):
3182         (NP_GetPropertyAtIndex):
3183         (NP_SetPropertyAtIndex):
3184         (NP_CreateNumberWithInt):
3185         (NP_CreateNumberWithFloat):
3186         (NP_CreateNumberWithDouble):
3187         (NP_IntFromNumber):
3188         (NP_FloatFromNumber):
3189         (NP_DoubleFromNumber):
3190         (NP_CreateStringWithUTF8):
3191         (NP_CreateStringWithUTF16):
3192         (NP_UTF8FromString):
3193         (NP_UTF16FromString):
3194         (NP_CreateBoolean):
3195         (NP_BoolFromBoolean):
3196         (NP_GetNull):
3197         (NP_GetUndefined):
3198         (NP_CreateArray):
3199         (NP_CreateArrayV):
3200         (NP_ObjectAtIndex):
3201         * bindings/NP_runtime.h: Added.
3202         * bindings/jni/jni_jsobject.cpp:
3203         (JSObject::invoke):
3204         (JSObject::finalize):
3205         (JSObject::createNative):
3206         (JSObject::convertValueToJObject):
3207         * bindings/jni/jni_jsobject.h:
3208         * bindings/objc/objc_jsobject.h:
3209         * bindings/objc/objc_jsobject.mm:
3210         (rootForView):
3211         (windowJavaScriptObject):
3212         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
3213         (-[JavaScriptObject dealloc]):
3214         (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
3215         (-[JavaScriptObject call:arguments:]):
3216         (-[JavaScriptObject evaluate:]):
3217         (-[JavaScriptObject getMember:]):
3218         (-[JavaScriptObject setMember:value:]):
3219         (-[JavaScriptObject removeMember:]):
3220         (-[JavaScriptObject toString]):
3221         (-[JavaScriptObject getSlot:]):
3222         (-[JavaScriptObject setSlot:value:]):
3223         * bindings/objc/objc_utility.h:
3224         * bindings/objc/objc_utility.mm:
3225         (KJS::Bindings::convertValueToObjcValue):
3226         * bindings/runtime_root.cpp: Added.
3227         (getReferencesByRootDictionary):
3228         (getReferencesDictionary):
3229         (KJS::Bindings::findReferenceDictionary):
3230         (KJS::Bindings::rootForImp):
3231         (KJS::Bindings::addNativeReference):
3232         (KJS::Bindings::removeNativeReference):
3233         (completedJavaScriptAccess):
3234         (initializeJavaScriptAccessLock):
3235         (lockJavaScriptAccess):
3236         (unlockJavaScriptAccess):
3237         (RootObject::dispatchToJavaScriptThread):
3238         (performJavaScriptAccess):
3239         (RootObject::setFindRootObjectForNativeHandleFunction):
3240         (RootObject::removeAllNativeReferences):
3241         * bindings/runtime_root.h: Added.
3242         (KJS::Bindings::RootObject::RootObject):
3243         (KJS::Bindings::RootObject::~RootObject):
3244         (KJS::Bindings::RootObject::setRootObjectImp):
3245         (KJS::Bindings::RootObject::rootObjectImp):
3246         (KJS::Bindings::RootObject::setInterpreter):
3247         (KJS::Bindings::RootObject::interpreter):
3248         (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
3249         (KJS::Bindings::RootObject::runLoop):
3250         (KJS::Bindings::RootObject::performJavaScriptSource):
3251
3252 === Safari-130 ===
3253
3254 === Safari-129 ===
3255
3256 2004-02-18  Richard Williamson   <rjw@apple.com>
3257
3258         Added NSNumber/Number conversion.
3259
3260         Removed some unnecessary KJS:: namespace specifiers.
3261
3262         Reviewed by Ken.
3263
3264         * bindings/objc/objc_utility.mm:
3265         (KJS::Bindings::convertValueToObjcValue):
3266         (KJS::Bindings::convertObjcValueToValue):
3267         * bindings/runtime_array.h:
3268
3269 2004-02-18  Richard Williamson   <rjw@apple.com>
3270
3271         Added support for export NSArrays.
3272
3273         Updated valueAt() to take an ExecState so we can throw
3274         JS exceptions.
3275
3276         Implemented excludeSelectorFromJavaScript: in ObjcClass.  This allows
3277         ObjectiveC classes to control the visibility of their methods in 
3278         JavaScript.
3279
3280         Reviewed by Ken.
3281
3282         * bindings/jni/jni_runtime.cpp:
3283         (JavaField::valueFromInstance):
3284         (JavaArray::valueAt):
3285         * bindings/jni/jni_runtime.h:
3286         * bindings/objc/objc_class.mm:
3287         (ObjcClass::methodsNamed):
3288         * bindings/objc/objc_runtime.h:
3289         (KJS::Bindings::ObjcArray::getObjcArray):
3290         * bindings/objc/objc_runtime.mm:
3291         (ObjcField::valueFromInstance):
3292         (ObjcField::setValueToInstance):
3293         (ObjcArray::ObjcArray):
3294         (ObjcArray::~ObjcArray):
3295         (ObjcArray::operator=):
3296         (ObjcArray::setValueAt):
3297         (ObjcArray::valueAt):
3298         (ObjcArray::getLength):
3299         * bindings/objc/objc_utility.mm:
3300         (KJS::Bindings::convertValueToObjcValue):
3301         (KJS::Bindings::convertObjcValueToValue):
3302         * bindings/runtime.cpp:
3303         (Instance::getValueOfField):
3304         * bindings/runtime.h:
3305         * bindings/runtime_array.cpp:
3306         (RuntimeArrayImp::get):
3307         * bindings/runtime_object.cpp:
3308         (RuntimeObjectImp::get):
3309
3310 2004-02-17  Richard Williamson   <rjw@apple.com>
3311
3312         Added String <-> NSString conversion.
3313         Added tests of String <-> NSString conversion to test program.
3314
3315         Reviewed by Chris.
3316
3317         * bindings/objc/objc_utility.mm:
3318         (KJS::Bindings::convertValueToObjcValue):
3319         (KJS::Bindings::convertObjcValueToValue):
3320         * bindings/test.js:
3321         * bindings/testbindings.mm:
3322         (-[MyFirstInterface getString]):
3323
3324 2004-02-15  Darin Adler  <darin@apple.com>
3325
3326         Reviewed by Dave.
3327
3328         * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
3329         and removing redundant settings of things that match defaults in other build styles.
3330
3331 2004-02-13  Richard Williamson   <rjw@apple.com>
3332
3333         Work towards the JavaScript ObjC bindings.  The bindings now work for 
3334         simple scalar types.  testbindings.mm is an illustration of how the 
3335         bindings work.
3336
3337         Reviewed by Ken.
3338
3339         * JavaScriptCore.pbproj/project.pbxproj:
3340         * Makefile.am:
3341         * bindings/jni/jni_class.cpp:
3342         (JavaClass::methodsNamed):
3343         * bindings/jni/jni_class.h:
3344         * bindings/jni/jni_instance.cpp:
3345         (JavaInstance::invokeMethod):
3346         * bindings/jni/jni_instance.h:
3347         * bindings/jni/jni_runtime.h:
3348         (KJS::Bindings::JavaMethod::returnType):
3349         * bindings/make_testbindings: Added.
3350         * bindings/objc/objc_class.h: Added.
3351         (KJS::Bindings::ObjcClass::~ObjcClass):
3352         (KJS::Bindings::ObjcClass::ObjcClass):
3353         (KJS::Bindings::ObjcClass::operator=):
3354         (KJS::Bindings::ObjcClass::constructorAt):
3355         (KJS::Bindings::ObjcClass::numConstructors):
3356         * bindings/objc/objc_class.mm: Added.
3357         (ObjcClass::_commonDelete):
3358         (ObjcClass::_commonCopy):
3359         (ObjcClass::_commonInit):
3360         (_createClassesByIsAIfNecessary):
3361         (ObjcClass::classForIsA):
3362         (ObjcClass::ObjcClass):
3363         (ObjcClass::name):
3364         (ObjcClass::methodsNamed):
3365         (ObjcClass::fieldNamed):
3366         * bindings/objc/objc_header.h: Added.
3367         * bindings/objc/objc_instance.h: Added.
3368         (KJS::Bindings::ObjcInstance::getObject):
3369         * bindings/objc/objc_instance.mm: Added.
3370         (ObjcInstance::ObjcInstance):
3371         (ObjcInstance::~ObjcInstance):
3372         (ObjcInstance::operator=):
3373         (ObjcInstance::begin):
3374         (ObjcInstance::end):
3375         (ObjcInstance::getClass):
3376         (ObjcInstance::invokeMethod):
3377         (ObjcInstance::defaultValue):
3378         (ObjcInstance::stringValue):
3379         (ObjcInstance::numberValue):
3380         (ObjcInstance::booleanValue):
3381         (ObjcInstance::valueOf):
3382         * bindings/objc/objc_jsobject.h: Added.
3383         * bindings/objc/objc_jsobject.mm: Added.
3384         * bindings/objc/objc_runtime.h:
3385         (KJS::Bindings::ObjcField::~ObjcField):
3386         (KJS::Bindings::ObjcField::ObjcField):
3387         (KJS::Bindings::ObjcField::operator=):
3388         (KJS::Bindings::ObjcMethod::ObjcMethod):
3389         (KJS::Bindings::ObjcMethod::~ObjcMethod):
3390         (KJS::Bindings::ObjcMethod::operator=):
3391         * bindings/objc/objc_runtime.mm: Added.
3392         (ObjcMethod::ObjcMethod):
3393         (ObjcMethod::name):
3394         (ObjcMethod::numParameters):
3395         (ObjcMethod::getMethodSignature):
3396         (ObjcField::ObjcField):
3397         (ObjcField::name):
3398         (ObjcField::type):
3399         (ObjcField::valueFromInstance):
3400         (ObjcField::setValueToInstance):
3401         * bindings/objc/objc_utility.h: Added.
3402         (KJS::Bindings::):
3403         * bindings/objc/objc_utility.mm: Added.
3404         (KJS::Bindings::JSMethodNameToObjCMethodName):
3405         (KJS::Bindings::convertValueToObjcValue):
3406         (KJS::Bindings::convertObjcValueToValue):
3407         (KJS::Bindings::objcValueTypeForType):
3408         * bindings/runtime.cpp:
3409         (MethodList::MethodList):
3410         (MethodList::operator=):
3411         (Instance::setValueOfField):
3412         (Instance::createBindingForLanguageInstance):
3413         (Instance::createRuntimeObject):
3414         * bindings/runtime.h:
3415         * bindings/runtime_method.cpp:
3416         (RuntimeMethodImp::RuntimeMethodImp):
3417         (RuntimeMethodImp::get):
3418         (RuntimeMethodImp::call):
3419         * bindings/runtime_method.h:
3420         * bindings/runtime_object.cpp:
3421         (RuntimeObjectImp::get):
3422         (RuntimeObjectImp::hasProperty):
3423         * bindings/test.js: Added.
3424         * bindings/testbindings.mm: Added.
3425         (-[MySecondInterface init]):
3426         (-[MyFirstInterface init]):
3427         (-[MyFirstInterface dealloc]):
3428         (+[MyFirstInterface JavaScriptNameForSelector:]):
3429         (-[MyFirstInterface getInt]):
3430         (-[MyFirstInterface setInt:]):
3431         (-[MyFirstInterface getMySecondInterface]):
3432         (-[MyFirstInterface logMessage:]):
3433         (GlobalImp::className):
3434         (readJavaScriptFromFile):
3435         (main):
3436
3437 === Safari-128 ===
3438
3439 2004-02-08  Darin Adler  <darin@apple.com>
3440
3441         Reviewed by Dave.
3442
3443         - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
3444
3445         * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
3446         macros from working right in C++ code that uses the <cctype> header.
3447
3448         * kjs/ustring.cpp:
3449         (KJS::inlineUTF8SequenceLengthNonASCII): Added.
3450         (KJS::UTF8SequenceLengthNonASCII): Added.
3451         (KJS::inlineUTF8SequenceLength): Added.
3452         (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
3453         (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3454         (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
3455         (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3456         (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3457
3458         - fixed the test program so it won't hit the interpreter lock assertion
3459
3460         * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
3461
3462 === Safari-127 ===
3463
3464 2004-02-06  Richard Williamson   <rjw@apple.com>
3465
3466         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.
3467
3468         Reviewed by John.
3469
3470         * bindings/jni/jni_jsobject.cpp:
3471         (JSObject::toString):
3472         * bindings/jni/jni_utility.cpp:
3473         (KJS::Bindings::convertValueToJValue):
3474
3475 2004-02-02  Darin Adler  <darin@apple.com>
3476
3477         Reviewed by Maciej.
3478
3479         - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
3480
3481         * kjs/array_object.cpp:
3482         (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
3483         we start putting values in. This prevents new Array(2147483647) from causing trouble.
3484         (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
3485         number is out of range. This prevents new Array(-1) from causing trouble.
3486
3487         - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
3488
3489         * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
3490         casting to int. Results now match those in other browsers.
3491
3492 2004-02-02  Darin Adler  <darin@apple.com>
3493
3494         Reviewed by Maciej.
3495
3496         - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
3497         - fixed other related overflow issues
3498
3499         * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
3500         * kjs/value.cpp:
3501         (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
3502         must not restrict values to the range of a particular integer type.
3503         (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
3504         proper handling for negative results from fmod.
3505         (ValueImp::toUInt32): Ditto.
3506         (ValueImp::toUInt16): Ditto.
3507         (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
3508
3509         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
3510         out-of-integer-range values better in the slice function.
3511         * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
3512         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
3513         out-of-integer-range values better in the toString function.
3514         * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
3515         out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
3516         and substr functions.
3517
3518 === Safari-126 ===
3519
3520 2004-01-30  Richard Williamson   <rjw@apple.com>
3521
3522         Fixed 3542044.  Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
3523
3524         Reviewed by Darin.
3525
3526         * bindings/jni/jni_instance.cpp:
3527         (JavaInstance::stringValue):
3528
3529 2004-01-26  Darin Adler  <darin@apple.com>
3530
3531         * Makefile.am: Switch from pbxbuild to xcodebuild.
3532
3533 2004-01-22  Richard Williamson   <rjw@apple.com>
3534
3535         Added stubs for ObjC language binding to JavaScript.
3536
3537         * JavaScriptCore.pbproj/project.pbxproj:
3538         * bindings/jni/jni_runtime.h:
3539         * bindings/objc/objc_runtime.h: Added.
3540         (KJS::Bindings::ObjcParameter::ObjcParameter):
3541         (KJS::Bindings::ObjcParameter::~ObjcParameter):
3542         (KJS::Bindings::ObjcParameter::operator=):
3543         (KJS::Bindings::ObjcParameter::type):
3544         (KJS::Bindings::ObjcConstructor::ObjcConstructor):
3545         (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
3546         (KJS::Bindings::ObjcConstructor::_commonCopy):
3547         (KJS::Bindings::ObjcConstructor::operator=):
3548         (KJS::Bindings::ObjcConstructor::value):
3549         (KJS::Bindings::ObjcConstructor::parameterAt):
3550         (KJS::Bindings::ObjcConstructor::numParameters):
3551         (KJS::Bindings::ObjcField::ObjcField):
3552         (KJS::Bindings::ObjcField::~ObjcField):
3553         * bindings/runtime.h:
3554
3555 2004-01-22  Richard Williamson   <rjw@apple.com>
3556
3557         Simplified JavaString by using UString as backing store.  This
3558         revealed a bug in CString's assignment operator which I fixed.
3559
3560         Removed some dead code.
3561  
3562         Reviewed by John.
3563
3564         * bindings/jni/jni_runtime.h:
3565         (KJS::Bindings::JavaString::JavaString):
3566         (KJS::Bindings::JavaString::_commonInit):
3567         (KJS::Bindings::JavaString::UTF8String):
3568         (KJS::Bindings::JavaString::uchars):
3569         (KJS::Bindings::JavaString::length):
3570         (KJS::Bindings::JavaString::ustring):
3571         * bindings/runtime_object.cpp:
3572         (RuntimeObjectImp::RuntimeObjectImp):
3573         * bindings/runtime_object.h:
3574         * kjs/ustring.cpp:
3575         (KJS::CString::CString):
3576         (KJS::CString::operator=):
3577
3578 === Safari-125 ===
3579
3580 === Safari-124 ===
3581
3582 2004-01-16  Richard Williamson   <rjw@apple.com>
3583
3584         Fixed 3525853.  We weren't handling mapping to overloaded Java
3585         methods very well.  Even though this is undefined the other
3586         browsers support it.  Also fixed a bug with returning arrays
3587         from Java functions.
3588
3589         Reviewed by John.
3590
3591         * bindings/jni/jni_class.cpp:
3592         (JavaClass::_commonInit):
3593         (JavaClass::methodsNamed):
3594         * bindings/jni/jni_class.h:
3595         * bindings/jni/jni_instance.cpp:
3596         (JavaInstance::invokeMethod):
3597         * bindings/jni/jni_instance.h:
3598         * bindings/jni/jni_runtime.cpp:
3599         (JavaArray::convertJObjectToArray):
3600         (JavaField::valueFromInstance):
3601         (JavaMethod::signature):
3602         (JavaArray::valueAt):
3603         * bindings/jni/jni_runtime.h:
3604         * bindings/jni_jsobject.cpp:
3605         (JSObject::call):
3606         (JSObject::convertJObjectToValue):
3607         * bindings/runtime.cpp:
3608         (MethodList::addMethod):
3609         (MethodList::length):
3610         (MethodList::methodAt):
3611         (MethodList::~MethodList):
3612         * bindings/runtime.h:
3613         (KJS::Bindings::MethodList::MethodList):
3614         * bindings/runtime_method.cpp:
3615         (RuntimeMethodImp::RuntimeMethodImp):
3616         (RuntimeMethodImp::get):
3617         (RuntimeMethodImp::call):
3618         * bindings/runtime_method.h:
3619         * bindings/runtime_object.cpp:
3620         (RuntimeObjectImp::get):
3621         (RuntimeObjectImp::hasProperty):
3622
3623 2004-01-16  Richard Williamson   <rjw@apple.com>
3624
3625         Fixed 3531229.  Another place that needs the  Push/PopLocalFrame
3626         protection implemented for 3530401.
3627
3628         Reviewed by John.
3629
3630         * bindings/runtime_method.cpp:
3631         (RuntimeMethodImp::call):
3632
3633 2004-01-15  Richard Williamson   <rjw@apple.com>
3634
3635         Fixed 3530401.  JNI doesn't cleanup local refs created on the
3636         main thread.   IMO this is a bad bug in our JMI implementation.
3637
3638         To work-around the problem I explicitly delete all local refs.
3639         Further, I've added Push/PopLocalFrame calls to catch any refs
3640         that I may have missed.  This will guarantee that we don't leak
3641         any Java references.
3642
3643         Reviewed by John.
3644
3645         * bindings/jni/jni_class.cpp:
3646         (JavaClass::_commonInit):
3647         (JavaClass::JavaClass):
3648         * bindings/jni/jni_instance.cpp:
3649         (JavaInstance::begin):
3650         (JavaInstance::end):
3651         * bindings/jni/jni_instance.h:
3652         * bindings/jni/jni_runtime.cpp:
3653         (JavaConstructor::JavaConstructor):
3654         (JavaMethod::JavaMethod):
3655         * bindings/jni_jsobject.cpp:
3656         (JSObject::listFromJArray):
3657         * bindings/runtime.h:
3658         (KJS::Bindings::Instance::begin):
3659         (KJS::Bindings::Instance::end):
3660         * bindings/runtime_object.cpp:
3661         (RuntimeObjectImp::get):
3662         (RuntimeObjectImp::put):
3663         (RuntimeObjectImp::canPut):
3664         (RuntimeObjectImp::hasProperty):
3665         (RuntimeObjectImp::defaultValue):
3666
3667 2004-01-15  Vicki Murley  <vicki@apple.com>
3668
3669         Reviewed by Darin.
3670
3671         * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
3672
3673 2004-01-14  Richard Williamson   <rjw@apple.com>
3674         
3675         Fixed 3529466.  With recent changes to Java plugin we must no
3676         longer call DeleteLocalRef().  Not a problem, it was an optimization anyway.
3677
3678         Reviewed by John.
3679
3680         * bindings/jni/jni_instance.cpp:
3681         (JObjectWrapper::JObjectWrapper):
3682
3683 === Safari-122 ===
3684
3685 2004-01-14  Richard Williamson   <rjw@apple.com>
3686
3687         Fixed 3529010.
3688
3689         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.
3690
3691         Reviewed by John.
3692
3693         * bindings/jni_jsobject.cpp:
3694         (addJavaReference):
3695         (removeJavaReference):
3696         (RootObject::removeAllJavaReferencesForRoot):
3697         (JSObject::invoke):
3698
3699 2004-01-13  Richard Williamson   <rjw@apple.com>
3700
3701         Fixed 3528324. 
3702
3703         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.
3704
3705         Reviewed by Hyatt.
3706
3707         * bindings/jni_jsobject.h:
3708         (KJS::Bindings::RootObject::~RootObject):
3709
3710 === Safari-121 ===
3711
3712 === Safari-120 ===
3713
3714 2004-01-06  Richard Williamson   <rjw@apple.com>
3715
3716         Fixed 3521814.  Finalize messages weren't being dispatched!
3717
3718         Reviewed by John.
3719
3720         * bindings/jni_jsobject.cpp:
3721         (JSObject::invoke):
3722
3723 2004-01-05  Richard Williamson   <rjw@apple.com>
3724
3725         Added cache of JNI method IDs to minimize allocations.  This mitigates the problem
3726         described by 3515579.
3727
3728         Also cleanup up logging of Java exceptions.
3729
3730         Reviewed by John.
3731
3732         * bindings/jni/jni_class.cpp:
3733         (JavaClass::classForInstance):
3734         * bindings/jni/jni_instance.cpp:
3735         (JavaInstance::JavaInstance):
3736         (JavaInstance::getClass):
3737         (JavaInstance::invokeMethod):
3738         (JObjectWrapper::JObjectWrapper):
3739         (JObjectWrapper::~JObjectWrapper):
3740         * bindings/jni/jni_instance.h:
3741         (KJS::Bindings::JavaInstance::operator=):
3742         * bindings/jni/jni_runtime.cpp:
3743         (JavaMethod::JavaMethod):
3744         (JavaMethod::methodID):
3745         * bindings/jni/jni_runtime.h:
3746         (KJS::Bindings::JavaMethod::JavaMethod):
3747         * bindings/jni/jni_utility.cpp:
3748         (callJNIMethod):
3749         (callJNIMethodIDA):
3750         (callJNIMethodA):
3751         (KJS::Bindings::getMethodID):
3752         (KJS::Bindings::callJNIVoidMethodIDA):
3753         (KJS::Bindings::callJNIObjectMethodIDA):
3754         (KJS::Bindings::callJNIByteMethodIDA):
3755         (KJS::Bindings::callJNICharMethodIDA):
3756         (KJS::Bindings::callJNIShortMethodIDA):
3757         (KJS::Bindings::callJNIIntMethodIDA):
3758         (KJS::Bindings::callJNILongMethodIDA):
3759         (KJS::Bindings::callJNIFloatMethodIDA):
3760         (KJS::Bindings::callJNIDoubleMethodIDA):
3761         (KJS::Bindings::callJNIBooleanMethodIDA):
3762         (KJS::Bindings::getCharactersFromJStringInEnv):
3763         (KJS::Bindings::getUCharactersFromJStringInEnv):
3764         (KJS::Bindings::getJNIField):
3765         * bindings/jni/jni_utility.h:
3766
3767 l2003-12-23  John Sullivan  <sullivan@apple.com>
3768
3769         * JavaScriptCore.pbproj/project.pbxproj:
3770         Xcode version wars, harmless
3771
3772 2003-12-23  Darin Adler  <darin@apple.com>
3773
3774         Reviewed by John (concept, not code, which is just the old code coming back).
3775
3776         - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
3777
3778         * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
3779         mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
3780
3781 2003-12-19  Richard Williamson   <rjw@apple.com>
3782
3783         Fixed 3515597.  When an error occurs we need
3784         to make sure result values are zeroed.
3785
3786         Cleaned up logs by adding a newline.
3787
3788         Reviewed by John.
3789
3790         * bindings/jni/jni_utility.cpp:
3791         (KJS::Bindings::getJavaVM):
3792         (KJS::Bindings::getJNIEnv):
3793         (callJNIMethod):
3794         (callJNIMethodA):
3795         (KJS::Bindings::getJNIField):
3796         * bindings/jni_jsobject.cpp:
3797         (JSObject::convertValueToJObject):
3798
3799 === Safari-119 ===
3800
3801 2003-12-17  Richard Williamson   <rjw@apple.com>
3802
3803         Ensure that all the symbols we export are in the KJS
3804         namespace (3512245).
3805
3806         Also renamed JavaString.characters() to JavaString.UTF8String()
3807         for enhanced clarity.
3808
3809         Added some sanity checking to constructor of JObjectWrapper.
3810
3811         Reviewed by Dave.
3812
3813         * ChangeLog:
3814         * bindings/jni/jni_class.cpp:
3815         * bindings/jni/jni_class.h:
3816         * bindings/jni/jni_instance.cpp:
3817         (JavaInstance::invokeMethod):
3818         (JObjectWrapper::JObjectWrapper):
3819         * bindings/jni/jni_instance.h:
3820         * bindings/jni/jni_runtime.cpp:
3821         (JavaParameter::JavaParameter):
3822         (JavaField::JavaField):
3823         (JavaMethod::JavaMethod):
3824         (JavaMethod::signature):
3825         * bindings/jni/jni_runtime.h:
3826         (KJS::Bindings::JavaString::ascii):
3827         (KJS::Bindings::JavaString::UTF8String):
3828         (KJS::Bindings::JavaString::JavaString):
3829         (KJS::Bindings::JavaString::_commonInit):
3830         (KJS::Bindings::JavaString::uchars):
3831         (KJS::Bindings::JavaString::length):
3832         (KJS::Bindings::JavaString::ustring):
3833         (KJS::Bindings::JavaParameter::type):
3834         (KJS::Bindings::JavaField::name):
3835         (KJS::Bindings::JavaField::type):
3836         (KJS::Bindings::JavaMethod::name):
3837         (KJS::Bindings::JavaMethod::returnType):
3838         * bindings/jni/jni_utility.cpp:
3839         (KJS::Bindings::getJavaVM):
3840         (KJS::Bindings::getJNIEnv):
3841         (KJS::Bindings::callJNIVoidMethod):
3842         (KJS::Bindings::callJNIObjectMethod):
3843         (KJS::Bindings::callJNIBooleanMethod):
3844         (KJS::Bindings::callJNIByteMethod):
3845         (KJS::Bindings::callJNICharMethod):
3846         (KJS::Bindings::callJNIShortMethod):
3847         (KJS::Bindings::callJNIIntMethod):
3848         (KJS::Bindings::callJNILongMethod):
3849         (KJS::Bindings::callJNIFloatMethod):
3850         (KJS::Bindings::callJNIDoubleMethod):
3851         (KJS::Bindings::callJNIVoidMethodA):
3852         (KJS::Bindings::callJNIObjectMethodA):
3853         (KJS::Bindings::callJNIByteMethodA):
3854         (KJS::Bindings::callJNICharMethodA):
3855         (KJS::Bindings::callJNIShortMethodA):
3856         (KJS::Bindings::callJNIIntMethodA):
3857         (KJS::Bindings::callJNILongMethodA):
3858         (KJS::Bindings::callJNIFloatMethodA):
3859         (KJS::Bindings::callJNIDoubleMethodA):
3860         (KJS::Bindings::callJNIBooleanMethodA):
3861         (KJS::Bindings::getCharactersFromJString):
3862         (KJS::Bindings::releaseCharactersForJString):
3863         (KJS::Bindings::getCharactersFromJStringInEnv):
3864         (KJS::Bindings::releaseCharactersForJStringInEnv):
3865         (KJS::Bindings::getUCharactersFromJStringInEnv):
3866         (KJS::Bindings::releaseUCharactersForJStringInEnv):
3867         (KJS::Bindings::JNITypeFromClassName):
3868         (KJS::Bindings::signatureFromPrimitiveType):
3869         (KJS::Bindings::JNITypeFromPrimitiveType):
3870         (KJS::Bindings::getJNIField):
3871         (KJS::Bindings::convertValueToJValue):
3872         * bindings/jni/jni_utility.h:
3873         * bindings/jni_jsobject.cpp:
3874         (KJS::Bindings::JSObject::invoke):
3875         (KJS::Bindings::JSObject::JSObject):
3876         (KJS::Bindings::JSObject::call):
3877         (KJS::Bindings::JSObject::eval):
3878         (KJS::Bindings::JSObject::getMember):
3879         (KJS::Bindings::JSObject::setMember):
3880         (KJS::Bindings::JSObject::removeMember):
3881         (KJS::Bindings::JSObject::getSlot):
3882         (KJS::Bindings::JSObject::setSlot):
3883         (KJS::Bindings::JSObject::toString):
3884         (KJS::Bindings::JSObject::finalize):
3885         (KJS::Bindings::JSObject::createNative):
3886         (KJS::Bindings::JSObject::convertValueToJObject):
3887         (KJS::Bindings::JSObject::convertJObjectToValue):
3888         (KJS::Bindings::JSObject::listFromJArray):
3889         * bindings/jni_jsobject.h:
3890         * bindings/runtime.cpp:
3891         * bindings/runtime.h:
3892         * bindings/runtime_method.cpp:
3893         * bindings/runtime_method.h:
3894
3895 === Safari-118 ===
3896
3897 2003-12-16  Richard Williamson   <rjw@apple.com>
3898
3899         Ack!  More assertions.  Lock ALL entry points into the interpreter!
3900         (3511733).
3901
3902         Reviewed by Ken.
3903
3904         * bindings/jni_jsobject.cpp:
3905         (Bindings::JSObject::call):
3906         (Bindings::JSObject::eval):
3907         (Bindings::JSObject::getMember):
3908         (Bindings::JSObject::setMember):
3909         (Bindings::JSObject::removeMember):
3910         (Bindings::JSObject::getSlot):
3911         (Bindings::JSObject::setSlot):
3912         (Bindings::JSObject::convertJObjectToValue):
3913
3914 2003-12-15  Richard Williamson   <rjw@apple.com>
3915
3916         Fixed a couple of snafus and removed some logging.
3917
3918         Reviewed by Maciej.
3919
3920         * bindings/jni_jsobject.cpp:
3921         (Bindings::performJavaScriptAccess):
3922         (Bindings::completedJavaScriptAccess):
3923         (Bindings::dispatchToJavaScriptThread):
3924         Removed some annoying JS_LOG clutter.
3925
3926         (Bindings::RootObject::removeAllJavaReferencesForRoot):
3927         Fixed allocation of key buffer that was called after it was needed.
3928
3929         (Bindings::JSObject::invoke):
3930         (Bindings::JSObject::JSObject):
3931         (Bindings::JSObject::getMember):
3932         (Bindings::JSObject::getSlot):
3933         Added additional interpreter locks around getMember and getSlot. 
3934         These functions may cause allocation of JS impls.  
3935
3936 2003-12-15  Richard Williamson   <rjw@apple.com>
3937
3938         args weren't passed to 'call' invocation.  d'oh.
3939         lock interpreter when we create instances of JS impls.        
3940
3941         Reviewed by Maciej.
3942
3943         * bindings/jni_jsobject.cpp:
3944         (Bindings::JSObject::call):
3945         (Bindings::JSObject::eval):
3946         (Bindings::JSObject::getMember):
3947         (Bindings::JSObject::setMember):
3948         (Bindings::JSObject::getSlot):
3949         (Bindings::JSObject::convertValueToJObject):
3950         (Bindings::JSObject::convertJObjectToValue):
3951         (Bindings::JSObject::listFromJArray):
3952         * bindings/jni_jsobject.h:
3953
3954 2003-12-15  Richard Williamson   <rjw@apple.com>
3955
3956         Last piece of LiveConnect!  This checkin adds implementation
3957         of the Java to JavaScript object conversion functions.
3958
3959         Reviewed by John.
3960
3961         * bindings/jni/jni_instance.cpp:
3962         (JavaInstance::invokeMethod):
3963         * bindings/jni/jni_utility.cpp:
3964         * bindings/jni/jni_utility.h:
3965         * bindings/jni_jsobject.cpp:
3966         (Bindings::JSObject::invoke):
3967         (Bindings::JSObject::call):
3968         (Bindings::JSObject::eval):
3969         (Bindings::JSObject::getMember):
3970         (Bindings::JSObject::setMember):
3971         (Bindings::JSObject::getSlot):
3972         (Bindings::JSObject::setSlot):
3973         (Bindings::JSObject::createNative):
3974         (Bindings::JSObject::convertValueToJObject):
3975         (Bindings::JSObject::convertJObjectToValue):
3976         (Bindings::JSObject::listFromJArray):
3977         * bindings/jni_jsobject.h:
3978         (Bindings::):
3979         * bindings/runtime_method.cpp:
3980         (RuntimeMethodImp::get):
3981         (RuntimeMethodImp::codeType):
3982         (RuntimeMethodImp::execute):
3983
3984 2003-12-12  Richard Williamson   <rjw@apple.com>
3985
3986         Added implementation of stubs in JSObject.  All that
3987         remains is a couple of simple conversion functions stubs and
3988         we're done with LiveConnect.  Also, changed string passing to
3989         JS to use uchars instead of chars.  
3990
3991         Reviewed by Maciej.
3992
3993         * bindings/jni/jni_runtime.h:
3994         (Bindings::JavaString::JavaString):
3995         (Bindings::JavaString::_commonInit):
3996         (Bindings::JavaString::_commonCopy):
3997         (Bindings::JavaString::_commonDelete):
3998         (Bindings::JavaString::~JavaString):
3999         (Bindings::JavaString::operator=):
4000         (Bindings::JavaString::uchars):
4001         (Bindings::JavaString::length):
4002         (Bindings::JavaString::ustring):
4003         * bindings/jni/jni_utility.cpp:
4004         (getUCharactersFromJStringInEnv):
4005         (releaseUCharactersForJStringInEnv):
4006         (convertValueToJObject):
4007         (convertJObjectToValue):
4008         * bindings/jni/jni_utility.h:
4009         * bindings/jni_jsobject.cpp:
4010         (Bindings::JSObject::invoke):
4011         (Bindings::JSObject::call):
4012         (Bindings::JSObject::eval):
4013         (Bindings::JSObject::getMember):
4014         (Bindings::JSObject::setMember):
4015         (Bindings::JSObject::removeMember):
4016         (Bindings::JSObject::getSlot):
4017         (Bindings::JSObject::setSlot):
4018         * bindings/jni_jsobject.h:
4019
4020 2003-12-12  Richard Williamson   <rjw@apple.com>
4021
4022         Ensure that all calls from Java into JavaScript are
4023         performed on a designated thread (the main thread).
4024
4025         Reviewed by Ken.
4026
4027         * bindings/jni_jsobject.cpp:
4028         (isJavaScriptThread):
4029         (rootForImp):
4030         (Bindings::performJavaScriptAccess):
4031         (Bindings::completedJavaScriptAccess):
4032         (Bindings::initializeJavaScriptAccessLock):
4033         (Bindings::lockJavaScriptAccess):
4034         (Bindings::unlockJavaScriptAccess):
4035         (Bindings::dispatchToJavaScriptThread):
4036         (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
4037         (Bindings::RootObject::removeAllJavaReferencesForRoot):
4038         (Bindings::JSObject::invoke):
4039         (Bindings::JSObject::JSObject):
4040         (Bindings::JSObject::call):
4041         (Bindings::JSObject::eval):
4042         (Bindings::JSObject::getMember):
4043         (Bindings::JSObject::setMember):
4044         (Bindings::JSObject::removeMember):
4045         (Bindings::JSObject::getSlot):
4046         (Bindings::JSObject::setSlot):
4047         (Bindings::JSObject::toString):
4048         (Bindings::JSObject::finalize):
4049         (Bindings::JSObject::getWindow):
4050         * bindings/jni_jsobject.h:
4051         (Bindings::RootObject::~RootObject):
4052         (Bindings::RootObject::findRootObjectForNativeHandleFunction):
4053         (Bindings::RootObject::runLoop):
4054         (Bindings::RootObject::performJavaScriptSource):
4055         (Bindings::):
4056
4057 2003-12-11  Richard Williamson   <rjw@apple.com>
4058
4059         Added support for calling a JavaScript function from
4060         Java.  Right now this only works for void func(void)
4061         functions, but the conversion of args and return values
4062         will come shortly.
4063
4064         Cleaned up and verified reference counting scheme, and
4065         dereferencing of vended JavaScript objects when applet is
4066         destroyed (actually when part is destroyed).
4067         
4068         Removed link hack for testkjs now that the Java folks think
4069         they have a solution for the 1.4.2 JavaVM link problem.  Although
4070         Greg B. thinks his solution may cause problems for the 1.3.1
4071         version of the VM!?!
4072
4073         Reviewed by Ken.
4074
4075         * Makefile.am:
4076         * bindings/jni/jni_runtime.h:
4077         (Bindings::JavaString::JavaString):
4078         * bindings/jni/jni_utility.cpp:
4079         (convertValueToJValue):
4080         (convertValueToJObject):
4081         (listFromJArray):
4082         * bindings/jni/jni_utility.h:
4083         * bindings/jni_jsobject.cpp:
4084         (KJS_setFindRootObjectForNativeHandleFunction):
4085         (KJS_findRootObjectForNativeHandleFunction):
4086         (getReferencesByRootDictionary):
4087         (getReferencesDictionary):
4088         (findReferenceDictionary):
4089         (rootForImp):
4090         (addJavaReference):
4091         (removeJavaReference):
4092         * bindings/jni_jsobject.h:
4093         (Bindings::RootObject::RootObject):
4094         (Bindings::RootObject::~RootObject):
4095         (Bindings::RootObject::setRootObjectImp):
4096         (Bindings::RootObject::rootObjectImp):
4097         (Bindings::RootObject::setInterpreter):
4098         (Bindings::RootObject::interpreter):
4099
4100 === Safari-117 ===
4101
4102 2003-12-10  Darin Adler  <darin@apple.com>
4103
4104         Reviewed by Maciej.
4105
4106         - fixed regression in JavaScript tests reported by the KDE guys
4107         - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
4108
4109         * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
4110         * kjs/ustring.cpp:
4111         (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
4112         tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
4113         and binary compatibility than default parameter values.
4114         (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
4115
4116         * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
4117         "tolerate empty string" parameter.
4118
4119 2003-12-10  Richard Williamson   <rjw@apple.com>
4120
4121         Added code to manage reference counting of JavaScript
4122         objects passed to Java.   Also added implementation of
4123         KJS_JSCreateNativeJSObject.  This is the function that
4124         provides the root object to Java (KJS::Window).
4125
4126         Reviewed by Hyatt.
4127
4128         * JavaScriptCore.pbproj/project.pbxproj:
4129         * bindings/jni_jsobject.cpp:
4130         (KJS_setFindObjectForNativeHandleFunction):
4131         (KJS_findObjectForNativeHandleFunction):
4132         (getReferencesByOwnerDictionary):
4133         (getReferencesDictionary):
4134         (findReferenceDictionary):
4135         (addJavaReference):
4136         (removeJavaReference):
4137         (removeAllJavaReferencesForOwner):
4138         * bindings/jni_jsobject.h:
4139
4140 2003-12-09  Richard Williamson   <rjw@apple.com>
4141
4142         LiveConnect stubs that correspond to the native methods
4143         on JSObject.  These will be called from the new Java plugin
4144         when an instance of JSObject is instantiated and messaged.
4145         When these are implemented the Java will be able to originate
4146         calls into JavaScript.
4147
4148         Also a temporary work-around added to Makefile.am to solve
4149         a link problem.  The 1.4.2 JavaVM accidentally links against
4150         libobjc.  This call a failure linking testkjs.  Mike Hay is
4151         working with someone to fix the problem (3505587).
4152
4153         Reviewed by Chris.
4154
4155         * JavaScriptCore.pbproj/project.pbxproj:
4156         * Makefile.am:
4157         * bindings/jni_jsobject.cpp: Added.
4158         (KJS_JSCreateNativeJSObject):
4159         (KJS_JSObject_JSFinalize):
4160         (KJS_JSObject_JSObjectCall):
4161         (KJS_JSObject_JSObjectEval):
4162         (KJS_JSObject_JSObjectGetMember):
4163         (KJS_JSObject_JSObjectSetMember):
4164         (KJS_JSObject_JSObjectRemoveMember):
4165         (KJS_JSObject_JSObjectGetSlot):
4166         (KJS_JSObject_JSObjectSetSlot):
4167         (KJS_JSObject_JSObjectToString):
4168         * bindings/jni_jsobject.h: Added.
4169
4170 2003-12-09  Maciej Stachowiak  <mjs@apple.com>
4171
4172         Reviewed by John.
4173
4174         <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
4175
4176         * kjs/collector.cpp:
4177         (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
4178         (KJS::Collector::collect): likewise
4179
4180 2003-12-08  Richard Williamson   <rjw@apple.com>
4181
4182         LiveConnect:  The last piece of the JavaScript side of the
4183         LiveConnect implementation.  This change adds support for
4184         setting/getting values from Java arrays in JavaScript.
4185
4186         Reviewed by John.
4187
4188         * bindings/jni/jni_instance.h:
4189         * bindings/jni/jni_runtime.cpp:
4190         (JavaField::JavaField):
4191         (convertJObjectToArray):
4192         (JavaArray::JavaArray):
4193         (JavaArray::~JavaArray):
4194         (JavaArray::setValueAt):
4195         (JavaArray::valueAt):
4196         (JavaArray::getLength):
4197         * bindings/jni/jni_runtime.h:
4198         (Bindings::JavaArray::operator=):
4199         (Bindings::JavaArray::javaArray):
4200         * bindings/jni/jni_utility.cpp:
4201         (JNITypeFromPrimitiveType):
4202         (convertValueToJValue):
4203         * bindings/jni/jni_utility.h:
4204         * bindings/runtime.h:
4205         * bindings/runtime_array.cpp:
4206         (RuntimeArrayImp::RuntimeArrayImp):
4207