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