658e1db8a40f7d732b6017d5827c28fdd82a6971
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2006-08-23  David Hyatt  <hyatt@apple.com>
2
3         Fix Platform.h to include #defines for graphics features.
4
5         Reviewed by darin
6
7         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
8         * wtf/Platform.h:
9
10 2006-08-23  Anders Carlsson  <acarlsson@apple.com>
11
12         Reviewed by Darin.
13
14         Make the bindings compile without CoreFoundation.
15         
16         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
17         * bindings/c/c_instance.cpp:
18         * bindings/c/c_utility.cpp:
19         (KJS::Bindings::convertUTF8ToUTF16):
20         * bindings/npapi.h:
21         * bindings/runtime.cpp:
22         (KJS::Bindings::Instance::createBindingForLanguageInstance):
23         (KJS::Bindings::Instance::createLanguageInstanceForValue):
24         * bindings/runtime_root.cpp:
25         * bindings/runtime_root.h:
26         * kjs/interpreter.cpp:
27         (KJS::Interpreter::createLanguageInstanceForValue):
28         * kjs/interpreter.h:
29
30 2006-08-22  Anders Carlsson  <acarlsson@apple.com>
31
32         Reviewed by Darin.
33
34         Move the npruntime code over to using HashMap and the runtime_root code over to using 
35         HashMap and HashCountedSet.
36         
37         * bindings/NP_jsobject.cpp:
38         * bindings/c/c_utility.cpp:
39         (KJS::Bindings::identifierFromNPIdentifier):
40         * bindings/c/c_utility.h:
41         * bindings/jni/jni_jsobject.cpp:
42         (JavaJSObject::invoke):
43         * bindings/npruntime.cpp:
44         (getStringIdentifierMap):
45         (getIntIdentifierMap):
46         (_NPN_GetStringIdentifier):
47         (_NPN_GetIntIdentifier):
48         * bindings/runtime_root.cpp:
49         (getReferencesByRootMap):
50         (getReferencesSet):
51         (KJS::Bindings::findReferenceSet):
52         (KJS::Bindings::rootForImp):
53         (KJS::Bindings::rootForInterpreter):
54         (KJS::Bindings::addNativeReference):
55         (KJS::Bindings::removeNativeReference):
56         (RootObject::removeAllNativeReferences):
57         * bindings/runtime_root.h:
58
59 2006-08-22  Anders Carlsson  <acarlsson@apple.com>
60
61         Reviewed by Geoff.
62         
63         Switch over the NPAPI and Java bindings to using HashMaps instead of dictionaries.
64         
65         * JavaScriptCore.xcodeproj/project.pbxproj:
66         * bindings/c/c_class.cpp:
67         (KJS::Bindings::CClass::CClass):
68         (KJS::Bindings::CClass::~CClass):
69         (KJS::Bindings::CClass::classForIsA):
70         (KJS::Bindings::CClass::methodsNamed):
71         (KJS::Bindings::CClass::fieldNamed):
72         * bindings/c/c_class.h:
73         * bindings/jni/jni_class.cpp:
74         (JavaClass::JavaClass):
75         (JavaClass::~JavaClass):
76         (JavaClass::methodsNamed):
77         (JavaClass::fieldNamed):
78         * bindings/jni/jni_class.h:
79         * bindings/objc/objc_class.h:
80         * bindings/objc/objc_class.mm:
81         (KJS::Bindings::deleteMethod):
82         (KJS::Bindings::deleteField):
83         (KJS::Bindings::):
84         (KJS::Bindings::ObjcClass::methodsNamed):
85         (KJS::Bindings::ObjcClass::fieldNamed):
86         * bindings/runtime.cpp:
87         * bindings/runtime.h:
88         * bindings/runtime_object.cpp:
89         (RuntimeObjectImp::fieldGetter):
90         (RuntimeObjectImp::getOwnPropertySlot):
91         (RuntimeObjectImp::put):
92         (RuntimeObjectImp::canPut):
93
94 2006-08-21  Vladimir Olexa  <vladimir.olexa@gmail.com>
95
96         Reviewed by Darin.
97
98         http://bugzilla.opendarwin.org/show_bug.cgi?id=6252
99         JavaScript 1.6 Array.lastIndexOf
100
101         Test: fast/js/array-lastIndexOf.html
102
103         * kjs/array_object.cpp:
104         (ArrayProtoFunc::callAsFunction): Added a LastIndexOf case.
105         * kjs/array_object.h:
106         (KJS::ArrayProtoFunc::): Added LastIndexOf to enum.
107         * tests/mozilla/expected.html: Two more tests now pass.
108
109 2006-08-20  Nikolas Zimmermann  <zimmermann@kde.org>
110
111         Reviewed by Maciej. Landed by rwlbuis.
112
113         Fixes parts of: http://bugzilla.opendarwin.org/show_bug.cgi?id=10463
114         WebKit should have Qt platform support
115
116         Removing obsolete QConstString/QString constructors in kjs code.
117
118         * kjs/identifier.h:
119         * kjs/ustring.h:
120
121 2006-08-17  Nikolas Zimmermann  <zimmermann@kde.org>
122
123         Reviewed by Maciej. Landed by rwlbuis.
124
125         Fixes: http://bugzilla.opendarwin.org/show_bug.cgi?id=10463
126         WTF Changes needed for Qt platform code.
127
128         * wtf/Platform.h:
129         * wtf/unicode/UnicodeDecomposition.h: Added.
130         (WTF::Unicode::):
131         * wtf/unicode/UnicodeDirection.h: Added.
132         (WTF::Unicode::):
133         * wtf/unicode/qt4/UnicodeQt4.cpp: Added.
134         (WTF::Unicode::direction):
135         (WTF::Unicode::category):
136         (WTF::Unicode::decomposition):
137         * wtf/unicode/qt4/UnicodeQt4.h:
138         (WTF::Unicode::toLower):
139         (WTF::Unicode::toUpper):
140         (WTF::Unicode::isPrintableChar):
141         (WTF::Unicode::isSpace):
142         (WTF::Unicode::isPunct):
143         (WTF::Unicode::isDigit):
144         (WTF::Unicode::mirroredChar):
145         (WTF::Unicode::compare):
146
147 2006-08-17  Nikolas Zimmermann  <zimmermann@kde.org>
148
149         Reviewed by Eric. Landed by rwlbuis.
150
151         Fixes: http://bugzilla.opendarwin.org/show_bug.cgi?id=10464
152         Offer a cmake build system for Qt platform.
153
154         * CMakeLists.txt: Added.
155         * pcre/CMakeLists.txt: Added.
156
157 2006-08-17  Anders Carlsson  <acarlsson@apple.com>
158
159         Reviewed by Maciej.
160
161         * bindings/npapi.h:
162         Fix ifdef.
163
164 2006-08-15  Steve Falkenburg  <sfalken@apple.com>
165
166         Reviewed by mjs.
167         
168         Build fix.
169
170         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
171         * wtf/Assertions.h:
172
173 2006-08-15  Mark Rowe  <opendarwin.org@bdash.net.nz>
174
175         Reviewed by Tim H.
176
177         Build fix:  DWARF and -gfull are incompatible with symbol separation.
178
179         * JavaScriptCore.xcodeproj/project.pbxproj:
180
181 2006-08-15  Mark Rowe  <opendarwin.org@bdash.net.nz>
182
183         Reviewed by Tim H.
184
185         http://bugzilla.opendarwin.org/show_bug.cgi?id=10394
186         Bug 10394: WebKit Release and Production configurations should enable dead code stripping
187
188         * JavaScriptCore.xcodeproj/project.pbxproj:
189
190 2006-08-15  Mark Rowe  <opendarwin.org@bdash.net.nz>
191
192         Reviewed by Tim H.
193
194         http://bugzilla.opendarwin.org/show_bug.cgi?id=10384
195         Bug 10384: Switch to DWARF for Release configuration
196
197         * JavaScriptCore.xcodeproj/project.pbxproj:
198
199 2006-08-13  Maks Orlovich  <maksim@kde.org>
200
201         Reviewed (and tweaked a little) by Maciej.
202         
203         - shrank the size of JSObject by 8 bytes and made the corresponding reduction to the cell size, resulting
204         in a 1.2% speed improvement on JS iBench (and probably overall memory savings).
205
206         This was done by removing _scope and _internalValue data members
207         from JSObject and moving them only to the subclasses that actually
208         make use of them.
209         
210         * kjs/object.cpp: 
211         (KJS::JSObject::mark): No need to mark scope or internal value here.
212         * kjs/object.h:
213         (KJS::JSObject::JSObject): Don't initialize them.
214         * kjs/JSWrapperObject.cpp: Added. New base class for object types that
215         wrap primitive values (Number, String, Boolean, Date).
216         (KJS::JSWrapperObject::mark): 
217         * kjs/JSWrapperObject.h: Added.
218         (KJS::JSWrapperObject::JSWrapperObject):
219         (KJS::JSWrapperObject::internalValue):
220         (KJS::JSWrapperObject::setInternalValue):
221         * kjs/array_object.cpp:
222         (ArrayPrototype::ArrayPrototype): Don't set useless internal value.
223         * kjs/bool_object.cpp:
224         (BooleanInstance::BooleanInstance): Inherit from JSWrapperObject.
225         (BooleanProtoFunc::callAsFunction): Fixed to account for fact that not all
226         JSObjects have an internal value.
227         (BooleanObjectImp::construct): ditto.
228         * kjs/bool_object.h:
229         * kjs/collector.cpp: Lowered cell size to 48.
230         (KJS::Collector::allocate): meaningless whitespace change
231         * kjs/date_object.cpp:
232         (KJS::DateInstance::DateInstance): Inherit from JSWrapperObject.
233         (KJS::DateProtoFunc::callAsFunction): adjusted for move of internalValue
234         (KJS::DateObjectImp::construct): ditto
235         * kjs/date_object.h:
236         * kjs/error_object.cpp:
237         (ErrorPrototype::ErrorPrototype): don't set internal value
238         * kjs/function.cpp: move _scope and related handling here
239         (KJS::FunctionImp::mark): mark scope
240         * kjs/function.h:
241         (KJS::FunctionImp::scope): moved here from JSObject
242         (KJS::FunctionImp::setScope): ditto
243         * kjs/number_object.cpp:
244         (NumberInstance::NumberInstance): inherit from JSWrapperObject
245         (NumberProtoFunc::callAsFunction): adjusted
246         (NumberObjectImp::construct): adjusted
247         * kjs/number_object.h: shring RegExp-related objects a little
248         * kjs/regexp_object.cpp:
249         (RegExpPrototype::RegExpPrototype): Adjust for size tweaks
250         (RegExpObjectImp::RegExpObjectImp): ditto
251         * kjs/regexp_object.h:
252         * kjs/string_object.cpp:
253         (StringInstance::StringInstance): inherit from JSWrapperObject
254         (StringProtoFunc::callAsFunction): adjusted
255         * kjs/string_object.h:
256         * JavaScriptCore.exp: Exported new methods as needed.
257         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files to build.
258
259 2006-08-04  Brady Eidson  <beidson@apple.com>
260
261         Reviewed by Geoff's rubber stamp
262
263         Fix a build break on Intel hardware causes by adapting stricter
264         compiler warnings (-Wshorten-64-to-32)
265
266         * API/testapi.c:
267         (assertEqualsAsNumber): manually cast some doubles to floats
268         (main): ditto
269
270 2006-08-04  Sam Weinig  <sam.weinig@gmail.com>
271
272         Reviewed by Darin.
273
274         - patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=10192
275           Make WebCore (and friends) compile with -Wshorten-64-to-32
276
277           * Adds -Wshorten-64-to-32 flag to Xcode project.
278           * Adds explicit casts where OK.
279
280         * API/JSNodeList.c:
281         (JSNodeList_item):
282         (JSNodeList_getProperty):
283         * JavaScriptCore.xcodeproj/project.pbxproj:
284
285 2006-08-04  Adam Roben  <aroben@apple.com>
286
287         Reviewed by Anders.
288
289         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Convert
290         spaces to tabs
291
292 2006-08-03  Sam Weinig  <sam.weinig@gmail.com>
293
294         Reviewed by Darin.
295
296         - patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=10176
297           Make WebCore compile with -Wundef
298
299           * Adds -Wundef flag to Xcode project
300           * Converts #ifs to #ifdef and #ifndefs where needed.
301           * Added #define YYMAXDEPTH 10000 in kjs/grammar.y
302             to fix a warning from within Bison.
303
304         * JavaScriptCore.xcodeproj/project.pbxproj:
305         * bindings/jni/jni_jsobject.cpp:
306         (JavaJSObject::getSlot):
307         (JavaJSObject::setSlot):
308         * bindings/npapi.h:
309         * bindings/objc/objc_class.mm:
310         (KJS::Bindings::ObjcClass::methodsNamed):
311         (KJS::Bindings::ObjcClass::fieldNamed):
312         * bindings/objc/objc_instance.mm:
313         (ObjcInstance::invokeMethod):
314         * bindings/objc/objc_runtime.mm:
315         (ObjcMethod::getMethodSignature):
316         (ObjcField::name):
317         (ObjcField::type):
318         * kjs/grammar.y:
319         * kjs/identifier.h:
320
321 2006-08-03  Anders Carlsson  <acarlsson@apple.com>
322
323         Reviewed by John Sullivan.
324
325        * wtf/HashSet.h:
326         (WTF::::operator):
327         Return *this in operator=
328
329 2006-08-03  Adam Roben  <aroben@apple.com>
330
331         Reviewed by Anders.
332
333         - Fixed Windows build
334
335         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
336         * wtf/MathExtras.h: Implement inline versions of these functions
337         (nextafter):
338         (nextafterf):
339
340 2006-08-02  Adam Roben  <aroben@apple.com>
341
342         Reviewed by Darin.
343
344         - Fixed build
345
346         * kjs/date_object.cpp:
347         (KJS::formatTime):
348
349 2006-07-29  Darin Adler  <darin@apple.com>
350
351         - Removed tabs from these source files that still had them.
352           We don't use them; that way source files look fine in editors
353           that have tabs set to 8 spaces or to 4 spaces.
354         - Removed allow-tabs Subversion property from the files too.
355
356         * bindings/NP_jsobject.cpp:
357         * bindings/c/c_utility.cpp:
358         * bindings/jni/jni_runtime.cpp:
359         * bindings/jni/jni_utility.cpp:
360         * bindings/objc/objc_utility.mm:
361         * bindings/runtime.cpp:
362         * bindings/runtime_method.cpp:
363         * bindings/testbindings.cpp:
364         * bindings/testbindings.mm:
365         * kjs/date_object.cpp:
366         * kjs/function.cpp:
367         * kjs/list.cpp:
368         * kjs/nodes.cpp:
369         * kjs/nodes.h:
370         * kjs/string_object.cpp:
371         * kjs/ustring.cpp:
372
373 2006-07-29  Darin Adler  <darin@apple.com>
374
375         * tests/mozilla/expected.html: Update test results now that regress-185165.js
376         is succeeding. I suspect Anders fix for bug 4620655 is the reason.
377
378 2006-07-29  Sam Weinig  <sam.weinig@gmail.com>
379
380         Reviewed by Darin.
381
382         - patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=10080
383           Adopt pedantic changes from the Unity project to improve 
384           cross-compiler compatibility
385
386           Changes include:
387           * Removing trailing semicolon from namespace braces.
388           * Removing trailing comma from last enum declaration.
389           * Updating to match style guidelines.
390           * Adding missing newline to the end of the file.
391           * Turning on gcc warning for missing newline at the end of a source file
392             (GCC_WARN_ABOUT_MISSING_NEWLINE in Xcode, -Wnewline in gcc).
393           * Alphabetical sorting of Xcode source list files. 
394           * Replace use of non-portable variable-size array with Vector.
395           * Use C-style comments instead of C++ comments in files that might
396             be included by either C or C++ files.
397
398         * API/JSCallbackConstructor.cpp:
399         (KJS::JSCallbackConstructor::construct):
400         * API/JSCallbackFunction.cpp:
401         (KJS::JSCallbackFunction::callAsFunction):
402         * API/JSCallbackObject.cpp:
403         (KJS::JSCallbackObject::construct):
404         (KJS::JSCallbackObject::callAsFunction):
405         * JavaScriptCore.xcodeproj/project.pbxproj:
406         * JavaScriptCorePrefix.h:
407         * bindings/jni/jni_class.cpp:
408         (JavaClass::fieldNamed):
409         * bindings/jni/jni_class.h:
410         * bindings/jni/jni_instance.cpp:
411         (JavaInstance::JavaInstance):
412         (JavaInstance::valueOf):
413         * bindings/jni/jni_objc.mm:
414         (KJS::Bindings::dispatchJNICall):
415         * bindings/jni/jni_runtime.cpp:
416         (JavaParameter::JavaParameter):
417         (JavaArray::JavaArray):
418         * bindings/jni/jni_runtime.h:
419         * bindings/jni/jni_utility.h:
420         * bindings/objc/objc_instance.h:
421         * bindings/runtime_array.h:
422         * kjs/collector.h:
423         * kjs/config.h:
424         * kjs/ustring.cpp:
425         * wtf/Platform.h:
426
427 2006-07-29  Mike Emmel  <mike.emmel@gmail.com>
428
429         Reviewed by Darin.
430
431         - fixes for Linux build
432
433         * JavaScriptCoreSources.bkl: Added new files to build, kjs/PropertyNameArray.cpp
434         and kjs/testkjs.cpp, and removed old files.
435
436 2006-07-24  Dan Waylonis  <waylonis@google.com>
437
438         Reviewed and tweaked a bit by Darin.
439
440         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9902
441           jsNull and NSNull not properly converted between JS and ObjC
442
443         * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
444         Added case for converting NSNull to jsNull.
445
446 2006-07-24  Rob Buis  <buis@kde.org>
447
448         Reviewed by Darin.
449
450         http://bugzilla.opendarwin.org/show_bug.cgi?id=4258
451         Date().toString() only includes GMT offset, not timezone string
452
453         Use the info in tm_zone to append timezone abbreviation
454         to Date().toString().
455
456         * kjs/date_object.cpp:
457         (KJS::formatTime):
458
459 2006-07-24  Rob Buis  <buis@kde.org>
460
461         Reviewed by Darin.
462
463         http://bugzilla.opendarwin.org/show_bug.cgi?id=5257
464         setYear() does not match FireFox/IE behavior
465
466         Make sure the right values end up in tm_year.
467
468         * kjs/date_object.cpp:
469         (KJS::formatTime):
470
471 2006-07-23  Mark Rowe  <opendarwin.org@bdash.net.nz>
472
473         Reviewed by Maciej.
474
475         Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
476         http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
477
478         JavaScriptCore portion of the fix.
479
480         * JavaScriptCore.exp: Update symbol for change in argument type.
481         * kjs/debugger.cpp:
482         (Debugger::detach): Clear map of recent exceptions.
483         (Debugger::hasHandledException): Track the most recent exception
484         thrown by an interpreter.
485         (Debugger::exception): Change exception argument to a JSValue.
486         * kjs/debugger.h:
487         * kjs/nodes.cpp:
488         (Node::debugExceptionIfNeeded): Notify the debugger of an exception
489         if it hasn't seen it before.
490         (ThrowNode::execute): Notify the debugger that an exception is being thrown.
491         * kjs/nodes.h:
492
493     2006-07-23  Geoffrey Garen  <ggaren@apple.com>
494
495         Patch by Eric Albert, reviewed by Darin and me.
496         
497         - Fixed <rdar://problem/4645931> JavaScriptCore stack-scanning code 
498         crashes (Collector::markStackObjectsConservatively)
499         
500         * bindings/jni/jni_jsobject.cpp: On 64bit systems, jint is a long, not an
501         int.
502         (JavaJSObject::getSlot):
503         (JavaJSObject::setSlot):
504         * kjs/collector.cpp:
505         (KJS::Collector::markCurrentThreadConservatively): Use a pointer instead of
506         an int as 'dummy,' because on LP64 systems, an int is not pointer-aligned,
507         and we want to scan the stack for pointers.
508         * JavaScriptCore.xcodeproj/project.pbxproj: After a tense cease-fire, the 
509         XCode war has started up again!
510
511 === Safari-521.20 ===
512
513 2006-07-21  Geoffrey Garen  <ggaren@apple.com>
514
515         Reviewed by Darin.
516
517         <rdar://problem/4507265> REGRESSION: overlays don't work on HousingMaps.com (Google Maps-based site)
518
519         - Added support for strings that masquerade as undefined. Currently used
520         by WebCore to implement undetectable style.filter.
521         
522         The name is a little long, but it's only used in one line of code, so I
523         thought clarity should win over brevity.
524
525         * JavaScriptCore.exp:
526         * JavaScriptCore.xcodeproj/project.pbxproj:
527         * kjs/object.h:
528         * kjs/string_object.h:
529         (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
530         (KJS::StringInstanceThatMasqueradesAsUndefined::masqueradeAsUndefined):
531         (KJS::StringInstanceThatMasqueradesAsUndefined::toBoolean):
532
533 === Safari-521.19 ===
534
535 2006-07-20  Steve Falkenburg  <sfalken@apple.com>
536
537         Fix the build
538
539         * kjs/function.cpp:
540         (KJS::escapeStringForPrettyPrinting):
541
542 2006-07-19  Anders Carlsson  <acarlsson@apple.com>
543
544         Reviewed by Darin.
545
546         <rdar://problem/4620655> REGRESSION(10.4.7-10.5): preview button for a blogger.com post doesn't work
547         
548         * kjs/nodes2string.cpp:
549         (StringNode::streamTo):
550         Return the escaped string.
551         
552         (RegExpNode::streamTo):
553         Use the correct syntax.
554         
555         * kjs/function.cpp:
556         (KJS::escapeStringForPrettyPrinting):
557         * kjs/function.h:
558         Add escape function which escapes a string for pretty-printing so it can be parsed again.
559         
560         * wtf/unicode/icu/UnicodeIcu.h:
561         (WTF::Unicode::isPrintableChar):
562         New function.
563
564 2006-07-18  Maciej Stachowiak  <mjs@apple.com>
565
566         Reviewed by Adele Peterson.
567         
568         <rdar://problem/4589530> REGRESSION: null character in JS string causes parse error (works in Tiger and in other browsers)
569
570         * kjs/lexer.cpp:
571         (Lexer::shift):
572         (Lexer::lex):
573         (Lexer::record16):
574         (Lexer::scanRegExp):
575         * kjs/lexer.h:
576
577 2006-07-18  Tim Omernick  <timo@apple.com>
578
579         Reviewed by Tim Hatcher.
580
581         Removed a misleading comment; we recently added support for the NPNVPluginElementNPObject
582         variable.
583
584         * bindings/npapi.h:
585
586 === Safari-521.18 ===
587
588 2006-07-18  Timothy Hatcher  <timothy@apple.com>
589
590         Made the following headers public:
591
592         * JavaScriptCore.h
593         * JSBase.h
594         * JSContextRef.h
595         * JSObjectRef.h
596         * JSStringRef.h
597         * JSValueRef.h
598
599         * JavaScriptCore.xcodeproj/project.pbxproj:
600
601 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
602
603         Reviewed by Maciej.
604         
605         - Added automatic prototype creation for classes.
606         
607         A class stores a weak reference to a prototype, which is cleared when
608         the prototype is garbage collected, to avoid a reference cycle.
609         
610         We now have an attributes field in JSClassDefinition, that currently is
611         used only to override automatic prototype creation when you want to manage your
612         own prototypes, but can be extended in the future for other nefarious purposes.
613         
614         Similarly, we have JSObjectMake and JSObjectMakeWithPrototype, the latter
615         allowing you to manage your own prototypes.
616         
617         JSObjectMakeConstructor is more interesting now, able to make a constructor
618         on your behalf if you just give it a class.
619         
620         - Removed bogus old code from minidom.js.
621         
622         - Tweaked the headerdocs.
623         
624         - Added more GC testing, which caught some leaks, and tested more funny 
625         edge cases in lookup, which caught a lookup bug. Removed some testing 
626         we used to do with MyObject because it was redundant with the new, cool 
627         stuff.
628         
629         While fixing the lookup bug I retracted this change:
630         
631             "If a static setProperty callback returns 'false', to indicate that the
632             property was not set, we no longer forward the set request up the class
633             chain, because that's almost certainly not what the programmer expected."
634
635         Returning false when setting a static property is a little silly, but you can see
636         it being useful when shadowing a base class's static properties, and, regardless
637         of usefullness, this is the defined behavior of the setProperty callback.
638         
639         - Plus a little ASCII art, for the kids.
640
641 2006-07-17  Timothy Hatcher  <timothy@apple.com>
642
643         Reviewed by Maciej.
644
645         <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
646
647         Moves WebScriptObject and WebUndefined up to WebCore.
648         This change does create an upwards-dependancy on WebScriptObject existing
649         in the loaded process, but this code path in JavaScriptCore does not get used
650         unless it is through WebKit/WebCore. Moving all of the binding code out of
651         JavaScriptCore might make sense in the future.
652
653         * JavaScriptCore.exp:
654         * JavaScriptCore.xcodeproj/project.pbxproj:
655         * bindings/objc/WebScriptObject.h: Replaced.
656         * bindings/objc/WebScriptObject.mm: Removed.
657         * bindings/objc/WebScriptObjectPrivate.h: Removed.
658         * bindings/objc/objc_class.h:
659         * bindings/objc/objc_instance.h:
660         * bindings/objc/objc_instance.mm:
661         (ObjcInstance::~ObjcInstance):
662         * bindings/objc/objc_runtime.h:
663         * bindings/objc/objc_runtime.mm:
664         (convertValueToObjcObject):
665         * bindings/objc/objc_utility.mm:
666         (KJS::Bindings::convertValueToObjcValue):
667         (KJS::Bindings::convertObjcValueToValue):
668         (KJS::Bindings::createObjcInstanceForValue):
669
670 2006-07-17  Darin Adler  <darin@apple.com>
671
672         * API/JSBase.h: Fix comment formatting where things used to be lined up but
673         are now ragged. Got rid of spaces that attempted to line things up.
674         * API/JSObjectRef.h: Ditto. Also add missing periods for a couple of comments.
675
676 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
677
678         Reviewed by Maciej.
679         
680         - Removed the exception parameter from the initialize callback and, by extension,
681         JSObjectMake. We have never had a need for exceptions when iniitializing,
682         so the parameter seemed likely to "get in the way." 
683         
684         Also, an exception in JavaScript is thrown in response to input -- 
685         "invalid URL", "index not a number", etc., so it's the job of the 
686         constructor function, not the initialize method, to throw.
687         
688         If initialize *really* wants to throw, it can communicate the throw to
689         the constructor through the constructed object's private data (e.g., set
690         it to NULL, signaling to the consntructor that initialization failed.)
691         
692         - Added JSObjectMakeWithData, which enables a constructor to set private
693         data on an object *before* it has been initialized. That way, the initialize
694         methods can properly operate on the data. 
695
696         * API/JSNode.c: Moved ref into the initialize method, for better encapsulation,
697         now that it's possible.
698         * API/JSNodeList.c: ditto
699         * API/minidom.c:
700         (main): Do more aggressive garbage collection to test ref/deref and 
701         initialize/finalize.
702         * API/minidom.js: store childNodes in a temporary so it doesn't get re-created
703         like a thousand times. This makes debugging ref/deref easier
704
705 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
706
707         Reviewed by Maciej.
708         
709         - Changed the initialize callback to run from least derived class (parent
710         class) to most derived class. This enables C++ style initialization,
711         and derived class overriding of member data.
712         
713         - Added excpetion propopgation to JSObjectMake, to support initialize
714         exceptions, and generally round out our policy of making function
715         signatures as long as possible.
716
717         * API/JSCallbackObject.h: Use ExecState instead of ContextRef, cuz we're
718         in C++ land now.
719
720 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
721
722         Reviewed by Maciej.
723         
724         - Changed JSObjectMakeConstructor to JSObjectMakeConstructorWithCallback,
725         to match JSObjectMakeFunctionWithCallback.
726         
727         - Added prototype parameter, so the generated constructor
728         automatically works with hasInstance / instanceof
729         
730         - Moved hasInstance implementation from InternalFunctionImp to JSObject
731         so that subclasses can inherit it without inheriting function-related baggage.
732         More refactoring here would be good, but this seems like a good short-term
733         solution.
734
735         (KJS::JSCallbackFunction::implementsHasInstance): override and return false,
736         because callback functions aren't constructors.
737
738 2006-07-17  Maciej Stachowiak  <mjs@apple.com>
739
740         Reviewed by Geoff.
741         
742         - add a JSContextRef parameter to all JSValueRef, JSObjectRef, and JSContextRef operations;
743         except JSObject{Get,Set}PrivateData which can be assumed to be simple pure accessors.
744         
745         Also renamed the parameter "context" to "ctx" because it makes the code read better with this pervasive
746         but usually uninteresting parameter.
747
748         * API/JSBase.cpp:
749         (JSEvaluateScript):
750         (JSCheckScriptSyntax):
751         (JSGarbageCollect):
752         * API/JSBase.h:
753         * API/JSCallbackObject.cpp:
754         (KJS::JSCallbackObject::JSCallbackObject):
755         (KJS::JSCallbackObject::init):
756         (KJS::JSCallbackObject::getOwnPropertySlot):
757         (KJS::JSCallbackObject::put):
758         (KJS::JSCallbackObject::deleteProperty):
759         (KJS::JSCallbackObject::toNumber):
760         (KJS::JSCallbackObject::toString):
761         * API/JSContextRef.cpp:
762         (JSGlobalContextCreate):
763         (JSGlobalContextRetain):
764         (JSGlobalContextRelease):
765         (JSContextGetGlobalObject):
766         * API/JSContextRef.h:
767         * API/JSNode.c:
768         (JSNodePrototype_appendChild):
769         (JSNodePrototype_removeChild):
770         (JSNodePrototype_replaceChild):
771         (JSNode_getNodeType):
772         (JSNode_getFirstChild):
773         (JSNode_prototype):
774         * API/JSNodeList.c:
775         (JSNodeListPrototype_item):
776         (JSNodeList_length):
777         (JSNodeList_getProperty):
778         (JSNodeList_prototype):
779         * API/JSObjectRef.cpp:
780         (JSObjectMake):
781         (JSObjectMakeFunctionWithCallback):
782         (JSObjectMakeConstructor):
783         (JSObjectMakeFunction):
784         (JSObjectGetPrototype):
785         (JSObjectSetPrototype):
786         (JSObjectHasProperty):
787         (JSObjectGetProperty):
788         (JSObjectSetProperty):
789         (JSObjectGetPropertyAtIndex):
790         (JSObjectSetPropertyAtIndex):
791         (JSObjectDeleteProperty):
792         (JSObjectIsFunction):
793         (JSObjectCallAsFunction):
794         (JSObjectIsConstructor):
795         (JSObjectCallAsConstructor):
796         (JSObjectCopyPropertyNames):
797         * API/JSObjectRef.h:
798         * API/JSStringRef.cpp:
799         * API/JSValueRef.cpp:
800         (JSValueGetType):
801         (JSValueIsUndefined):
802         (JSValueIsNull):
803         (JSValueIsBoolean):
804         (JSValueIsNumber):
805         (JSValueIsString):
806         (JSValueIsObject):
807         (JSValueIsObjectOfClass):
808         (JSValueIsEqual):
809         (JSValueIsStrictEqual):
810         (JSValueIsInstanceOfConstructor):
811         (JSValueMakeUndefined):
812         (JSValueMakeNull):
813         (JSValueMakeBoolean):
814         (JSValueMakeNumber):
815         (JSValueMakeString):
816         (JSValueToBoolean):
817         (JSValueToNumber):
818         (JSValueToStringCopy):
819         (JSValueToObject):
820         (JSValueProtect):
821         (JSValueUnprotect):
822         * API/JSValueRef.h:
823         * API/minidom.c:
824         (print):
825         * API/testapi.c:
826         (MyObject_getProperty):
827         (MyObject_deleteProperty):
828         (MyObject_callAsFunction):
829         (MyObject_callAsConstructor):
830         (MyObject_convertToType):
831         (print_callAsFunction):
832         (main):
833
834 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
835
836         Approved by Maciej, RS by Beth.
837         
838         JSObjectMakeFunction -> JSObjectMakeFunctionWithCallback
839         JSObjectMakeFunctionWithBody -> JSObjectMakeFunction
840         
841         because the latter is more common, and more fundamental, than the former.
842
843         * API/APICast.h:
844         (toJS):
845         * API/JSBase.h:
846         * API/JSCallbackObject.cpp:
847         (KJS::JSCallbackObject::getOwnPropertySlot):
848         (KJS::JSCallbackObject::put):
849         (KJS::JSCallbackObject::deleteProperty):
850         (KJS::JSCallbackObject::getPropertyNames):
851         (KJS::JSCallbackObject::staticValueGetter):
852         (KJS::JSCallbackObject::staticFunctionGetter):
853         * API/JSClassRef.cpp:
854         (OpaqueJSClass::OpaqueJSClass):
855         (OpaqueJSClass::~OpaqueJSClass):
856         * API/JSClassRef.h:
857         * API/JSObjectRef.cpp:
858         (JSClassCreate):
859         (JSObjectMakeFunctionWithCallback):
860         (JSObjectMakeFunction):
861         (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
862         (JSObjectCopyPropertyNames):
863         * API/JSObjectRef.h:
864         * API/minidom.c:
865         (main):
866         * API/testapi.c:
867         (main):
868         * ChangeLog:
869         * JavaScriptCore.exp:
870
871 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
872
873         Laughed at by Beth.
874         
875         Replace __JS with OpaqueJS because the former, while used by CF, is
876         a prefix that's triply-reserved by the compiler. (_* is reserved in global 
877         names, _[A-Z] is reserved in all names, and __ is reserved in all names 
878         in C++.)
879         
880         Opaque is an alternative used by other Mac OS X framewokrs.
881
882         * API/APICast.h:
883         (toJS):
884         * API/JSBase.h:
885         * API/JSCallbackObject.cpp:
886         (KJS::JSCallbackObject::getOwnPropertySlot):
887         (KJS::JSCallbackObject::put):
888         (KJS::JSCallbackObject::deleteProperty):
889         (KJS::JSCallbackObject::getPropertyNames):
890         (KJS::JSCallbackObject::staticValueGetter):
891         (KJS::JSCallbackObject::staticFunctionGetter):
892         * API/JSClassRef.cpp:
893         (OpaqueJSClass::OpaqueJSClass):
894         (OpaqueJSClass::~OpaqueJSClass):
895         * API/JSClassRef.h:
896         * API/JSObjectRef.cpp:
897         (JSClassCreate):
898         (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
899         (JSObjectCopyPropertyNames):
900
901 2006-07-16  Darin Adler  <darin@apple.com>
902
903         - try to fix Windows build
904
905         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
906         Added some recently added files, removed some recently removed.
907
908 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
909
910         Reviewed by Maciej.
911         
912         - Change getProperty* to return undefined, rather than NULL, for missing
913         properties, since that's what the spec says. Also added exception out
914         parameters to the *Index functions, because they can call through to the
915         regular functions, which can throw for custom objects.
916
917         * API/JSObjectRef.cpp:
918         (JSObjectGetProperty):
919         (JSObjectGetPropertyAtIndex):
920         (JSObjectSetPropertyAtIndex):
921         * API/JSObjectRef.h:
922         * API/testapi.c:
923         (main):
924
925 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
926
927         Reviewed by Maciej.
928         
929         - Properly document and handle NULL callbacks for static properties. We
930         throw an exception in any case other than a ReadOnly property with a NULL
931         setProperty callback, because a NULL callback almost certainly indicates 
932         a programming error. Also throw an exception if hasProperty returns true
933         for a property that getProperty can't get.
934         
935         - If a static setProperty callback returns 'false', to indicate that the
936         property was not set, we no longer forward the set request up the class
937         chain, because that's almost certainly not what the programmer expected.
938
939         * API/JSCallbackObject.cpp:
940         (KJS::JSCallbackObject::getOwnPropertySlot):
941         (KJS::JSCallbackObject::put):
942         (KJS::JSCallbackObject::staticValueGetter):
943         (KJS::JSCallbackObject::staticFunctionGetter):
944         (KJS::JSCallbackObject::callbackGetter):
945         * API/JSObjectRef.h:
946         * API/minidom.js:
947         * API/testapi.c:
948         (MyObject_hasProperty):
949         * API/testapi.js:
950
951 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
952
953         Reviewed by Maciej.
954         
955         - Added names to functions.
956         
957         - Removed GetPrivate/SetPrivate from callbackFunctions and callbackConstructors.
958         The private data idiom is that a JS object stores its native implementation
959         as private data. For functions and constructors, the native implementation is nothing
960         more than the callback they already store, so supporting private data, too,
961         confuses the idiom. If you *really* want, you can still create a custom 
962         function with private data.
963
964         * API/JSCallbackConstructor.cpp:
965         * API/JSCallbackConstructor.h:
966         * API/JSCallbackFunction.cpp:
967         (KJS::JSCallbackFunction::JSCallbackFunction):
968         * API/JSCallbackFunction.h:
969         * API/JSCallbackObject.cpp:
970         (KJS::JSCallbackObject::staticFunctionGetter):
971         * API/JSObjectRef.cpp:
972         (JSObjectMakeFunction):
973         (JSObjectMakeFunctionWithBody):
974         (JSObjectGetPrivate):
975         (JSObjectSetPrivate):
976         * API/JSObjectRef.h:
977         * API/minidom.c:
978         (main):
979         * API/testapi.c:
980         (main):
981
982 2006-07-15  Maciej Stachowiak  <mjs@apple.com>
983
984         Reviewed by Darin.
985         
986         - switch property lists to be vector+set of Identifiers instead of list of References
987         
988         This has the following benefits:
989         
990         - no duplicates in property lists
991         - simplifies API calls
992         - probably more efficient, since linked list is gone
993         - entirely removed Reference, ReferenceList and ProtectedReference types from the API
994
995         * kjs/PropertyNameArray.cpp: Added.
996         (KJS::PropertyNameArray::add): Check set, if not already there, add to
997         vector.
998         * kjs/PropertyNameArray.h: Added.
999         (KJS::PropertyNameArray::PropertyNameArray): Newly added type, combines
1000         a set and a vector to make a unique but ordered list of identifiers.
1001         (KJS::PropertyNameArray::begin): ditto
1002         (KJS::PropertyNameArray::end): ditto
1003         (KJS::PropertyNameArray::size): ditto
1004         (KJS::PropertyNameArray::operator[]): ditto
1005         * kjs/array_instance.h:
1006         * kjs/array_object.cpp:
1007         (ArrayInstance::getPropertyNames): renamed from getPropertyList, updated
1008         for PropertyNameArray
1009         (ArrayInstance::setLength): updated for PropertyNameArray
1010         (ArrayInstance::pushUndefinedObjectsToEnd): ditto
1011         * kjs/nodes.cpp:
1012         (ForInNode::execute): updated for PropertyNameArray
1013         * kjs/nodes.h:
1014         * kjs/object.cpp:
1015         (KJS::JSObject::getPropertyNames): renamed from getPropertyList, updated
1016         for PropertyNameArray
1017         * kjs/object.h:
1018         * kjs/property_map.cpp:
1019         (KJS::PropertyMap::getEnumerablePropertyNames): updated for PropertyNameArray
1020         (KJS::PropertyMap::getSparseArrayPropertyNames): ditto
1021         * kjs/property_map.h:
1022         * kjs/protected_reference.h: Removed.
1023         * kjs/reference.cpp: Removed.
1024         * kjs/reference.h: Removed.
1025         * kjs/reference_list.cpp: Removed.
1026         * kjs/reference_list.h: Removed.
1027         * kjs/scope_chain.cpp:
1028         (KJS::ScopeChain::print): Use PropertyNamesArray instead of ReferenceList.
1029         * kjs/string_object.cpp:
1030         (StringInstance::getPropertyNames): Updated for new approach.
1031         * kjs/string_object.h:
1032         * kjs/ustring.h:
1033         * API/APICast.h:
1034         (toJS): Added overload for PropertyNameAccumulatorRef / PropertyNameArray*
1035         (toRef): ditto
1036         * API/JSBase.h:
1037         * API/JSCallbackObject.cpp:
1038         (KJS::JSCallbackObject::getPropertyNames): Fixed for new API.
1039         * API/JSCallbackObject.h:
1040         * API/JSObjectRef.cpp:
1041         (__JSPropertyNameArray::__JSPropertyNameArray): Type used for a publicly vended
1042         JSPropertyNameArrayRef.
1043         (JSObjectCopyPropertyNames): New API call - renamed / refactored from 
1044         JSObjectCreatePropertyList
1045         (JSPropertyNameArrayRetain): new retain call for JSPropertyNameArray.
1046         (JSPropertyNameArrayRelease): new release call for - " -.
1047         (JSPropertyNameArrayGetCount): Instead of having to use a stateful enumerator you
1048         can now get the count and items in any order.
1049         (JSPropertyNameArrayGetNameAtIndex): See above.
1050         (JSPropertyNameAccumulatorAddName): What you add properties to is now an opaque 
1051         accumulator object.
1052         * API/JSObjectRef.h: Prototyped new functions, removed old ones
1053         * JavaScriptCore.exp: Updated exported symbols.
1054         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files, removed old.
1055         * API/testapi.c:
1056         (MyObject_getPropertyNames): Renamed / fixed callback to fit new paradigm.
1057         (main): Updated for new API.
1058
1059 2006-07-15  Darin Adler  <darin@apple.com>
1060
1061         - oops, missed a few more arrays that had to be const
1062
1063         * API/JSNode.c:
1064         (JSNodePrototype_appendChild): Added const.
1065         (JSNodePrototype_removeChild): Ditto.
1066         (JSNodePrototype_replaceChild): Ditto.
1067         (JSNode_construct): Ditto.
1068         * API/JSNodeList.c:
1069         (JSNodeListPrototype_item): Ditto.
1070         * API/JSObjectRef.cpp:
1071         (JSObjectMakeFunctionWithBody): Ditto.
1072         (JSObjectCallAsFunction): Ditto.
1073         (JSObjectCallAsConstructor): Ditto.
1074         * API/minidom.c:
1075         (print): Ditto.
1076         * API/testapi.c:
1077         (MyObject_callAsFunction): Ditto.
1078         (MyObject_callAsConstructor): Ditto.
1079         (print_callAsFunction): Ditto.
1080         (myConstructor_callAsConstructor): Ditto.
1081
1082 2006-07-15  Darin Adler  <darin@apple.com>
1083
1084         Reviewed by Maciej.
1085
1086         * API/JSNode.h: Made an array parameter const.
1087         * API/JSObjectRef.h: Made array parameters const. Fixed a comment.
1088
1089 2006-07-15  Geoffrey Garen  <ggaren@apple.com>
1090
1091         Reviewed by Maciej.
1092         
1093         - JSObjectMakeFunctionWithBody includes a function name and named parameters now.
1094
1095         * API/JSObjectRef.cpp:
1096         (JSObjectMakeFunctionWithBody):
1097         * API/JSObjectRef.h:
1098         * API/testapi.c:
1099         (assertEqualsAsUTF8String): More informative failure reporting.
1100         (main): Test more function cases.
1101
1102 2006-07-15  Geoffrey Garen  <ggaren@apple.com>
1103
1104         Reviewed by Maciej.
1105
1106         - Moved the arguments passed to JSClassCreate into a single structure,
1107         called JSClassDefinition. This will enable easier structure 
1108         migration/versioning in the future, if necessary.
1109         
1110         - Added support for class names.
1111         
1112         - kJSClassDefinitionNull replaces kJSObjectCallbacksNone.
1113         
1114         - JSClass is becoming a fairly complex struct, so I migrated all of its
1115         implementation other than reference counting to the sruct.
1116         
1117         - Also moved JSClass* functions in the API to JSObjectRef.cpp, since they're
1118         declared in JSObjectRef.h
1119         
1120         - Also added some more informative explanation to the class structure doc.
1121         
1122 2006-07-15  Darin Adler  <darin@apple.com>
1123
1124         Reviewed by Geoff.
1125
1126         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8395
1127           <rdar://problem/4613467>
1128           REGRESSION: RegEx seems broken for hex escaped non breaking space
1129
1130         Test: fast/js/regexp-extended-characters-more.html
1131
1132         * pcre/pcre_exec.c:
1133         (match): Got rid of utf16Length local variable to guarantee there's no
1134         extra stack usage in recursive calls. Fixed two places in the PCRE_UTF16
1135         code that were using the length variable, which is the UTF-8 length of
1136         a character in the pattern, to move in the UTF-16 subject string. Instead
1137         they hardcode lengths of 1 and 2 since the code already handles BMP
1138         characters and surrogate pairs separately. Also fixed some DPRINTF so
1139         I could compile with DEBUG on.
1140         (pcre_exec): Changed a place that was checking for multibyte characters
1141         in the subject string to use ISMIDCHAR. Instead it was using hardcoded
1142         logic that was right for UTF-8 but wrong for UTF-16.
1143
1144         * pcre/pcre_compile.c: (pcre_compile2): Fixed a DPRINTF so I could compile
1145         with DEBUG on.
1146
1147 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
1148
1149         RS by Maciej.
1150         
1151         Global replace in the API of argc/argv with argumentCount/arguments.
1152
1153 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
1154
1155         Reviewed by Maciej.
1156         
1157         - Finalized exception handling in the API.
1158         
1159         setProperty can throw because it throws for built-in arrays. getProperty
1160         and deleteProperty can throw because setProperty can throw and we want
1161         to be consistent, and also because they seem like "actions." callAsFunction,
1162         callAsConstructor, and hasInstance can throw, because they caan throw for
1163         all built-ins.
1164         
1165         toBoolean can't throw because it's defined that way in the spec.
1166         
1167         - Documented that toBoolean and toObject can't be overridden by custom 
1168         objects because they're defined that way in the spec.
1169
1170 === Safari-521.17 ===
1171
1172 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
1173
1174         Reviewed by Maciej.
1175         
1176         - Implemented ref-counting of JSContexts by splitting into two datatypes:
1177         JSGlobalContext, which you can create/retain/release, and JSContext, which
1178         you can't.
1179         
1180         Internally, you retain a JSGlobalContext/ExecState by retaining its
1181         interpreter, which, in the case of a global ExecState, owns it.
1182         
1183         - Also made ~Interpreter() protected to catch places where Interpreter
1184         is manually deleted. (Can't make it private because some crazy fool
1185         decided it would be a good idea to subclass Interpreter in other frameworks.
1186         I pity da fool.)
1187
1188         * API/APICast.h: 
1189         (toJS): Added cast for new JSGlobalContext
1190         * API/JSStringRef.h: Changed vague "you must" language to more specific
1191         (but, ultimately, equally vague) "behavior is undefined if you don't" 
1192         language.
1193         (KJS::Interpreter::Interpreter): Factored more common initialization into
1194         init()
1195         * kjs/interpreter.h:
1196         (KJS::Interpreter::ref): new
1197         (KJS::Interpreter::deref): new
1198         (KJS::Interpreter::refCount): new
1199         * kjs/testkjs.cpp: 
1200         (doIt): Ref-count the interpreter.
1201
1202 2006-07-14  Maciej Stachowiak  <mjs@apple.com>
1203
1204         Reviewed by Geoff.
1205         
1206         - removed bool return value from JSObjectSetProperty, since it is inefficient and
1207         also doesn't work quite right
1208         - added JSObjectGetPropertyAtIndex and JSObjectSetPropertyAtIndex
1209
1210         * API/JSObjectRef.cpp:
1211         (JSObjectSetProperty): Removed return value and canPut stuff.
1212         (JSObjectGetPropertyAtIndex): Added.
1213         (JSObjectSetPropertyAtIndex): Added.
1214         * API/JSObjectRef.h: Prototyped and documented new functions.
1215
1216 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
1217
1218         Reviewed by Beth.
1219         
1220         Moved JSCheckScriptSyntax, JSEvaluateScript, and JSGarbageCollect into
1221         JSBase.h/.cpp. They don't belong in the value-specific or context-specific 
1222         files because they're not part of the value or context implementations.
1223
1224         * API/JSBase.h:
1225         * API/JSContextRef.cpp:
1226         (JSContextGetGlobalObject):
1227         * API/JSContextRef.h:
1228         * API/JSValueRef.cpp:
1229         (JSValueUnprotect):
1230         * API/JSValueRef.h:
1231         * JavaScriptCore.xcodeproj/project.pbxproj:
1232
1233 2006-07-13  Timothy Hatcher  <timothy@apple.com>
1234
1235         Reviewed by Maciej.
1236
1237         Moved JavaScriptCore to be a public framework.
1238
1239         * JavaScriptCore.xcodeproj/project.pbxproj:
1240
1241 2006-07-13  Mark Rowe  <opendarwin.org@bdash.net.nz>
1242
1243         Reviewed by Geoffrey.
1244
1245         http://bugzilla.opendarwin.org/show_bug.cgi?id=9742
1246         Bug 9742: REGRESSION: WebKit hangs when loading <http://www.vtbook.com>
1247
1248         * kjs/value.h:
1249         (KJS::JSValue::getUInt32): Only types tagged as numeric can be converted to UInt32.
1250
1251 2006-07-13  Geoffrey Garen  <ggaren@apple.com>
1252
1253         Pleasing to Maciej.
1254         
1255         - Renamed JSEvaluate -> JSEvaluateScript, JSCheckSyntax -> JSCheckScriptSyntax
1256         - Added exception out parameters to JSValueTo* and JSValueIsEqual because
1257         they can throw
1258         - Removed JSObjectGetDescription because it's useless and vague, and 
1259         JSValueToString/JSValueIsObjectOfClass do a better job, anyway
1260         - Clarified comments about "IsFunction/Constructor" to indicate that they
1261         are true of all functions/constructors, not just those created by JSObjectMake*
1262
1263 2006-07-12  Geoffrey Garen  <ggaren@apple.com>
1264
1265         RS by Beth.
1266         
1267         Finished previously approved JSInternalString -> JSString conversion 
1268         by renaming the files.
1269
1270         * API/JSCallbackObject.cpp:
1271         * API/JSInternalStringRef.cpp: Removed.
1272         * API/JSInternalStringRef.h: Removed.
1273         * API/JSStringRef.cpp: Added.
1274         * API/JSStringRef.h: Added.
1275         * API/JavaScriptCore.h:
1276         * JavaScriptCore.xcodeproj/project.pbxproj:
1277
1278 2006-07-12  Geoffrey Garen  <ggaren@apple.com>
1279
1280         Reviewed by Maciej.
1281         
1282         - Removed context and exception parameters from JSObjectGetPropertyEnumerator,
1283         removing the spurious use of ExecState inside JavaScriptCore that made
1284         us think this was necessary in the first place.
1285
1286         (StringInstance::getPropertyList): Use getString instead of toString because
1287         we know we're dealing with a string -- we put it there in the first place.
1288         While we're at it, store the string's size instead of retrieving it each time 
1289         through the loop, to avoid the unnecessary killing of puppies.
1290         * kjs/string_object.h:
1291
1292 2006-07-12  Maciej Stachowiak  <mjs@apple.com>
1293
1294         Reviewed by Geoff.
1295         
1296         - add handling of hasInstance callback for API objects
1297
1298         * API/JSCallbackObject.cpp:
1299         (KJS::JSCallbackObject::implementsHasInstance): Check if callback is present.
1300         (KJS::JSCallbackObject::hasInstance): Invoke appropriate callback.
1301         * API/JSCallbackObject.h:
1302         * API/JSClassRef.cpp:
1303         * API/JSObjectRef.h:
1304         * API/testapi.c:
1305         (MyObject_hasInstance): Test case; should match what construct would do.
1306         * API/testapi.js:
1307
1308 2006-07-11  Geoffrey Garen  <ggaren@apple.com>
1309
1310         Reviewed by Maciej.
1311         
1312         - Implemented a vast number of renames and comment clarifications 
1313         suggested during API review.
1314         
1315         JSInternalString -> JSString
1316         JS*Make -> JSValueMake*, JSObjectMake*
1317         JSTypeCode -> JSType
1318         JSValueIsInstanceOf -> JSValueIsInstanceOfConstructor (reads strangely well in client code)
1319         JSGC*Protect -> JSValue*Protect
1320         JS*Callback -> JSObject*Callback
1321         JSGetPropertyListCallback -> JSObjectAddPropertiesToListCallback
1322         JSPropertyEnumeratorGetNext -> JSPropertyEnumeratorGetNextName
1323         JSString* -> 
1324             JSStringCreateWithUTF8CString, JSStringGetUTF8CString,
1325             JSStringGetMaximumUTF8CStringSize JSStringIsEqualToUTF8CString, 
1326             JSStringCreateWithCFString, JSStringCopyCFString, JSStringCreateWithCharacters.
1327         
1328         - Changed functions taking a JSValue out arg and returning a bool indicating
1329         whether it was set to simply return a JSValue or NULL.
1330         
1331         - Removed JSStringGetCharacters because it's more documentation than code,
1332         and it's just a glorified memcpy built on existing API functionality.
1333         
1334         - Moved standard library includes into the headers that actually require them.
1335         
1336         - Standardized use of the phrase "Create Rule."
1337         
1338         - Removed JSLock from make functions that don't allocate.
1339         
1340         - Added exception handling to JSValueToBoolean, since we now allow
1341         callback objects to throw exceptions upon converting to boolean.
1342         
1343         - Renamed JSGCCollect to JSGarbageCollect.
1344
1345 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
1346
1347         Reviewed by Darin.
1348         
1349         - Changed public header includes to the <JavaScriptCore/ style.
1350         - Changed instances of 'buffer' to 'string' since we decided on
1351         JSInternalString instead of JSStringBuffer.
1352
1353         * API/JSContextRef.h:
1354         * API/JSInternalStringRef.cpp:
1355         (JSStringMake):
1356         (JSInternalStringRetain):
1357         (JSInternalStringRelease):
1358         (JSValueCopyStringValue):
1359         (JSInternalStringGetLength):
1360         (JSInternalStringGetCharactersPtr):
1361         (JSInternalStringGetCharacters):
1362         (JSInternalStringGetMaxLengthUTF8):
1363         (JSInternalStringGetCharactersUTF8):
1364         (CFStringCreateWithJSInternalString):
1365         * API/JSInternalStringRef.h:
1366         * API/JSNode.c:
1367         (JSNodePrototype_appendChild):
1368         (JSNode_getNodeType):
1369         * API/JSObjectRef.cpp:
1370         (JSObjectCallAsConstructor):
1371         * API/JSValueRef.h:
1372         * API/JavaScriptCore.h:
1373         * API/minidom.c:
1374         (main):
1375         (print):
1376         * API/testapi.c:
1377         (MyObject_getPropertyList):
1378         (myConstructor_callAsConstructor):
1379         (main): I noticed that we were prematurely releasing some string buffers,
1380         so I moved their release calls to the end of main(). I got rid of 'Buf' in *Buf
1381         (sometimes changing to 'IString', when necessary to differentiate a variable) 
1382         to match the buffer->string change.
1383
1384 === Safari-521.16 ===
1385
1386 2006-07-10  Darin Adler  <darin@apple.com>
1387
1388         * kjs/value.cpp: (KJS::JSValue::toInt32Inline): Added inline keyword one more place.
1389         Just in case.
1390
1391 2006-07-10  Darin Adler  <darin@apple.com>
1392
1393         - fix the release build
1394
1395         * kjs/value.h:
1396         * kjs/value.cpp:
1397         (KJS::JSValue::toInt32Inline): Move the code here to an inline.
1398         (KJS::JSValue::toInt32): Call the inline from both overloaded toInt32 functions.
1399
1400 2006-07-10  David Kilzer  <ddkilzer@kilzer.net>
1401
1402         Reviewed by Darin.
1403
1404         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9179
1405           Implement select.options.add() method
1406
1407         * JavaScriptCore.exp: Added overloaded KJS::JSValue::toInt32() method.
1408         * JavaScriptCore.xcodeproj/project.pbxproj: Altered attributes metadata for
1409         kjs/value.h to make it available as a forwarded header.
1410         * kjs/lookup.h:
1411         (KJS::lookupPut): Extracted a lookupPut() method from the existing lookupPut() method.
1412         The new method returns a boolean value if no entry is found in the lookup table.
1413         * kjs/value.cpp:
1414         (KJS::JSValue::toInt32): Overloaded toInt32() method with boolean "Ok" argument.
1415         * kjs/value.h: Ditto.
1416
1417 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
1418
1419         No review necessary. Removed bogus file I accidentally checked in before.
1420
1421         * API/JSInternalSringRef.h: Removed.
1422
1423 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
1424
1425         Reviewed by Darin.
1426         
1427         Added exception out parameter to API object callbacks, removed semi-bogus
1428         JSContext(.*)Exception functions.
1429         
1430         To make these calls syntactically simple, I added an exceptionSlot()
1431         method to the ExecState class, which provides a JSValue** slot in which to 
1432         store a JSValue* exception.
1433
1434         * API/APICast.h:
1435         (toRef):
1436         * API/JSCallbackConstructor.cpp:
1437         (KJS::JSCallbackConstructor::construct):
1438         * API/JSCallbackFunction.cpp:
1439         (KJS::JSCallbackFunction::callAsFunction):
1440         * API/JSCallbackObject.cpp:
1441         (KJS::JSCallbackObject::init):
1442         (KJS::JSCallbackObject::getOwnPropertySlot):
1443         (KJS::JSCallbackObject::put):
1444         (KJS::JSCallbackObject::deleteProperty):
1445         (KJS::JSCallbackObject::construct):
1446         (KJS::JSCallbackObject::callAsFunction):
1447         (KJS::JSCallbackObject::getPropertyList):
1448         (KJS::JSCallbackObject::toBoolean):
1449         (KJS::JSCallbackObject::toNumber):
1450         (KJS::JSCallbackObject::toString):
1451         (KJS::JSCallbackObject::staticValueGetter):
1452         (KJS::JSCallbackObject::callbackGetter):
1453         * API/JSContextRef.cpp:
1454         (JSCheckSyntax):
1455         * API/JSContextRef.h:
1456         * API/JSNode.c:
1457         (JSNodePrototype_appendChild):
1458         (JSNodePrototype_removeChild):
1459         (JSNodePrototype_replaceChild):
1460         (JSNode_getNodeType):
1461         (JSNode_getChildNodes):
1462         (JSNode_getFirstChild):
1463         (JSNode_construct):
1464         * API/JSNode.h:
1465         * API/JSNodeList.c:
1466         (JSNodeListPrototype_item):
1467         (JSNodeList_length):
1468         (JSNodeList_getProperty):
1469         * API/JSObjectRef.h:
1470         * API/minidom.c:
1471         (print):
1472         * API/testapi.c:
1473         (MyObject_initialize):
1474         (MyObject_hasProperty):
1475         (MyObject_getProperty):
1476         (MyObject_setProperty):
1477         (MyObject_deleteProperty):
1478         (MyObject_getPropertyList):
1479         (MyObject_callAsFunction):
1480         (MyObject_callAsConstructor):
1481         (MyObject_convertToType):
1482         (print_callAsFunction):
1483         (myConstructor_callAsConstructor):
1484         (main):
1485         * JavaScriptCore.exp:
1486         * kjs/ExecState.h:
1487         (KJS::ExecState::exceptionHandle):
1488
1489 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
1490
1491         Reviewed by Darin.
1492
1493         Improved type safety by implementing opaque JSValue/JSObject typing through 
1494         abuse of 'const', not void*. Also fixed an alarming number of bugs
1495         exposed by this new type safety.
1496         
1497         I made one design change in JavaScriptCore, which is that the JSObject
1498         constructor should take a JSValue* as its prototype argument, not a JSObject*,
1499         since we allow the prototype to be any JSValue*, including jsNull(), for
1500         example.
1501         
1502         * API/APICast.h:
1503         (toJS):
1504         * API/JSBase.h:
1505         * API/JSCallbackConstructor.cpp:
1506         (KJS::JSCallbackConstructor::construct):
1507         * API/JSCallbackFunction.cpp:
1508         (KJS::JSCallbackFunction::callAsFunction):
1509         * API/JSCallbackObject.cpp:
1510         (KJS::JSCallbackObject::JSCallbackObject):
1511         (KJS::JSCallbackObject::getOwnPropertySlot):
1512         (KJS::JSCallbackObject::put):
1513         (KJS::JSCallbackObject::construct):
1514         (KJS::JSCallbackObject::callAsFunction):
1515         (KJS::JSCallbackObject::staticFunctionGetter):
1516         * API/JSCallbackObject.h:
1517         * API/JSContextRef.cpp:
1518         (JSEvaluate):
1519         * API/JSNode.c:
1520         (JSNodePrototype_appendChild):
1521         (JSNodePrototype_removeChild):
1522         (JSNodePrototype_replaceChild):
1523         * API/JSObjectRef.cpp:
1524         (JSObjectMake):
1525         (JSFunctionMakeWithBody):
1526         (JSObjectGetProperty):
1527         (JSObjectCallAsFunction):
1528         (JSObjectCallAsConstructor):
1529         * API/JSObjectRef.h:
1530         * API/testapi.c:
1531         (main):
1532         * ChangeLog:
1533         * kjs/object.h:
1534         (KJS::JSObject::JSObject):
1535
1536 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
1537
1538         Approved by Maciej, Darin.
1539         
1540         Renamed JSStringBufferRef to JSInternalStringRef. "Internal string" means the 
1541         JavaScript engine's internal string representation, which is the most 
1542         low-level and efficient representation to use when interfacing with JavaScript.
1543
1544         * API/APICast.h:
1545         (toJS):
1546         (toRef):
1547         * API/JSBase.h:
1548         * API/JSCallbackObject.cpp:
1549         (KJS::JSCallbackObject::getOwnPropertySlot):
1550         (KJS::JSCallbackObject::put):
1551         (KJS::JSCallbackObject::deleteProperty):
1552         (KJS::JSCallbackObject::staticValueGetter):
1553         (KJS::JSCallbackObject::callbackGetter):
1554         * API/JSContextRef.cpp:
1555         (JSEvaluate):
1556         (JSCheckSyntax):
1557         * API/JSContextRef.h:
1558         * API/JSInternalStringRef.cpp: Added.
1559         (JSStringMake):
1560         (JSInternalStringCreate):
1561         (JSInternalStringCreateUTF8):
1562         (JSInternalStringRetain):
1563         (JSInternalStringRelease):
1564         (JSValueCopyStringValue):
1565         (JSInternalStringGetLength):
1566         (JSInternalStringGetCharactersPtr):
1567         (JSInternalStringGetCharacters):
1568         (JSInternalStringGetMaxLengthUTF8):
1569         (JSInternalStringGetCharactersUTF8):
1570         (JSInternalStringIsEqual):
1571         (JSInternalStringIsEqualUTF8):
1572         (JSInternalStringCreateCF):
1573         (CFStringCreateWithJSInternalString):
1574         * API/JSInternalStringRef.h: Added.
1575         * API/JSNode.c:
1576         (JSNodePrototype_appendChild):
1577         (JSNode_getNodeType):
1578         (JSNode_getChildNodes):
1579         (JSNode_getFirstChild):
1580         * API/JSNodeList.c:
1581         (JSNodeList_length):
1582         (JSNodeList_getProperty):
1583         * API/JSObjectRef.cpp:
1584         (JSFunctionMakeWithBody):
1585         (JSObjectGetDescription):
1586         (JSObjectHasProperty):
1587         (JSObjectGetProperty):
1588         (JSObjectSetProperty):
1589         (JSObjectDeleteProperty):
1590         (JSPropertyEnumeratorGetNext):
1591         (JSPropertyListAdd):
1592         * API/JSObjectRef.h:
1593         * API/JSStringBufferRef.cpp: Removed.
1594         * API/JSStringBufferRef.h: Removed.
1595         * API/JSValueRef.h:
1596         * API/JavaScriptCore.h:
1597         * API/minidom.c:
1598         (main):
1599         (print):
1600         * API/testapi.c:
1601         (assertEqualsAsUTF8String):
1602         (assertEqualsAsCharactersPtr):
1603         (assertEqualsAsCharacters):
1604         (MyObject_hasProperty):
1605         (MyObject_getProperty):
1606         (MyObject_setProperty):
1607         (MyObject_deleteProperty):
1608         (MyObject_getPropertyList):
1609         (print_callAsFunction):
1610         (myConstructor_callAsConstructor):
1611         (main):
1612         * JavaScriptCore.exp:
1613         * JavaScriptCore.xcodeproj/project.pbxproj:
1614
1615 2006-07-08  Tim Omernick  <timo@apple.com>
1616
1617         Reviewed by Maciej.
1618
1619         Added an OpenGL drawing model to the Netscape Plug-in API.
1620
1621         * bindings/npapi.h:
1622
1623 2006-07-08  Timothy Hatcher  <timothy@apple.com>
1624
1625         Reviewed by Maciej.
1626
1627         Moved KJS_GetCreatedJavaVMs to jni_utility.cpp.
1628         Switched KJS_GetCreatedJavaVMs over to use dlopen and dlsym
1629         now that NSAddImage, NSLookupSymbolInImage and NSAddressOfSymbol
1630         are deprecated in Leopard.
1631
1632         * JavaScriptCore.exp:
1633         * JavaScriptCore.xcodeproj/project.pbxproj:
1634         * bindings/jni/jni_utility.cpp:
1635         (KJS::Bindings::KJS_GetCreatedJavaVMs):
1636         * bindings/softlinking.c: Removed.
1637         * bindings/softlinking.h: Removed.
1638
1639 2006-07-08  Geoffrey Garen  <ggaren@apple.com>
1640
1641         Reviewed by Anders.
1642         
1643         - Make JSObjectGetProperty return a JSValue or NULL, like JSEvaluate does.
1644
1645         * API/JSObjectRef.cpp:
1646         (JSObjectGetProperty):
1647         * API/JSObjectRef.h:
1648         * API/testapi.c:
1649         (main):
1650
1651 2006-07-08  Geoffrey Garen  <ggaren@apple.com>
1652
1653         Style change -- no review necessary.
1654         
1655         Use 0 instead of NULL in API .cpp files, to match our style guidelines.
1656
1657         * API/JSContextRef.cpp:
1658         (JSEvaluate):
1659         * API/JSObjectRef.cpp:
1660         (JSFunctionMakeWithBody):
1661         (JSObjectCallAsFunction):
1662         (JSObjectCallAsConstructor):
1663         * API/JSValueRef.cpp:
1664         (JSValueToObject):
1665
1666 2006-07-08  Geoffrey Garen  <ggaren@apple.com>
1667
1668         Reviewed by TimO.
1669
1670         - Added ability to pass NULL for thisObject when calling JSObjectCallAsFunction,
1671         to match JSEvaluate.
1672         
1673         * API/JSObjectRef.cpp:
1674         (JSObjectCallAsFunction):
1675         * API/JSObjectRef.h:
1676         * API/testapi.c:
1677         (main):
1678
1679 === Safari-521.15 ===
1680
1681 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
1682
1683         Reviewed by Maciej.
1684         
1685         - Standardized which functions take a JSContext as an argument. The rule is:
1686         if you might execute JavaScript, you take a JSContext, otherwise you don't.
1687         
1688         The FIXME in JSObjectRef.h requires refactoring some parts of Interpreter,
1689         but not API changes, so I'm putting it off until later.
1690
1691         * API/JSCallbackObject.cpp:
1692         (KJS::JSCallbackObject::JSCallbackObject):
1693         (KJS::JSCallbackObject::init):
1694         * API/JSCallbackObject.h:
1695         * API/JSContextRef.cpp:
1696         (JSContextCreate):
1697         * API/JSContextRef.h:
1698         * API/JSObjectRef.cpp:
1699         (JSObjectMake):
1700         (JSPropertyEnumeratorGetNext):
1701         * API/JSObjectRef.h:
1702         * API/testapi.c:
1703         (MyObject_initialize):
1704         (main):
1705         * JavaScriptCore.exp:
1706         * kjs/array_object.cpp:
1707         (ArrayInstance::setLength):
1708         (ArrayInstance::pushUndefinedObjectsToEnd):
1709         * kjs/nodes.cpp:
1710         (ForInNode::execute):
1711         * kjs/reference.cpp:
1712         (KJS::Reference::getPropertyName):
1713         (KJS::Reference::getValue):
1714         * kjs/reference.h:
1715         * kjs/scope_chain.cpp:
1716         (KJS::ScopeChain::print):
1717
1718 2006-07-06  Geoffrey Garen  <ggaren@apple.com>
1719
1720         Reviewed by Maciej.
1721         
1722         More API action.
1723         
1724         - Headerdoc finished
1725
1726         Semantic Changes:
1727         - Added a JSContextRef argument to many functions, because you need a 
1728         JSContextRef for doing virtually anything. I expect to add this argument
1729         to even more functions in a future patch.
1730         
1731         - Removed the globalObjectPrototype argument to JSContextCreate because
1732         you can't create an object until you have a context, so it's impossible
1733         to pass a prototype object to JSContextCreate. That's OK because (1) there's
1734         no reason to give the global object a prototype and (2) if you really want
1735         to, you can just use a separate call to JSObjectSetPrototype.
1736         
1737         - Removed the JSClassRef argument to JSClassCreate because it was unnecessary,
1738         and you need to be able to make the global object's class before you've
1739         created a JSContext.
1740         
1741         - Added an optional exception parameter to JSFunctionMakeWithBody because anything
1742         less would be uncivilized.
1743         
1744         - Made the return value parameter to JSObjectGetProperty optional to match
1745         all other return value parameters in the API.
1746         
1747         - Made JSObjectSetPrivate/JSObjectGetPrivate work on JSCallbackFunctions
1748         and JSCallbackConstructors. You could use an abstract base class or strategic
1749         placement of m_privateData in the class structure to implement this, but 
1750         the former seemed like overkill, and the latter seemed too dangerous.
1751         
1752         - Fixed a bug where JSPropertyEnumeratorGetNext would skip the first property.
1753
1754         Cosmetic Changes:
1755         - Reversed the logic of the JSChar #ifdef to avoid confusing headerdoc
1756         
1757         - Removed function names from @function declarations because headeroc
1758         can parse them automatically, and I wanted to rule out manual mismatch.
1759
1760         - Changed Error::create to take a const UString& instead of a UString*
1761         because it was looking at me funny.
1762         
1763         - Renamed JSStringBufferCreateWithCFString to JSStringBufferCreateCF
1764         because the latter is more concise and it matches JSStringBufferCreateUTF8.
1765         
1766         * API/JSCallbackObject.cpp:
1767         (KJS::JSCallbackObject::getOwnPropertySlot):
1768         (KJS::JSCallbackObject::put):
1769         (KJS::JSCallbackObject::deleteProperty):
1770         (KJS::JSCallbackObject::getPropertyList):
1771         (KJS::JSCallbackObject::toBoolean):
1772         (KJS::JSCallbackObject::toNumber):
1773         (KJS::JSCallbackObject::toString):
1774         * API/JSClassRef.cpp:
1775         (JSClassCreate):
1776         * API/JSContextRef.cpp:
1777         (JSContextCreate):
1778         (JSContextSetException):
1779         * API/JSContextRef.h:
1780         * API/JSNode.c:
1781         (JSNodePrototype_class):
1782         (JSNode_class):
1783         * API/JSNodeList.c:
1784         (JSNodeListPrototype_class):
1785         (JSNodeList_class):
1786         * API/JSObjectRef.cpp:
1787         (JSObjectGetProperty):
1788         (JSObjectGetPrivate):
1789         (JSObjectSetPrivate):
1790         (JSObjectCallAsFunction):
1791         (JSObjectCallAsConstructor):
1792         (JSPropertyEnumeratorGetNext):
1793         * API/JSObjectRef.h:
1794         * API/JSStringBufferRef.cpp:
1795         (JSStringBufferCreateCF):
1796         * API/JSStringBufferRef.h:
1797         * API/JSValueRef.cpp:
1798         (JSValueIsInstanceOf):
1799         * API/JSValueRef.h:
1800         * API/minidom.c:
1801         (main):
1802         * API/minidom.js:
1803         * API/testapi.c:
1804         (MyObject_hasProperty):
1805         (MyObject_setProperty):
1806         (MyObject_deleteProperty):
1807         (MyObject_getPropertyList):
1808         (MyObject_convertToType):
1809         (MyObject_class):
1810         (main):
1811         * JavaScriptCore.exp:
1812
1813 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
1814
1815         Reviewed by John.
1816         
1817         - Fixed a few crashes resulting from NULL parameters to JSClassCreate.
1818
1819         * API/JSClassRef.cpp:
1820         (JSClassCreate):
1821         (JSClassRelease):
1822         * API/testapi.c: Added test for NULL parameters.
1823         (main):
1824
1825 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
1826
1827         Reviewed by John, mocked by Darin.
1828         
1829         - Changed JSEvaluate to take a JSObjectRef instead of a JSValueRef as
1830         "this," since "this" must be an object.
1831
1832         * API/JSContextRef.cpp:
1833         (JSEvaluate):
1834         * API/JSContextRef.h:
1835
1836 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
1837
1838         Reviewed by John.
1839         
1840         - More headerdoc
1841
1842         * API/JSBase.h:
1843         * JavaScriptCore.xcodeproj/project.pbxproj:
1844
1845 2006-07-05  Geoffrey Garen  <ggaren@apple.com>
1846
1847         RS by Beth.
1848         
1849         Renamed JSCharBufferRef, which was universally unpopular, to JSStringBufferRef,
1850         which, hopefully, will be less unpopular.
1851
1852         * API/APICast.h:
1853         (toJS):
1854         (toRef):
1855         * API/JSBase.h:
1856         * API/JSCallbackObject.cpp:
1857         (KJS::JSCallbackObject::getOwnPropertySlot):
1858         (KJS::JSCallbackObject::put):
1859         (KJS::JSCallbackObject::deleteProperty):
1860         (KJS::JSCallbackObject::staticValueGetter):
1861         (KJS::JSCallbackObject::callbackGetter):
1862         * API/JSCharBufferRef.cpp: Removed.
1863         * API/JSCharBufferRef.h: Removed.
1864         * API/JSContextRef.cpp:
1865         (JSEvaluate):
1866         (JSCheckSyntax):
1867         * API/JSContextRef.h:
1868         * API/JSNode.c:
1869         (JSNodePrototype_appendChild):
1870         (JSNode_getNodeType):
1871         (JSNode_getChildNodes):
1872         (JSNode_getFirstChild):
1873         * API/JSNodeList.c:
1874         (JSNodeList_length):
1875         (JSNodeList_getProperty):
1876         * API/JSObjectRef.cpp:
1877         (JSFunctionMakeWithBody):
1878         (JSObjectGetDescription):
1879         (JSObjectHasProperty):
1880         (JSObjectGetProperty):
1881         (JSObjectSetProperty):
1882         (JSObjectDeleteProperty):
1883         (JSPropertyEnumeratorGetNext):
1884         (JSPropertyListAdd):
1885         * API/JSObjectRef.h:
1886         * API/JSStringBufferRef.cpp: Added.
1887         (JSStringMake):
1888         (JSStringBufferCreate):
1889         (JSStringBufferCreateUTF8):
1890         (JSStringBufferRetain):
1891         (JSStringBufferRelease):
1892         (JSValueCopyStringValue):
1893         (JSStringBufferGetLength):
1894         (JSStringBufferGetCharactersPtr):
1895         (JSStringBufferGetCharacters):
1896         (JSStringBufferGetMaxLengthUTF8):
1897         (JSStringBufferGetCharactersUTF8):
1898         (JSStringBufferIsEqual):
1899         (JSStringBufferIsEqualUTF8):
1900         (JSStringBufferCreateWithCFString):
1901         (CFStringCreateWithJSStringBuffer):
1902         * API/JSStringBufferRef.h: Added.
1903         * API/JSValueRef.h:
1904         * API/JavaScriptCore.h:
1905         * API/minidom.c:
1906         (main):
1907         (print):
1908         * API/testapi.c:
1909         (assertEqualsAsUTF8String):
1910         (assertEqualsAsCharactersPtr):
1911         (assertEqualsAsCharacters):
1912         (MyObject_hasProperty):
1913         (MyObject_getProperty):
1914         (MyObject_setProperty):
1915         (MyObject_deleteProperty):
1916         (MyObject_getPropertyList):
1917         (print_callAsFunction):
1918         (myConstructor_callAsConstructor):
1919         (main):
1920         * JavaScriptCore.exp:
1921         * JavaScriptCore.xcodeproj/project.pbxproj:
1922
1923 2006-07-05  Geoffrey Garen  <ggaren@apple.com>
1924
1925         RS by Beth.
1926         
1927         Moved some code around for more logical file separation.
1928
1929         * API/JSBase.h:
1930         * API/JSContextRef.h:
1931         * API/JSObjectRef.cpp:
1932         * API/JSValueRef.cpp:
1933         (JSValueToObject):
1934         * API/JSValueRef.h:
1935
1936 2006-07-03  Geoffrey Garen  <ggaren@apple.com>
1937
1938         Reviewed by Maciej.
1939         
1940         Implemented JSFunctionMakeWithBody, which parses a script as a function body
1941         in the global scope, and returns the resulting anonymous function.
1942         
1943         I also removed private data from JSCallbackFunction. It never worked,
1944         since JSCallbackFunction doesn't inherit from JSCallbackObject.
1945
1946         * API/JSCallbackConstructor.cpp: Removed.
1947         * API/JSCallbackConstructor.h: Removed.
1948         * API/JSCallbackFunction.cpp:
1949         (KJS::JSCallbackFunction::JSCallbackFunction):
1950         (KJS::JSCallbackFunction::implementsConstruct):
1951         (KJS::JSCallbackFunction::construct):
1952         (KJS::JSCallbackFunction::implementsCall):
1953         (KJS::JSCallbackFunction::callAsFunction):
1954         * API/JSCallbackFunction.h:
1955         * API/JSCallbackObject.cpp:
1956         (KJS::JSCallbackObject::staticFunctionGetter):
1957         * API/JSObjectRef.cpp:
1958         (JSFunctionMake):
1959         (JSFunctionMakeWithCallbacks):
1960         * API/JSObjectRef.h:
1961         * API/JSValueRef.h:
1962         * API/minidom.c:
1963         (main):
1964         * API/testapi.c:
1965         (main):
1966         * JavaScriptCore.exp: Programmatically added all symbols exported by
1967         API object files, and sorted results
1968         * JavaScriptCore.xcodeproj/project.pbxproj:
1969
1970 2006-07-03  Geoffrey Garen  <ggaren@apple.com>
1971
1972         Reviewed by Maciej.
1973
1974         - Return syntax error in JSCheckSyntax through a JSValueRef* exception
1975         argument
1976         
1977         * API/JSBase.h:
1978         * API/JSContextRef.cpp:
1979         (JSCheckSyntax):
1980         * API/testapi.c:
1981         (main):
1982         * JavaScriptCore.exp:
1983         * kjs/interpreter.cpp:
1984         (KJS::Interpreter::checkSyntax):
1985         * kjs/interpreter.h:
1986
1987 2006-07-04  Darin Adler  <darin@apple.com>
1988
1989         - fixed build
1990
1991         * wtf/MathExtras.h: Oops. Added missing #endif.
1992
1993 2006-07-04  Bjoern Graf  <bjoern.graf@gmail.com>
1994
1995         Reviewed by Maciej.
1996         Tweaked a bit by Darin.
1997
1998         - http://bugzilla.opendarwin.org/show_bug.cgi?id=9678
1999           work around MSVCRT's fmod function returning NaN for fmod(x, infinity) instead of x
2000
2001         * wtf/MathExtras.h: Added include of <float.h>.
2002         (isinf): Fix to return false for NAN.
2003         (wtf_fmod): Added. An inline that works around the bug.
2004
2005         * kjs/nodes.cpp:
2006         * kjs/number_object.cpp:
2007         * kjs/operations.cpp:
2008         * kjs/value.cpp:
2009         Added includes of MathExtras.h to all files using fmod.
2010
2011         * JavaScriptCore.xcodeproj/project.pbxproj: Let Xcode 2.3 have its way with
2012         the project.
2013
2014 2006-07-01  Geoffrey Garen  <ggaren@apple.com>
2015
2016         Reviewed by Darin.
2017         
2018         - Refined value conversions in the API:
2019             - failed toNumber returns NaN
2020             - failed toObject returns NULL
2021             - failed toString returns empty string
2022         
2023         - Refined excpetion handling in the API:
2024             - failed value conversions do not throw exceptions
2025             - uncaught exceptions in JSEvaluate, JSObjectCallAsFunction, and 
2026               JSObjectCallAsConstructor are returned through a JSValueRef* exception
2027               argument
2028             - removed JSContextHasException, because JSContextGetException does
2029               the same job
2030             
2031         * API/JSBase.h:
2032         * API/JSCharBufferRef.cpp:
2033         (JSValueCopyStringValue):
2034         * API/JSContextRef.cpp:
2035         (JSEvaluate):
2036         * API/JSContextRef.h:
2037         * API/JSNodeList.c: Added test code demonstrating how you would use
2038         toNumber, and why you probably don't need toUInt32, etc.
2039         (JSNodeListPrototype_item):
2040         (JSNodeList_getProperty):
2041         * API/JSObjectRef.cpp:
2042         (JSValueToObject):
2043         (JSObjectCallAsFunction):
2044         (JSObjectCallAsConstructor):
2045         * API/JSObjectRef.h:
2046         * API/JSValueRef.cpp:
2047         (JSValueToNumber):
2048         * API/JSValueRef.h:
2049         * API/minidom.c:
2050         (main):
2051         * API/testapi.c:
2052         (main): Added tests for new rules, and call to JSGCProtect to fix Intel 
2053         crash
2054         * JavaScriptCore.exp:
2055
2056 2006-07-03  Darin Adler  <darin@apple.com>
2057
2058         - Rolled out HashMap implementation of NPRuntime, at least temporarily.
2059
2060         Fixes hang in the bindings section of layout tests seen on the
2061         buildbot.
2062
2063         This code was using HashMap<const char*, PrivateIdentifier*>.
2064         But that hashes based on pointer identity, not string value.
2065         The default hash for any pointer type is to hash based on the pointer.
2066         And WTF doesn't currently have a string hash for char*.
2067         We'll need to fix that before re-landing this patch.
2068
2069         (Formatting was also incorrect -- extra spaces in parentheses.)
2070
2071         * bindings/npruntime.cpp: Rolled out last change.
2072
2073 2006-07-02  Justin Haygood  <jhaygood@spsu.edu>
2074
2075         Reviewed, tweaked, landed by ggaren.
2076
2077         - Port NPRuntime from CFDictionary to HashMap.
2078
2079         * bindings/npruntime.cpp:
2080         (getStringIdentifierDictionary):
2081         (getIntIdentifierDictionary):
2082         (_NPN_GetStringIdentifier):
2083         (_NPN_GetIntIdentifier):
2084         * bindings/npruntime.h:
2085
2086 2006-07-01  Geoffrey Garen  <ggaren@apple.com>
2087
2088         Reviewed by Adele.
2089         
2090         - Fixed <rdar://problem/4611197> REGRESSION: Liveconnect with Java test 
2091         fails at http://www-sor.inria.fr/~dedieu/notes/liveconnect/simple_example.html
2092
2093         * JavaScriptCore.exp: Export symbols used by liveconnect
2094
2095 2006-06-29  Geoffrey Garen  <ggaren@apple.com>
2096
2097         Reviewed by Maciej.
2098         
2099         - Phase 2 in the JS API.
2100         
2101         - Added support for specifying static tables of values -- this should
2102         obviate the need for using complicated callbacks for most lookups.
2103         
2104         -  API objects are now created with classes (JSClassRef) -- in order to support
2105         static values, and in order to prevent API objects from storing their
2106         data inline, and thus falling into the oversized (read: slow and prone to
2107         giving Maciej the frowny face) heap.
2108         
2109         - Added two specialized JSObject subclasses -- JSCallbackFunction and JSCallbackConstructor -- 
2110         to allow JSFunctionMake and JSConstructorMake to continue to work with
2111         the new class model. Another solution to this problem would be to create
2112         a custom class object for each function and constructor you make. This
2113         solution is more code but also more efficient.
2114         
2115         - Substantially beefed up the minidom example to demonstrate and test a
2116         lot of these techniques. Its output is still pretty haphazard, though.
2117         
2118         - Gave the <kjs/ preface to some includes -- I'm told this matters to
2119         building on some versions of Linux.
2120         
2121         - Implemented JSValueIsInstanceOf and JSValueIsObjectOfClass
2122         
2123         - Removed GetDescription callback. Something in the class datastructure
2124         should take care of this.
2125
2126         * API/JSBase.h:
2127         * API/JSCallbackConstructor.cpp: Added.
2128         (KJS::):
2129         (KJS::JSCallbackConstructor::JSCallbackConstructor):
2130         (KJS::JSCallbackConstructor::implementsConstruct):
2131         (KJS::JSCallbackConstructor::construct):
2132         (KJS::JSCallbackConstructor::setPrivate):
2133         (KJS::JSCallbackConstructor::getPrivate):
2134         * API/JSCallbackConstructor.h: Added.
2135         (KJS::JSCallbackConstructor::classInfo):
2136         * API/JSCallbackFunction.cpp: Added.
2137         (KJS::):
2138         (KJS::JSCallbackFunction::JSCallbackFunction):
2139         (KJS::JSCallbackFunction::implementsCall):
2140         (KJS::JSCallbackFunction::callAsFunction):
2141         (KJS::JSCallbackFunction::setPrivate):
2142         (KJS::JSCallbackFunction::getPrivate):
2143         * API/JSCallbackFunction.h: Added.
2144         (KJS::JSCallbackFunction::classInfo):
2145         * API/JSCallbackObject.cpp:
2146         (KJS::):
2147         (KJS::JSCallbackObject::JSCallbackObject):
2148         (KJS::JSCallbackObject::init):
2149         (KJS::JSCallbackObject::~JSCallbackObject):
2150         (KJS::JSCallbackObject::className):
2151         (KJS::JSCallbackObject::getOwnPropertySlot):
2152         (KJS::JSCallbackObject::put):
2153         (KJS::JSCallbackObject::deleteProperty):
2154         (KJS::JSCallbackObject::implementsConstruct):
2155         (KJS::JSCallbackObject::construct):
2156         (KJS::JSCallbackObject::implementsCall):
2157         (KJS::JSCallbackObject::callAsFunction):
2158         (KJS::JSCallbackObject::getPropertyList):
2159         (KJS::JSCallbackObject::toBoolean):
2160         (KJS::JSCallbackObject::toNumber):
2161         (KJS::JSCallbackObject::toString):
2162         (KJS::JSCallbackObject::inherits):
2163         (KJS::JSCallbackObject::staticValueGetter):
2164         (KJS::JSCallbackObject::staticFunctionGetter):
2165         (KJS::JSCallbackObject::callbackGetter):
2166         * API/JSCallbackObject.h:
2167         * API/JSCharBufferRef.cpp:
2168         * API/JSClassRef.cpp: Added.
2169         (JSClassCreate):
2170         (JSClassRetain):
2171         (JSClassRelease):
2172         * API/JSClassRef.h: Added.
2173         (StaticValueEntry::StaticValueEntry):
2174         (StaticFunctionEntry::StaticFunctionEntry):
2175         (__JSClass::__JSClass):
2176         * API/JSContextRef.cpp:
2177         (JSContextCreate):
2178         (JSEvaluate):
2179         * API/JSContextRef.h:
2180         * API/JSNode.c: Added.
2181         (JSNodePrototype_appendChild):
2182         (JSNodePrototype_removeChild):
2183         (JSNodePrototype_replaceChild):
2184         (JSNodePrototype_class):
2185         (JSNode_getNodeType):
2186         (JSNode_getChildNodes):
2187         (JSNode_getFirstChild):
2188         (JSNode_finalize):
2189         (JSNode_class):
2190         (JSNode_prototype):
2191         (JSNode_new):
2192         (JSNode_construct):
2193         * API/JSNode.h: Added.
2194         * API/JSNodeList.c: Added.
2195         (JSNodeListPrototype_item):
2196         (JSNodeListPrototype_class):
2197         (JSNodeList_length):
2198         (JSNodeList_getProperty):
2199         (JSNodeList_finalize):
2200         (JSNodeList_class):
2201         (JSNodeList_prototype):
2202         (JSNodeList_new):
2203         * API/JSNodeList.h: Added.
2204         * API/JSObjectRef.cpp:
2205         (JSObjectMake):
2206         (JSFunctionMake):
2207         (JSConstructorMake):
2208         (__JSPropertyEnumerator::__JSPropertyEnumerator):
2209         (JSObjectCreatePropertyEnumerator):
2210         (JSPropertyEnumeratorGetNext):
2211         (JSPropertyEnumeratorRetain):
2212         (JSPropertyEnumeratorRelease):
2213         * API/JSObjectRef.h:
2214         (__JSObjectCallbacks::):
2215         * API/JSValueRef.cpp:
2216         (JSValueIsObjectOfClass):
2217         (JSValueIsInstanceOf):
2218         * API/JSValueRef.h:
2219         * API/Node.c: Added.
2220         (Node_new):
2221         (Node_appendChild):
2222         (Node_removeChild):
2223         (Node_replaceChild):
2224         (Node_ref):
2225         (Node_deref):
2226         * API/Node.h: Added.
2227         * API/NodeList.c: Added.
2228         (NodeList_new):
2229         (NodeList_length):
2230         (NodeList_item):
2231         (NodeList_ref):
2232         (NodeList_deref):
2233         * API/NodeList.h: Added.
2234         * API/minidom.c:
2235         (main):
2236         (print):
2237         (createStringWithContentsOfFile):
2238         * API/minidom.js:
2239         * API/testapi.c:
2240         (assertEqualsAsCharacters):
2241         (MyObject_getProperty):
2242         (MyObject_class):
2243         (myConstructor_callAsConstructor):
2244         (main):
2245         * API/testapi.js:
2246         * JavaScriptCore.xcodeproj/project.pbxproj:
2247
2248 2006-06-26  Kevin Ollivier  <kevino@theolliviers.com>
2249         
2250         Reviewed and tweaked by Darin.
2251
2252         - Compile fixes for wx port / gcc 4.0.2
2253
2254         * kjs/array_object.cpp:
2255         Added missing headers. 
2256
2257         * kjs/ExecState.h:
2258         gcc needs class prototypes before defining those classes as friend classes
2259
2260 2006-06-30  Mike Emmel  <mike.emmel@gmail.com>
2261
2262         Reviewed by Darin.
2263
2264         Compilation fixes for Linux/Gdk.
2265
2266         * JavaScriptCore/kjs/interpreter.cpp: added include of signal.h
2267         * JavaScriptCore/kjs/ExecState.h: added missing class declaration 
2268         * JavaScriptCore/kjs/ExecState.cpp: case wrong on include of context.h 
2269         * JavaScriptCore/JavaScriptCoreSources.bkl: added Context.cpp and ExecState.cpp
2270
2271 === Safari-521.14 ===
2272
2273 2006-06-29  Maciej Stachowiak  <mjs@apple.com>
2274
2275         Reviewed by Geoff.
2276         
2277         - add headerdoc comments to some of the new JS API headers
2278
2279         * API/JSBase.h:
2280         * API/JSValueRef.h:
2281
2282 2006-06-28  Timothy Hatcher  <timothy@apple.com>
2283
2284         Prefer the Stabs debugging symbols format until DWARF bugs are fixed.
2285
2286         * JavaScriptCore.xcodeproj/project.pbxproj:
2287
2288 2006-06-27  Timothy Hatcher  <timothy@apple.com>
2289
2290         Reviewed by Tim O.
2291
2292         <rdar://problem/4448350> Deprecated ObjC language API used in JavaScriptCore, WebCore, WebKit and WebBrowser
2293
2294         Switch to the new ObjC 2 API, ifdefed the old code around OBJC_API_VERSION so it still works on Tiger.
2295         Removed the use of the old stringWithCString, switched to the new Tiger version that accepts an encoding.
2296         Lots of code style cleanup.
2297
2298         * JavaScriptCore.xcodeproj/project.pbxproj:
2299         * bindings/objc/objc_class.h:
2300         * bindings/objc/objc_class.mm:
2301         (KJS::Bindings::ObjcClass::~ObjcClass):
2302         (KJS::Bindings::_createClassesByIsAIfNecessary):
2303         (KJS::Bindings::ObjcClass::classForIsA):
2304         (KJS::Bindings::ObjcClass::name):
2305         (KJS::Bindings::ObjcClass::methodsNamed):
2306         (KJS::Bindings::ObjcClass::fieldNamed):
2307         (KJS::Bindings::ObjcClass::fallbackObject):
2308         * bindings/objc/objc_header.h:
2309         * bindings/objc/objc_instance.h:
2310         * bindings/objc/objc_instance.mm:
2311         (ObjcInstance::ObjcInstance):
2312         (ObjcInstance::~ObjcInstance):
2313         (ObjcInstance::operator=):
2314         (ObjcInstance::begin):
2315         (ObjcInstance::end):
2316         (ObjcInstance::getClass):
2317         (ObjcInstance::invokeMethod):
2318         (ObjcInstance::invokeDefaultMethod):
2319         (ObjcInstance::setValueOfField):
2320         (ObjcInstance::supportsSetValueOfUndefinedField):
2321         (ObjcInstance::setValueOfUndefinedField):
2322         (ObjcInstance::getValueOfField):
2323         (ObjcInstance::getValueOfUndefinedField):
2324         (ObjcInstance::defaultValue):
2325         (ObjcInstance::stringValue):
2326         (ObjcInstance::numberValue):
2327         (ObjcInstance::booleanValue):
2328         (ObjcInstance::valueOf):
2329         * bindings/objc/objc_runtime.h:
2330         * bindings/objc/objc_runtime.mm:
2331         (ObjcMethod::ObjcMethod):
2332         (ObjcMethod::name):
2333         (ObjcMethod::getMethodSignature):
2334         (ObjcMethod::setJavaScriptName):
2335         (ObjcField::name):
2336         (ObjcField::type):
2337         (ObjcField::valueFromInstance):
2338         (convertValueToObjcObject):
2339         (ObjcField::setValueToInstance):
2340         (ObjcArray::operator=):
2341         (ObjcArray::setValueAt):
2342         (ObjcArray::valueAt):
2343         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
2344         (ObjcFallbackObjectImp::callAsFunction):
2345         (ObjcFallbackObjectImp::defaultValue):
2346
2347 2006-06-28  Anders Carlsson  <acarlsson@apple.com>
2348
2349         Reviewed by Geoff.
2350
2351         http://bugzilla.opendarwin.org/show_bug.cgi?id=8636
2352         REGRESSION: JavaScript access to Java applet causes hang (_webViewURL not implemented)
2353
2354         * bindings/jni/jni_objc.mm:
2355         (KJS::Bindings::dispatchJNICall):
2356         Just pass nil as the calling URL. This will cause the Java plugin to use the URL of the page
2357         containing the applet (which is what we used to do).
2358
2359 2006-06-27  Timothy Hatcher  <timothy@apple.com>
2360
2361         Reviewed by Darin.
2362
2363         <rdar://problem/4406785> Add an export file to TOT JavaScriptCore like the Safari-2-0-branch
2364
2365         * JavaScriptCore.exp: Added.
2366         * JavaScriptCore.xcodeproj/project.pbxproj:
2367
2368 2006-06-25  Geoffrey Garen  <ggaren@apple.com>
2369
2370         Reviewed by Adele.
2371         
2372         - Added JSConstructorMake to match JSFunctionMake, along with test code.
2373         
2374         [ I checked in the ChangeLog before without the actual files. ]
2375
2376         * API/JSObjectRef.cpp:
2377         (JSConstructorMake):
2378         * API/JSObjectRef.h:
2379         * API/testapi.c:
2380         (myConstructor_callAsConstructor):
2381         (main):
2382         * API/testapi.js:
2383         * ChangeLog:
2384         * JavaScriptCore.xcodeproj/project.pbxproj: Moved testapi.c to the testapi
2385         target -- this was an oversight in my earlier check-in.
2386
2387 2006-06-25  Timothy Hatcher  <timothy@apple.com>
2388
2389         Reviewed by Darin.
2390
2391         Bug 9574: Drosera should show inline scripts within the original HTML
2392         http://bugzilla.opendarwin.org/show_bug.cgi?id=9574
2393
2394         Pass the starting line number and error message to the debugger.
2395
2396         * kjs/debugger.cpp:
2397         (Debugger::sourceParsed):
2398         * kjs/debugger.h:
2399         * kjs/function.cpp:
2400         (KJS::GlobalFuncImp::callAsFunction):
2401         * kjs/function_object.cpp:
2402         (FunctionObjectImp::construct):
2403         * kjs/interpreter.cpp:
2404         (KJS::Interpreter::evaluate):
2405
2406 2006-06-24  Alexey Proskuryakov  <ap@nypop.com>
2407
2408         Rubber-stamped by Eric.
2409
2410         Add a -h (do not follow symlinks) option to ln in derived sources build script (without it,
2411         a symlink was created inside the source directory on second build).
2412
2413         * JavaScriptCore.xcodeproj/project.pbxproj:
2414
2415 2006-06-24  David Kilzer  <ddkilzer@kilzer.net>
2416
2417         Reviewed by Timothy.
2418
2419         * Info.plist: Fixed copyright to include 2003-2006.
2420
2421 2006-06-24  Alexey Proskuryakov  <ap@nypop.com>
2422
2423         Reviewed by Darin.
2424
2425         - http://bugzilla.opendarwin.org/show_bug.cgi?id=9418
2426         WebKit will not build when Space exists in path
2427
2428         * JavaScriptCore.xcodeproj/project.pbxproj: Enclose search paths in quotes; create symlinks to 
2429         avoid passing paths with spaces to make.
2430
2431 2006-06-23  Timothy Hatcher  <timothy@apple.com>
2432
2433         Reviewed by Darin.
2434
2435         Adding more operator[] overloads for long and short types.
2436
2437         * wtf/Vector.h:
2438         (WTF::Vector::operator[]):
2439
2440 === JavaScriptCore-521.13 ===
2441
2442 2006-06-22  Alexey Proskuryakov  <ap@nypop.com>
2443
2444         Build fix.
2445
2446         - http://bugzilla.opendarwin.org/show_bug.cgi?id=9539
2447         Another case error preventing build
2448
2449         * API/JSObjectRef.cpp: Changed "identifier.h" to "Identifier.h"
2450         
2451 2006-06-22  David Kilzer  <ddkilzer@kilzer.net>
2452
2453         Build fix.
2454
2455         http://bugzilla.opendarwin.org/show_bug.cgi?id=9539
2456         Another case error preventing build
2457
2458         * API/APICast.h: Changed "UString.h" to "ustring.h".
2459
2460 2006-06-21  Geoffrey Garen  <ggaren@apple.com>
2461
2462         Fixed release build, fixed accidental infinite recursion due to
2463         last minute global replace gone awry.
2464         
2465         * API/APICast.h:
2466         (toRef):
2467         * API/testapi.c:
2468         (assertEqualsAsBoolean):
2469         (assertEqualsAsNumber):
2470         (assertEqualsAsUTF8String):
2471         (assertEqualsAsCharactersPtr):
2472         * JavaScriptCore.xcodeproj/project.pbxproj:
2473
2474 2006-06-21  Geoffrey Garen  <ggaren@apple.com>
2475
2476         Reviewed by Anders.
2477         
2478         - First cut at C API to JavaScript. Includes a unit test, 'testapi.c', 
2479         and the outline of a test app, 'minidom.c'.
2480         
2481         Includes one change to JSC internals: Rename propList to getPropertyList and have it
2482         take its target property list by reference so that subclasses can
2483         add properties to the list before calling through to their superclasses.
2484         
2485         Also, I just ran prepare-ChangeLog in about 10 seconds, and I would like
2486         to give a shout-out to that.
2487         
2488         * API/APICast.h: Added.
2489         (toJS):
2490         (toRef):
2491         * API/JSBase.h: Added.
2492         * API/JSCallbackObject.cpp: Added.
2493         (KJS::):
2494         (KJS::JSCallbackObject::JSCallbackObject):
2495         (KJS::JSCallbackObject::~JSCallbackObject):
2496         (KJS::JSCallbackObject::className):
2497         (KJS::JSCallbackObject::getOwnPropertySlot):
2498         (KJS::JSCallbackObject::put):
2499         (KJS::JSCallbackObject::deleteProperty):
2500         (KJS::JSCallbackObject::implementsConstruct):
2501         (KJS::JSCallbackObject::construct):
2502         (KJS::JSCallbackObject::implementsCall):
2503         (KJS::JSCallbackObject::callAsFunction):
2504         (KJS::JSCallbackObject::getPropertyList):
2505         (KJS::JSCallbackObject::toBoolean):
2506         (KJS::JSCallbackObject::toNumber):
2507         (KJS::JSCallbackObject::toString):
2508         (KJS::JSCallbackObject::setPrivate):
2509         (KJS::JSCallbackObject::getPrivate):
2510         (KJS::JSCallbackObject::cachedValueGetter):
2511         (KJS::JSCallbackObject::callbackGetter):
2512         * API/JSCallbackObject.h: Added.
2513         (KJS::JSCallbackObject::classInfo):
2514         * API/JSCharBufferRef.cpp: Added.
2515         (JSStringMake):
2516         (JSCharBufferCreate):
2517         (JSCharBufferCreateUTF8):
2518         (JSCharBufferRetain):
2519         (JSCharBufferRelease):
2520         (JSValueCopyStringValue):
2521         (JSCharBufferGetLength):
2522         (JSCharBufferGetCharactersPtr):
2523         (JSCharBufferGetCharacters):
2524         (JSCharBufferGetMaxLengthUTF8):
2525         (JSCharBufferGetCharactersUTF8):
2526         (JSCharBufferIsEqual):
2527         (JSCharBufferIsEqualUTF8):
2528         (JSCharBufferCreateWithCFString):
2529         (CFStringCreateWithJSCharBuffer):
2530         * API/JSCharBufferRef.h: Added.
2531         * API/JSContextRef.cpp: Added.
2532         (JSContextCreate):
2533         (JSContextDestroy):
2534         (JSContextGetGlobalObject):
2535         (JSEvaluate):
2536         (JSCheckSyntax):
2537         (JSContextHasException):
2538         (JSContextGetException):
2539         (JSContextClearException):
2540         (JSContextSetException):
2541         * API/JSContextRef.h: Added.
2542         * API/JSObjectRef.cpp: Added.
2543         (JSValueToObject):
2544         (JSObjectMake):
2545         (JSFunctionMake):
2546         (JSObjectGetDescription):
2547         (JSObjectGetPrototype):
2548         (JSObjectSetPrototype):
2549         (JSObjectHasProperty):
2550         (JSObjectGetProperty):
2551         (JSObjectSetProperty):
2552         (JSObjectDeleteProperty):
2553         (JSObjectGetPrivate):
2554         (JSObjectSetPrivate):
2555         (JSObjectIsFunction):
2556         (JSObjectCallAsFunction):
2557         (JSObjectIsConstructor):
2558         (JSObjectCallAsConstructor):
2559         (__JSPropertyListEnumerator::__JSPropertyListEnumerator):
2560         (JSObjectCreatePropertyEnumerator):
2561         (JSPropertyEnumeratorGetNext):
2562         (JSPropertyEnumeratorRetain):
2563         (JSPropertyEnumeratorRelease):
2564         (JSPropertyListAdd):
2565         * API/JSObjectRef.h: Added.
2566         * API/JSValueRef.cpp: Added.
2567         (JSValueGetType):
2568         (JSValueIsUndefined):
2569         (JSValueIsNull):
2570         (JSValueIsBoolean):
2571         (JSValueIsNumber):
2572         (JSValueIsString):
2573         (JSValueIsObject):
2574         (JSValueIsEqual):
2575         (JSValueIsStrictEqual):
2576         (JSUndefinedMake):
2577         (JSNullMake):
2578         (JSBooleanMake):
2579         (JSNumberMake):
2580         (JSValueToBoolean):
2581         (JSValueToNumber):
2582         (JSGCProtect):
2583         (JSGCUnprotect):
2584         (JSGCCollect):
2585         * API/JSValueRef.h: Added.
2586         * API/JavaScriptCore.h: Added.
2587         * API/minidom.c: Added.
2588         (main):
2589         * API/minidom.html: Added.
2590         * API/minidom.js: Added.
2591         * API/testapi.c: Added.
2592         (assertEqualsAsBoolean):
2593         (assertEqualsAsNumber):
2594         (assertEqualsAsUTF8String):
2595         (assertEqualsAsCharactersPtr):
2596         (assertEqualsAsCharacters):
2597         (MyObject_initialize):
2598         (MyObject_copyDescription):
2599         (MyObject_hasProperty):
2600         (MyObject_getProperty):
2601         (MyObject_setProperty):
2602         (MyObject_deleteProperty):
2603         (MyObject_getPropertyList):
2604         (MyObject_callAsFunction):
2605         (MyObject_callAsConstructor):
2606         (MyObject_convertToType):
2607         (MyObject_finalize):
2608         (print_callAsFunction):
2609         (main):
2610         (createStringWithContentsOfFile):
2611         * API/testapi.js: Added.
2612         * ChangeLog:
2613         * JavaScriptCore.xcodeproj/project.pbxproj:
2614         * bindings/npruntime_impl.h:
2615         * kjs/array_instance.h:
2616         * kjs/array_object.cpp:
2617         (ArrayInstance::getPropertyList):
2618         * kjs/interpreter.cpp:
2619         (KJS::Interpreter::evaluate):
2620         * kjs/nodes.cpp:
2621         (ForInNode::execute):
2622         * kjs/object.cpp:
2623         (KJS::JSObject::put):
2624         (KJS::JSObject::canPut):
2625         (KJS::JSObject::deleteProperty):
2626         (KJS::JSObject::propertyIsEnumerable):
2627         (KJS::JSObject::getPropertyAttributes):
2628         (KJS::JSObject::getPropertyList):
2629         * kjs/object.h:
2630         * kjs/property_map.cpp:
2631         (KJS::PropertyMap::get):
2632         * kjs/property_map.h:
2633         * kjs/scope_chain.cpp:
2634         (KJS::ScopeChain::print):
2635         * kjs/string_object.cpp:
2636         (StringInstance::getPropertyList):
2637         * kjs/string_object.h:
2638         * kjs/ustring.h:
2639         (KJS::UString::Rep::ref):
2640
2641 2006-06-20  Timothy Hatcher  <timothy@apple.com>
2642
2643         Reviewed by Geoff.
2644
2645         Make sure we clear the exception before returning so
2646         that future calls will not fail because of an earlier
2647         exception state. Assert on entry that the WebScriptObject
2648         is working with an ExecState that dose not have an exception. 
2649         Document that evaluateWebScript and callWebScriptMethod return
2650         WebUndefined when an exception is thrown.
2651
2652         * bindings/objc/WebScriptObject.h:
2653         * bindings/objc/WebScriptObject.mm:
2654         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2655         (-[WebScriptObject evaluateWebScript:]):
2656         (-[WebScriptObject setValue:forKey:]):
2657         (-[WebScriptObject valueForKey:]):
2658         (-[WebScriptObject removeWebScriptKey:]):
2659         (-[WebScriptObject webScriptValueAtIndex:]):
2660         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
2661
2662 2006-06-19  Anders Carlsson  <acarlsson@apple.com>
2663
2664         Reviewed by John.
2665
2666         * kjs/interpreter.cpp:
2667         (KJS::TimeoutChecker::pauseTimeoutCheck):
2668         (KJS::TimeoutChecker::resumeTimeoutCheck):
2669         Fix argument order in setitimer calls.
2670
2671 2006-06-18  Anders Carlsson  <acarlsson@apple.com>
2672
2673         Reviewed by Geoff.
2674
2675         * kjs/interpreter.cpp:
2676         (KJS::TimeoutChecker::pauseTimeoutCheck):
2677         Do nothing if the timeout check hasn't been started.
2678         
2679         (KJS::TimeoutChecker::resumeTimeoutCheck):
2680         Do nothing if the timeout check hasn't been started.
2681         Use the right signal handler when unblocking.
2682         
2683         (KJS::Interpreter::handleTimeout):
2684         pause/resume the timeout check around the call to
2685         shouldInterruptScript().
2686         
2687 2006-06-16  Ben Goodger <beng@google.com>
2688         
2689         Reviewed by Maciej
2690
2691         http://bugzilla.opendarwin.org/show_bug.cgi?id=9491
2692         Windows build breaks in interpreter.cpp 
2693
2694         * kjs/interpreter.cpp
2695         (KJS::TimeoutChecker::pauseTimeoutCheck):
2696         (KJS::TimeoutChecker::resumeTimeoutCheck):
2697         Make sure to only assert equality with s_executingInterpreter when it 
2698         is being used (i.e. when HAVE(SYS_TIME_H) == true)
2699
2700 2006-06-17  David Kilzer  <ddkilzer@kilzer.net>
2701
2702         Reviewed by darin.
2703
2704         http://bugzilla.opendarwin.org/show_bug.cgi?id=9477
2705         REGRESSION: fast/dom/replaceChild.html crashes on WebKit ToT in debug build
2706
2707         * kjs/function.cpp:
2708         (KJS::FunctionImp::callAsFunction): Refetch the debugger after executing the function
2709         in case the WebFrame it was running in has since been destroyed.
2710
2711 2006-06-17  David Kilzer  <ddkilzer@kilzer.net>
2712
2713         Reviewed by ggaren.
2714
2715         http://bugzilla.opendarwin.org/show_bug.cgi?id=9476
2716         REGRESSION: Reproducible crash after closing window after viewing
2717         css2.1/t0803-c5501-imrgn-t-00-b-ag.html
2718
2719         * kjs/debugger.cpp:
2720         (Debugger::detach): Call setDebugger(0) for all interpreters removed from
2721         the 'attached to a debugger' list.
2722
2723 2006-06-17  Anders Carlsson  <acarlsson@apple.com>
2724
2725         Reviewed by Maciej and Geoff.
2726
2727         http://bugzilla.opendarwin.org/show_bug.cgi?id=7080
2728         Provide some way to stop a JavaScript infinite loop
2729         
2730         * kjs/completion.h:
2731         (KJS::):
2732         Add Interrupted completion type.
2733         
2734         * kjs/function.cpp:
2735         (KJS::FunctionImp::callAsFunction):
2736         (KJS::GlobalFuncImp::callAsFunction):
2737         Only set the exception on the new ExecState if the current one has had one.
2738         
2739         * kjs/interpreter.cpp:
2740         (KJS::TimeoutChecker::startTimeoutCheck):
2741         (KJS::TimeoutChecker::stopTimeoutCheck):
2742         (KJS::TimeoutChecker::alarmHandler):
2743         (KJS::TimeoutChecker::pauseTimeoutCheck):
2744         (KJS::TimeoutChecker::resumeTimeoutCheck):
2745         New TimeoutChecker class which handles setting Interpreter::m_timedOut flag after a given
2746         period of time. This currently only works on Unix platforms where setitimer and signals are used.
2747         
2748         (KJS::Interpreter::Interpreter):
2749         Initialize new member variables.
2750         
2751         (KJS::Interpreter::~Interpreter):
2752         Destroy the timeout checker.
2753         
2754         (KJS::Interpreter::startTimeoutCheck):
2755         (KJS::Interpreter::stopTimeoutCheck):
2756         (KJS::Interpreter::pauseTimeoutCheck):
2757         (KJS::Interpreter::resumeTimeoutCheck):
2758         Call the timeout checker.
2759         
2760         (KJS::Interpreter::handleTimeout):
2761         Called on timeout. Resets the m_timedOut flag and calls shouldInterruptScript.
2762         
2763         * kjs/interpreter.h:
2764         (KJS::Interpreter::setTimeoutTime):
2765         New function for setting the timeout time.
2766         
2767         (KJS::Interpreter::shouldInterruptScript):
2768         New function. The idea is that this should be overridden by subclasses in order to for example
2769         pop up a dialog asking the user if the script should be interrupted.
2770         
2771         (KJS::Interpreter::checkTimeout):
2772         New function which checks the m_timedOut flag and calls handleTimeout if it's set.
2773         
2774         * kjs/nodes.cpp:
2775         (DoWhileNode::execute):
2776         (WhileNode::execute):
2777         (ForNode::execute):
2778         Call Interpreter::checkTimeout after each iteration of the loop.
2779
2780 2006-06-15  Timothy Hatcher  <timothy@apple.com>
2781
2782         Reviewed by Geoff and Darin.
2783         
2784         Prefer the DWARF debugging symbols format for use in Xcode 2.3.
2785
2786         * JavaScriptCore.xcodeproj/project.pbxproj:
2787
2788 2006-06-14  Geoffrey Garen  <ggaren@apple.com>
2789
2790         Reviewed by Beth.
2791         
2792         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=9438
2793         Someone broke ToT: cannot build
2794
2795         * JavaScriptCore.xcodeproj/project.pbxproj:
2796         * bindings/runtime_root.h: Changed "Interpreter.h" to "interpreter.h"
2797
2798 2006-06-12  Geoffrey Garen  <ggaren@apple.com>
2799
2800         build fix
2801         
2802         * bindings/objc/WebScriptObject.mm:
2803         (+[WebScriptObject throwException:]): Restore assignment I accidentally
2804         deleted in previous commit
2805
2806 2006-06-12  Geoffrey Garen  <ggaren@apple.com>
2807
2808         Reviewed by TimO, Maciej.
2809         
2810         - Merged InterpreterImp code into Interpreter, which implements
2811         all interpreter functionality now. This is part of my continuing quest
2812         to create an external notion of JS "execution context" that is unified and simple --
2813         something to replace the mix of Context, ContextImp, ExecState, Interpreter,
2814         InterpreterImp, and JSRun.
2815         
2816         All tests pass. Leaks test has not regressed from its baseline ~207 leaks
2817         with ~3460 leaked nodes.
2818
2819         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2820         * JavaScriptCore.xcodeproj/project.pbxproj:
2821         * bindings/NP_jsobject.cpp:
2822         * bindings/objc/WebScriptObject.mm:
2823         (+[WebScriptObject throwException:]):
2824         * bindings/runtime_root.cpp:
2825         * bindings/runtime_root.h:
2826         * kjs/Context.cpp:
2827         (KJS::Context::Context):
2828         * kjs/ExecState.cpp: Added.
2829         (KJS::ExecState::lexicalInterpreter):
2830         * kjs/ExecState.h: Added.
2831         (KJS::ExecState::dynamicInterpreter):
2832         * kjs/SavedBuiltins.h: Added.
2833         * kjs/bool_object.cpp:
2834         (BooleanPrototype::BooleanPrototype):
2835         * kjs/collector.cpp:
2836         (KJS::Collector::collect):
2837         (KJS::Collector::numInterpreters):
2838         * kjs/context.h:
2839         * kjs/debugger.cpp:
2840         (Debugger::attach):
2841         (Debugger::detach):
2842         * kjs/function.cpp:
2843         (KJS::FunctionImp::callAsFunction):
2844         (KJS::GlobalFuncImp::callAsFunction):
2845         * kjs/function_object.cpp:
2846         (FunctionObjectImp::construct):
2847         * kjs/internal.cpp:
2848         * kjs/internal.h:
2849         * kjs/interpreter.cpp:
2850         (KJS::interpreterMap):
2851         (KJS::Interpreter::Interpreter):
2852         (KJS::Interpreter::init):
2853         (KJS::Interpreter::~Interpreter):
2854         (KJS::Interpreter::globalObject):
2855         (KJS::Interpreter::initGlobalObject):
2856         (KJS::Interpreter::globalExec):
2857         (KJS::Interpreter::checkSyntax):
2858         (KJS::Interpreter::evaluate):
2859         (KJS::Interpreter::builtinObject):
2860         (KJS::Interpreter::builtinFunction):
2861         (KJS::Interpreter::builtinArray):
2862         (KJS::Interpreter::builtinBoolean):
2863         (KJS::Interpreter::builtinString):
2864         (KJS::Interpreter::builtinNumber):
2865         (KJS::Interpreter::builtinDate):
2866         (KJS::Interpreter::builtinRegExp):
2867         (KJS::Interpreter::builtinError):
2868         (KJS::Interpreter::builtinObjectPrototype):
2869         (KJS::Interpreter::builtinFunctionPrototype):
2870         (KJS::Interpreter::builtinArrayPrototype):
2871         (KJS::Interpreter::builtinBooleanPrototype):
2872         (KJS::Interpreter::builtinStringPrototype):
2873         (KJS::Interpreter::builtinNumberPrototype):
2874         (KJS::Interpreter::builtinDatePrototype):
2875         (KJS::Interpreter::builtinRegExpPrototype):
2876         (KJS::Interpreter::builtinErrorPrototype):
2877         (KJS::Interpreter::builtinEvalError):
2878         (KJS::Interpreter::builtinRangeError):
2879         (KJS::Interpreter::builtinReferenceError):
2880         (KJS::Interpreter::builtinSyntaxError):
2881         (KJS::Interpreter::builtinTypeError):
2882         (KJS::Interpreter::builtinURIError):
2883         (KJS::Interpreter::builtinEvalErrorPrototype):
2884         (KJS::Interpreter::builtinRangeErrorPrototype):
2885         (KJS::Interpreter::builtinReferenceErrorPrototype):
2886         (KJS::Interpreter::builtinSyntaxErrorPrototype):
2887         (KJS::Interpreter::builtinTypeErrorPrototype):
2888         (KJS::Interpreter::builtinURIErrorPrototype):
2889         (KJS::Interpreter::mark):
2890         (KJS::Interpreter::interpreterWithGlobalObject):
2891         (KJS::Interpreter::saveBuiltins):
2892         (KJS::Interpreter::restoreBuiltins):
2893         * kjs/interpreter.h:
2894         (KJS::Interpreter::setCompatMode):
2895         (KJS::Interpreter::compatMode):
2896         (KJS::Interpreter::firstInterpreter):
2897         (KJS::Interpreter::nextInterpreter):
2898         (KJS::Interpreter::prevInterpreter):
2899         (KJS::Interpreter::debugger):
2900         (KJS::Interpreter::setDebugger):
2901         (KJS::Interpreter::setContext):
2902         (KJS::Interpreter::context):
2903         * kjs/nodes.cpp:
2904         (StatementNode::hitStatement):
2905         (RegExpNode::evaluate):
2906         * kjs/protect.h:
2907
2908 2006-06-12  Geoffrey Garen  <ggaren@apple.com>
2909
2910         Reviewed by Maciej.
2911         
2912         - Have *.lut.h files #include lookup.h to eliminate surprising header
2913         include order dependency.
2914
2915         * DerivedSources.make:
2916         * kjs/array_object.cpp:
2917         * kjs/date_object.cpp:
2918         * kjs/date_object.h:
2919         (KJS::DateProtoFunc::):
2920         * kjs/lexer.cpp:
2921         * kjs/math_object.cpp:
2922         * kjs/number_object.cpp:
2923         * kjs/regexp_object.cpp:
2924         * kjs/string_object.cpp:
2925
2926 2006-06-10  Geoffrey Garen  <ggaren@apple.com>
2927
2928         - http://bugzilla.opendarwin.org/show_bug.cgi?id=8515
2929         Linux porting compile bug
2930         
2931         Fix by Mike Emmel, Reviewed by Darin.
2932
2933         * JavaScriptCoreSources.bkl:
2934         * jscore.bkl:
2935         * wtf/Platform.h:
2936
2937 2006-06-09  Geoffrey Garen  <ggaren@apple.com>
2938
2939         Build fix -- I think :).
2940
2941         * JavaScriptCore.xcodeproj/project.pbxproj:
2942         * kjs/context.h:
2943
2944 2006-06-09  Geoffrey Garen  <ggaren@apple.com>
2945
2946         Reviewed by Eric (yay!).
2947         
2948         - Removed Context wrapper for ContextImp, renamed ContextImp to Context,
2949         split Context into its own file -- Context.cpp -- renamed _var to m_var,
2950         change ' *' to '* '.
2951
2952         * JavaScriptCore.xcodeproj/project.pbxproj:
2953         * kjs/Context.cpp: Added.
2954         (KJS::Context::Context):
2955         (KJS::Context::~Context):
2956         (KJS::Context::mark):
2957         * kjs/context.h:
2958         (KJS::Context::scopeChain):
2959         (KJS::Context::variableObject):
2960         (KJS::Context::setVariableObject):
2961         (KJS::Context::thisValue):
2962         (KJS::Context::callingContext):
2963         (KJS::Context::activationObject):
2964         (KJS::Context::currentBody):
2965         (KJS::Context::function):
2966         (KJS::Context::arguments):
2967         (KJS::Context::pushScope):
2968         (KJS::Context::seenLabels):
2969         * kjs/function.cpp:
2970         (KJS::FunctionImp::callAsFunction):
2971         (KJS::FunctionImp::processParameters):
2972         (KJS::FunctionImp::argumentsGetter):
2973         (KJS::GlobalFuncImp::callAsFunction):
2974         * kjs/internal.cpp:
2975         (KJS::InterpreterImp::evaluate):
2976         * kjs/internal.h:
2977         (KJS::InterpreterImp::setContext):
2978         (KJS::InterpreterImp::context):
2979         * kjs/interpreter.cpp:
2980         * kjs/interpreter.h:
2981         (KJS::ExecState::context):
2982         (KJS::ExecState::ExecState):
2983         * kjs/nodes.cpp:
2984         (currentSourceId):
2985         (currentSourceURL):
2986         (ThisNode::evaluate):
2987         (ResolveNode::evaluate):
2988         (FunctionCallResolveNode::evaluate):
2989         (PostfixResolveNode::evaluate):
2990         (DeleteResolveNode::evaluate):
2991         (TypeOfResolveNode::evaluate):
2992         (PrefixResolveNode::evaluate):
2993         (AssignResolveNode::evaluate):
2994         (VarDeclNode::evaluate):
2995         (VarDeclNode::processVarDecls):
2996         (DoWhileNode::execute):
2997         (WhileNode::execute):
2998         (ForNode::execute):
2999         (ForInNode::execute):
3000         (ContinueNode::execute):
3001         (BreakNode::execute):
3002         (ReturnNode::execute):
3003         (WithNode::execute):
3004         (SwitchNode::execute):
3005         (LabelNode::execute):
3006         (TryNode::execute):
3007         (FuncDeclNode::processFuncDecl):
3008         (FuncExprNode::evaluate):
3009
3010 2006-06-07  Geoffrey Garen  <ggaren@apple.com>
3011
3012         Removed API directory I prematurely/accidentally added.
3013
3014         * API: Removed.
3015
3016 2006-06-05  Mitz Pettel  <opendarwin.org@mitzpettel.com>
3017
3018         Reviewed and landed by Geoff.
3019
3020         - fix a regression in ecma_3/String/regress-104375.js
3021
3022         * kjs/string_object.cpp:
3023         (substituteBackreferences): If a 2-digit back reference is out of range,
3024         parse it as a 1-digit reference (followed by the other digit). This matches
3025         Firefox's behavior.
3026
3027 2006-06-05  Geoffrey Garen  <ggaren@apple.com>
3028
3029         Reviewed By Maciej.
3030         Darin already reviewed this change on the branch. See <rdar://problem/4317701>.
3031         
3032         - Fixed <rdar://problem/4291345> PCRE overflow in Safari JavaScriptCore
3033
3034         No test case because there's no behavior change.
3035         
3036         * pcre/pcre_compile.c:
3037         (read_repeat_counts): Check for integer overflow / out of bounds
3038
3039 2006-06-05  Geoffrey Garen  <ggaren@apple.com>
3040
3041         Reviewed by aliu.
3042
3043         - Changed CString length from int to size_t. We sould probably do this
3044         for UString, too. (Darin, if you're reading this: Maciej said so.)
3045         
3046         * kjs/function.cpp:
3047         (KJS::encode):
3048         * kjs/ustring.cpp:
3049         (KJS::CString::CString):
3050         (KJS::operator==):
3051         * kjs/ustring.h:
3052         (KJS::CString::size):
3053
3054 2006-06-04  Geoffrey Garen  <ggaren@apple.com>
3055
3056         Reviewed by Maciej.
3057         
3058         - http://bugzilla.opendarwin.org/show_bug.cgi?id=9304
3059         Minor cleanup in JavaScriptCore
3060
3061         * kjs/value.h: Removed redundant declarations
3062
3063 2006-06-04  Darin Adler  <darin@apple.com>
3064
3065         Reviewed by Anders.
3066
3067         - changed deleteAllValues so it can work on "const" collections
3068           Deleting the values affects the values, not the pointers in the
3069           collection, so it's legitimate to do it to a const collection,
3070           and a case of that actually came up in the XPath code.
3071
3072         * wtf/HashMap.h:
3073         (WTF::deleteAllPairSeconds): Use const iterators.
3074         (WTF::deleteAllValues): Take const HashMap reference as a parameter.
3075         * wtf/HashSet.h:
3076         (WTF::deleteAllValues): Take const HashSet reference as a parameter,
3077         and use const iterators.
3078         * wtf/Vector.h:
3079         (WTF::deleteAllValues): Take const Vector reference as a parameter.
3080
3081         - added more functions that are present in <math.h> on some platforms,
3082           but not on others; moved here from various files in WebCore
3083
3084         * wtf/MathExtras.h:
3085         (isinf): Added.
3086         (isnan): Added.
3087         (lround): Added.
3088         (lroundf): Tweaked.
3089         (round): Added.
3090         (roundf): Tweaked.
3091         (signbit): Added.
3092
3093 2006-06-02  Mitz Pettel  <opendarwin.org@mitzpettel.com>
3094
3095         Reviewed by ggaren.
3096
3097         - http://bugzilla.opendarwin.org/show_bug.cgi?id=9234
3098           Implement $&, $' and $` replacement codes in String.prototype.replace
3099
3100         Test: fast/js/string-replace-3.html
3101
3102         * kjs/string_object.cpp:
3103         (substituteBackreferences): Added support for $& (matched substring),
3104         $` (everything preceding matched substring), $' (everything following
3105         matched substring) and 2-digit back references, and cleaned up a little.
3106
3107 2006-06-02 Adele Peterson  <adele@apple.com>
3108
3109         Reviewed by Darin.
3110
3111         Set incremental linking to no. This seems to fix a build problem I was seeing
3112         where dftables couldn't find a dll. 
3113
3114         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
3115
3116 2006-05-26  Steve Falkenburg  <sfalken@apple.com>
3117
3118         Build fixes/tweaks
3119
3120         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3121
3122 === JavaScriptCore-521.11 ===
3123
3124 2006-05-24  Geoffrey Garen  <ggaren@apple.com>
3125
3126         Reviewed by mjs.
3127         
3128         - JSC half of fix for <rdar://problem/4557926> TOT REGRESSSION: Crash
3129         occurs when attempting to view image in slideshow mode at
3130         http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute
3131         (KJS::ExecState*) + 312)
3132
3133         On alternate threads, DOMObjects remain in the
3134         ScriptInterpreter's cache because they're not collected. So, they
3135         need an opportunity to mark their children.
3136         
3137         I'm not particularly happy with this solution because it fails to
3138         resolve many outstanding issues with the DOM object cache. Since none
3139         of those issues is a crasher or a serious compatibility concern,
3140         and since the behavior of other browsers is not much to go on in this
3141         case, I've filed <rdar://problem/4561439> about that, and I'm moving on 
3142         with my life.
3143
3144         * JavaScriptCore.xcodeproj/project.pbxproj:
3145         * kjs/collector.cpp:
3146         (KJS::Collector::collect):
3147         * kjs/internal.cpp:
3148         (KJS::InterpreterImp::mark):
3149         * kjs/internal.h:
3150         * kjs/interpreter.cpp:
3151         (KJS::Interpreter::mark):
3152         * kjs/interpreter.h:
3153
3154 === JavaScriptCore-521.10 ===
3155
3156 2006-05-22  Timothy Hatcher  <timothy@apple.com>
3157
3158         Reviewed by Eric, Kevin and Geoff.
3159
3160         Merge open source build fixes. <rdar://problem/4555500>
3161
3162         * kjs/collector.cpp: look at the rsp register in x86_64 
3163         (KJS::Collector::markOtherThreadConservatively):
3164         * wtf/Platform.h: add x86_64 to the platform list
3165
3166 2006-05-19  Anders Carlsson  <acarlsson@apple.com>
3167
3168         Reviewed by Geoff.
3169
3170         http://bugzilla.opendarwin.org/show_bug.cgi?id=8993
3171         Support function declaration in case statements
3172         
3173         * kjs/grammar.y: Get rid of StatementList and use SourceElements instead.
3174         
3175         * kjs/nodes.cpp:
3176         (CaseClauseNode::evalStatements):
3177         (CaseClauseNode::processVarDecls):
3178         (CaseClauseNode::processFuncDecl):
3179         (ClauseListNode::processFuncDecl):
3180         (CaseBlockNode::processFuncDecl):
3181         (SwitchNode::processFuncDecl):
3182         * kjs/nodes.h:
3183         (KJS::CaseClauseNode::CaseClauseNode):
3184         (KJS::ClauseListNode::ClauseListNode):
3185         (KJS::ClauseListNode::getClause):
3186         (KJS::ClauseListNode::getNext):
3187         (KJS::ClauseListNode::releaseNext):
3188         (KJS::SwitchNode::SwitchNode):
3189         Add processFuncDecl for the relevant nodes.        
3190
3191         * kjs/nodes2string.cpp:
3192         (CaseClauseNode::streamTo):
3193         next got renamed to source.
3194
3195 2006-05-17  George Staikos <staikos@kde.org>
3196
3197         Reviewed by Maciej, Alexey, and Eric.
3198
3199         * pcre/pcre_compile.c:
3200         * pcre/pcre_get.c:
3201         * pcre/pcre_exec.c:
3202         * wtf/UnusedParam.h:
3203         Use /**/ in .c files to compile with non-C99 and non-GCC compilers.
3204
3205         * kjs/testkjs.cpp:
3206         Change include to <wtf/HashTraits.h> from "HashTraits.h" to avoid -I
3207
3208         * wtf/unicode/qt4/UnicodeQt4.h:
3209         Use correct parentheses and correct mask for utf-32 support.
3210
3211 2006-05-17  Alexey Proskuryakov  <ap@nypop.com>
3212
3213         Reviewed by Darin.
3214
3215         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8870
3216         Crash typing in Yahoo auto-complete widget.
3217
3218         Test: fast/js/regexp-stack-overflow.html
3219
3220         * pcre/pcre-config.h: Define NO_RECURSE.
3221
3222 2006-05-16  George Staikos <staikos@kde.org>
3223
3224         Reviewed by Maciej.
3225
3226         Fix some warnings and strict compilation errors.
3227
3228         * kjs/nodes.cpp: 
3229         * kjs/value.cpp: 
3230
3231 2006-05-15  Alexey Proskuryakov  <ap@nypop.com>
3232
3233         * make-generated-sources.sh: Changed to be executable and removed
3234         text in the file generated by "svn diff".
3235
3236 2006-05-15  Geoffrey Garen  <ggaren@apple.com>
3237
3238         Reviewed by Maciej.
3239
3240         - Fixed <rdar://problem/4534904> please do not treat "debugger" as
3241         a reserved word while parsing JavaScript (and other ECMA reserved
3242         words) 
3243
3244         AKA 
3245
3246         http://bugzilla.opendarwin.org/show_bug.cgi?id=6179 
3247         We treat "char" as a reserved word in JavaScript and firefox/IE do
3248         not
3249
3250         (1) I unreserved most of the spec's "future reserved words" because 
3251         they're not reserved in IE or FF. (Most, but not all, because IE
3252         somewhat randomly *does* reserve a few of them.)
3253         (2) I made 'debugger' a legitimate statement that acts like an empty
3254         statement because FF and IE support it.
3255         
3256         * kjs/grammar.y:
3257         * kjs/keywords.table:
3258
3259 2006-05-15  Tim Omernick  <timo@apple.com>
3260
3261         Reviewed by John Sullivan.
3262
3263         Part of <rdar://problem/4466508> Add 64-bit support to the Netscape Plugin API
3264
3265         Added to the Netscape Plugin API the concept of "plugin drawing models".  The drawing model
3266         determines the kind of graphics context created by the browser for the plugin, as well as 
3267         the Mac types of various Netscape Plugin API data structures.
3268
3269         There is a drawing model to represent the old QuickDraw-based API.  It is used by default
3270         if QuickDraw is available on the system, unless the plugin specifies another drawing model.
3271
3272         The big change is the addition of the CoreGraphics drawing model.  A plugin may request this
3273         drawing model to obtain access to a CGContextRef for drawing, instead of a QuickDraw CGrafPtr.
3274
3275         * bindings/npapi.h:
3276         Define NP_NO_QUICKDRAW when compiling 64-bit; there is no 64-bit QuickDraw.
3277         Added NPNVpluginDrawingModel, NPNVsupportsQuickDrawBool, and NPNVsupportsCoreGraphicsBool
3278         variables.
3279         Added NPDrawingModel enumeration.  Currently the only drawing models are QuickDraw and
3280         CoreGraphics.
3281         NPRegion's type now depends on the drawing model specified by the plugin.
3282         NP_Port is now only defined when QuickDraw is available.
3283         Added NP_CGContext, which is the type of the NPWindow's "window" member in CoreGraphics mode.
3284
3285 2006-05-13  Kevin M. Ollivier  <kevino@theolliviers.com>
3286
3287         Reviewed by Darin, landed by ap.
3288
3289         - http://bugzilla.opendarwin.org/show_bug.cgi?id=8528
3290           Bakefiles (and generated Makefiles) for wx and gdk ports
3291
3292         * make-generated-sources.sh: 
3293         Added script to configure environment to run DerivedSources.make
3294         
3295         * JavaScriptCoreSources.bkl:
3296         Added JavaScriptCore sources list for Bakefile.
3297         
3298         * jscore.bkl:
3299         Bakefile used to generate JavaScriptCore project files 
3300         (currently only used by wx and gdk ports)
3301
3302 2006-05-09  Steve Falkenburg  <sfalken@apple.com>
3303
3304         Fix Windows build.
3305         Minor fixes to WTF headers.
3306         
3307         Reviewed by kevin.
3308
3309         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Fix include dirs, paths to files. 
3310         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Fix include dirs.
3311         * wtf/Assertions.h: include Platform.h to get definition for COMPILER()
3312         * wtf/Vector.h: include FastMalloc.h for definition of fastMalloc, fastFree
3313
3314 2006-05-09  Maciej Stachowiak  <mjs@apple.com>
3315
3316         Rubber stamped by Anders.
3317         
3318         - renamed kxmlcore to wtf
3319         
3320         kxmlcore --> wtf
3321         KXMLCore --> WTF
3322         KXC --> WTF
3323
3324         * JavaScriptCore.xcodeproj/project.pbxproj:
3325         * bindings/c/c_instance.cpp:
3326         * bindings/objc/WebScriptObject.mm:
3327         * kjs/JSImmediate.h:
3328         * kjs/Parser.cpp:
3329         * kjs/Parser.h:
3330         * kjs/array_object.cpp:
3331         * kjs/collector.cpp:
3332         (KJS::Collector::registerThread):
3333         * kjs/collector.h:
3334         * kjs/config.h:
3335         * kjs/function.cpp:
3336         (KJS::isStrWhiteSpace):
3337         * kjs/function.h:
3338         * kjs/identifier.cpp:
3339         * kjs/internal.cpp:
3340         * kjs/internal.h:
3341         * kjs/lexer.cpp:
3342         (Lexer::shift):
3343         (Lexer::isWhiteSpace):
3344         (Lexer::isIdentStart):
3345         (Lexer::isIdentPart):
3346         * kjs/lookup.cpp:
3347         * kjs/nodes.cpp:
3348         * kjs/nodes.h:
3349         * kjs/number_object.cpp:
3350         * kjs/object.h:
3351         * kjs/property_map.cpp:
3352         * kjs/property_map.h:
3353         * kjs/string_object.cpp:
3354         (StringProtoFunc::callAsFunction):
3355         * kjs/testkjs.cpp:
3356         (testIsInteger):
3357         * kjs/ustring.cpp:
3358         * kjs/ustring.h:
3359         * kxmlcore: Removed.
3360         * kxmlcore/AlwaysInline.h: Removed.
3361         * kxmlcore/Assertions.cpp: Removed.
3362         * kxmlcore/Assertions.h: Removed.
3363         * kxmlcore/FastMalloc.cpp: Removed.
3364         * kxmlcore/FastMalloc.h: Removed.
3365         * kxmlcore/FastMallocInternal.h: Removed.
3366         * kxmlcore/Forward.h: Removed.
3367         * kxmlcore/HashCountedSet.h: Removed.
3368         * kxmlcore/HashFunctions.h: Removed.
3369         * kxmlcore/HashMap.h: Removed.
3370         * kxmlcore/HashSet.h: Removed.
3371         * kxmlcore/HashTable.cpp: Removed.
3372         * kxmlcore/HashTable.h: Removed.
3373         * kxmlcore/HashTraits.h: Removed.
3374         * kxmlcore/ListRefPtr.h: Removed.
3375         * kxmlcore/Noncopyable.h: Removed.
3376         * kxmlcore/OwnArrayPtr.h: Removed.
3377         * kxmlcore/OwnPtr.h: Removed.
3378         * kxmlcore/PassRefPtr.h: Removed.
3379         * kxmlcore/Platform.h: Removed.
3380         * kxmlcore/RefPtr.h: Removed.
3381         * kxmlcore/TCPageMap.h: Removed.
3382         * kxmlcore/TCSpinLock.h: Removed.
3383         * kxmlcore/TCSystemAlloc.cpp: Removed.
3384         * kxmlcore/TCSystemAlloc.h: Removed.
3385         * kxmlcore/UnusedParam.h: Removed.
3386         * kxmlcore/Vector.h: Removed.
3387         * kxmlcore/VectorTraits.h: Removed.
3388         * kxmlcore/unicode: Removed.
3389         * kxmlcore/unicode/Unicode.h: Removed.
3390         * kxmlcore/unicode/UnicodeCategory.h: Removed.
3391         * kxmlcore/unicode/icu: Removed.
3392         * kxmlcore/unicode/icu/UnicodeIcu.h: Removed.
3393         * kxmlcore/unicode/posix: Removed.
3394         * kxmlcore/unicode/qt3: Removed.
3395         * kxmlcore/unicode/qt4: Removed.
3396         * kxmlcore/unicode/qt4/UnicodeQt4.h: Removed.
3397         * pcre/pcre_get.c:
3398         * wtf: Added.
3399         * wtf/Assertions.cpp:
3400         * wtf/Assertions.h:
3401         * wtf/FastMalloc.cpp:
3402         (WTF::TCMalloc_ThreadCache::Scavenge):
3403         (WTF::do_malloc):
3404         (WTF::do_free):
3405         (WTF::TCMallocGuard::TCMallocGuard):
3406         (WTF::malloc):
3407         (WTF::free):
3408         (WTF::calloc):
3409         (WTF::cfree):
3410         (WTF::realloc):
3411         * wtf/FastMalloc.h:
3412         * wtf/FastMallocInternal.h:
3413         * wtf/Forward.h:
3414         * wtf/HashCountedSet.h:
3415         * wtf/HashFunctions.h:
3416         * wtf/HashMap.h:
3417         * wtf/HashSet.h:
3418         * wtf/HashTable.cpp:
3419         * wtf/HashTable.h:
3420         * wtf/HashTraits.h:
3421         * wtf/ListRefPtr.h:
3422         * wtf/Noncopyable.h:
3423         * wtf/OwnArrayPtr.h:
3424         * wtf/OwnPtr.h:
3425         * wtf/PassRefPtr.h:
3426         * wtf/RefPtr.h:
3427         * wtf/TCSystemAlloc.cpp:
3428         (TCMalloc_SystemAlloc):
3429         * wtf/Vector.h:
3430         * wtf/VectorTraits.h:
3431         * wtf/unicode/UnicodeCategory.h:
3432         * wtf/unicode/icu/UnicodeIcu.h:
3433
3434 2006-05-08  Timothy Hatcher  <timothy@apple.com>
3435
3436         Reviewed by Tim O.
3437
3438         * bindings/npapi.h: do not define #pragma options align=mac68k if we are 64-bit
3439
3440 2006-05-07  Darin Adler  <darin@apple.com>
3441
3442         Reviewed and landed by Maciej.
3443
3444         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8765
3445         Random crashes on TOT since the form state change
3446         
3447         I haven't figured out how to construct a test for this, but this does seem to fix the
3448         problem; Mitz mentioned that a double-destroy was occurring in these functions.
3449         
3450         * kxmlcore/HashMap.h: (KXMLCore::HashMap::remove): Use RefCounter::deref instead of calling
3451         ~ValueType, because ~ValueType often results in a double-destroy, since the HashTable also
3452         destroys the element based on the storage type. The RefCounter template correctly does work
3453         only in cases where ValueType and ValueStorageType differ and this class is what's used
3454         elsewhere for the same purpose; I somehow missed this case when optimizing HashMap.
3455         * kxmlcore/HashSet.h: (KXMLCore::HashSet::remove): Ditto.
3456         
3457 2006-05-05  Darin Adler  <darin@apple.com>
3458
3459         - http://bugzilla.opendarwin.org/show_bug.cgi?id=8722
3460           IE compatibility fix in date parsing
3461
3462         * kjs/date_object.cpp: (KJS::parseDate): Merged change that George Staikos provided
3463         from KDE 3.4.3 branch that allows day values of 0 and values that are > 1000.
3464
3465 2006-05-04  Anders Carlsson  <andersca@mac.com>
3466
3467         Reviewed by Maciej.
3468
3469         http://bugzilla.opendarwin.org/show_bug.cgi?id=8734
3470         Would like a Vector::append that takes another Vector
3471         
3472         * kxmlcore/Vector.h:
3473         (KXMLCore::::append):
3474         New function that takes another array.
3475
3476 2006-05-02  Steve Falkenburg  <sfalken@apple.com>
3477
3478         Reviewed by eric.
3479
3480         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: set NDEBUG for release build
3481         * kxmlcore/FastMalloc.cpp: Prevent USE_SYSTEM_MALLOC from being defined twice
3482
3483 2006-05-02  Anders Carlsson  <andersca@mac.com>
3484
3485         Reviewed by Maciej.
3486
3487         * kxmlcore/HashMap.h:
3488         (KXMLCore::::operator):
3489         Return *this
3490
3491 2006-05-01  Tim Omernick  <timo@apple.com>
3492
3493         Reviewed by Tim Hatcher.
3494
3495         <rdar://problem/4476875> Support printing for embedded Netscape plugins
3496
3497         * bindings/npapi.h:
3498         Fixed struct alignment problem in our npapi.h.  Structs must be 68k-aligned on both pre-Mac OS X
3499         and Mac OS X systems, as this is what plugins expect.
3500
3501 2006-05-01  Timothy Hatcher  <timothy@apple.com>
3502
3503         Reviewed by Maciej.
3504         
3505         <rdar://problem/4308243> 8F36 Regression: crash in malloc_consolidate if you use a .PAC file
3506
3507         The original fix missed the oversized cell case. Added a test for "currentThreadIsMainThread || 
3508         imp->m_destructorIsThreadSafe" where we collect oversized cells.
3509
3510         We don't have a way to test PAC files yet, so there's no test attached.
3511
3512         * kjs/collector.cpp:
3513         (KJS::Collector::collect): test the thread when we collect oversized cells
3514
3515 2006-05-01  Tim Omernick  <timo@apple.com>
3516
3517         Reviewed by Adele.
3518
3519         <rdar://problem/4526114> REGRESSION (two days ago): LOG() just prints @ for NSObject substitutions
3520
3521         * kxmlcore/Assertions.cpp:
3522         Changed sense of strstr("%@") check.  I already made the same fix to the WebBrowser assertions.
3523
3524 2006-04-28  Steve Falkenburg  <sfalken@apple.com>
3525
3526         Reviewed by kdecker
3527         
3528         Actually apply the change that was reviewed insted of checking it in with an #if 0 (oops).
3529
3530         * kjs/testkjs.cpp:
3531         (main): Suppress C runtime alerts
3532
3533 2006-04-28  Steve Falkenburg  <sfalken@apple.com>
3534
3535         Reviewed by kdecker
3536
3537         Suppress error reporting dialog that blocks Javascript tests from completing.
3538         
3539         Real error is due to an overflow in the date/time handling functions that needs
3540         to be addressed, but this will prevent the hang running the Javascript tests
3541         on the build bot (along with the related changes).
3542         
3543         * kjs/testkjs.cpp:
3544         (main): Suppress C runtime alerts
3545
3546 2006-04-27  Geoffrey Garen  <ggaren@apple.com>
3547
3548         Reviewed by Maciej
3549
3550         - Minor fixups I discovered while working on the autogenerator.
3551         
3552         * kjs/lookup.cpp:
3553         (findEntry): ASSERT that size is not 0, because otherwise we'll % by 0,
3554         compute a garbage address, and possibly crash.
3555         * kjs/lookup.h:
3556         (cacheGlobalObject): Don't enumerate cached objects -- ideally, they
3557         would be hidden entirely.
3558
3559 2006-04-21  Kevin M. Ollivier  <kevino@theolliviers.com>
3560
3561         Reviewed by Darin.
3562
3563         - http://bugzilla.opendarwin.org/show_bug.cgi?id=8507
3564           Compilation fixes for building on gcc 4.0.2, and without precomp headers
3565
3566         * kjs/operations.h:
3567         * kxmlcore/Assertions.cpp:
3568         * kxmlcore/FastMalloc.cpp:
3569         Added necessary headers to resolve compilation issues when not using
3570         precompiled headers.
3571         
3572         * kjs/value.h: Declare the JSCell class before friend declaration  
3573         to resolve compilation issues with gcc 4.0.2.
3574         
3575         * kxmlcore/Platform.h: Set Unicode support to use ICU on platforms
3576         other than KDE (previously only defined for Win and Mac OS)
3577                 
3578 2006-04-18  Eric Seidel  <eseidel@apple.com>
3579
3580         Reviewed by ggaren.
3581
3582         Fix "new Function()" to correctly use lexical scoping.
3583         Add ScopeChain::print() function for debugging.
3584         <rdar://problem/4067864> REGRESSION (125-407): JavaScript failure on PeopleSoft REN Server
3585
3586         * kjs/function_object.cpp:
3587         (FunctionObjectImp::construct):
3588         * kjs/scope_chain.cpp:
3589         (KJS::ScopeChain::print):
3590         * kjs/scope_chain.h:
3591
3592 2006-04-14  James G. Speth  <speth@end.com>
3593
3594         Reviewed by Timothy.
3595
3596         Bug 8389: support for Cocoa bindings - binding an NSTreeController to the WebView's DOM
3597         http://bugzilla.opendarwin.org/show_bug.cgi?id=8389
3598
3599         Adds a category to WebScriptObject with array accessors for KVC/KVO.
3600
3601         If super valueForKey: fails it will call valueForUndefinedKey:, which is
3602         important because it causes the right behavior to happen with bindings using
3603         the "Raises for Not Applicable Keys" flag and the "Not Applicable Placeholder"
3604
3605         * bindings/objc/WebScriptObject.mm:
3606         (-[WebScriptObject valueForKey:]):
3607         (-[WebScriptObject count]):
3608         (-[WebScriptObject objectAtIndex:]):
3609         (-[WebUndefined description]): return "undefined"
3610
3611 2006-04-13  Geoffrey Garen  <ggaren@apple.com>
3612
3613         Reviewed by Darin.
3614
3615         * kjs/internal.cpp:
3616         (KJS::InterpreterImp::initGlobalObject): Add the built-in object
3617         prototype to the end of the global object's prototype chain instead of
3618         just blowing away its existing prototype. We need to do this because
3619         the window object has a meaningful prototype now.
3620
3621 2006-04-13  Maciej Stachowiak  <mjs@apple.com>
3622
3623         Reviewed by Geoff.
3624         
3625         - fix testkjs to not show false-positive KJS::Node leaks in debug builds
3626
3627         * kjs/testkjs.cpp:
3628         (doIt):
3629         (kjsmain):
3630
3631 2006-04-11  Geoffrey Garen  <ggaren@apple.com>
3632
3633         Reviewed by Maciej.
3634
3635         Minor code cleanup -- passes all the JS tests.
3636
3637         * kjs/object_object.cpp:
3638         (ObjectObjectImp::construct):
3639         (ObjectObjectImp::callAsFunction):
3640
3641 2006-04-11  Darin Adler  <darin@apple.com>
3642
3643         - another attempt to fix Windows build -- Vector in Forward.h was not working
3644
3645         * kxmlcore/Forward.h: Remove Vector.
3646         * kxmlcore/Vector.h: Add back default arguments, remove include of
3647         Forward.h.
3648
3649 2006-04-11  Darin Adler  <darin@apple.com>
3650
3651         - try to fix Windows build -- HashForward.h was not working
3652
3653         * kxmlcore/HashForward.h: Removed.
3654
3655         * JavaScriptCore.xcodeproj/project.pbxproj: Remove HashForward.h.
3656         * kjs/collector.h: Remove use of HashForward.h.
3657         * kxmlcore/HashCountedSet.h: Remove include of HashForward.h, restore
3658         default arguments.
3659         * kxmlcore/HashMap.h: Ditto.
3660         * kxmlcore/HashSet.h: Ditto.
3661
3662 2006-04-11  David Harrison  <harrison@apple.com>
3663
3664         Reviewed by Darin.
3665
3666         - fixed clean build, broken by Darin's check-in
3667
3668         * kjs/date_object.cpp: Add needed include of lookup.h.
3669         * kjs/regexp_object.cpp: Move include of .lut.h file below other includes.
3670
3671 2006-04-10  Darin Adler  <darin@apple.com>
3672
3673         Rubber-stamped by John Sullivan.
3674
3675         - switched from a shell script to a makefile for generated files
3676         - removed lots of unneeded includes
3677         - added new Forward.h and HashForward.h headers that allow compiling with
3678           fewer unneeded templates
3679
3680         * DerivedSources.make: Added.
3681         * generate-derived-sources: Removed.
3682         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files, changed to use
3683         DerivedSources.make.
3684
3685         * kxmlcore/Forward.h: Added.
3686         * kxmlcore/HashForward.h: Added.
3687
3688         * kxmlcore/HashCountedSet.h: Include HashForward for default args.
3689         * kxmlcore/HashMap.h: Ditto.
3690         * kxmlcore/HashSet.h: Ditto.
3691
3692         * kjs/object.h:
3693         * kjs/object.cpp:
3694         Moved KJS_MAX_STACK into the .cpp file.
3695
3696         * bindings/NP_jsobject.cpp:
3697         * bindings/c/c_instance.h:
3698         * bindings/jni/jni_class.h:
3699         * bindings/jni/jni_runtime.h:
3700         * bindings/jni/jni_utility.h:
3701         * bindings/objc/WebScriptObject.mm:
3702         * bindings/objc/WebScriptObjectPrivate.h:
3703         * bindings/objc/objc_class.h:
3704         * bindings/objc/objc_class.mm:
3705         * bindings/objc/objc_instance.h:
3706         * bindings/objc/objc_instance.mm:
3707         * bindings/objc/objc_runtime.mm:
3708         * bindings/objc/objc_utility.mm:
3709         * bindings/runtime.h:
3710         * bindings/runtime_array.cpp:
3711         * bindings/runtime_array.h:
3712         * bindings/runtime_method.cpp:
3713         * bindings/runtime_method.h:
3714         * bindings/runtime_object.cpp:
3715         * bindings/runtime_root.h:
3716         * kjs/JSImmediate.cpp:
3717         * kjs/Parser.h:
3718         * kjs/array_object.cpp:
3719         * kjs/array_object.h:
3720         * kjs/bool_object.cpp:
3721         * kjs/bool_object.h:
3722         * kjs/collector.h:
3723         * kjs/context.h:
3724         * kjs/debugger.cpp:
3725         * kjs/error_object.h:
3726         * kjs/function_object.h:
3727         * kjs/internal.h:
3728         * kjs/lexer.cpp:
3729         * kjs/math_object.cpp:
3730         * kjs/math_object.h:
3731         * kjs/nodes.cpp:
3732         * kjs/nodes.h:
3733         * kjs/number_object.cpp:
3734         * kjs/number_object.h:
3735         * kjs/object_object.cpp:
3736         * kjs/operations.cpp:
3737         * kjs/protected_reference.h:
3738         * kjs/reference.h:
3739         * kjs/reference_list.h:
3740         * kjs/regexp_object.h:
3741         * kjs/string_object.cpp:
3742         * kjs/string_object.h:
3743         * kjs/testkjs.cpp:
3744         * kjs/value.cpp:
3745         * kjs/value.h:
3746         * kxmlcore/HashTable.h:
3747         * kxmlcore/ListRefPtr.h:
3748         * kxmlcore/TCPageMap.h:
3749         * kxmlcore/Vector.h:
3750         Removed unneeded header includes.
3751
3752 2006-04-09  Geoffrey Garen  <ggaren@apple.com>
3753
3754         Reviewed by eric.
3755
3756         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=8284
3757         prevent unnecessary entries in the "nodes with extra refs" hash table
3758
3759         This patch switches manually RefPtr exchange with use of
3760         RefPtr::release to ensure that a node's ref count never tops 1
3761         (in the normal case).
3762
3763         * kjs/nodes.cpp:
3764         (BlockNode::BlockNode):
3765         (CaseBlockNode::CaseBlockNode):
3766         * kjs/nodes.h:
3767         (KJS::ArrayNode::ArrayNode):
3768         (KJS::ObjectLiteralNode::ObjectLiteralNode):
3769         (KJS::ArgumentsNode::ArgumentsNode):
3770         (KJS::VarStatementNode::VarStatementNode):
3771         (KJS::ForNode::ForNode):
3772         (KJS::CaseClauseNode::CaseClauseNode):
3773         (KJS::FuncExprNode::FuncExprNode):
3774         (KJS::FuncDeclNode::FuncDeclNode):
3775
3776 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
3777
3778         Reviewed by Darin.
3779
3780         One more attempt - use reinterpret_cast, rather than static_cast.
3781
3782 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
3783
3784         Reviewed by Darin.
3785
3786         An attempt to fix Win32 build - ICU uses wchar_t on Windows, so we need a type cast.
3787
3788         * kxmlcore/unicode/icu/UnicodeIcu.h:
3789         (KXMLCore::Unicode::toLower):
3790         (KXMLCore::Unicode::toUpper):
3791
3792 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
3793
3794         Reviewed by Darin.
3795
3796         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8264
3797         toLowerCase and toUpperCase don't honor special mappings
3798
3799         Test: fast/js/string-capitalization.html
3800
3801         * JavaScriptCore.xcodeproj/project.pbxproj: Added KXMLCore::Unicode headers to the project.
3802         * icu/unicode/putil.h: Added (copied from WebCore).
3803         * icu/unicode/uiter.h: Ditto.
3804         * icu/unicode/ustring.h: Ditto.
3805         * kjs/string_object.cpp:
3806         (StringProtoFunc::callAsFunction): Use the new KXMLCore::Unicode::toUpper() and toLower().
3807         * kjs/ustring.cpp: Removed unused (and evil) UChar::toLower() and toUpper().
3808         * kjs/ustring.h: Ditto.
3809
3810         * kxmlcore/unicode/Unicode.h: Corrected capitalization of the word Unicode.
3811         * kxmlcore/unicode/UnicodeCategory.h: Renamed include guard macro to match file name.
3812
3813         * kxmlcore/unicode/icu/UnicodeIcu.h:
3814         (KXMLCore::Unicode::toLower): Work on strings, not individual characters. Use ICU root locale.
3815         (KXMLCore::Unicode::toUpper): Ditto.
3816         (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
3817         (KXMLCore::Unicode::isSeparatorSpace): Ditto.
3818         (KXMLCore::Unicode::category): Ditto.
3819         * kxmlcore/unicode/qt4/UnicodeQt4.h:
3820         (KXMLCore::Unicode::toLower): Work on strings, not individual characters.
3821         (KXMLCore::Unicode::toUpper): Ditto.
3822         (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
3823         (KXMLCore::Unicode::isSeparatorSpace): Ditto.
3824         (KXMLCore::Unicode::category): Ditto.
3825
3826         * tests/mozilla/ecma/String/15.5.4.12-1.js: Corrected expected results.
3827         * tests/mozilla/ecma/String/15.5.4.12-5.js: Corrected expected results.
3828
3829 2006-04-05  Darin Adler  <darin@apple.com>
3830
3831         - attempt to fix Windows build
3832
3833         * kxmlcore/HashMap.h: (KXMLCore::HashMap::remove): Use (*it). instead of it->.
3834         * kxmlcore/HashSet.h: (KXMLCore::HashSet::remove): Ditto.
3835
3836 2006-04-05  Darin Adler  <darin@apple.com>
3837
3838         - attempt to fix Windows build
3839
3840         * os-win32/stdint.h: Add int8_t, uint8_t, int64_t.
3841
3842 2006-04-05  Darin Adler  <darin@apple.com>
3843
3844         Reviewed by Maciej.
3845
3846         - fix memory leak introduced by the previous change
3847
3848         * kxmlcore/HashTable.h: Specialize NeedsRef so that it correctly returns true when
3849         the value in question is a pair where one of the pair needs a ref and the other
3850         of the pair does not.
3851
3852 2006-04-05  Darin Adler  <darin@apple.com>
3853
3854         Reviewed by Maciej.
3855
3856         - JavaScriptCore part of fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=8049
3857           StringImpl hash traits deleted value creates an init routine for WebCore
3858           <rdar://problem/4442248> REGRESSION: WebCore has init routines (8049)
3859
3860         Change HashMap and HashSet implementation so they fold various types together.
3861         This allows us to implement maps and sets that use RefPtr<WebCore::StringImpl>
3862         and WebCore::String in terms of the underlying raw pointer type, and hence use
3863         -1 for the deleted value.
3864
3865         * kxmlcore/HashTraits.h: Added a new type to HashTraits, StorageTraits, which is a
3866         type to be used when storing a value that has the same layout as the type itself.
3867         This is used only for non-key cases. In the case of keys, the hash function must also
3868         be considered. Moved emptyValue out of GenericHashTraitsBase into GenericHashTraits.
3869         Added a new bool to HashTraits, needsRef, which indicates whether the type needs
3870         explicit reference counting. If the type itself has needsRef true, but the storage
3871         type has needsRef false, then the HashSet or HashMap has to handle the reference
3872         counting explicitly. Added hash trait specializations for all signed integer values
3873         that give -1 as the deleted value. Gave all integers StorageTraits of the canonical
3874         integer type of the same size so int and long will share code. Gave all pointers and
3875         RefPtrs StorageTraits of the appropriately sized integer type. Removed redundant
3876         TraitType and emptyValue definitions in the pointer specialization for HashTraits.
3877         Added PairBaseHashTraits, which doesn't try to set up needsDestruction and deletedValue.
3878         Useful for types where we don't want to force the existence of deletedValue, such as
3879         the type of a pair in a HashMap which is not the actual storage type. Removed an
3880         unneeded parameter from the DeletedValueAssigner template. Added HashKeyStorageTraits
3881         template, which determines what type can be used to store a given hash key type with
3882         a given hash function, and specialized it for pointers and RefPtr so that pointer
3883         hash tables share an underlying HashTable that uses IntHash.
3884
3885         * kxmlcore/HashTable.h: Added HashTableConstIteratorAdapter, HashTableIteratorAdapter,
3886         NeedsRef, RefCountManagerBase, RefCountManager, HashTableRefCountManagerBase, and
3887         HashTableRefCountManager. All are used by both HashSet and HashMap to handle hash
3888         tables where the type stored is not the same as the real value type.
3889         
3890         * kxmlcore/HashFunctions.h: Added a new struct named IntTypes that finds an
3891         integer type given a sizeof value. Renamed pointerHash to intHash and made it
3892         use overloading and take integer parameters. Added an IntHash struct which is
3893         a hash function that works for integers. Changed PtrHash to call IntHash with
3894         an appropriately sized integer. Made IntHash the default hash function for
3895         many integer types. Made PtrHash the default hash function for RefPtr as well
3896         as for raw pointers.
3897
3898         * kxmlcore/HashSet.h: Changed implementation to use a separate "storage type"
3899         derived from the new traits. The HashTable will use the storage type and all
3900         necessary translation and ref/deref is done at the HashSet level. Also reorganized
3901         the file so that the HashSet is at the top and has no inline implementation inside
3902         it so it's easy to read the interface to HashSet.
3903
3904         * kxmlcore/HashMap.h: Changed implementation to use a separate "storage type"
3905         derived from the new traits. The HashTable will use the storage type and all
3906         necessary translation and ref/deref is done at the HashMap level. Also reorganized
3907         the file so that the HashMap is at the top and has no inline implementation inside
3908         it so it's easy to read the interface to HashMap.
3909
3910         * kxmlcore/HashMapPtrSpec.h: Removed. Superceded by optimizations in HashMap itself.
3911
3912         * JavaScriptCore.xcodeproj/project.pbxproj: Remove HashMapPtrSpec.h, resort files,
3913         and also remove some unnecessary build settings from the aggregate target that
3914         generates derived sources.
3915         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
3916
3917 2006-04-04  Timothy Hatcher  <timothy@apple.com>
3918
3919         Reviewed by Darin.
3920
3921         The Debug and Release frameworks are now built with install paths relative to the build products directory.
3922         This removes the need for other projects to build with -framework WebCore and -framework JavaScriptCore. 
3923
3924         * JavaScriptCore.xcodeproj/project.pbxproj:
3925
3926 2006-04-04  Eric Seidel  <eseidel@apple.com>
3927
3928         Reviewed by ggaren.
3929
3930         Fix win32 build.
3931         Disable ASSERT redefinition warnings for now.
3932
3933         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3934         * kxmlcore/Assertions.h:
3935
3936 2006-04-04  Bjrn Graf  <bjoern.graf@gmail.com>
3937
3938         Reviewed by ggaren & darin.  Landed by eseidel.
3939
3940         Integrate CURL version of gettimeofday
3941         http://bugzilla.opendarwin.org/show_bug.cgi?id=7399
3942         Disable crash report dialogs for testkjs.exe in Release mode
3943         http://bugzilla.opendarwin.org/show_bug.cgi?id=8113
3944
3945         * kjs/testkjs.cpp:
3946         (StopWatch::start):
3947         (StopWatch::stop):
3948         (StopWatch::getElapsedMS):
3949         (main):
3950         (kjsmain):
3951
3952 2006-04-04  Eric Seidel  <eseidel@apple.com>
3953
3954         Reviewed by mjs.
3955
3956         * kjs/number_object.cpp:
3957         (NumberProtoFunc::callAsFunction): remove trunc() to fix win32.
3958
3959 2006-03-12  Maciej Stachowiak  <mjs@apple.com>
3960
3961         Reviewed by Darin.
3962         
3963         - fixed "toPrecision sometimes messes up the last digit on intel Macs"
3964         http://bugzilla.opendarwin.org/show_bug.cgi?id=7748
3965
3966         * kjs/number_object.cpp:
3967         (intPow10): Compute integer powers of 10 using exponentiation by squaring.
3968         (NumberProtoFunc::callAsFunction): Use intPow10(n) in place of all pow(10.0, n),
3969         plus a bit of refactoring.
3970
3971 2006-04-03  Darin Adler  <darin@apple.com>
3972
3973         - tweak config.h and Platform.h to try to get buildbot working
3974           (making some small changes at the same time)
3975
3976         * kjs/config.h: Removed now-unneeded HAVE_ICU.
3977         * kxmlcore/Platform.h: Tweak how platform gets set up. Move all the
3978         USE stuff to the end.
3979
3980 2006-04-03  George Staikos   <staikos@opensource.apple.com>
3981
3982         Reviewed by Maciej.
3983
3984         Fix Win32 build breakage from previous commit, remove unused forward.
3985
3986 2006-04-03  George Staikos   <staikos@opensource.apple.com>
3987
3988         Reviewed by Maciej.
3989
3990         Implement a unicode abstraction layer to make JavaScriptCore much more
3991         easily ported to other platforms without having to take in libicu.  Also
3992         makes the unicode related code easier to understand.
3993
3994 2006-04-03  Timothy Hatcher  <timothy@apple.com>
3995
3996         Reviewed by Adele.
3997
3998         Fixes <rdar://problem/4498338> JavaScriptCore fails to compile for ppc64
3999         Other 64 bit build fixes.
4000
4001         * kjs/collector.cpp:
4002         (KJS::Collector::markOtherThreadConservatively): test for __DARWIN_UNIX03 and use __r1
4003         * kjs/dtoa.cpp:
4004         (Bigint::): cast PRIVATE_mem to unsigned to prevent warning
4005         * bindings/jni/jni_utility.cpp:
4006         (KJS::Bindings::getJavaVM): cast jniError to long to prevent format warning
4007         (KJS::Bindings::getJNIEnv): cast jniError to long to prevent format warning
4008         * bindings/runtime_root.cpp:
4009         (KJS::Bindings::addNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
4010         (KJS::Bindings::removeNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
4011
4012 2006-03-31  Darin Adler  <darin@apple.com>
4013
4014         Reviewed by Geoff.
4015
4016         - <rdar://problem/4395622> API: WebScriptObject.h incorrectly reports that -isSelectorExcludedFromWebScript returns NO by default
4017
4018         * bindings/objc/WebScriptObject.h: Fixed comment.
4019
4020 2006-03-31  Eric Seidel  <eseidel@apple.com>
4021
4022         Reviewed by mjs.
4023
4024         A bit more code cleanup.
4025
4026         * bindings/c/c_utility.cpp:
4027         (KJS::Bindings::convertValueToNPVariant):
4028         * bindings/objc/objc_runtime.mm:
4029         (convertValueToObjcObject):
4030         * bindings/objc/objc_utility.mm:
4031         (KJS::Bindings::convertValueToObjcValue):
4032         * kjs/function.cpp:
4033         (KJS::GlobalFuncImp::callAsFunction):
4034         * kjs/interpreter.cpp:
4035         (KJS::ExecState::lexicalInterpreter):
4036         * kjs/interpreter.h:
4037         * kjs/operations.cpp:
4038         (KJS::equal):
4039
4040 2006-03-30  Eric Seidel  <eseidel@apple.com>
4041
4042         Reviewed by anders.
4043
4044         Small code-style update.
4045
4046         * kjs/operations.cpp:
4047         (KJS::isNaN):
4048         (KJS::isInf):
4049         (KJS::isPosInf):
4050         (KJS::isNegInf):
4051         (KJS::equal):
4052         (KJS::strictEqual):
4053         (KJS::relation):
4054         (KJS::maxInt):
4055         (KJS::minInt):
4056         (KJS::add):
4057         (KJS::mult):
4058
4059 2006-03-31  Anders Carlsson  <andersca@mac.com>
4060
4061         Reviewed by Maciej.
4062
4063         Make sure the GetterSetterImp objects are marked as well.
4064         
4065         * kjs/internal.cpp:
4066         (KJS::GetterSetterImp::mark):
4067         Call JSCell::mark().
4068
4069 2006-03-30  Eric Seidel  <eseidel@apple.com>
4070
4071         Reviewed by ggaren.
4072
4073         * kjs/nodes.h: Some various small style fixes.
4074
4075 2006-03-30  Eric Seidel  <eseidel@apple.com>
4076
4077         Reviewed by ggaren.
4078
4079         Clean-up style issues in node.h, remove redundant initializations.
4080
4081         * kjs/nodes.h:
4082         (KJS::StatementNode::evaluate):
4083         (KJS::ArrayNode::ArrayNode):
4084         (KJS::ObjectLiteralNode::ObjectLiteralNode):
4085         (KJS::ArgumentsNode::ArgumentsNode):
4086         (KJS::NewExprNode::NewExprNode):
4087         (KJS::CaseClauseNode::CaseClauseNode):
4088         (KJS::FuncDeclNode::FuncDeclNode):
4089
4090 2006-03-30  Tim Omernick  <timo@apple.com>
4091
4092         Reviewed by Geoff.
4093
4094         <rdar://problem/4212626> REGRESSION: LIVECONNECT: JavaScript type for Java Strings is function,
4095         not object
4096
4097         * bindings/runtime.h:
4098         (KJS::Bindings::Instance::implementsCall):
4099         New method.  Returns false by default.  Concrete subclasses can override this return true when
4100         the bound object may be called as a function.
4101         (KJS::Bindings::Instance::invokeDefaultMethod):
4102         Since bound objects are no longer treated as functions by default, we can return jsUndefined()
4103         here instead of in concrete subclasses that decide not to implement the default method
4104         functionality.
4105
4106         * bindings/runtime_object.cpp:
4107         (RuntimeObjectImp::implementsCall):
4108         Don't assume that the bound object is a function; instead, let the object instance decide whether
4109         it is callable.
4110
4111         * bindings/c/c_instance.h:
4112         * bindings/c/c_instance.cpp:
4113         (KJS::Bindings::CInstance::implementsCall):
4114         The object is callable if its class has an invokeDefault function.
4115
4116         * bindings/objc/objc_instance.h:
4117         * bindings/objc/objc_instance.mm:
4118         (ObjcInstance::implementsCall):
4119         The object is callable if the ObjC instance responds to -invokeDefaultMethodWithArguments:.
4120
4121         * bindings/jni/jni_instance.h:
4122         * bindings/jni/jni_instance.cpp:
4123         Moved bogus invokeDefaultMethod() to superclass.
4124
4125 2006-03-29  Geoffrey Garen  <ggaren@apple.com>
4126
4127         Reviewed by Darin.
4128
4129         - JavaScriptCore side of fix for <rdar://problem/4308243> 8F36 
4130         Regression: crash in malloc_consolidate if you use a .PAC file
4131
4132         The crash was a result of threaded deallocation of thread-unsafe
4133         objects. Pure JS objects are thread-safe because all JS execution
4134         is synchronized through JSLock. However, JS objects that wrap WebCore 
4135         objects are thread-unsafe because JS and WebCore execution are not 
4136         synchronized.  That unsafety comes into play when the collector 
4137         deallocates a JS object that wraps a WebCore object, thus causing the 
4138         WebCore object to be deallocated.
4139
4140         The solution here is to have each JSCell know whether it is safe to
4141         collect on a non-main thread, and to avoid collecting unsafe cells
4142         when on a non-main thread.
4143
4144         We don't have a way to test PAC files yet, so there's no test
4145         attached to this patch.
4146
4147         * kjs/collector.cpp:
4148         (KJS::Collector::collect):
4149         (1) Added the test "currentThreadIsMainThread || 
4150         imp->m_destructorIsThreadSafe". 
4151
4152         * kjs/protect.h:
4153         (KJS::gcProtectNullTolerant):
4154         (KJS::gcUnprotectNullTolerant):
4155         * kjs/value.h:
4156         (KJS::JSCell::JSCell): The bools here must be bitfields, otherwise
4157         m_destructorIsThreadSafe becomes another whole word, ruining the
4158         collector optimizations we've made based on the size of a JSObject.
4159      &nbs