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