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