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