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