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