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