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