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