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