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