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