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