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