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