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