f2ac14af51e687d3028c8af02815f7af6d049c8d
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
2
3         -landed patch by Carsten Guenther <cguenther@gmail.com>
4
5         -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477
6         some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
7
8         -relevant tests:
9                mozilla/ecma_3/Date/15.9.5.5.js 
10                layout-tests/fast/js/date-parse-test.html
11
12         Reviewed by darin.
13
14         * kjs/date_object.cpp:
15         (formatLocaleDate):
16         (day):
17         (dayFromYear):
18         (daysInYear):
19         (timeFromYear):
20         (yearFromTime):
21         (weekDay):
22         (timeZoneOffset):
23         (DateProtoFuncImp::call):
24         (DateObjectImp::construct):
25         (KJS::parseDate):
26         (ymdhms_to_seconds):
27         (KJS::makeTime):
28         (findMonth):
29         (KJS::KRFCDate_parseDate):
30         * kjs/date_object.h:
31         * tests/mozilla/expected.html: updated expected results to reflect fix
32
33 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
34
35         -fixed <rdar://problem/4168186> JavaScript fails to throw exceptions 
36         for invalid return statements
37         
38         relevant tests:
39             ecma/Statements/12.9-1-n.js
40             ecma_2/Exceptions/lexical-052.js
41             ecma_2/Exceptions/statement-009.js
42
43         Reviewed by sullivan.
44
45         * kjs/nodes.cpp:
46         (ReturnNode::execute): now throws exception if return is not inside
47         a function.
48
49         * tests/mozilla/expected.html: updated to reflect fix
50
51 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
52
53         Reviewed by sullivan.
54
55         * tests/mozilla/expected.html: Updated test results for last fix.
56
57 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
58
59         -fixed <rdar://problem/4168161> JavaScript fails to throw an exception 
60         for invalid function calls
61         
62         Reviewed by sullivan.
63
64         Relevant mozilla test: ecma_3/Exceptions/regress-95101.js 
65
66         * kjs/nodes.cpp:
67         (FunctionCallNode::evaluate): evaluate now checks for an exception
68         after resolving a function name (in case the function is undefined)
69
70 2005-07-01  Eric Seidel  <eseidel@apple.com>
71
72         Reviewed by darin.
73
74         * kjs/interpreter.h:
75         (KJS::Context::curStmtFirstLine): stub for compatibility with KDE
76         * kjs/value.h:
77         (KJS::Value::isValid): compatibility with KDE
78         http://bugzilla.opendarwin.org/show_bug.cgi?id=3687
79
80 2005-07-01  Eric Seidel  <eseidel@apple.com>
81
82         Reviewed by darin.
83
84         * kjs/create_hash_table: rolled in changes from KDE, including
85         -n <namespace> support from KDOM and support for newer comments
86         http://bugzilla.opendarwin.org/show_bug.cgi?id=3771
87
88 2005-06-30  Geoffrey Garen  <ggaren@apple.com>
89
90         -rolled in KDE fix to <rdar://problem/4167660> JavaScript fails to 
91         throw exceptions for invalid break/continue statements
92
93         No layout tests because it's already covered by the Mozilla suite
94
95         Reviewed by mjs.
96
97         * kjs/internal.h: LabelStack now tracks where you are relative to
98         switch and iteration (loop) statements
99         
100         (KJS::LabelStack::LabelStack):
101         (KJS::LabelStack::pushIteration):
102         (KJS::LabelStack::popIteration):
103         (KJS::LabelStack::inIteration):
104         (KJS::LabelStack::pushSwitch):
105         (KJS::LabelStack::popSwitch):
106         (KJS::LabelStack::inSwitch):
107
108         * kjs/nodes.cpp: 
109         These files were updated to use the new LabelStack:
110         (DoWhileNode::execute): 
111         (WhileNode::execute):
112         (ForNode::execute):
113         (ForInNode::execute):
114         (SwitchNode::execute):
115         
116         These files were updated to throw exceptions for invalid
117         break/continue statements:
118         (BreakNode::execute): 
119         (ContinueNode::execute):
120
121         * tests/mozilla/expected.html: Updated expected results to reflect fix
122
123 2005-06-30  Kevin Decker  <kdecker@apple.com>
124
125         Reviewed by rjw.
126
127         fixed: <rdar://problem/4166838> failed assertion in`Interpreter::lockCount() > 0
128
129         no layout test added; this is in the bindings code.
130
131         * bindings/objc/WebScriptObject.mm:
132         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): make sure to lock and unlock the interpreter around allocations. 
133
134 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
135
136         Patch by Francisco Tolmasky <tolmasky@gmail.com>
137
138         - fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3667
139         Core JavaScript 1.5 Reference:Objects:Array:forEach
140
141         See WebCore Changelog for layout tests added.
142
143         Reviewed by darin.
144
145         * kjs/array_object.cpp:
146         (ArrayProtoFuncImp::call):
147         * kjs/array_object.h:
148         (KJS::ArrayProtoFuncImp::):
149
150 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
151
152         Patch contributed by Oliver Hunt <ojh16@student.canterbury.ac.nz>
153
154         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3743
155         Incorrect error message given for certain calls
156
157         See WebCore Changelog for layout test added.
158
159         Reviewed by mjs.
160
161         * kjs/object.cpp:
162         (KJS::ObjectImp::defaultValue):
163
164 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
165
166         Rolling out date patch from 6-28-05 because it breaks 
167         fast/js/date-parse-test
168
169         Reviewed by NOBODY.
170
171         * kjs/date_object.cpp:
172         (formatLocaleDate):
173         (DateProtoFuncImp::call):
174         (DateObjectImp::construct):
175         (KJS::parseDate):
176         (ymdhms_to_seconds):
177         (isSpaceOrTab):
178         (KJS::KRFCDate_parseDate):
179         * kjs/date_object.h:
180         * tests/mozilla/expected.html:
181
182 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
183
184         Reviewed by Darin.
185
186         -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3750
187         build fails with KJS_VERBOSE set
188
189         * kjs/nodes.cpp: changed debug print statement to use UString
190         (VarDeclNode::evaluate):
191         * kjs/reference.cpp: ditto
192         (KJS::Reference::putValue):
193
194 2005-06-28  Geoffrey Garen  <ggaren@apple.com>
195
196         Patch contributed by Carsten Guenther <cguenther@gmail.com>.
197
198         -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477
199         some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
200
201         Reviewed by darin.
202
203         * kjs/date_object.cpp:
204         (formatLocaleDate):
205         (day):
206         (dayFromYear):
207         (daysInYear):
208         (timeFromYear):
209         (yearFromTime):
210         (weekDay):
211         (timeZoneOffset):
212         (DateProtoFuncImp::call):
213         (DateObjectImp::construct):
214         (KJS::parseDate):
215         (ymdhms_to_seconds):
216         (KJS::makeTime):
217         (findMonth):
218         (KJS::KRFCDate_parseDate):
219         * kjs/date_object.h:
220         * tests/mozilla/expected.html: updated expected test results to reflect fix
221
222 2005-06-26  Maciej Stachowiak  <mjs@apple.com>
223
224         Reviewed by Darin.
225
226         - replace hash functions  with better ones
227
228         * JavaScriptCore.pbproj/project.pbxproj: Add new file to build.
229         * kjs/interpreter_map.cpp:
230         (KJS::InterpreterMap::computeHash): Use shared pointer hash.
231         * kjs/pointer_hash.h: Added.
232         (KJS::pointerHash): Pointer hash based on 32-bit mix and 64-bit mix hashes.
233         * kjs/protected_values.cpp:
234         (KJS::ProtectedValues::computeHash): Use shared pointer hash.
235         * kjs/ustring.cpp:
236         (KJS::UString::Rep::computeHash): Use SuperFastHash algorithm.
237
238 2005-06-22  Darin Adler  <darin@apple.com>
239
240         Change by Anders Carlsson.
241         Reviewed by me.
242
243         - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3294>
244           String.prototype.replace() fails with function as second param
245
246         * kjs/string_object.cpp: (replace): Added code to handle functions.
247
248         * tests/mozilla/expected.html: Updated since ecma_3/RegExp/regress-209067.js is fixed now.
249
250         * tests/mozilla/run-mozilla-tests: Fix a minor coding style issue that leads to a warning each
251         time we run the tests.
252
253 2005-06-21  Adele Peterson  <adele@apple.com>
254
255         rolling out fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=3293, since it caused layout test failures.
256         fast/forms/element-by-name
257         fast/loader/loadInProgress
258
259         * ChangeLog:
260         * bindings/objc/objc_runtime.h:
261         * bindings/objc/objc_runtime.mm:
262         (ObjcFallbackObjectImp::hasProperty):
263         * bindings/runtime_array.cpp:
264         (RuntimeArrayImp::hasProperty):
265         * bindings/runtime_array.h:
266         * bindings/runtime_object.cpp:
267         (RuntimeObjectImp::hasProperty):
268         * bindings/runtime_object.h:
269         * kjs/array_instance.h:
270         * kjs/array_object.cpp:
271         (ArrayInstanceImp::hasProperty):
272         * kjs/function.cpp:
273         (KJS::FunctionImp::hasProperty):
274         (KJS::ActivationImp::hasProperty):
275         * kjs/function.h:
276         * kjs/object.cpp:
277         (KJS::ObjectImp::hasProperty):
278         * kjs/object.h:
279         * kjs/object_object.cpp:
280         (ObjectPrototypeImp::ObjectPrototypeImp):
281         (ObjectProtoFuncImp::call):
282         * kjs/object_object.h:
283         (KJS::ObjectProtoFuncImp::):
284         * kjs/string_object.cpp:
285         (StringInstanceImp::hasProperty):
286         * kjs/string_object.h:
287         * tests/mozilla/expected.html:
288
289 2005-06-21  Darin Adler  <darin@apple.com>
290
291         * JavaScriptCore.pbproj/project.pbxproj: Switched to a build rule rather than a build phase for
292         .y files -- this gets rid of the problem where modifying the .y file would not cause sufficient
293         compilation.
294
295         * kjs/grammar_wrapper.cpp: Removed.
296
297 2005-06-21  Adele Peterson  <adele@apple.com>
298
299         Patch from Anders Carlsson <andersca@mac.com>, reviewed by Darin.
300
301         Fixed: <http://bugzilla.opendarwin.org/show_bug.cgi?id=3450>
302         <rdar://problem/3881901> String.replace() method not working when regex pattern contains {n, m}
303
304         * pcre/pcre.c: (pcre_compile): Remember the last char length so it can be subtracted correctly if needed.
305
306 2005-06-21  Geoffrey Garen  <ggaren@apple.com>
307
308         - fixed <rdar://problem/4155532> 'delete' succeeds on functions
309         - fixed <rdar://problem/4155049> javascript function named as "opener" doesn't get called because of window.opener property
310         
311         Reviewed by cblu.
312
313         * kjs/nodes.cpp:
314         (FuncDeclNode::processFuncDecl): Functions now have DontDelete and Internal attributes set when appropriate.
315
316         Test cases:
317         * tests/mozilla/expected.html: Updated for one new success.
318         - see also test case added in WebCore.
319
320 2005-06-20  Maciej Stachowiak  <mjs@apple.com>
321
322         Reviewed by Darin(first pass) and Hyatt.
323
324         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3576
325         (roll in support for "const" keyword from KDE tree)
326         - make processVarDecls handle deletability of variables declared
327         in an eval block the same as evaluate would
328         - make eval() call processVarDecls - needed to match mozilla and
329         to make the second change testable
330
331         I started with the KDE implementation of const but I ended up changing it a bit
332         to avoid the use of a global variable. Now instead of the global variable it distinguishes
333         const and var at the grammar level so the appropriate node can know the right kind of
334         declaration.
335
336         Test cases:
337         * tests/mozilla/expected.html: Updated for one new test that is
338         failing - we used to bail on it entirely because it checks for
339         const support before starting.
340         - see also test cases added in WebCore
341
342         * kjs/grammar.y: Add rules for const declarations.
343         * kjs/keywords.table: Add const keyword.
344         * kjs/nodes.cpp:
345         (VarDeclNode::VarDeclNode): Add parameter.
346         (VarDeclNode::evaluate): Add const support.
347         (VarDeclNode::processVarDecls): Add const support.
348         (VarStatementNode::execute): Irrelevant change.
349         (ForInNode::ForInNode): Tell our variable node that it's a variable.
350         * kjs/nodes.h:
351         (KJS::VarDeclNode::): Add declaration of type enum, extra constructor parameter.
352         (KJS::VarStatementNode::VarStatementNode): Irrelevant change.
353         * kjs/function.cpp:
354         (KJS::GlobalFuncImp::call): Process var decls before evaluating.
355
356 2005-06-20  Maciej Stachowiak  <mjs@apple.com>
357
358         Patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
359
360         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3293
361         
362         Test cases added: 
363         * tests/mozilla/expected.html: Updated for two fixed tests.
364         - also added a layout test
365
366         * bindings/objc/objc_runtime.h:
367         * bindings/objc/objc_runtime.mm:
368         (ObjcFallbackObjectImp::hasOwnProperty):
369         * bindings/runtime_array.cpp:
370         (RuntimeArrayImp::hasOwnProperty):
371         * bindings/runtime_array.h:
372         * bindings/runtime_object.cpp:
373         (RuntimeObjectImp::hasOwnProperty):
374         * bindings/runtime_object.h:
375         * kjs/array_instance.h:
376         * kjs/array_object.cpp:
377         (ArrayInstanceImp::hasOwnProperty):
378         * kjs/function.cpp:
379         (KJS::FunctionImp::hasOwnProperty):
380         (KJS::ActivationImp::hasOwnProperty):
381         * kjs/function.h:
382         * kjs/object.cpp:
383         (KJS::ObjectImp::hasProperty):
384         (KJS::ObjectImp::hasOwnProperty):
385         * kjs/object.h:
386         (KJS::Object::hasOwnProperty):
387         * kjs/object_object.cpp:
388         (ObjectPrototypeImp::ObjectPrototypeImp):
389         (ObjectProtoFuncImp::call):
390         * kjs/object_object.h:
391         (KJS::ObjectProtoFuncImp::):
392         * kjs/string_object.cpp:
393         (StringInstanceImp::hasOwnProperty):
394         * kjs/string_object.h:
395
396 2005-06-18  Darin Adler  <darin@apple.com>
397
398         Reviewed by Eric Seidel.
399
400         * pcre/get.c: (pcre_get_substring): Fix some computations so this works for UTF-16.
401         This is unused in the current JavaScriptCore, but still good to fix.
402
403 2005-06-18  Darin Adler  <darin@apple.com>
404
405         Change by Finlay Dobbie.
406         Reviewed by me.
407
408         - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3331>
409           10.3.9 Build Failure: NSString may not respond to `+stringWithCString:encoding:'
410
411         * bindings/objc/WebScriptObject.mm: (-[WebScriptObject stringRepresentation]):
412         Undo change we did a while back to work around the gcc 3.3 compiler error.
413         It no longer seems to happen, and the workaround code was 10.4-specific.
414
415 2005-06-16  Geoffrey Garen  <ggaren@apple.com>
416
417         Fixed: <rdar://problem/4151759> 'delete' fails on variables declared inside 'eval' statements.
418
419         Reviewed by cblu.
420
421         * kjs/context.h:
422         (KJS::ContextImp::codeType): Added code type accessor for execution context objects.
423         * kjs/internal.cpp:
424         (ContextImp::ContextImp): Reflects change to ContextImp::codeType.
425         * kjs/nodes.cpp:
426         (VarDeclNode::evaluate): Added separate code path for variable declarations inside 'eval' statements.
427         * tests/mozilla/expected.html: Updated expected test results to reflect fix.
428
429 2005-06-14  Geoffrey Garen  <ggaren@apple.com>
430
431         Updated expected.html to reflect fix to <rdar://problem/4147745>.
432
433         Reviewed by cblu.
434
435         * tests/mozilla/expected.html:
436
437 2005-06-14  Geoffrey Garen  <ggaren@apple.com>
438
439         Fixed: <rdar://problem/4147745> JavaScript discards locally defined "arguments" property
440
441         No layout tests added because this change fixes existing tests:
442         ecma/ExecutionContexts/10.1.6.js
443         ecma_3/Function/regress-94506.js
444         js1_4/Functions/function-001.js
445
446         Reviewed by cblu.
447
448         * kjs/function.cpp:
449         (KJS::ActivationImp::get): get now checks for an "arguments" property defined in the local variable object
450         before trying to return the built-in arguments array.
451         
452         * kjs/function.h: ActivationImp::put no longer overrides ObjectImp::put
453
454 2005-06-10  Darin Adler  <darin@apple.com>
455
456         Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
457         Reviewed by me.
458
459         - further improvements to exception file/line number fix
460
461         * kjs/nodes.h: Added setExceptionDetailsIfNeeded function.
462         * kjs/nodes.cpp: Updated macros to call the new setExceptionDetailsIfNeeded function.
463         (Node::setExceptionDetailsIfNeeded): Added.
464
465 2005-06-09  Darin Adler  <darin@apple.com>
466
467         Change by Mark Rowe <opendarwin.org@bdash.net.nz>
468         Reviewed by me.
469
470         * kjs/nodes.cpp: Get rid of unneeded this->.
471
472 2005-06-08  Maciej Stachowiak  <mjs@apple.com>
473
474         Change by Mark Rowe <opendarwin.org@bdash.net.nz>
475         Reviewed by me.
476
477         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3327
478         (Exception When Setting Style to Invalid Value Lacks Line/File Information)
479
480         * kjs/nodes.cpp: Include source file and line number when making exception in
481         KJS_CHECKEXCEPTIONVALUE.
482
483 2005-06-07  Darin Adler  <darin@apple.com>
484
485         Change by Toby Peterson <toby@opendarwin.org>.
486         Reviewed by me.
487
488         * JavaScriptCore.pbproj/project.pbxproj: Allow bison 2.0, which generates the file
489         with a different name.
490
491 2005-06-07  Darin Adler  <darin@apple.com>
492
493         Change by Toby Peterson <toby@opendarwin.org>.
494         Reviewed by me.
495
496         * kjs/grammar.y: Remove bogus extra line from grammar.y. Toby got this change from KDE KJS.
497
498 2005-06-06  Darin Adler  <darin@apple.com>
499
500         * tests/mozilla/run-mozilla-tests: Wrote a perl version of this so we don't require
501         the "jst" tool to run the tests.
502
503 2005-06-04  Darin Adler  <darin@apple.com>
504
505         Reviewed by Maciej.
506
507         - add libicu headers
508
509         * JavaScriptCore.pbproj/project.pbxproj: Added icu directory to header search path.
510
511         * icu/README: Added.
512         * icu/unicode/platform.h: Added.
513         * icu/unicode/uchar.h: Added.
514         * icu/unicode/uconfig.h: Added.
515         * icu/unicode/umachine.h: Added.
516         * icu/unicode/urename.h: Added.
517         * icu/unicode/utf.h: Added.
518         * icu/unicode/utf16.h: Added.
519         * icu/unicode/utf8.h: Added.
520         * icu/unicode/utf_old.h: Added.
521         * icu/unicode/utypes.h: Added.
522         * icu/unicode/uversion.h: Added.
523
524 2005-05-19  Darin Adler  <darin@apple.com>
525
526         Reviewed by Maciej.
527         
528         - turned off exceptions and RTTI; seems to cut JavaScriptCore code size by about 22%
529
530         * JavaScriptCore.pbproj/project.pbxproj: Turn off exceptions and RTTI for both
531         the framework and testkjs tool.
532
533 2005-05-18  Darin Adler  <darin@apple.com>
534
535         Reviewed by Maciej.
536
537         - got rid of code that depended on RTTI
538
539         * kjs/collector.cpp:
540         (KJS::className): Added. Gets class name in a KJS way, rather than a C++ RTTI way.
541         (KJS::Collector::rootObjectClasses): Use className instead of typeid names.
542
543 2005-05-18  Darin Adler  <darin@apple.com>
544
545         Reviewed by Maciej.
546
547         - fix a failure seen in the Mozilla JavaScript tests where a live object was garbage-collected
548           when the only reference to it was in an argList on the stack
549
550         * kjs/list.h: Moved the operator= function into the .cpp file since it's too big to be
551         a good choice to inline.
552         * kjs/list.cpp: (KJS::List::operator=): Moved this formerly-inline function into a separate
553         file and added missing code to update valueRefCount. It's the latter that fixes the bug.
554
555 2005-05-16  Darin Adler  <darin@apple.com>
556
557         Reviewed by Adele.
558
559         - fixed issues preventing us from compiling with newer versions of gcc 4.0
560
561         * kjs/ustring.cpp:
562         (KJS::operator==): Remove redundant and illegal KJS:: prefix on this function's definition.
563         (KJS::operator<): Ditto.
564         (KJS::compare): Ditto.
565
566 2005-05-09  Darin Adler  <darin@apple.com>
567
568         Reviewed by John.
569
570         - turn on conservative GC unconditionally and start on SPI changes to
571           eliminate the now-unneeded smart pointers since we don't ref count any more
572
573         * kjs/value.h: Removed macros to turn conservative GC on and off.
574         Removed ref and deref functions.
575         (KJS::ValueImp::ValueImp): Removed non-conservative-GC code path.
576         (KJS::ValueImp::isUndefined): Added. New SPI to make it easier to deal with ValueImp directly.
577         (KJS::ValueImp::isNull): Ditto.
578         (KJS::ValueImp::isBoolean): Ditto.
579         (KJS::ValueImp::isNumber): Ditto.
580         (KJS::ValueImp::isString): Ditto.
581         (KJS::ValueImp::isObject): Ditto.
582         (KJS::Value::Value): Removed non-conservative-GC code path and made constructor no
583         longer explicit so we can quietly create Value wrappers from ValueImp *; inexpensive with
584         conservative GC and eases the transition.
585         (KJS::Value::operator ValueImp *): Added. Quietly creates ValueImp * from Value.
586         (KJS::ValueImp::marked): Removed non-conservative-GC code path.
587
588         * kjs/value.cpp:
589         (KJS::ValueImp::mark): Removed non-conservative-GC code path.
590         (KJS::ValueImp::isUndefinedOrNull): Added. New SPI to make it easier to deal with ValueImp directly.
591         (KJS::ValueImp::isBoolean): Ditto.
592         (KJS::ValueImp::isNumber): Ditto.
593         (KJS::ValueImp::isString): Ditto.
594         (KJS::ValueImp::asString): Ditto.
595         (KJS::ValueImp::isObject): Ditto.
596         (KJS::undefined): Ditto.
597         (KJS::null): Ditto.
598         (KJS::boolean): Ditto.
599         (KJS::string): Ditto.
600         (KJS::zero): Ditto.
601         (KJS::one): Ditto.
602         (KJS::two): Ditto.
603         (KJS::number): Ditto.
604
605         * kjs/object.h: Made constructor no longer explicit so we can quietly create Object
606         wrappers from ObjectImp *; inexpensive with conservative GC and eases the transition.
607         (KJS::Object::operator ObjectImp *): Added. Quietly creates ObjectImp * from Object.
608         (KJS::ValueImp::isObject): Added. Implementation of new object-related ValueImp function.
609         (KJS::ValueImp::asObject): Ditto.
610
611         * kjs/object.cpp:
612         (KJS::ObjectImp::setInternalValue): Remove non-conservative-GC code path.
613         (KJS::ObjectImp::putDirect): Ditto.
614         (KJS::error): Added. Function in the new SPI style to create an error object.
615
616         * kjs/internal.h: Added the new number-constructing functions as friends of NumberImp.
617         There may be a more elegant way to do this later; what's important now is the new SPI.
618
619         * kjs/collector.h:  Remove non-conservative-GC code path and also take out some
620         unneeded APPLE_CHANGES.
621
622         * bindings/runtime_root.cpp:
623         (KJS::Bindings::addNativeReference): Remove non-conservative-GC code path.
624         (KJS::Bindings::removeNativeReference): Ditto.
625         (RootObject::removeAllNativeReferences): Ditto.
626         * bindings/runtime_root.h:
627         (KJS::Bindings::RootObject::~RootObject): Ditto.
628         (KJS::Bindings::RootObject::setRootObjectImp): Ditto.
629         * kjs/collector.cpp:
630         (KJS::Collector::allocate): Ditto.
631         (KJS::Collector::collect): Ditto.
632         (KJS::Collector::numGCNotAllowedObjects): Ditto.
633         (KJS::Collector::numReferencedObjects): Ditto.
634         (KJS::Collector::rootObjectClasses): Ditto.
635         * kjs/internal.cpp:
636         (NumberImp::create): Ditto.
637         (InterpreterImp::globalInit): Ditto.
638         (InterpreterImp::globalClear): Ditto.
639         * kjs/list.cpp:
640         (KJS::List::markProtectedLists): Ditto.
641         (KJS::List::clear): Ditto.
642         (KJS::List::append): Ditto.
643         * kjs/list.h:
644         (KJS::List::List): Ditto.
645         (KJS::List::deref): Ditto.
646         (KJS::List::operator=): Ditto.
647         * kjs/protect.h:
648         (KJS::gcProtect): Ditto.
649         (KJS::gcUnprotect): Ditto.
650
651 2005-05-09  Chris Blumenberg  <cblu@apple.com>
652
653         Workaround gcc 3.3 internal compiler errors.
654
655         Reviewed by darin.
656
657         * bindings/objc/WebScriptObject.mm:
658         (-[WebScriptObject stringRepresentation]): call [NSString stringWithCString:encoding] rather than using @""
659
660 2005-05-09  Darin Adler  <darin@apple.com>
661
662         * Makefile.am: Don't set up PBXIntermediatesDirectory explicitly;
663         Not needed to make builds work, spews undesirable error messages too.
664
665 2005-05-06  Darin Adler  <darin@apple.com>
666
667         Reviewed by Maciej.
668
669         - make building multiple trees with make work better
670
671         * Makefile.am: Set up Xcode build directory before invoking xcodebuild.
672
673 2005-05-04  Maciej Stachowiak  <mjs@apple.com>
674
675         Reviewed by Darin.
676
677         <rdar://problem/4086570> Crash in JavaScriptCore with RSS Visualizer
678         
679         * kjs/internal.cpp:
680         (InterpreterImp::mark): mark staticNaN, it is usually protected by the Number
681         prototype but there is a small window where it can get collected.
682
683 2005-05-04  Darin Adler  <darin@apple.com>
684
685         Reviewed by Dave Hyatt.
686
687         - another gcc-4.0-related fix
688
689         * bindings/runtime_root.h: Take off extra namespace prefixes that apparently cause problems
690         compiling with gcc 4.0, although I have not observed the problems.
691
692 2005-05-04  Darin Adler  <darin@apple.com>
693
694         Reviewed by Dave Hyatt.
695
696         - fixed build rules to match other projects
697
698         * JavaScriptCore.pbproj/project.pbxproj: Set deployment target to 10.3 in the build styles.
699         When built without a build style (by Apple B&I) we want to get the target from the
700         environment. But when built with a build style (by Safari engineers and others), we want
701         to use 10.3.
702
703         * Makefile.am: Took out extra parameters that make command-line building different from
704         Xcode building. Now that this is fixed, you should not get a full rebuild if you switch
705         from command line to Xcode or back.
706
707 2005-05-04  Maciej Stachowiak  <mjs@apple.com>
708
709         - revert presumably accidental change to mozilla JS test expected results, this
710         was making the tests fail.
711
712         * tests/mozilla/expected.html:
713
714 2005-05-03  Richard Williamson   <rjw@apple.com>
715
716         Fixed <rdar://problem/4102644> Crash in LiveConnect below KJS::Bindings::JavaInstance::stringValue() const
717
718         Correctly handle accessing nil objects from a Java object array.
719
720         Reviewed by John.
721
722         * bindings/jni/jni_runtime.cpp:
723         (JavaArray::valueAt):
724
725 2005-05-01  Darin Adler  <darin@apple.com>
726
727         - move to Xcode native targets and stop checking in generated files
728
729         * JavaScriptCore.pbproj/project.pbxproj: Updated to use native targets and generate all the generated
730         files, so we don't have to check them in any more.
731         * Info.plist: Added. Native targets use a separate file for this.
732
733         * Makefile.am: Removed pcre and kjs SUBDIRS. Also removed code that deleted the embedded copy of this
734         framework, since we haven't been embedding it for some time.
735
736         * kjs/grammar_wrapper.cpp: Added. Shell used to compile grammar.cpp since we can't add a generated file
737         easily to the list of files to be compiled.
738
739         * kjs/.cvsignore: Removed.
740         * kjs/Makefile.am: Removed.
741         * kjs/array_object.lut.h: Removed.
742         * kjs/date_object.lut.h: Removed.
743         * kjs/grammar.cpp: Removed.
744         * kjs/grammar.cpp.h: Removed.
745         * kjs/grammar.h: Removed.
746         * kjs/lexer.lut.h: Removed.
747         * kjs/math_object.lut.h: Removed.
748         * kjs/number_object.lut.h: Removed.
749         * kjs/string_object.lut.h: Removed.
750         * pcre/.cvsignore: Removed.
751         * pcre/Makefile.am: Removed.
752         * pcre/chartables.c: Removed.
753
754 2005-04-28  Darin Adler  <darin@apple.com>
755
756         Reviewed by Dave Harrison.
757
758         - fixed problems preventing us from compiling with gcc 4.0
759
760         * JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from
761         WARNING_CPLUSPLUSFLAGS since it's now a C-only warning.
762
763         * bindings/jni/jni_jsobject.cpp:
764         (JSObject::getSlot): Changed some %d to %ld where the parameters where long ints.
765         (JSObject::setSlot): Ditto.
766         * bindings/jni/jni_utility.cpp:
767         (KJS::Bindings::getJavaVM): Ditto.
768         (KJS::Bindings::getJNIEnv): Ditto.
769         * bindings/objc/objc_utility.mm: Fixed include of <JavascriptCore/internal.h> that needed the
770         letter "S" capitalized.
771         * kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to
772         avoid incorrect gcc 4.0 warning.
773         * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check
774         the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment.
775         Prevents a crash on garbage collect when compiled with gcc 4.0.
776         * kjs/nodes.cpp:
777         (WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning.
778         (ForNode::execute): Ditto.
779         (SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning.
780         (LabelNode::execute): Ditto.
781         * kjs/string_object.cpp: (replace): Ditto.
782
783 2005-04-26  Richard Williamson   <rjw@apple.com>
784
785         Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla
786         
787         We were incompatible with Mozilla's implementation of the scripting APIs in
788         two ways:
789
790         Their NPN_SetException has the following signature:
791
792             void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
793
794         ours has:
795
796             void NPN_SetException (NPObject * npobj, const NPString *message);
797
798         Also, they expect the string returned from NPN_UTF8FromIdentifier() to be freed by caller.
799         We do not.
800
801         I changed both behaviors to match Mozilla.
802
803         Reviewed by Chris.
804
805         * bindings/NP_jsobject.cpp:
806         (_NPN_SetException):
807         * bindings/npruntime.cpp:
808         (_NPN_UTF8FromIdentifier):
809         (_NPN_IntFromIdentifier):
810         (_NPN_SetExceptionWithUTF8):
811         * bindings/npruntime.h:
812         * bindings/npruntime_impl.h:
813
814 2005-04-26  Maciej Stachowiak  <mjs@apple.com>
815
816         Reviewed by Chris.
817
818         <rdar://problem/4092136> reproducible crash in KJS::kjs_fast_realloc loading maps.google.com
819         
820         * kjs/string_object.cpp:
821         (StringObjectFuncImp::call): Allocate adopted ustring buffer properly.
822
823 2005-04-22  Darin Adler  <darin@apple.com>
824
825         Reviewed by Maciej.
826
827         * kjs/ustring.cpp: (KJS::UString::UTF8String): Fix off-by-one error in surrogate pair logic.
828
829 2005-04-22  Darin Adler  <darin@apple.com>
830
831         Reviewed by John.
832
833         - fixed <rdar://problem/4090046> JavaScript throw statement causes parse error when no semicolon is present
834
835         * kjs/grammar.y: Added an additional rule for throw like the ones we have for all the other semicolon rules.
836         Not sure why we missed this one earlier.
837
838         * kjs/grammar.cpp: Regenerated.
839
840 === JavaScriptCore-412.1 ===
841
842 2005-04-20  Darin Adler  <darin@apple.com>
843
844         Reviewed by Maciej.
845
846         - speedups, total 12% on JavaScript iBench
847
848         I ran the benchmark under Shark and followed its advice a lot, mainly.
849
850         * kjs/collector.cpp:
851         (KJS::Collector::allocate): Take out special case for 0; costing speed but unexercised.
852         Use numLiveObjectsAtLastCollect instead of numAllocationsSinceLastCollect so we don't
853         have to bump it each time we call allocate. Put numLiveObjects into a local variable to
854         cut down on global variable accesses. Make "next" cell pointer be a byte offset rather
855         than a pointer so we don't need a special case for NULL. Allow freeList to point to some
856         bogus item when the entire block is full rather than going out of our way to make it
857         point to NULL.
858         (KJS::Collector::markProtectedObjects): Get table size and pointer into locals outside
859         the loop to avoid re-loading them over and over again.
860         (KJS::Collector::collect): Put numLiveObjects into a local variable to cut down on global
861         variable accesses. Make "next" cell pointer be a byte offset as above. Put numLiveObjects
862         into a local variable to cut down on global variable accesses. Set numLiveObjectsAtLastCollect
863         rather than numAllocationsSinceLastCollect.
864         (KJS::Collector::numReferencedObjects): Get table size and pointer into locals outside
865         the loop to avoid re-loading them over and over again.
866         (KJS::Collector::rootObjectClasses): Ditto.
867
868         * kjs/internal.h: Make Value be a friend of NumberImp so it can construct number objects
869         directly, avoiding the conversion from Number to Value.
870
871         * kjs/internal.cpp: (StringImp::toObject): Don't use Object::dynamicCast, because we know
872         the thing is an object and we don't want to do all the extra work; just cast directly.
873
874         * kjs/list.cpp: (KJS::List::List): Construct valueRefCount in a way that avoids the need for
875         a branch -- in the hot case this just meant avoiding checking a variable we just set to false.
876
877         * kjs/lookup.cpp: (keysMatch): Marked this inline.
878
879         * kjs/nodes.cpp: Disabled KJS_BREAKPOINT, to avoid calling hitStatement all the time.
880         (BooleanNode::evaluate): Make a Value directly, rather than making a Boolean which is converted
881         into a Value.
882         (NumberNode::evaluate): Ditto.
883         (StringNode::evaluate): Ditto.
884         (ArrayNode::evaluate): Ditto.
885         (FunctionCallNode::evaluate): Use new inline baseIfMutable to avoid unnecessary getBase function.
886         Also just use a pointer for func, rather than an Object.
887         (PostfixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
888         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
889         integer and back.
890         (DeleteNode::evaluate): Make a Value directly.
891         (TypeOfNode::evaluate): Use new inline baseIfMutable and make Value directly.
892         (PrefixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
893         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
894         integer and back.
895         (UnaryPlusNode::evaluate): Make a Value directly.
896         (NegateNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
897         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
898         integer and back.
899         (BitwiseNotNode::evaluate): Make a Value directly.
900         (LogicalNotNode::evaluate): Ditto.
901         (ShiftNode::evaluate): Don't convert to a double before making a Value.
902         (RelationalNode::evaluate): Make a Value directly.
903         (EqualNode::evaluate): Ditto.
904         (BitOperNode::evaluate): Ditto.
905         (AssignNode::evaluate): Make a Value directly. Change code so that it passes a "known to be integer"
906         boolean in, often avoiding a conversion from floating point to integer and back.
907         (VarDeclNode::evaluate): Make a Value directly.
908         (ForNode::execute): Remove unused local variable.
909
910         * kjs/operations.h:
911         (KJS::isNaN): Inlined.
912         (KJS::isInf): Ditto.
913         (KJS::isPosInf): Ditto.
914         (KJS::isNegInf): Ditto.
915
916         * kjs/operations.cpp: Change isNaN, isInf, isPosInf, and isNegInf to be inlines.
917         (KJS::equal): Rewrite to avoid creating values and recursing back into the function.
918         (KJS::relation): Rearranged code so that we don't need explicit isNaN checks.
919         (KJS::add): Changed code to make Value directly, and so that it passes a "known to be integer"
920         boolean in, often avoiding a conversion from floating point to integer and back.
921         (KJS::mult): Ditto.
922
923         * kjs/property_map.cpp:
924         (KJS::PropertyMap::~PropertyMap): Get size and entries pointer outside loop to avoid
925         re-getting them inside the loop.
926         (KJS::PropertyMap::clear): Ditto. Clear value pointer in addition to key, so we can just
927         look at the value pointer in the mark function.
928         (KJS::PropertyMap::get): Get sizeMask and entries pointer outside loop to avoid
929         re-getting them inside the loop.
930         (KJS::PropertyMap::put): Ditto.
931         (KJS::PropertyMap::insert): Ditto.
932         (KJS::PropertyMap::remove): Ditto.
933         (KJS::PropertyMap::mark): Get size and entries pointer outside loop to avoid
934         re-getting them inside the loop. Don't bother checking key for 0, since we already have
935         to check value for 0. (Also had to change clear() to set value to 0.)
936         (KJS::PropertyMap::addEnumerablesToReferenceList): Get size and entries pointer outside
937         loop to avoid re-getting them inside the loop.
938         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Ditto.
939         (KJS::PropertyMap::save): Ditto.
940
941         - other changes
942
943         * kjs/protected_values.h: Remove unneeded class name qualifiers.
944
945         * kjs/reference.h:
946         (KJS::Reference::baseIfMutable): New inline function: replaces isMutable().
947         (KJS::Reference::Reference): Inlined.
948         * kjs/reference.cpp:
949         (KJS::Reference::getValue): Rewrite to not use getBase.
950         (KJS::Reference::putValue): Ditto.
951         (KJS::Reference::deleteValue): Dittol
952
953         * kjs/simple_number.h:
954         (KJS::SimpleNumber::integerFits): Added. For use when the parameter is known to be integral.
955
956         * kjs/string_object.cpp: (StringProtoFuncImp::call): Create the number without first converting
957         to double in various cases that involve integers.
958
959         * kjs/ustring.h:
960         (KJS::UString::attach): Inlined.
961         (KJS::UString::release): Inlined.
962         * kjs/ustring.cpp:
963         (KJS::UString::find): Get first character outside the loop instead of re-fetching it each time.
964
965         * kjs/value.cpp:
966         (Value::Value): Added overloads for all the various specific types of values, so you don't have
967         to convert from, say, Number to Value, just to create one.
968         (Number::Number): Added an overload that takes a boolean to indicate the number is already
969         known to be an integer.
970
971         * kjs/value.h: Added more Value constructors, added a version of toNumber that returns
972         a boolean to indicate if the number is known to be an integer (because it was a "simple number").
973         (KJS::ValueImp::marked): Inlined.
974         (KJS::ValueImp::dispatchType): Inlined.
975         (KJS::ValueImp::dispatchToPrimitive): Inlined.
976         (KJS::ValueImp::dispatchToBoolean): Inlined.
977         (KJS::ValueImp::dispatchToNumber): Inlined.
978         (KJS::ValueImp::dispatchToString): Inlined.
979         (KJS::ValueImp::dispatchToUInt32): Inlined.
980
981 2005-04-14  Maciej Stachowiak  <mjs@apple.com>
982
983         - make fast_malloc.h a private header, not project
984
985         * JavaScriptCore.pbproj/project.pbxproj:
986
987 2005-04-12  Maciej Stachowiak  <mjs@apple.com>
988
989         Reviewed by Richard.
990
991         <rdar://problem/4089734> JavaScript iBench can be sped up ~10% with custom allocator
992
993         - use custom single-threaded malloc for all non-GC JavaScriptCore
994         allocations, for a 9.1% speedup on JavaScript iBench
995         
996         * JavaScriptCore.pbproj/project.pbxproj:
997         * kjs/collector.cpp:
998         (KJS::Collector::allocate): Use dlmalloc to allocate the collector blocks.
999         (KJS::Collector::collect): And dlfree to free it.
1000         * kjs/fast_malloc.cpp: Added, just the standard dlmalloc here.
1001         * kjs/fast_malloc.h: Added. Declarations for the functions. Also added a handy
1002         macro to give a class custom operator new/delete
1003         * kjs/identifier.cpp:
1004         (KJS::Identifier::add): Use dlmalloc/dlfree.
1005         * kjs/nodes.h: make nodes KJS_FAST_ALLOCATED.
1006         * kjs/property_map.cpp:
1007         (KJS::PropertyMap::~PropertyMap): Use dlmalloc/dlfree.
1008         (KJS::PropertyMap::rehash): ditto
1009         * kjs/scope_chain.h:
1010         * kjs/ustring.cpp:
1011         (KJS::UString::Rep::createCopying): New named constructor that copies a passed-in
1012         buffer, to hide allocation details from webcore.
1013         (KJS::UString::UString): use createCopying when appropriate.
1014         (KJS::UString::Rep::destroy): Use dlmalloc/dlfree.
1015         (KJS::UString::expandedSize): likewise
1016         (KJS::UString::expandCapacity): likewise
1017         (KJS::UString::expandPreCapacity): likewise
1018         (KJS::UString::spliceSubstringsWithSeparators): likewise
1019         (KJS::UString::append): likewise
1020         (KJS::UString::operator=): likewise
1021         (KJS::UString::detach): likewise
1022         * kjs/ustring.h: make UString and UString::Rep KJS_FAST_ALLOCATED.
1023
1024 2005-04-11  Maciej Stachowiak  <mjs@apple.com>
1025
1026         Reviewed by John.
1027
1028         <rdar://problem/4086819> Avoid using protect count hash table so much for 5.6% JS iBench speedup
1029
1030         - Avoid using protected values hash for the two most common cases
1031         - Bump up ListImp high water mark, new testing shows 508 ListImps are
1032         created during JS iBench.
1033
1034         Net result is a 5.6% speedup on JavaScript iBench
1035         
1036         * kjs/collector.cpp:
1037         (KJS::Collector::collect): mark protected lists as appropriate.
1038         * kjs/context.h:
1039         * kjs/list.cpp:
1040         (KJS::ListImp::markValues): Moved implementation from List::markValues
1041         (KJS::List::markProtectedLists): Implemented - scan pool and overflow
1042         list.
1043         (KJS::allocateListImp): link lists outside the pool into a separate
1044         doubly linked list to be able to mark protected lists
1045         (KJS::deallocateListImp): do the corresponding delinking
1046         (KJS::List::derefValues): do nothing in conservative GC mode
1047         (KJS::List::refValues): do nothing in conservative GC mode
1048         (KJS::List::markValues): call ListImp version
1049         (KJS::List::append):
1050         * kjs/list.h:
1051
1052 === Safari-412 ===
1053
1054 === Safari-411 ===
1055
1056 === Safari-410 ===
1057
1058 === Safari-409 ===
1059
1060 === Safari-408 ===
1061
1062 === Safari-407 ===
1063
1064 2005-03-16  Jens Alfke  <jens@apple.com>
1065
1066         Reviewed by Kevin.
1067
1068         Fix for <rdar://problem/4025212> "REGRESSION (163-164): search not performed correctly; united.com"
1069         JavaScript unescape("") was returning a messed-up String object that appeared identical to an empty string, but would in some cases act as 'null' when passed to native functions, in this case the Option() constructor.
1070         In the implementation of unescape, the UString holding the result was not initialized to "", so it started out as a null string. If nothing was appended to it, it remained null, resulting in a JavaScript String object with some bad behaviors (namely, converting it to a DOMStringImpl results in a NULL pointer.)
1071         Darin says this regression occurred when we replaced our own implementation of unescape() with code from KJS.
1072
1073         * kjs/function.cpp:
1074         (KJS::GlobalFuncImp::call):
1075
1076 2005-03-15  Richard Williamson   <rjw@apple.com>
1077
1078         Fixed <rdar://problem/4053276> WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C
1079
1080         Added JavaScript boolean to type that can be converted to
1081         ObjC scalar parameters.
1082
1083         Reviewed by Ken Kocienda.
1084
1085         * bindings/objc/objc_utility.mm:
1086         (KJS::Bindings::convertValueToObjcValue):
1087
1088 === Safari-406 ===
1089
1090 === Safari-405 ===
1091
1092 === Safari-403 ===
1093
1094 === Safari-402 ===
1095
1096 === Safari-401 ===
1097
1098 === Safari-400 ===
1099
1100 === Safari-188 ===
1101
1102 2005-02-21  Darin Adler  <darin@apple.com>
1103
1104         * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
1105
1106 2005-02-17  Richard Williamson   <rjw@apple.com>
1107
1108         Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
1109
1110         Added nil check.
1111
1112         Reviewed by John Sullivan.
1113
1114         * bindings/jni/jni_runtime.cpp:
1115         (JavaField::valueFromInstance):
1116
1117 === Safari-187 ===
1118
1119 2005-02-11  Richard Williamson   <rjw@apple.com>
1120
1121         Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
1122
1123         Re-factored how 'native' wrappers for JS objects are created.  The interpreter now
1124         creates these wrappers.  The WebCore subclass of the interpreter now overrides
1125         createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
1126
1127         Reviewed by Ken.
1128
1129         * bindings/c/c_utility.cpp:
1130         (convertValueToNPVariant):
1131         * bindings/jni/jni_instance.cpp:
1132         (JavaInstance::invokeMethod):
1133         * bindings/jni/jni_objc.mm:
1134         (KJS::Bindings::dispatchJNICall):
1135         * bindings/jni/jni_runtime.cpp:
1136         (JavaField::valueFromInstance):
1137         (JavaArray::valueAt):
1138         * bindings/objc/WebScriptObject.mm:
1139         (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
1140         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1141         * bindings/objc/WebScriptObjectPrivate.h:
1142         * bindings/objc/objc_utility.h:
1143         * bindings/objc/objc_utility.mm:
1144         (KJS::Bindings::convertObjcValueToValue):
1145         (KJS::Bindings::createObjcInstanceForValue):
1146         * bindings/runtime.cpp:
1147         (Instance::createBindingForLanguageInstance):
1148         (Instance::createRuntimeObject):
1149         (Instance::createLanguageInstanceForValue):
1150         * bindings/runtime.h:
1151         * kjs/interpreter.cpp:
1152         (Interpreter::createLanguageInstanceForValue):
1153         * kjs/interpreter.h:
1154
1155 === Safari-186 ===
1156
1157 2005-02-10  Darin Adler  <darin@apple.com>
1158
1159         "Reviewed" by Richard (he told me the file was obsolete).
1160
1161         - got rid of an obsolete file
1162
1163         * bindings/npsap.h: Removed.
1164
1165 === Safari-185 ===
1166
1167 === Safari-183 ===
1168
1169 2005-02-03  Richard Williamson   <rjw@apple.com>
1170
1171         Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
1172
1173         Revert to old (and correct) behavior of returning runtime object
1174         when passed as a parameter, rather than it's corresponding DOM
1175         object.
1176
1177         Reviewed by Chris.
1178
1179         * bindings/objc/WebScriptObject.mm:
1180         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1181
1182 === Safari-182 ===
1183
1184 2005-01-28  Richard Williamson   <rjw@apple.com>
1185
1186         Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
1187
1188         Only use special 'back door' property to get the runtime object if thisObj isn't
1189         already a runtime object.
1190
1191         <gratuitous> Cleaned up a couple of strcmp on ClassInfo name.  Used == on
1192         ClassInfo pointer instead.
1193
1194         Reviewed by Chris.
1195
1196         * bindings/c/c_utility.cpp:
1197         (convertValueToNPVariant):
1198         * bindings/objc/WebScriptObject.mm:
1199         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1200         * bindings/runtime_method.cpp:
1201         (RuntimeMethodImp::call):
1202
1203 === Safari-181 ===
1204
1205 2005-01-26  Richard Williamson   <rjw@apple.com>
1206
1207         Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
1208
1209         I added a member variable to ObjectImp.  This changed it's size and consequently
1210         hampered the optimizations built into the garbage collector.  Objects no longer
1211         fit within the allocators cell size, and thus allocation fell back to a slower
1212         allocator.
1213
1214         As a result of this fix I also dramatically cleaned up how runtime objects are
1215         accessed.  The path mostly *removes* code.
1216         
1217         Reviewed by Chris.
1218
1219         * bindings/runtime_method.cpp:
1220         (RuntimeMethodImp::call):
1221         * bindings/runtime_object.cpp:
1222         (RuntimeObjectImp::get):
1223         (RuntimeObjectImp::put):
1224         (RuntimeObjectImp::canPut):
1225         (RuntimeObjectImp::hasProperty):
1226         (RuntimeObjectImp::defaultValue):
1227         * bindings/runtime_object.h:
1228         * kjs/object.cpp:
1229         (KJS::ObjectImp::ObjectImp):
1230         * kjs/object.h:
1231
1232 2005-01-20  Darin Adler  <darin@apple.com>
1233
1234         Reviewed by me, changes by Han Ming Ong.
1235
1236         - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
1237
1238         * bindings/objc/WebScriptObjectPrivate.h: Make members public.
1239         * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
1240
1241 2005-01-20  Richard Williamson   <rjw@apple.com>
1242
1243         Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
1244
1245         The comprehensive fix for this problem requires new API, as described in 3965326.  However,
1246         given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
1247         like and Undefined object if  invokeUndefinedMethodFromWebScript:withArguments: isn't
1248         implemented on the bound object.
1249
1250         Reviewed by Chris.
1251
1252         * bindings/objc/objc_runtime.h:
1253         * bindings/objc/objc_runtime.mm:
1254         (ObjcFallbackObjectImp::type):
1255         (ObjcFallbackObjectImp::implementsCall):
1256         (ObjcFallbackObjectImp::toBoolean):
1257         * bindings/testbindings.mm:
1258         (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
1259         (+[MyFirstInterface isKeyExcludedFromWebScript:]):
1260
1261 === Safari-180 ===
1262
1263 2005-01-19  Richard Williamson   <rjw@apple.com>
1264
1265         Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
1266
1267         Fixed the following problems with LiveConnect that are demonstrated by the application
1268         described in 3853676.
1269
1270         1.  If a nil object is passed in an array from Java to JavaScript we will crash.
1271         2.  We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
1272         3.  We will sometimes fail to find the correct static method ID.
1273
1274         Reviewed by Maciej.
1275
1276         * bindings/jni/jni_jsobject.cpp:
1277         (JSObject::convertJObjectToValue):
1278         (JSObject::listFromJArray):
1279         * bindings/jni/jni_runtime.cpp:
1280         (JavaField::valueFromInstance):
1281         (JavaField::setValueToInstance):
1282         * bindings/jni/jni_utility.cpp:
1283         (KJS::Bindings::getMethodID):
1284         (KJS::Bindings::convertValueToJValue):
1285         * bindings/runtime_array.h:
1286
1287 2005-01-18  Richard Williamson   <rjw@apple.com>
1288
1289         Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
1290
1291         Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
1292         Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
1293         Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
1294         Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
1295
1296         We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
1297         tags.  Also, if any of these elements are named they can be accessed from the document or window objects.
1298         Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
1299
1300         Reviewed by Chris.
1301
1302         * bindings/objc/objc_instance.h:
1303         * bindings/objc/objc_instance.mm:
1304         (ObjcInstance::supportsSetValueOfUndefinedField):
1305         * bindings/runtime.h:
1306         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
1307         * bindings/runtime_object.cpp:
1308         (RuntimeObjectImp::RuntimeObjectImp):
1309         (RuntimeObjectImp::get):
1310         (RuntimeObjectImp::put):
1311         (RuntimeObjectImp::canPut):
1312         (RuntimeObjectImp::hasProperty):
1313         (RuntimeObjectImp::defaultValue):
1314         * bindings/runtime_object.h:
1315         (KJS::RuntimeObjectImp::fallbackObject):
1316         * kjs/object.cpp:
1317         (KJS::ObjectImp::ObjectImp):
1318         * kjs/object.h:
1319         (KJS::ObjectImp::forwardingScriptMessage):
1320         (KJS::ObjectImp::setForwardingScriptMessage):
1321
1322 2005-01-18  Richard Williamson   <rjw@apple.com>
1323
1324         Back out a change that was incorrectly committed yesterday.
1325
1326         Reviewed by Chris.
1327
1328         * bindings/objc/objc_utility.mm:
1329         (KJS::Bindings::convertValueToObjcValue):
1330
1331 2005-01-17  Richard Williamson   <rjw@apple.com>
1332
1333         Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
1334
1335         Keep track of originating execution context and target execution
1336         context for native JS object wrappers, and perform appropriate
1337         security checks.
1338
1339         Reviewed by David Harrison.
1340
1341         * bindings/NP_jsobject.cpp:
1342         (_isSafeScript):
1343         (_NPN_CreateScriptObject):
1344         (_NPN_Invoke):
1345         (_NPN_Evaluate):
1346         (_NPN_GetProperty):
1347         (_NPN_SetProperty):
1348         (_NPN_RemoveProperty):
1349         (_NPN_HasProperty):
1350         (_NPN_HasMethod):
1351         (_NPN_SetException):
1352         * bindings/NP_jsobject.h:
1353         * bindings/c/c_instance.cpp:
1354         (CInstance::CInstance):
1355         (CInstance::stringValue):
1356         * bindings/c/c_instance.h:
1357         * bindings/c/c_utility.cpp:
1358         (convertValueToNPVariant):
1359         * bindings/jni/jni_instance.cpp:
1360         (JavaInstance::JavaInstance):
1361         (JavaInstance::valueOf):
1362         * bindings/jni/jni_instance.h:
1363         * bindings/objc/WebScriptObject.mm:
1364         (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1365         (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1366         (-[WebScriptObject KJS::Bindings::]):
1367         (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
1368         (-[WebScriptObject _isSafeScript]):
1369         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1370         (-[WebScriptObject evaluateWebScript:]):
1371         (-[WebScriptObject setValue:forKey:]):
1372         (-[WebScriptObject valueForKey:]):
1373         (-[WebScriptObject removeWebScriptKey:]):
1374         (-[WebScriptObject stringRepresentation]):
1375         (-[WebScriptObject webScriptValueAtIndex:]):
1376         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1377         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1378         * bindings/objc/WebScriptObjectPrivate.h:
1379         * bindings/objc/objc_instance.h:
1380         * bindings/objc/objc_runtime.mm:
1381         (convertValueToObjcObject):
1382         * bindings/objc/objc_utility.mm:
1383         (KJS::Bindings::convertValueToObjcValue):
1384         * bindings/runtime.cpp:
1385         (Instance::Instance):
1386         (Instance::operator=):
1387         * bindings/runtime.h:
1388         (KJS::Bindings::Instance::Instance):
1389         (KJS::Bindings::Instance::setExecutionContext):
1390         (KJS::Bindings::Instance::executionContext):
1391         * bindings/runtime_root.cpp:
1392         (RootObject::setInterpreter):
1393         * bindings/runtime_root.h:
1394         * kjs/interpreter.h:
1395         (KJS::Interpreter::isGlobalObject):
1396         (KJS::Interpreter::interpreterForGlobalObject):
1397         (KJS::Interpreter::isSafeScript):
1398
1399 === Safari-179 ===
1400
1401 2005-01-13  Vicki Murley <vicki@apple.com>
1402
1403         Reviewed by Adele.
1404
1405         - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
1406  
1407         * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
1408
1409 2005-01-12  Richard Williamson   <rjw@apple.com>
1410
1411         Avoid additional work on dealloc by adding early out to
1412         removeNativeReference().  (This will save time on dealloc
1413         for all ObjC DOM objects.)
1414
1415         Reviewed by Darin.
1416
1417         * bindings/runtime_root.cpp:
1418         (KJS::Bindings::removeNativeReference):
1419
1420 2005-01-12  Richard Williamson   <rjw@apple.com>
1421
1422         Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
1423
1424         We were always returning the first "root" object for all runtime
1425         objects.  Changed 0 in loop to i, the index.
1426
1427         Reviewed by David Harrison.
1428
1429         * bindings/runtime_root.cpp:
1430         (KJS::Bindings::rootForImp):
1431
1432 2005-01-11  Richard Williamson   <rjw@apple.com>
1433
1434         Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
1435
1436         Use the new dispatching API to invoke JNI, rather than calling JNI
1437         directly.
1438
1439         Reviewed by David Harrison.
1440
1441         * bindings/jni/jni_instance.cpp:
1442         (JavaInstance::invokeMethod):
1443         * bindings/jni/jni_runtime.cpp:
1444         (JavaField::dispatchValueFromInstance):
1445         (JavaField::valueFromInstance):
1446         (JavaField::dispatchSetValueToInstance):
1447         (JavaField::setValueToInstance):
1448         * bindings/jni/jni_runtime.h:
1449         * bindings/jni/jni_utility.cpp:
1450         (KJS::Bindings::convertValueToJValue):
1451
1452 === Safari-178 ===
1453
1454 === Safari-177 ===
1455
1456 === Safari-176 ===
1457
1458 2004-12-17  Maciej Stachowiak  <mjs@apple.com>
1459
1460         Reviewed by Kevin.
1461
1462         <rdar://problem/3926869> Opening caches window after running PLT causes crash
1463         
1464         * kjs/protected_values.cpp:
1465         (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
1466         the protected value table.
1467         (KJS::ProtectedValues::increaseProtectCount): Ditto.
1468         (KJS::ProtectedValues::decreaseProtectCount): Ditto.
1469
1470 2004-12-16  Darin Adler  <darin@apple.com>
1471
1472         Reviewed by Maciej.
1473
1474         - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
1475
1476         * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
1477         * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
1478         non-locale-specific versions.
1479         * kjs/string_object.lut.h: Regenerated.
1480
1481 2004-12-14  Richard Williamson   <rjw@apple.com>
1482
1483         Pass URL of plugin view when call into JNI.
1484
1485         Reviewed by Chris.
1486
1487         * bindings/jni/jni_objc.mm:
1488         (KJS::Bindings::dispatchJNICall):
1489
1490 2004-12-13  Richard Williamson   <rjw@apple.com>
1491
1492         Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
1493
1494         Add support for calling static Java methods from JavaScript.
1495
1496         Reviewed by Maciej.
1497
1498         * bindings/jni/jni_instance.cpp:
1499         (JavaInstance::invokeMethod):
1500         * bindings/jni/jni_runtime.cpp:
1501         (JavaMethod::JavaMethod):
1502         * bindings/jni/jni_runtime.h:
1503         (KJS::Bindings::JavaMethod::isStatic):
1504         * bindings/jni/jni_utility.cpp:
1505         (callJNIStaticMethod):
1506         (KJS::Bindings::callJNIBooleanMethod):
1507         (KJS::Bindings::callJNIStaticBooleanMethod):
1508         * bindings/jni/jni_utility.h:
1509
1510 2004-12-13  Richard Williamson   <rjw@apple.com>
1511
1512         Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
1513
1514         Reviewed by John.
1515
1516         * bindings/jni/jni_instance.cpp:
1517         (JavaInstance::invokeMethod):
1518         * bindings/jni/jni_objc.mm:
1519         (KJS::Bindings::dispatchJNICall):
1520         * bindings/jni/jni_runtime.h:
1521         * bindings/jni/jni_utility.h:
1522
1523 === Safari-175 ===
1524
1525 2004-12-07  Maciej Stachowiak  <mjs@apple.com>
1526
1527         Reviewed by Darin.
1528
1529         <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
1530
1531         The fix was to implement copy constructor and assignment operator,
1532         the ones that worked on the base class did not replace the
1533         defaults apparently!
1534         
1535         * kjs/protect.h:
1536         (KJS::ProtectedValue::ProtectedValue):
1537         (KJS::ProtectedValue::operator=):
1538         (KJS::ProtectedObject::ProtectedObject):
1539         (KJS::ProtectedObject::operator=):
1540         
1541         Also fixed a bug in the GC test mode that compares the results of
1542         the old collector and the new collector.
1543
1544         * kjs/value.cpp:
1545         (ValueImp::mark):
1546
1547 === Safari-173 ===
1548
1549 2004-11-23  Richard Williamson   <rjw@apple.com>
1550
1551         Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
1552
1553         Reviewed by Ken.
1554
1555         * bindings/c/c_class.cpp:
1556         (CClass::_commonInit):
1557
1558 2004-11-21  Maciej Stachowiak  <mjs@apple.com>
1559
1560         Reviewed by Ken.
1561
1562         <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
1563         
1564         * kjs/collector.cpp:
1565         (KJS::Collector::Thread::Thread):
1566         (KJS::destroyRegisteredThread):
1567         (KJS::initializeRegisteredThreadKey):
1568         (KJS::Collector::registerThread):
1569         (KJS::Collector::markStackObjectsConservatively):
1570         (KJS::Collector::markCurrentThreadConservatively):
1571         (KJS::Collector::markOtherThreadConservatively):
1572         * kjs/collector.h:
1573         * kjs/internal.cpp:
1574         (lockInterpreter):
1575         * kjs/value.h:
1576
1577 === Safari-172 ===
1578
1579 2004-11-15  Richard Williamson   <rjw@apple.com>
1580
1581         Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
1582
1583         Reviewed by Hyatt.
1584
1585         * bindings/objc/objc_instance.mm:
1586         (ObjcInstance::stringValue):
1587         * bindings/objc/objc_utility.h:
1588         * bindings/objc/objc_utility.mm:
1589         (KJS::Bindings::convertNSStringToString):
1590         (KJS::Bindings::convertObjcValueToValue):
1591
1592 === Safari-171 ===
1593
1594 2004-11-09  Chris Blumenberg  <cblu@apple.com>
1595
1596         Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
1597
1598         Reviewed by rjw.
1599
1600         * ChangeLog:
1601         * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
1602         * bindings/softlinking.c: Added.
1603         (loadFramework): new
1604         (getFunctionPointer): new
1605         (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
1606
1607 === Safari-170 ===
1608
1609 2004-11-04  Darin Adler  <darin@apple.com>
1610
1611         Reviewed by Ken.
1612
1613         - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
1614         - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
1615           and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
1616           than allocating a new one
1617
1618         * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
1619         (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
1620         of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
1621         actually allocate only the very first time it's called.
1622         (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
1623         shared instance since there can be only one).
1624         (-[WebUndefined copyWithZone:]): Ditto.
1625         (-[WebUndefined retain]): Ditto.
1626         (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
1627         of class).
1628         (-[WebUndefined autorelease]): Simplified to just return self (see above).
1629         (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
1630         (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
1631         a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
1632         bug mentioned above).
1633         (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
1634         No need to call init, since that's a no-op for this class.
1635
1636 2004-11-03  David Harrison  <harrison@apple.com>
1637
1638         Reviewed by Darin.
1639         
1640         Eliminate the use of a marker file to determine how to build.
1641
1642         * .cvsignore:
1643         * Makefile.am:
1644
1645 2004-11-01  Richard Williamson   <rjw@apple.com>
1646
1647         Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
1648
1649         Reviewed by Ken.
1650
1651         * bindings/c/c_instance.cpp:
1652         (CInstance::invokeMethod):
1653         (CInstance::invokeDefaultMethod):
1654         Initialize out parameters to void type.
1655
1656         * bindings/c/c_runtime.cpp:
1657         (CField::valueFromInstance):
1658         (CField::setValueToInstance):
1659         Initialize out parameters to void type.
1660         Also added additional checks to protect against classes that 
1661         don't implement all functions.
1662
1663 2004-11-01  Richard Williamson   <rjw@apple.com>
1664
1665         Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
1666
1667         Reviewed by John.
1668
1669         * ChangeLog:
1670         * bindings/objc/WebScriptObject.mm:
1671         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1672         Added additional conversion Undefined -> WebUndefined.
1673         * bindings/objc/objc_utility.mm:
1674         (KJS::Bindings::convertObjcValueToValue):
1675         Added additional conversion WebUndefined -> Undefined.
1676
1677 2004-11-01  Darin Adler  <darin@apple.com>
1678
1679         - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
1680
1681         * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
1682         this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
1683         report to match the contents of the file.
1684
1685 === Safari-169 ===
1686
1687 === Safari-168 ===
1688
1689 2004-10-22  Ken Kocienda  <kocienda@apple.com>
1690
1691         Reviewed by me
1692
1693         * JavaScriptCore.pbproj/project.pbxproj:  
1694         Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
1695
1696 === Safari-167 ===
1697
1698 2004-10-13  Richard Williamson   <rjw@apple.com>
1699
1700         Moved boolean checks prior to NSNumber checks.  booleans are
1701         NSNumbers.
1702
1703         Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
1704
1705         Reviewed by John.
1706
1707         * bindings/objc/objc_utility.mm:
1708         (KJS::Bindings::convertObjcValueToValue):
1709
1710 2004-10-12  Richard Williamson   <rjw@apple.com>
1711
1712         Fixed access to DOM object via WebScriptObject API.
1713         The execution context for DOM objects wasn't being found.       
1714         <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
1715
1716         Reviewed by Chris.
1717
1718         * bindings/objc/WebScriptObject.mm:
1719         (_didExecute):
1720         (-[WebScriptObject KJS::Bindings::]):
1721         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1722         (-[WebScriptObject evaluateWebScript:]):
1723         (-[WebScriptObject setValue:forKey:]):
1724         (-[WebScriptObject valueForKey:]):
1725         (-[WebScriptObject stringRepresentation]):
1726         * bindings/objc/WebScriptObjectPrivate.h:
1727
1728 2004-10-09  Darin Adler  <darin@apple.com>
1729
1730         Reviewed by Kevin.
1731
1732         - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
1733
1734         * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
1735         creating an init routine.
1736
1737         * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
1738         require a global constructor that creates an init routine.
1739
1740 2004-10-09  Darin Adler  <darin@apple.com>
1741
1742         Reviewed by Kevin.
1743
1744         - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
1745
1746         * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
1747         work with the window object of the page the function is in, not the page of the caller. This
1748         is what all other browsers do. This code was hidden before by the "everything is defined on
1749         window object" hack in WebCore.
1750
1751 2004-10-07  Richard Williamson   <rjw@apple.com>
1752
1753         Added simple JavaScript call tracing.  Very useful for
1754         debugging complex pages.
1755
1756         Tracing is only available in development builds and is
1757         enabled by:
1758
1759         (gdb) set traceJavaScript = 1
1760
1761         or programatically
1762
1763         setTraceJavaScript(true)
1764
1765         Function, args, and return values are printed to console.  Very
1766         verbose.
1767
1768         Reviewed by Ken.
1769
1770         * kjs/function_object.cpp:
1771         (FunctionProtoFuncImp::call):
1772         * kjs/object.cpp:
1773         (KJS::Object::call):
1774
1775 === Safari-166 ===
1776
1777 2004-10-05  Richard Williamson   <rjw@apple.com>
1778
1779         Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
1780
1781         Reviewed by Chris.
1782
1783         * bindings/NP_jsobject.cpp:
1784         (_NPN_SetException):
1785         * bindings/npruntime.cpp:
1786         (_NPN_SetExceptionWithUTF8):
1787         * bindings/objc/WebScriptObject.mm:
1788         (+[WebScriptObject throwException:]):
1789         * kjs/internal.h:
1790         (KJS::InterpreterImp::context):
1791
1792 2004-10-05  Richard Williamson   <rjw@apple.com>
1793
1794         Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
1795
1796         Reviewed by Ken.
1797
1798         * bindings/objc/objc_utility.mm:
1799         (KJS::Bindings::convertObjcValueToValue):
1800
1801 2004-10-04  Darin Adler  <darin@apple.com>
1802
1803         Reviewed by Ken.
1804
1805         - rolled in a fix the KDE folks did for the operations that generate HTML fragments
1806
1807         * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
1808
1809         - rolled out an old workaround we don't need any more
1810
1811         * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
1812         required it is no longer there.
1813
1814 2004-09-30  Richard Williamson  <rjw@apple.com>
1815
1816         Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
1817
1818         Reviewed by Chris.
1819
1820         * bindings/NP_jsobject.cpp:
1821         (_NPN_GetProperty):
1822         (_NPN_HasProperty):
1823         (_NPN_HasMethod):
1824         * bindings/c/c_class.cpp:
1825         (CClass::methodsNamed):
1826         (CClass::fieldNamed):
1827         * bindings/c/c_class.h:
1828         * bindings/c/c_instance.cpp:
1829         (CInstance::invokeMethod):
1830         * bindings/jni/jni_class.cpp:
1831         (JavaClass::methodsNamed):
1832         * bindings/jni/jni_class.h:
1833         * bindings/npruntime.h:
1834         * bindings/objc/objc_class.h:
1835         * bindings/objc/objc_class.mm:
1836         (ObjcClass::methodsNamed):
1837         * bindings/runtime.h:
1838         * bindings/runtime_object.cpp:
1839         (RuntimeObjectImp::get):
1840         (RuntimeObjectImp::hasProperty):
1841
1842 2004-09-29  Chris Blumenberg  <cblu@apple.com>
1843
1844         Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
1845
1846         Reviewed by rjw.
1847
1848         * JavaScriptCore.pbproj/project.pbxproj:
1849         * bindings/NP_jsobject.cpp:
1850         (_NPN_CreateScriptObject):
1851         (_NPN_InvokeDefault):
1852         (_NPN_Invoke):
1853         (_NPN_Evaluate):
1854         (_NPN_GetProperty):
1855         (_NPN_SetProperty):
1856         (_NPN_RemoveProperty):
1857         (_NPN_HasProperty):
1858         (_NPN_HasMethod):
1859         * bindings/c/c_class.cpp:
1860         (CClass::methodsNamed):
1861         (CClass::fieldNamed):
1862         * bindings/c/c_instance.cpp:
1863         (CInstance::CInstance):
1864         (CInstance::~CInstance):
1865         (CInstance::operator=):
1866         (CInstance::invokeMethod):
1867         (CInstance::invokeDefaultMethod):
1868         * bindings/c/c_runtime.cpp:
1869         * bindings/c/c_runtime.h:
1870         (KJS::Bindings::CField::name):
1871         (KJS::Bindings::CMethod::name):
1872         * bindings/npruntime.cpp:
1873         (_NPN_GetStringIdentifier):
1874         (_NPN_GetStringIdentifiers):
1875         (_NPN_GetIntIdentifier):
1876         (_NPN_IdentifierIsString):
1877         (_NPN_UTF8FromIdentifier):
1878         (_NPN_IntFromIdentifier):
1879         (NPN_InitializeVariantWithObject):
1880         (_NPN_ReleaseVariantValue):
1881         (_NPN_CreateObject):
1882         (_NPN_RetainObject):
1883         (_NPN_ReleaseObject):
1884         (_NPN_SetExceptionWithUTF8):
1885         (_NPN_SetException):
1886
1887 2004-09-26  Darin Adler  <darin@apple.com>
1888
1889         * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
1890         low() to get Unicode value of character, and just use unicode().
1891
1892 2004-09-26  Darin Adler  <darin@apple.com>
1893
1894         - refine charAt/charCodeAt fix slightly
1895
1896         * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
1897         omitted parameter, as we do everywhere else, and as other browsers do here.
1898
1899 2004-09-26  Darin Adler  <darin@apple.com>
1900
1901         Reviewed by Kevin.
1902
1903         - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
1904
1905         * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
1906         the program. We were doing this properly for functions, but not entire programs.
1907
1908         - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
1909
1910         * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
1911         and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
1912
1913         * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
1914
1915 === Safari-165 ===
1916
1917 === Safari-164 ===
1918
1919 2004-09-14  Richard Williamson   <rjw@apple.com>
1920
1921         1.  Add class parameter to object allocation function.  This is somewhat redundant, given that
1922         the allocation function is in the class function vector, but people wanted to use the same
1923         allocation function for different classes.
1924         
1925         2.  Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
1926         
1927         3.  Add support for a default function on an object.  This is a feature that ActiveX supports,
1928         and will allow JavaScript code to be written that will look exactly the same for both ActiveX
1929         plugins and Netscape or WebKit plugins.  There are implementations included for the 'C' and
1930         'Objective-C' bindings.
1931         
1932         There bugs are covered by
1933         
1934         <rdar://problem/3776343> Support for default functions in the JavaScript bindings
1935         <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
1936         <rdar://problem/3674754> Need to implement latest npruntime.h
1937
1938         Reviewed by John.
1939
1940         * bindings/NP_jsobject.cpp:
1941         (jsAllocate):
1942         (NPN_InvokeDefault):
1943         (NPN_Invoke):
1944         * bindings/c/c_class.cpp:
1945         * bindings/c/c_instance.cpp:
1946         (CInstance::CInstance):
1947         (CInstance::operator=):
1948         (CInstance::invokeMethod):
1949         (CInstance::invokeDefaultMethod):
1950         * bindings/c/c_instance.h:
1951         * bindings/c/c_runtime.cpp:
1952         * bindings/c/c_runtime.h:
1953         * bindings/jni/jni_instance.cpp:
1954         (JavaInstance::invokeDefaultMethod):
1955         * bindings/jni/jni_instance.h:
1956         * bindings/npruntime.cpp:
1957         (NPN_CreateObject):
1958         * bindings/npruntime.h:
1959         * bindings/objc/WebScriptObject.h:
1960         * bindings/objc/objc_class.mm:
1961         (ObjcClass::fallbackObject):
1962         * bindings/objc/objc_instance.h:
1963         * bindings/objc/objc_instance.mm:
1964         (ObjcInstance::invokeDefaultMethod):
1965         * bindings/objc/objc_runtime.h:
1966         * bindings/objc/objc_runtime.mm:
1967         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
1968         (ObjcFallbackObjectImp::get):
1969         (ObjcFallbackObjectImp::put):
1970         (ObjcFallbackObjectImp::canPut):
1971         (ObjcFallbackObjectImp::implementsCall):
1972         (ObjcFallbackObjectImp::call):
1973         (ObjcFallbackObjectImp::hasProperty):
1974         (ObjcFallbackObjectImp::deleteProperty):
1975         (ObjcFallbackObjectImp::defaultValue):
1976         * bindings/runtime.h:
1977         (KJS::Bindings::Class::fallbackObject):
1978         (KJS::Bindings::Instance::getValueOfUndefinedField):
1979         (KJS::Bindings::Instance::setValueOfUndefinedField):
1980         (KJS::Bindings::Instance::valueOf):
1981         * bindings/runtime_object.cpp:
1982         (RuntimeObjectImp::implementsCall):
1983         (RuntimeObjectImp::call):
1984         * bindings/runtime_object.h:
1985
1986 2004-09-13  Maciej Stachowiak  <mjs@apple.com>
1987
1988         Reviewed by Darin.
1989
1990         <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
1991         
1992         * kjs/string_object.cpp:
1993         (StringProtoFuncImp::call): Replaced implementation of replace()
1994         method with function below...
1995         (replace): In order to avoid excessive allocation and copying,
1996         figure out the ranges of the original string and replacement
1997         strings to be assembled, instead of constantly creating new
1998         strings at each substitution. The old behavior is basically O(N^2)
1999         for a global replace on a pattern that matches many places in the
2000         string.
2001         (regExpIsGlobal): Helper function for the above.
2002         (expandSourceRanges): ditto
2003         (pushSourceRange): ditto
2004         (expandReplacements): ditto
2005         (pushReplacement): ditto
2006         * kjs/ustring.cpp:
2007         (KJS::UString::spliceSubstringsWithSeparators): New method that
2008         pieces together substring ranges of this string together with
2009         specified separators, all at one go.
2010         * kjs/ustring.h:
2011         (KJS::UString::Range::Range): Added new helper class to represent
2012         substring choices.
2013
2014 2004-09-14  Maciej Stachowiak  <mjs@apple.com>
2015
2016         Reviewed by Darin.
2017
2018         - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
2019         
2020         * kjs/function.cpp:
2021         (KJS::GlobalFuncImp::call): Make sure to escape null
2022         characters. This is a bug in the new code that made part of the
2023         test fail.
2024
2025 2004-09-13  Darin Adler  <darin@apple.com>
2026
2027         Reviewed by Kevin and Maciej.
2028
2029         - new function to support fix for DIG bug in WebCore
2030
2031         * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
2032         * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
2033
2034 2004-09-12  Darin Adler  <darin@apple.com>
2035
2036         * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
2037         of escape and unescape.
2038
2039 2004-09-12  Darin Adler  <darin@apple.com>
2040
2041         Reviewed by Maciej.
2042
2043         - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
2044
2045         * kjs/date_object.cpp:
2046         (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
2047         uses CFDateFormatter.
2048         (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
2049
2050 2004-09-09  Maciej Stachowiak  <mjs@apple.com>
2051
2052         Reviewed by Richard.
2053
2054         <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
2055
2056         * kjs/function.cpp:
2057         (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
2058         ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
2059         * kjs/lexer.cpp:
2060         (Lexer::isHexDigit): Made static and non-const.
2061         * kjs/lexer.h:
2062
2063 === Safari-163 ===
2064
2065 2004-09-06  Darin Adler  <darin@apple.com>
2066
2067         * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
2068
2069 === Safari-162 ===
2070
2071 2004-09-01  Richard Williamson   <rjw@apple.com>
2072
2073         Add pid to exception messages (to help debug dashboard clients).
2074
2075         Reviewed by Chris.
2076
2077         * kjs/interpreter.cpp:
2078         (Interpreter::evaluate):
2079
2080 === Safari-161 ===
2081
2082 2004-08-20  Richard Williamson   <rjw@apple.com>
2083
2084         Implemented new JNI abstraction.  We no longer invoke Java methods
2085         directly with JNI, rather we call into the plugin.  This allows the
2086         plugin to dispatch the call to the appropriate VM thread.  This
2087         change should (will?) fix a whole class of threading related problems with
2088         the Java VM.
2089
2090         Reviewed by Hyatt.
2091
2092         * JavaScriptCore.pbproj/project.pbxproj:
2093         * bindings/c/c_instance.h:
2094         (KJS::Bindings::CInstance::setExecutionContext):
2095         (KJS::Bindings::CInstance::executionContext):
2096         * bindings/jni/jni_instance.cpp:
2097         (JavaInstance::JavaInstance):
2098         (JavaInstance::invokeMethod):
2099         (JavaInstance::setExecutionContext):
2100         (JavaInstance::executionContext):
2101         * bindings/jni/jni_instance.h:
2102         * bindings/jni/jni_jsobject.cpp:
2103         (JSObject::convertJObjectToValue):
2104         * bindings/jni/jni_runtime.cpp:
2105         (JavaField::JavaField):
2106         (JavaArray::convertJObjectToArray):
2107         (JavaField::valueFromInstance):
2108         (JavaArray::JavaArray):
2109         (JavaArray::valueAt):
2110         * bindings/jni/jni_runtime.h:
2111         (KJS::Bindings::JavaArray::operator=):
2112         (KJS::Bindings::JavaArray::executionContext):
2113         * bindings/jni/jni_utility.h:
2114         * bindings/objc/objc_instance.h:
2115         (KJS::Bindings::ObjcInstance::setExecutionContext):
2116         (KJS::Bindings::ObjcInstance::executionContext):
2117         * bindings/runtime.cpp:
2118         (Instance::createBindingForLanguageInstance):
2119         * bindings/runtime.h:
2120         * bindings/runtime_root.h:
2121         (KJS::Bindings::RootObject::nativeHandle):
2122
2123 === Safari-158 ===
2124
2125 2004-08-19  Vicki Murley  <vicki@apple.com>
2126
2127         Reviewed by John.
2128
2129         * kjs/property_map.cpp:
2130         (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
2131
2132 2004-08-17  Darin Adler  <darin@apple.com>
2133
2134         Reviewed by Adele.
2135
2136         - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
2137
2138         * kjs/property_map.h: Added some private functions.
2139         * kjs/property_map.cpp:
2140         (KJS::PropertyMap::clear): Set sentinelCount to 0.
2141         (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
2142         Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
2143         (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
2144         (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
2145         (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
2146         deleted-element sentinels.
2147         (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
2148
2149 2004-08-16  Maciej Stachowiak  <mjs@apple.com>
2150
2151         Code change by Eric Albert, reviewd by me.
2152
2153         <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
2154
2155         * kjs/date_object.cpp:
2156         (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
2157         entirely would be even better, but is not required to fix this bug.
2158
2159 === Safari-157 ===
2160
2161 2004-08-16  Richard Williamson   <rjw@apple.com>
2162
2163         Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
2164
2165         Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
2166
2167         Reviewed by Chris.
2168
2169         * bindings/NP_jsobject.cpp:
2170         (NPN_Evaluate):
2171         * bindings/jni/jni_jsobject.cpp:
2172         (JSObject::eval):
2173         * bindings/objc/WebScriptObject.mm:
2174         (-[WebScriptObject evaluateWebScript:]):
2175
2176 2004-08-15  Richard Williamson   <rjw@apple.com>
2177
2178         More updates to np headers.  Implemented new NPN functions.
2179
2180         Reviewed by Darin.
2181
2182         * bindings/NP_jsobject.cpp:
2183         (NPN_HasProperty):
2184         (NPN_HasMethod):
2185         * bindings/npapi.h:
2186         * bindings/npruntime.h:
2187
2188 2004-08-13  Darin Adler  <darin@apple.com>
2189
2190         - fix build so we can compile again
2191
2192         * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
2193         is good enough so that we can compile, but it's only a stopgap measure, because I think
2194         Richard has a newer one he wants to check in.
2195
2196 2004-08-12  Richard Williamson   <rjw@apple.com>
2197
2198         Bring npruntime.h and friends closer to compliance with
2199         latest spec.
2200
2201         Reviewed by Maciej.
2202
2203         * JavaScriptCore.pbproj/project.pbxproj:
2204         * bindings/NP_jsobject.cpp:
2205         (jsAllocate):
2206         (_NPN_CreateScriptObject):
2207         (NPN_Call):
2208         (NPN_Evaluate):
2209         (NPN_GetProperty):
2210         (NPN_SetProperty):
2211         (NPN_RemoveProperty):
2212         * bindings/NP_jsobject.h:
2213         * bindings/c/c_instance.cpp:
2214         (CInstance::invokeMethod):
2215         * bindings/c/c_utility.cpp:
2216         (convertNPVariantToValue):
2217         * bindings/npruntime.cpp:
2218         (NPN_IdentifierIsString):
2219         (NPN_VariantIsVoid):
2220         (NPN_VariantIsNull):
2221         (NPN_VariantIsUndefined):
2222         (NPN_VariantIsBool):
2223         (NPN_VariantIsInt32):
2224         (NPN_VariantIsDouble):
2225         (NPN_VariantIsString):
2226         (NPN_VariantIsObject):
2227         (NPN_VariantToBool):
2228         (NPN_VariantToString):
2229         (NPN_VariantToInt32):
2230         (NPN_VariantToDouble):
2231         (NPN_VariantToObject):
2232         (NPN_InitializeVariantAsVoid):
2233         (NPN_InitializeVariantAsNull):
2234         (NPN_InitializeVariantAsUndefined):
2235         (NPN_InitializeVariantWithBool):
2236         (NPN_InitializeVariantWithInt32):
2237         (NPN_InitializeVariantWithDouble):
2238         (NPN_InitializeVariantWithString):
2239         (NPN_InitializeVariantWithStringCopy):
2240         (NPN_InitializeVariantWithObject):
2241         (NPN_InitializeVariantWithVariant):
2242         (NPN_ReleaseVariantValue):
2243         (NPN_CreateObject):
2244         * bindings/npruntime.h:
2245         (_NPString::):
2246         (_NPString::_NPVariant::):
2247         * bindings/npruntime_priv.h: Added.
2248
2249 2004-08-12  Darin Adler  <darin@apple.com>
2250
2251         Reviewed by Adele.
2252
2253         - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
2254
2255         * kjs/function.cpp:
2256         (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
2257         (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
2258         (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
2259         to skip leading "+" or "-".
2260
2261 === Safari-156 ===
2262
2263 2004-08-12  Darin Adler  <darin@apple.com>
2264
2265         Reviewed by Ken.
2266
2267         - fixed 43 Mozilla JavaScript tests
2268
2269         * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
2270         * kjs/date_object.cpp:
2271         (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
2272         than constructing a number object to pass to it.
2273         (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
2274         (KJS::parseDate): Change to return a double instead of creating the Number object here.
2275         (KJS::timeClip): Implement this as specified in the language standard.
2276
2277         * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
2278         flags on the prototype property.
2279
2280         * kjs/function.cpp:
2281         (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
2282         currently in scope.
2283         (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
2284         file later.
2285         (KJS::parseDigit): Added. Helper function for parseInt.
2286         (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
2287         strtoll can handle. Also matches standard more closely.
2288         (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
2289         instead of 0.
2290         (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
2291
2292         * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
2293
2294         * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
2295         * kjs/lexer.cpp:
2296         (Lexer::setCode): Clear error state.
2297         (Lexer::lex): Set error state if the lexer encounters an error
2298
2299         * kjs/internal.cpp:
2300         (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
2301         (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
2302
2303         * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
2304         Change round to round values between -0.5 and -0 to -0 instead of +0.
2305
2306         * kjs/nodes.h: Add evaluateReference function to GroupNode.
2307         * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
2308         expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
2309         would change x.y into a value that can't be deleted as a side effect.
2310
2311         * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
2312         the specification.
2313
2314         * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
2315         get rid of the fixed size limit for code.
2316
2317         * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
2318         returns the string without creating a new Rep, since I'm using substr in a place where it will
2319         often be passed a 0.
2320
2321         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
2322         the other day that was making a couple tests fail.
2323         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
2324         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
2325         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
2326         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
2327         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
2328
2329         * kjs/string_object.lut.h: Regenerated.
2330
2331 2004-08-11  Darin Adler  <darin@apple.com>
2332
2333         - fixed a tiny problem with the UTF-16 PCRE check-in
2334
2335         * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
2336         the ctype_meta flag to get set in items that should not have it.
2337
2338         * pcre/chartables.c: Regenerated.
2339
2340 2004-08-10  Richard Williamson   <rjw@apple.com>
2341
2342         Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
2343
2344         The following WebScripting methods are now supported on bound
2345         objects:
2346
2347         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
2348         - (void)setValue:(id)value forUndefinedKey:(NSString *)key
2349         - (id)valueForUndefinedKey:(NSString *)key
2350
2351         Reviewed by Chris.
2352
2353         * bindings/c/c_class.cpp:
2354         (CClass::fieldNamed):
2355         * bindings/c/c_class.h:
2356         * bindings/jni/jni_class.cpp:
2357         (JavaClass::fieldNamed):
2358         * bindings/jni/jni_class.h:
2359         * bindings/objc/objc_class.h:
2360         (KJS::Bindings::ObjcClass::isa):
2361         * bindings/objc/objc_class.mm:
2362         (ObjcClass::methodsNamed):
2363         (ObjcClass::fieldNamed):
2364         (ObjcClass::fallbackObject):
2365         * bindings/objc/objc_instance.h:
2366         * bindings/objc/objc_instance.mm:
2367         (ObjcInstance::invokeMethod):
2368         (ObjcInstance::setValueOfField):
2369         (ObjcInstance::setValueOfUndefinedField):
2370         (ObjcInstance::getValueOfField):
2371         (ObjcInstance::getValueOfUndefinedField):
2372         * bindings/objc/objc_runtime.h:
2373         (KJS::Bindings::ObjcField::~ObjcField):
2374         (KJS::Bindings::ObjcField::ObjcField):
2375         (KJS::Bindings::ObjcField::operator=):
2376         (KJS::Bindings::FallbackObjectImp::classInfo):
2377         * bindings/objc/objc_runtime.mm:
2378         (ObjcField::ObjcField):
2379         (ObjcField::name):
2380         (ObjcField::type):
2381         (ObjcField::valueFromInstance):
2382         (ObjcField::setValueToInstance):
2383         (FallbackObjectImp::FallbackObjectImp):
2384         (FallbackObjectImp::get):
2385         (FallbackObjectImp::put):
2386         (FallbackObjectImp::canPut):
2387         (FallbackObjectImp::implementsCall):
2388         (FallbackObjectImp::call):
2389         (FallbackObjectImp::hasProperty):
2390         (FallbackObjectImp::deleteProperty):
2391         (FallbackObjectImp::defaultValue):
2392         * bindings/runtime.h:
2393         (KJS::Bindings::Class::fallbackObject):
2394         (KJS::Bindings::Instance::getValueOfUndefinedField):
2395         (KJS::Bindings::Instance::setValueOfUndefinedField):
2396         * bindings/runtime_object.cpp:
2397         (RuntimeObjectImp::get):
2398         (RuntimeObjectImp::put):
2399         (RuntimeObjectImp::canPut):
2400         (RuntimeObjectImp::hasProperty):
2401         * bindings/testbindings.mm:
2402         (-[MyFirstInterface valueForUndefinedKey:]):
2403         (-[MyFirstInterface setValue:forUndefinedKey:]):
2404
2405 2004-08-10  Darin Adler  <darin@apple.com>
2406
2407         Reviewed by Dave.
2408
2409         - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
2410
2411         * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
2412         or uint16_t depending on the mode, and used appropriate in the 7 public functions
2413         that need to use it.
2414         * pcre/pcre.c: Add UTF-16 support to all functions.
2415         * pcre/study.c: Ditto.
2416
2417         * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
2418         the mode. Changed declarations to use symbolic constants and typedefs so we size
2419         things to ichar when needed.
2420
2421         * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
2422         sized to 16-bit characters instead of 8-bit.
2423
2424         * pcre/get.c:
2425         (pcre_copy_substring): Use pcre_char instead of char.
2426         (pcre_get_substring_list): Ditto.
2427         (pcre_free_substring_list): Ditto.
2428         (pcre_get_substring): Ditto.
2429         (pcre_free_substring): Ditto.
2430
2431         * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
2432         of hard-coding 8-bit table sizes.
2433
2434         * pcre/chartables.c: Regenerated.
2435
2436         * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
2437         * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
2438         is not null. The null string still has a null pointer. This prevents us from
2439         passing a null through to the regular expression engine (which results in a null
2440         error even when the string length is 0).
2441
2442         * kjs/regexp.cpp:
2443         (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
2444         (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
2445
2446 2004-08-09  Darin Adler  <darin@apple.com>
2447
2448         Reviewed by Maciej.
2449
2450         - fixed 28 Mozilla JavaScript tests
2451
2452         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
2453         checking the number of arguments for the join method.
2454
2455         * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
2456         than integers, so we aren't limited to 32 bits.
2457
2458         * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
2459         the implementation of the pow operation. Also simplied a case that was handling positive
2460         and negative infinity separately.
2461
2462         * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
2463         putting them in a long, so that unsigned shift will work properly.
2464
2465         * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
2466
2467         * kjs/operations.cpp:
2468         (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
2469         sign of isinf; our isinf function returns +1 even for negative infinity.
2470         (KJS::isNegInf): And again.
2471         (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
2472         Our floating point already handles the various infinity cases correctly.
2473
2474         * kjs/regexp_object.cpp:
2475         (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
2476         (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
2477         array in cases where we did not match.
2478         (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
2479         "global", "ignoreCase", "multiline", and "source".
2480
2481         * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
2482         string into undefined rather than an empty string. For the slice method, handle an
2483         undefined parameter for the limit properly as decribed in the specification, and add
2484         the limit to one case that didn't have the limit at all. For the methods that generate
2485         HTML strings, use lowercase tags instead of uppercase.
2486
2487         * kjs/ustring.cpp:
2488         (KJS::UChar::toLower): Use u_tolower from the ICU library.
2489         (KJS::UChar::toUpper): Use u_toupper from the ICU library.
2490         (KJS::UString::append): Fix some math that caused a buffer overflow.
2491         (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
2492         flag) rather than converting them all to 0.
2493         (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
2494
2495         * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
2496
2497         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
2498         the Unicode specification in a few cases where it was wrong before.
2499         * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
2500         * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
2501         * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
2502         * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
2503         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
2504         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
2505         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
2506         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
2507         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
2508
2509         * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
2510
2511         * kjs/number_object.lut.h: Regenerated.
2512
2513 2004-08-09  Darin Adler  <darin@apple.com>
2514
2515         Reviewed by Maciej.
2516
2517         - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
2518
2519         * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
2520         we get a buffer overflow.
2521
2522 === Safari-155 ===
2523
2524 2004-08-05  Richard Williamson   <rjw@apple.com>
2525
2526         Fixed part of 3674747.  The QT guys need this for feature freeze.
2527
2528         This patch implements support for the
2529
2530         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
2531
2532         method of objects bound to JavaScript.
2533
2534         Reviewed by John.
2535
2536         * ChangeLog:
2537         * bindings/objc/objc_class.mm:
2538         (ObjcClass::methodsNamed):
2539         (ObjcClass::fieldNamed):
2540         * bindings/objc/objc_instance.mm:
2541         (ObjcInstance::invokeMethod):
2542         * bindings/objc/objc_runtime.h:
2543         (KJS::Bindings::ObjcMethod::~ObjcMethod):
2544         (KJS::Bindings::ObjcMethod::isFallbackMethod):
2545         (KJS::Bindings::ObjcMethod::javaScriptName):
2546         * bindings/objc/objc_runtime.mm:
2547         (ObjcMethod::ObjcMethod):
2548         (ObjcMethod::getMethodSignature):
2549         (ObjcMethod::setJavaScriptName):
2550         * bindings/testbindings.mm:
2551
2552 2004-08-04  Vicki Murley  <vicki@apple.com>
2553
2554         Reviewed by mjs.
2555  
2556         - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error        
2557
2558         * kjs/lexer.cpp:
2559         (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
2560         go to the next line and continue parsing the string (instead of failing).  This matches 
2561         behavior in Mac IE and Mozilla.
2562
2563 2004-08-03  Kevin Decker  <kdecker@apple.com>
2564
2565         Reviewed by Darin.
2566
2567         Rolled in changes from the latest KJS sources that support additional 
2568         Number.prototype functions. 
2569
2570         Specifically this patch covers the follow parts of the ECMA 3 spec:
2571         15.7.4.5, 15.7.4.6, and 15.7.4.7 
2572         
2573         Fixes:
2574         <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
2575         <rdar://problem/3749492> missing Number.toPrecision prototype implementation
2576         <rdar://problem/3749591> missing Number.toExponential prototype implementation
2577
2578         * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
2579         list of supported identifiers (a macro).
2580         * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
2581         and toExponential(). 
2582         (NumberPrototypeImp::NumberPrototypeImp):
2583         (NumberProtoFuncImp::call):
2584         * kjs/number_object.h: Added property names for toFixed, toPrecision,
2585         and toExponential. 
2586         (KJS::NumberProtoFuncImp::):
2587         * tests/mozilla/expected.html: Update results.
2588
2589 2004-08-03  Darin Adler  <darin@apple.com>
2590
2591         Reviewed by Ken.
2592
2593         - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
2594
2595         * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
2596         we are supposed to just copy the regular expression object, and do so.
2597         Also tighten up arguments check to handle case where an actual "undefined"
2598         is passed rather than just omitting an argument.
2599
2600         * tests/mozilla/expected.html: Update results.
2601
2602 2004-08-02  Darin Adler  <darin@apple.com>
2603
2604         * tests/mozilla/.cvsignore: Added.
2605         * tests/mozilla/expected.html: Update results.
2606
2607 2004-08-02  Darin Adler  <darin@apple.com>
2608
2609         Reviewed by Ken.
2610
2611         - fixed RegExp.toString so 3 more Mozilla regexp tests pass
2612
2613         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
2614         Append the flags here so more tests paseed.
2615
2616 2004-08-02  Darin Adler  <darin@apple.com>
2617
2618         Reviewed by Ken.
2619
2620         - fixed a couple things making 5 Mozilla regexp tests pass
2621
2622         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
2623         for the prototype.
2624         (RegExpObjectImp::construct): Fix bug where the string "undefined" would
2625         be used as the flags string when no parameter was passed.
2626
2627         * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
2628         Added a class info object for RegExp prototype so it can return
2629         a string instead of raising an exception when converting to a string.
2630
2631         * tests/mozilla/expected.html: Update results.
2632
2633 2004-08-02  Darin Adler  <darin@apple.com>
2634
2635         Reviewed by Kevin.
2636
2637         - fix crashes in mozilla tests due to mishandling NaN
2638
2639         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
2640         calls to toInteger so that NaN will get turned into something that fits in an integer.
2641         These were the ones John already fixed, but his fix used isnan and the new fix is
2642         more efficient.
2643
2644         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
2645         after a call to toInteger to handle NaN properly. Also removed separate check
2646         for undefined that's not needed.
2647
2648         * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
2649         as in the above two files, but for a lot more functions. Also changed one place with
2650         an explicit check for undefined to instead just check isNaN.
2651
2652         * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
2653         like me who don't keep $SYMROOTS in their $PATH.
2654
2655 === Safari-154 ===
2656
2657 === Safari-153 ===
2658
2659 2004-07-26  Kevin Decker  <kdecker@apple.com>
2660
2661         Changes done by Darin, reviewed by Kevin.
2662
2663         - changed testkjs to build in Xcode rather than from Makefile
2664
2665         * .cvsignore: Removed obsolete files from this list.
2666         * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
2667         Changed to build target "All" rather than default target. This makes us
2668         build the testkjs test tool.
2669         * dummy.cpp: Removed.
2670         * kjs/.cvsignore: Removed obsolete files from this list, including
2671         the testkjs tool, which is now built in the symroots directory.
2672         * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
2673         changed this file. Also this has the nice side effect of causing the tool
2674         to be rebuilt in the new location even if there are no other changes in
2675         your tree when you check this out.
2676         * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
2677         without setting the execute bit on jsDriver.pl.
2678
2679 2004-07-22  Kevin Decker  <kdecker@apple.com>
2680
2681         Reviewed by Darin
2682         
2683         Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions). 
2684
2685         * kjs/function_object.cpp:
2686         (FunctionObjectImp::construct):
2687         * kjs/function_object.h:
2688         * kjs/object.cpp:
2689         (KJS::ObjectImp::construct):
2690         * kjs/object.h:
2691         (KJS::Object::construct):
2692
2693 2004-07-21  Darin Adler  <darin@apple.com>
2694
2695         * bindings/npruntime.h: Fixed typo.
2696
2697 2004-07-19  John Sullivan  <sullivan@apple.com>
2698
2699         Reviewed by Maciej.
2700         
2701         - bulletproofed array.slice() against NAN arguments. Harri noticed this
2702         vulnerability in my patch for 3714644
2703
2704         * kjs/array_object.cpp:
2705         (ArrayProtoFuncImp::call):
2706         handle NAN parameters passed to slice() by clamping to 0 and length.
2707
2708 2004-07-19  Richard Williamson   <rjw@apple.com>
2709
2710         Fixed 3733349.  Prevent Java applet callbacks into JavaScript after applet
2711         has been destroyed.
2712
2713         Reviewed by John.
2714
2715         * bindings/jni/jni_jsobject.cpp:
2716         (JSObject::invoke):
2717         (JSObject::JSObject):
2718
2719 2004-07-16  John Sullivan  <sullivan@apple.com>
2720
2721         Reviewed by Maciej.
2722         
2723         - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link 
2724         hangs browser with javascript
2725
2726         * kjs/array_object.cpp:
2727         (ArrayProtoFuncImp::call):
2728         Check for undefined type for args[0] the same way we were already checking
2729         for args[1]. In this case, args was zero-length, but we were treating
2730         args[0] like an integer anyway. Resulted in some code looping from a NAN
2731         value to 4, taking approximately forever.
2732
2733         * JavaScriptCore.pbproj/project.pbxproj:
2734         version wars
2735         
2736 === Safari-152 ===
2737
2738 2004-07-14  Maciej Stachowiak  <mjs@apple.com>
2739
2740         Reviewed by John.
2741
2742         <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
2743         <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
2744
2745         * kjs/number_object.cpp:
2746         (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
2747
2748 2004-07-13  Kevin Decker  <kdecker@apple.com>
2749
2750         Reviewed by kocienda.
2751
2752         - made testkjs and JavaScriptCore a subtarget of 'All'
2753         - testkjs now builds in $SYMROOTS
2754
2755         * JavaScriptCore.pbproj/project.pbxproj:
2756
2757 === Safari-151 ===
2758
2759 2004-06-24  Chris Blumenberg  <cblu@apple.com>
2760
2761         Ignore .mode1 files in JavaScriptCore.pbproj
2762
2763         Reviewed by kocienda.
2764
2765         * JavaScriptCore.pbproj/.cvsignore:
2766
2767 2004-06-23  Richard Williamson   <rjw@apple.com>
2768
2769         Implemented changes for latest npruntime.h.
2770         
2771         Reviewed by Chris.
2772
2773         * JavaScriptCore.pbproj/project.pbxproj:
2774         * bindings/NP_jsobject.cpp:
2775         (listFromVariantArgs):
2776         (identiferFromNPIdentifier):
2777         (_NPN_CreateScriptObject):
2778         (NPN_Call):
2779         (NPN_Evaluate):
2780         (NPN_GetProperty):
2781         (NPN_SetProperty):
2782         (NPN_RemoveProperty):
2783         * bindings/NP_jsobject.h:
2784         * bindings/c/c_class.cpp:
2785         (CClass::methodsNamed):
2786         (CClass::fieldNamed):
2787         * bindings/c/c_instance.cpp:
2788         (CInstance::invokeMethod):
2789         * bindings/c/c_utility.cpp:
2790         (convertNPVariantToValue):
2791         * bindings/c/c_utility.h:
2792         * bindings/npruntime.cpp:
2793         (stringIdentifierEqual):
2794         (stringIdentifierHash):
2795         (getStringIdentifierDictionary):
2796         (intIdentifierEqual):
2797         (intIdentifierHash):
2798         (getIntIdentifierDictionary):
2799         (NPN_GetStringIdentifier):
2800         (NPN_GetStringIdentifiers):
2801         (NPN_GetIntIdentifier):
2802         (NPN_IdentifierIsString):
2803         (NPN_UTF8FromIdentifier):
2804         (NPN_VariantToInt32):
2805         (NPN_VariantToDouble):
2806         (NPN_SetException):
2807         * bindings/npruntime.h:
2808         * bindings/objc/WebScriptObject.mm:
2809         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2810         * bindings/runtime_object.cpp:
2811         (RuntimeObjectImp::~RuntimeObjectImp):
2812         * bindings/runtime_root.cpp:
2813         (KJS::Bindings::rootForInterpreter):
2814         * bindings/testbindings.cpp:
2815         (initializeIdentifiers):
2816         (logMessage):
2817         (setDoubleValue):
2818         (setIntValue):
2819         (setBooleanValue):
2820
2821 === JavaScriptCore-146.1 ===
2822
2823 2004-06-16  Richard Williamson   <rjw@apple.com>
2824
2825         Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
2826
2827         This turned out to be a show stopper for Dashboard.  Accessing a nil
2828         ObjC property from JS caused a crash.  Similar to the problem
2829         3696112 fixed below.
2830         
2831         Reviewed by Trey.
2832
2833         * bindings/objc/objc_runtime.mm:
2834         (KJS::Bindings::ObjcField::valueFromInstance):
2835
2836 === Safari-146 ===
2837
2838 2004-06-16  Richard Williamson   <rjw@apple.com>
2839
2840         Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
2841
2842         This turned out to be a show stopper for Dashboard.  We now
2843         return Undefined() when nil is returned from a ObjC method
2844         that returns an object type.
2845         
2846         Reviewed by Maciej.
2847
2848         * bindings/objc/objc_utility.mm:
2849         (KJS::Bindings::convertObjcValueToValue):
2850
2851 === Safari-145 ===
2852
2853 2004-06-15  Richard Williamson   <rjw@apple.com>
2854
2855         Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
2856
2857         No longer need to check respondsToSelector: for
2858         isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
2859         because these now have a default implementation on NSObject.
2860
2861         Reviewed by Trey.
2862
2863         * bindings/objc/objc_class.mm:
2864         (ObjcClass::methodsNamed):
2865         (ObjcClass::fieldNamed):
2866
2867 2004-06-14  Darin Adler  <darin@apple.com>
2868
2869         Reviewed by Maciej.
2870
2871         - fixed some things for GC that Patrick missed, or that happened after the branch
2872
2873         * bindings/objc/WebScriptObject.mm:
2874         (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
2875         (-[WebScriptObject finalize]): Added.
2876
2877         - added some missing nil checks
2878
2879         * bindings/objc/objc_instance.mm:
2880         (ObjcInstance::ObjcInstance): Check for nil.
2881         (ObjcInstance::~ObjcInstance): Check for nil.
2882         (ObjcInstance::operator=): Check for nil.
2883
2884 2004-06-14  Darin Adler  <darin@apple.com>
2885
2886         Reviewed by me, code changes by Patrick Beard.
2887
2888         - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
2889
2890         * bindings/objc/objc_instance.mm:
2891         (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
2892         (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
2893         (ObjcInstance::operator=): More of the same.
2894         (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
2895
2896         * bindings/objc/objc_runtime.mm:
2897         (ObjcArray::ObjcArray): Use CFRetain instead of retain.
2898         (ObjcArray::~ObjcArray): Use CFRelease instead of release.
2899         (ObjcArray::operator=): More of the same.
2900
2901         * bindings/testbindings.mm: Fixed incorrect license.
2902         (main): Use [pool drain] if compiling on Tiger.
2903
2904 === Safari-144 ===
2905
2906 2004-06-10  Kevin Decker  <kdecker@apple.com>
2907
2908         Reviewed by John.
2909
2910         * kjs/lexer.cpp: 
2911         (Lexer::setCode):
2912             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
2913         * kjs/lexer.h:
2914         (KJS::Lexer::lineNo):
2915             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
2916
2917 === JavaScriptCore-143.2 ===
2918
2919 2004-06-07  Darin Adler  <darin@apple.com>
2920
2921         - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
2922
2923         * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
2924         * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
2925
2926 === JavaScriptCore-143.1 ===
2927
2928 2004-06-04  Kevin Decker  <kdecker@apple.com>
2929
2930         Reviewed by Darin
2931         
2932         - fixed <rdar://problem/3680594>
2933
2934         * kjs/object.cpp:
2935         (KJS::Error::create):
2936
2937 === Safari-143 ===
2938
2939 2004-06-04  Darin Adler  <darin@apple.com>
2940
2941         * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
2942
2943 2004-06-04  Kevin Decker  <kdecker@apple.com>
2944
2945         Reviewed by Dave.
2946
2947         - ObjC bindings do not (yet) pass along sourceurl or line numbers
2948         - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
2949         - changed the wording of an error message
2950         - the lexer, parser, and interpreter have been made "sourceURL aware"
2951         - stored the url into Error
2952          
2953         * bindings/NP_jsobject.cpp:
2954         (NPN_Evaluate):
2955         * bindings/jni/jni_jsobject.cpp:
2956         (JSObject::eval):
2957         * bindings/objc/WebScriptObject.mm:
2958         (-[WebScriptObject evaluateWebScript:]):
2959         * kjs/function.cpp:
2960         (GlobalFuncImp::call):
2961         * kjs/function_object.cpp:
2962         (FunctionObjectImp::construct):
2963         * kjs/internal.cpp:
2964         (Parser::parse):
2965         (InterpreterImp::checkSyntax):
2966         (InterpreterImp::evaluate):
2967         * kjs/internal.h:
2968         * kjs/interpreter.cpp:
2969         (Interpreter::evaluate):
2970         * kjs/interpreter.h:
2971         * kjs/lexer.cpp:
2972         (Lexer::setCode):
2973         * kjs/lexer.h:
2974         (KJS::Lexer::sourceURL):
2975         * kjs/nodes.cpp:
2976         (Node::Node):
2977         (Node::throwError):
2978         (FunctionCallNode::evaluate):
2979         * kjs/nodes.h:
2980         * kjs/object.cpp:
2981         (KJS::Error::create):
2982         * kjs/object.h:
2983
2984 2004-06-04  Richard Williamson   <rjw@apple.com>
2985
2986         Fixed crash when attempting to access properties on nil
2987         object.
2988         
2989         Reviewed by John.
2990
2991         * bindings/objc/objc_instance.mm:
2992         (ObjcInstance::getClass):
2993         * bindings/runtime_object.cpp:
2994         (RuntimeObjectImp::get):
2995         * bindings/testM.js:
2996         * bindings/testbindings.mm:
2997         (-[MyFirstInterface getString]):
2998
2999 2004-05-27  Kevin Decker  <kdecker@apple.com>
3000
3001         Reviewed by Ken.
3002
3003         -revised generated error message content
3004         
3005         * kjs/error_object.cpp:
3006         (ErrorProtoFuncImp::call):
3007         * kjs/internal.cpp:
3008         (Parser::parse):
3009         * kjs/object.cpp:
3010         (KJS::Error::create):
3011
3012 === Safari-142 ===
3013
3014 2004-05-27  Richard Williamson   <rjw@apple.com>
3015
3016         Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
3017
3018         Reviewed by Chris.
3019
3020         * bindings/objc/WebScriptObject.h:
3021
3022 2004-05-27  Darin Adler  <darin@apple.com>
3023
3024         Reviewed by Maciej.
3025
3026         - moved to new symlink technique for embedding frameworks
3027
3028         * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
3029         because we don't need it any more.
3030
3031 2004-05-24  Richard Williamson   <rjw@apple.com>
3032
3033         Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
3034         fixed ClassInfo to correctly reflect inheritance.  This is required
3035         because of the runtime checks in JSC for arrays, i.e. in
3036         the Function objects apply method.
3037
3038         Reviewed by Ken.
3039
3040         * bindings/jni/jni_runtime.cpp:
3041         (JavaArray::convertJObjectToArray):
3042         * bindings/objc/objc_utility.mm:
3043         (KJS::Bindings::convertObjcValueToValue):
3044         * bindings/runtime_array.cpp:
3045         (RuntimeArrayImp::RuntimeArrayImp):
3046         * bindings/runtime_array.h:
3047         * bindings/testM.js: Added.
3048         * bindings/testbindings.mm:
3049         (+[MyFirstInterface webScriptNameForSelector:]):
3050         (-[MyFirstInterface logMessages:]):
3051         (-[MyFirstInterface logMessage:prefix:]):
3052         (-[MyFirstInterface callJSObject::]):
3053
3054 2004-05-22  Darin Adler  <darin@apple.com>
3055
3056         Reviewed by Maciej.
3057
3058         - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
3059
3060         * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
3061         with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
3062         CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
3063         it hasn't been set explicitly.
3064
3065 === Safari-141 ===
3066
3067 2004-05-20  Richard Williamson   <rjw@apple.com>
3068
3069         Implemented WebScriptObject/DOM wrapper voodoo.  DOM wrappers
3070         can now be referenced like any other WebScriptObject, meaning
3071         you can do JS operations on them.
3072
3073         All added implementation of finalizeForWebScript.
3074
3075         Reviewed by Ken.
3076
3077         * bindings/objc/WebScriptObject.h:
3078         * bindings/objc/WebScriptObject.mm:
3079         (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
3080         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
3081         (-[WebScriptObject KJS::]):
3082         (-[WebScriptObject dealloc]):
3083         (-[WebScriptObject callWebScriptMethod:withArguments:]):
3084         (-[WebScriptObject evaluateWebScript:]):
3085         (-[WebScriptObject setValue:forKey:]):
3086         (-[WebScriptObject valueForKey:]):
3087         (-[WebScriptObject stringRepresentation]):
3088         * bindings/objc/WebScriptObjectPrivate.h:
3089         * bindings/objc/objc_instance.mm:
3090         (ObjcInstance::~ObjcInstance):
3091
3092 2004-05-19  Richard Williamson   <rjw@apple.com>
3093
3094         Removed extraneous tabs that were added (by XCode?).
3095
3096         * bindings/objc/WebScriptObject.h:
3097
3098 2004-05-19  Darin Adler  <darin@apple.com>
3099
3100         - fixed headers with licenses mangled by Xcode auto-indenting
3101
3102         * bindings/jni/jni_jsobject.cpp:
3103         * bindings/jni/jni_jsobject.h:
3104         * bindings/runtime_array.h:
3105         * bindings/runtime_root.cpp:
3106         * bindings/runtime_root.h:
3107
3108 2004-05-18  Richard Williamson   <rjw@apple.com>
3109
3110         Added exception logging.  Also check for exception and
3111         set results as appropriate.
3112
3113         Reviewed by Maciej (partially reviewed).
3114
3115         * bindings/objc/WebScriptObject.mm:
3116         (-[WebScriptObject callWebScriptMethod:withArguments:]):
3117         (-[WebScriptObject evaluateWebScript:]):
3118         (-[WebScriptObject setValue:forKey:]):
3119         (-[WebScriptObject valueForKey:]):
3120
3121 2004-05-18  Richard Williamson   <rjw@apple.com>
3122
3123         Finsished implementing support for windowScriptObject.
3124         Had to make WebScriptObjectPrivate.h accessible from
3125         WebCore.
3126
3127         Reviewed by Maciej.
3128
3129         * JavaScriptCore.pbproj/project.pbxproj:
3130         * bindings/objc/WebScriptObjectPrivate.h:
3131
3132 2004-05-18  Richard Williamson   <rjw@apple.com>
3133
3134         Use KVC to set/get values instead of directly accessing
3135         ivars.
3136
3137         Reviewed by Maciej.
3138
3139         * bindings/objc/WebScriptObject.mm:
3140         (-[WebScriptObject callWebScriptMethod:withArguments:]):
3141         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
3142         * bindings/objc/objc_runtime.mm:
3143         (ObjcField::valueFromInstance):
3144         (convertValueToObjcObject):
3145         (ObjcField::setValueToInstance):
3146
3147 2004-05-17  Richard Williamson   <rjw@apple.com>
3148
3149         Implemented new API for WebScriptObject.
3150
3151         Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
3152         Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object)  (w/ help from Vicki)
3153
3154         Reviewed by Hyatt.
3155
3156         * JavaScriptCore.pbproj/project.pbxproj:
3157         * bindings/c/c_instance.cpp:
3158         (CInstance::invokeMethod):
3159         * bindings/jni/jni_instance.cpp:
3160         (JavaInstance::invokeMethod):
3161         * bindings/jni/jni_jsobject.cpp:
3162         (JSObject::convertValueToJObject):
3163         * bindings/jni/jni_utility.cpp:
3164         (KJS::Bindings::getJNIField):
3165         * bindings/objc/WebScriptObject.mm:
3166         (_didExecute):
3167         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
3168         (-[WebScriptObject KJS::]):
3169         (-[WebScriptObject dealloc]):
3170         (+[WebScriptObject throwException:]):
3171         (listFromNSArray):
3172         (-[WebScriptObject callWebScriptMethod:withArguments:]):
3173         (-[WebScriptObject evaluateWebScript:]):
3174         (-[WebScriptObject setValue:forKey:]):
3175         (-[WebScriptObject valueForKey:]):
3176         (-[WebScriptObject stringRepresentation]):
3177         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
3178         (+[WebUndefined undefined]):
3179         (-[WebUndefined initWithCoder:]):
3180         (-[WebUndefined encodeWithCoder:]):
3181         (-[WebUndefined copyWithZone:]):
3182         (-[WebUndefined retain]):
3183         (-[WebUndefined release]):
3184         (-[WebUndefined retainCount]):
3185         (-[WebUndefined autorelease]):
3186         (-[WebUndefined dealloc]):
3187         (-[WebUndefined copy]):
3188         (-[WebUndefined replacementObjectForPortCoder:]):
3189         * bindings/objc/WebScriptObjectPrivate.h: Added.
3190         * bindings/objc/objc_class.mm:
3191         (ObjcClass::methodsNamed):
3192         (ObjcClass::fieldNamed):
3193         * bindings/objc/objc_instance.mm:
3194         (ObjcInstance::invokeMethod):
3195         * bindings/objc/objc_jsobject.h:
3196         * bindings/objc/objc_jsobject.mm:
3197         * bindings/objc/objc_runtime.mm:
3198         (ObjcField::valueFromInstance):
3199         * bindings/objc/objc_utility.mm:
3200         (KJS::Bindings::JSMethodNameToObjCMethodName):
3201         (KJS::Bindings::convertValueToObjcValue):
3202         (KJS::Bindings::convertObjcValueToValue):
3203         * bindings/runtime.cpp:
3204         (Instance::setDidExecuteFunction):
3205         (Instance::didExecuteFunction):
3206         (Instance::setValueOfField):
3207         * bindings/runtime.h:
3208         * bindings/testbindings.mm:
3209         (+[MyFirstInterface webScriptNameForSelector:]):
3210         (-[MyFirstInterface callJSObject::]):
3211
3212 2004-05-14  Vicki Murley  <vicki@apple.com>
3213
3214         Reviewed by mjs.
3215  
3216         <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
3217
3218         * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
3219
3220 === Safari-140 ===
3221
3222 2004-05-13  Richard Williamson   <rjw@apple.com>
3223
3224         Fixed indentation.
3225
3226         Reviewed by Chris.
3227
3228         * ChangeLog:
3229         * bindings/objc/WebScriptObject.h:
3230
3231 2004-05-13  Richard Williamson   <rjw@apple.com>
3232
3233         Approved API changes.  Currently unimplemented.
3234
3235         Reviewed by Chris.
3236
3237         * ChangeLog:
3238         * JavaScriptCore.pbproj/project.pbxproj:
3239         * bindings/objc/WebScriptObject.h: Added.
3240         * bindings/objc/WebScriptObject.mm: Added.
3241         (+[WebScriptObject throwException:]):
3242         (-[WebScriptObject callWebScriptMethod:withArguments:]):
3243         (-[WebScriptObject evaluateWebScript:]):
3244         (-[WebScriptObject stringRepresentation]):
3245         (+[WebUndefined undefined]):
3246         (-[WebUndefined initWithCoder:]):
3247         (-[WebUndefined encodeWithCoder:]):
3248         (-[WebUndefined copyWithZone:]):
3249
3250 2004-05-07  Vicki Murley  <vicki@apple.com>
3251
3252         Reviewed by darin.
3253
3254         Turn off GC since it uses ppc only instructions (which breaks 
3255         the B&I build).   
3256     
3257         * kjs/value.h: set USE_CONSERVATIVE_GC to 0
3258
3259 === Safari-139 ===
3260
3261 2004-05-07  Maciej Stachowiak  <mjs@apple.com>
3262
3263         Reviewed by Darin.
3264
3265         - add -funroll-loops=16 compiler option for approx .5% speedup on
3266         HTML iBench and .5-1% speedup on JS iBench.
3267         
3268         * JavaScriptCore.pbproj/project.pbxproj:
3269
3270 2004-04-25  Maciej Stachowiak  <mjs@apple.com>
3271
3272         Reviewed by Darin.
3273
3274         Enable full conservative GC mode in addition to test mode. When
3275         conservative GC is enabled, we now get an 11% speed improvement on
3276         the iBench. Also fix some spots I missed before.
3277
3278         Specific noteworth changes:
3279         
3280         * kjs/collector.cpp:
3281         (KJS::Collector::markStackObjectsConservatively): Check possible
3282         cell pointers for 8-byte aligment and verify they are not 0.
3283
3284         * kjs/protected_values.cpp:
3285         (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
3286         (KJS::ProtectedValues::decreaseProtectCount): ...and here...
3287         * kjs/protect.h:
3288         (KJS::gcProtectNullTolerant): ...to here...
3289         (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
3290         tolerance, and doing the check is expensive.
3291
3292         * kjs/protected_values.cpp:
3293         (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
3294         that is still very good.
3295
3296         * kjs/protect.h:
3297         (KJS::gcProtect):
3298         (KJS::gcUnprotect):
3299         (KJS::ProtectedValue::ProtectedValue):
3300         (KJS::ProtectedValue::~ProtectedValue):
3301         (KJS::ProtectedValue::operator=):
3302         (KJS::ProtectedObject::ProtectedObject):
3303         (KJS::ProtectedObject::~ProtectedObject):
3304         (KJS::ProtectedObject::operator=):
3305         (KJS::ProtectedReference::ProtectedReference):
3306         (KJS::ProtectedReference::~ProtectedReference):
3307         (KJS::ProtectedReference::operator=):
3308         * kjs/protected_values.cpp:
3309         (KJS::ProtectedValues::getProtectCount):
3310         (KJS::ProtectedValues::increaseProtectCount):
3311         (KJS::ProtectedValues::decreaseProtectCount):
3312         (KJS::ProtectedValues::computeHash):
3313         * bindings/runtime_root.cpp:
3314         (KJS::Bindings::addNativeReference):
3315         (KJS::Bindings::removeNativeReference):
3316         (RootObject::removeAllNativeReferences):
3317         * bindings/runtime_root.h:
3318         (KJS::Bindings::RootObject::~RootObject):
3319         (KJS::Bindings::RootObject::setRootObjectImp):
3320         * kjs/collector.cpp:
3321         (KJS::Collector::allocate):
3322         (KJS::Collector::collect):
3323         * kjs/collector.h:
3324         * kjs/internal.cpp:
3325         (NumberImp::create):
3326         (InterpreterImp::globalInit):
3327         (InterpreterImp::globalClear):
3328         (InterpreterImp::mark):
3329         * kjs/list.cpp:
3330         (KJS::List::derefValues):
3331         (KJS::List::refValues):
3332         (KJS::List::append):
3333         * kjs/object.cpp:
3334         (KJS::ObjectImp::setInternalValue):
3335         (KJS::ObjectImp::putDirect):
3336         * kjs/value.cpp:
3337         (ValueImp::mark):
3338         (ValueImp::marked):
3339         * kjs/value.h:
3340         (KJS::ValueImp::ValueImp):
3341         (KJS::ValueImp::~ValueImp):
3342         (KJS::ValueImp::):
3343         (KJS::Value::Value):
3344         (KJS::Value::~Value):
3345         (KJS::Value::operator=):
3346
3347 2004-04-30  Richard Williamson   <rjw@apple.com>
3348
3349         Asking an NSInvocation for it's return value when return type
3350         is void throws an exception.  Added check for void return types
3351         to avoid this exception.
3352
3353         Reviewed by Ken.
3354
3355         * bindings/objc/objc_instance.mm:
3356         (ObjcInstance::invokeMethod):
3357
3358 2004-04-29  Richard Williamson   <rjw@apple.com>
3359
3360         Fixed several bad problems with the ObjC bindings.  In particular, conversion
3361         to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
3362
3363         Reviewed by Chris.
3364
3365         * bindings/objc/objc_jsobject.h:
3366         * bindings/objc/objc_jsobject.mm:
3367         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
3368         (-[JavaScriptObject KJS::]):
3369         (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
3370         (-[JavaScriptObject call:arguments:]):
3371         (-[JavaScriptObject evaluate:]):
3372         (-[JavaScriptObject getMember:]):
3373         (-[JavaScriptObject getSlot:]):
3374         * bindings/objc/objc_runtime.mm:
3375         (ObjcField::valueFromInstance):
3376         (ObjcField::setValueToInstance):
3377         * bindings/objc/objc_utility.mm:
3378         (KJS::Bindings::convertValueToObjcValue):
3379         (KJS::Bindings::convertObjcValueToValue):
3380         * bindings/runtime.h:
3381         * bindings/runtime_root.cpp:
3382         (KJS::Bindings::rootForInterpreter):
3383         (KJS::Bindings::addNativeReference):
3384         (KJS::Bindings::removeNativeReference):
3385         * bindings/runtime_root.h:
3386         * bindings/testbindings.mm:
3387         (-[MyFirstInterface logMessage:]):
3388         (-[MyFirstInterface setJSObject:]):
3389         (-[MyFirstInterface callJSObject::]):
3390
3391 2004-04-24  Darin Adler  <darin@apple.com>
3392
3393         Reviewed by Dave.
3394
3395         * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
3396         that is 2x too big.
3397
3398 2004-04-23  Maciej Stachowiak  <mjs@apple.com>
3399
3400         Reviewed by Darin.
3401
3402         Implementation of conservative GC, based partly on code from
3403         Darin. It's turned off for now, so it shouldn't have any effect on
3404         the normal build.
3405         
3406         * JavaScriptCore.pbproj/project.pbxproj:
3407         * kjs/collector.cpp:
3408         (KJS::Collector::markStackObjectsConservatively):
3409         (KJS::Collector::markProtectedObjects):
3410         (KJS::Collector::collect):
3411         * kjs/collector.h:
3412         * kjs/protect.h:
3413         (KJS::gcProtect):
3414         (KJS::gcUnprotect):
3415         * kjs/protected_values.cpp: Added.
3416         (KJS::ProtectedValues::getProtectCount):
3417         (KJS::ProtectedValues::increaseProtectCount):
3418         (KJS::ProtectedValues::insert):
3419         (KJS::ProtectedValues::decreaseProtectCount):
3420         (KJS::ProtectedValues::expand):
3421         (KJS::ProtectedValues::shrink):
3422         (KJS::ProtectedValues::rehash):
3423         (KJS::ProtectedValues::computeHash):
3424         * kjs/protected_values.h: Added.
3425         * kjs/value.cpp:
3426         (ValueImp::useConservativeMark):
3427         (ValueImp::mark):
3428         (ValueImp::marked):
3429         * kjs/value.h:
3430         (KJS::ValueImp::):
3431
3432 === Safari-138 ===
3433
3434 2004-04-22  Richard Williamson   <rjw@apple.com>
3435
3436         Fixed build snafu (re-declaration of NPBool in npruntime.h and
3437         npapi.h).
3438
3439         * bindings/npruntime.h:
3440
3441 2004-04-22  Richard Williamson   <rjw@apple.com>
3442
3443         Updated plugin binding API to reflect latest revision from
3444         working group.
3445         
3446         Biggest change is the introduction of NPVariant used to represent
3447         value types.  NPVariant replaces the use of NPObject for the
3448         exchange of values between scripting environment and native code.
3449
3450         Reviewed by John.
3451
3452         * JavaScriptCore.pbproj/project.pbxproj:
3453         * bindings/NP_jsobject.cpp:
3454         (identiferFromNPIdentifier):
3455         (NPN_Call):
3456         (NPN_Evaluate):
3457         (NPN_GetProperty):
3458         (NPN_SetProperty):
3459         (NPN_ToString):
3460         (NPN_GetPropertyAtIndex):
3461         (NPN_SetPropertyAtIndex):
3462         * bindings/c/c_class.cpp:
3463         (CClass::methodsNamed):
3464         (CClass::fieldNamed):
3465         * bindings/c/c_instance.cpp:
3466         (CInstance::invokeMethod):
3467         (CInstance::defaultValue):
3468         * bindings/c/c_runtime.cpp:
3469         (CField::valueFromInstance):
3470         (CField::setValueToInstance):
3471         * bindings/c/c_utility.cpp:
3472         (convertNPStringToUTF16):
3473         (convertUTF8ToUTF16):
3474         (coerceValueToNPVariantStringType):
3475         (convertValueToNPVariant):
3476         (convertNPVariantToValue):
3477         * bindings/c/c_utility.h:
3478         * bindings/npruntime.cpp:
3479         (NPN_GetIdentifier):
3480         (NPN_GetIdentifiers):
3481         (NPN_UTF8FromIdentifier):
3482         (NPN_VariantIsVoid):
3483         (NPN_VariantIsNull):
3484         (NPN_VariantIsUndefined):
3485         (NPN_VariantIsBool):
3486         (NPN_VariantIsInt32):
3487         (NPN_VariantIsDouble):
3488         (NPN_VariantIsString):
3489         (NPN_VariantIsObject):
3490         (NPN_VariantToBool):
3491         (NPN_VariantToString):
3492         (NPN_VariantToInt32):
3493         (NPN_VariantToDouble):
3494         (NPN_VariantToObject):
3495         (NPN_InitializeVariantAsVoid):
3496         (NPN_InitializeVariantAsNull):
3497         (NPN_InitializeVariantAsUndefined):
3498         (NPN_InitializeVariantWithBool):
3499         (NPN_InitializeVariantWithInt32):
3500         (NPN_InitializeVariantWithDouble):
3501         (NPN_InitializeVariantWithString):
3502         (NPN_InitializeVariantWithStringCopy):
3503         (NPN_InitializeVariantWithObject):
3504         (NPN_InitializeVariantWithVariant):
3505         (NPN_ReleaseVariantValue):
3506         (NPN_CreateObject):
3507         (NPN_RetainObject):
3508         (NPN_ReleaseObject):
3509         (NPN_IsKindOfClass):
3510         (NPN_SetExceptionWithUTF8):
3511         (NPN_SetException):
3512         * bindings/npruntime.h:
3513         (_NPString::):
3514         (_NPString::_NPVariant::):
3515         * bindings/testbindings.cpp:
3516         (logMessage):
3517         (setDoubleValue):
3518         (setIntValue):
3519         (setStringValue):
3520         (setBooleanValue):
3521         (getDoubleValue):
3522         (getIntValue):
3523         (getStringValue):
3524         (getBooleanValue):
3525         (myGetProperty):
3526         (mySetProperty):
3527         (myInvoke):
3528         (myAllocate):
3529
3530 2004-04-22  Darin Adler  <darin@apple.com>
3531
3532         Reviewed by Maciej.
3533
3534         - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
3535
3536         * kjs/ustring.cpp:
3537         (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
3538         Was resulting in a buffer 2x the needed size.
3539         (KJS::UString::expandPreCapacity): Ditto.
3540         (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
3541
3542 2004-04-21  Maciej Stachowiak  <mjs@apple.com>
3543
3544         Reviewed by Darin.
3545
3546         Preliminary change for conservative GC. Create "protected"
3547         subclasses to GC-protect objects when on heap, since we will soon
3548         remove the built-in refcounting of the normal wrapper classes. Use
3549         them where needed.
3550         
3551         * JavaScriptCore.pbproj/project.pbxproj:
3552         * kjs/context.h:
3553         * kjs/internal.h:
3554         (KJS::InterpreterImp::globalObject):
3555         * kjs/interpreter.h:
3556         * kjs/property_map.cpp:
3557         * kjs/reference.h:
3558         * kjs/reference_list.cpp:
3559
3560 2004-04-19  Maciej Stachowiak  <mjs@apple.com>
3561
3562         Reviewed by Dave.
3563
3564         Optimize prepend using the shared substring optimization. Also,
3565         limit the applicability of shared append and shared prepend. If
3566         you overdo it, it does more harm than good, because you create a
3567         bunch of strings that are disqualified from future shared
3568         append/prepend, for not much immediate savings in allocate/copy
3569         expense.
3570         
3571         * kjs/ustring.cpp:
3572         (KJS::):
3573         (KJS::UString::Rep::create):
3574         (KJS::UString::expandedSize):
3575         (KJS::UString::usedPreCapacity):
3576         (KJS::UString::expandCapacity):
3577         (KJS::UString::expandPreCapacity):
3578         (KJS::UString::UString):
3579         (KJS::UString::append):
3580         (KJS::UString::operator=):
3581         * kjs/ustring.h:
3582         (KJS::UString::Rep::data):
3583
3584 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
3585         Reviewed by Richard.
3586
3587         No more need for Completion or Reference to privately inherit from
3588         Value, none of the superclass functionality is used.
3589
3590         * kjs/completion.h:
3591         * kjs/reference.h:
3592
3593 === Safari-137 ===
3594
3595 2004-04-16  Richard Williamson   <rjw@apple.com>
3596
3597         Added interpreter lock protection around object creation.
3598
3599         Reviewed by Chris.
3600
3601         * bindings/runtime.cpp:
3602         (Instance::createRuntimeObject):
3603
3604 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
3605
3606         Reviewed by Ken.
3607
3608         Another JavaScript speed improvement: use the mechanism from
3609         string append optimization to make taking a substring fast, again
3610         sharing the buffer.
3611
3612         A further 22% improvement on the 24fun string speed test.
3613         
3614         * kjs/ustring.cpp:
3615         (KJS::):
3616         (KJS::UString::Rep::create):
3617         (KJS::UString::UString):
3618         (KJS::UString::append):
3619         (KJS::UString::operator=):
3620         (KJS::UString::substr):
3621         * kjs/ustring.h:
3622         (KJS::UString::Rep::data):
3623
3624 2004-04-13  Maciej Stachowiak  <mjs@apple.com>
3625
3626         Reviewed by Darin.
3627
3628         - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
3629         - fixed <rdar://problem/3600691>: Table generation test is really slow
3630         - fixed <rdar://problem/3600661>: 24fun date test is really slow
3631
3632         80% speedup on the string test, lesser speedups on the other two.
3633         
3634         Two different optimizations here:
3635
3636         1) Avoid large overhead of scanning strings to see if they are all
3637         ASCII before numeric conversion.
3638         
3639         * kjs/nodes.cpp:
3640         (AssignNode::evaluate): Don't convert to integer until we know for
3641         sure the operation will need it. Attempting to convert strings to
3642         numbers is a waste when they are being appended with +=.
3643
3644         2) Avoid huge cost of appending strings.
3645
3646         This is done by allowing multiple strings to share a buffer but
3647         actually use different ranges of it. The first time a string is
3648         appended to, we start leaving at least 10% extra space in the
3649         buffer, so doing N appends to the same string takes O(log N)
3650         mallocs instead of O(N).
3651         
3652         * kjs/identifier.cpp:
3653         (KJS::Identifier::equal):
3654         (KJS::Identifier::add):
3655         * kjs/ustring.cpp:
3656         (KJS::):
3657         (KJS::UCharReference::operator=):
3658         (KJS::UCharReference::ref):
3659         (KJS::UString::Rep::create):
3660         (KJS::UString::Rep::destroy):
3661         (KJS::UString::expandedSize):
3662         (KJS::UString::usedCapacity):
3663         (KJS::UString::expandCapacity):
3664         (KJS::UString::UString):
3665         (KJS::UString::null):
3666         (KJS::UString::append):
3667         (KJS::UString::operator=):
3668         (KJS::UString::toStrictUInt32):
3669         (KJS::UString::detach):
3670         (KJS::KJS::operator==):
3671         * kjs/ustring.h:
3672         (KJS::UString::Rep::data):
3673         (KJS::UString::Rep::hash):
3674
3675 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
3676
3677         Reviewed by John.
3678
3679         - fix deployment build by avoiding deployment-only warning.
3680
3681         * kjs/scope_chain.cpp:
3682         (KJS::ScopeChain::bottom):
3683
3684 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
3685
3686         Reviewed by John.
3687
3688         Changed things so that newly created objects get a prototype based
3689         on the scope chain of the current function, rather than the
3690         interpreter that started execution. This fixes the following bugs:
3691         
3692         <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
3693         <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
3694
3695         * JavaScriptCore.pbproj/project.pbxproj:
3696         * kjs/array_object.cpp:
3697         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
3698         (ArrayProtoFuncImp::ArrayProtoFuncImp):
3699         (ArrayProtoFuncImp::call):
3700         (ArrayObjectImp::construct):
3701         * kjs/bool_object.cpp:
3702         (BooleanObjectImp::construct):
3703         * kjs/date_object.cpp:
3704         (DateProtoFuncImp::DateProtoFuncImp):
3705         (DateProtoFuncImp::call):
3706         (DateObjectImp::construct):
3707         * kjs/error_object.cpp:
3708         (ErrorObjectImp::construct):
3709         * kjs/function.cpp:
3710         (FunctionImp::FunctionImp):
3711         (FunctionImp::call):
3712         (DeclaredFunctionImp::construct):
3713         (ArgumentsImp::ArgumentsImp):
3714         (GlobalFuncImp::call):
3715         * kjs/function_object.cpp:
3716         (FunctionProtoFuncImp::call):
3717         (FunctionObjectImp::construct):
3718         * kjs/internal.cpp:
3719         (BooleanImp::toObject):
3720         (StringImp::toObject):
3721         (NumberImp::toObject):
3722         (InterpreterImp::InterpreterImp):
3723         (InterpreterImp::clear):
3724         (InterpreterImp::interpreterWithGlobalObject):
3725         * kjs/internal.h:
3726         * kjs/interpreter.cpp:
3727         (ExecState::lexicalInterpreter):
3728         * kjs/interpreter.h:
3729         (KJS::ExecState::dynamicInterpreter):
3730         (KJS::ExecState::interpreter):
3731         * kjs/math_object.cpp:
3732         (MathFuncImp::MathFuncImp):
3733         * kjs/nodes.cpp:
3734         (StatementNode::hitStatement):
3735         (StatementNode::abortStatement):
3736         (RegExpNode::evaluate):
3737         (ElementNode::evaluate):
3738         (ArrayNode::evaluate):
3739         (ObjectLiteralNode::evaluate):
3740         (PropertyValueNode::evaluate):
3741         (FunctionCallNode::evaluate):
3742         (FuncDeclNode::processFuncDecl):
3743         (FuncExprNode::evaluate):
3744         * kjs/number_object.cpp:
3745         (NumberObjectImp::construct):
3746         * kjs/object.cpp:
3747         (KJS::ObjectImp::defaultValue):
3748         (KJS::Error::create):
3749         * kjs/object_object.cpp:
3750         (ObjectObjectImp::construct):
3751         * kjs/reference.cpp:
3752         (Reference::putValue):
3753         * kjs/regexp_object.cpp:
3754         (RegExpProtoFuncImp::call):
3755         (RegExpObjectImp::arrayOfMatches):
3756         (RegExpObjectImp::construct):
3757         * kjs/scope_chain.cpp:
3758         (KJS::ScopeChain::bottom):
3759         * kjs/scope_chain.h:
3760         * kjs/string_object.cpp:
3761         (StringProtoFuncImp::StringProtoFuncImp):
3762         (StringProtoFuncImp::call):
3763         (StringObjectImp::construct):
3764
3765 === Safari-136 ===
3766
3767 === Safari-135 ===
3768
3769 2004-03-31  Richard Williamson   <rjw@apple.com>
3770
3771         Tedious renames based on feedback from plugin-futures list.
3772         NP_ functions are renamed with NPN_ prefix.
3773         Types prefix renamed from NP_ to NP.
3774         NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated. 
3775         
3776         No review because this was just a renaming patch.
3777
3778         * bindings/NP_jsobject.cpp:
3779         (listFromNPArray):
3780         (jsAllocate):
3781         (identiferFromNPIdentifier):
3782         (NPN_Call):
3783         (NPN_Evaluate):
3784         (NPN_GetProperty):
3785         (NPN_SetProperty):
3786         (NPN_RemoveProperty):
3787         (NPN_ToString):
3788         (NPN_GetPropertyAtIndex):
3789         (NPN_SetPropertyAtIndex):
3790         * bindings/NP_jsobject.h:
3791         * bindings/c/c_class.cpp:
3792         (CClass::_commonInit):
3793         (CClass::classForIsA):
3794         (CClass::CClass):
3795         (CClass::methodsNamed):
3796         (CClass::fieldNamed):
3797         * bindings/c/c_class.h:
3798         * bindings/c/c_instance.cpp:
3799         (CInstance::CInstance):
3800         (CInstance::~CInstance):
3801         (CInstance::operator=):
3802         (CInstance::invokeMethod):
3803         (CInstance::defaultValue):
3804         * bindings/c/c_instance.h:
3805         (KJS::Bindings::CInstance::getObject):
3806         * bindings/c/c_runtime.cpp:
3807         (CField::valueFromInstance):
3808         (CField::setValueToInstance):
3809         * bindings/c/c_runtime.h:
3810         (KJS::Bindings::CField::CField):
3811         (KJS::Bindings::CField::name):
3812         (KJS::Bindings::CMethod::CMethod):
3813         (KJS::Bindings::CMethod::name):
3814         * bindings/c/c_utility.cpp:
3815         (coerceValueToNPString):
3816         (convertValueToNPValueType):
3817         (convertNPValueTypeToValue):
3818         * bindings/c/c_utility.h:
3819         * bindings/npruntime.cpp:
3820         (NPN_IdentifierFromUTF8):
3821         (NPN_IsValidIdentifier):
3822         (NPN_GetIdentifiers):
3823         (NPN_UTF8FromIdentifier):
3824         (NPN_CreateObject):
3825         (NPN_RetainObject):
3826         (NPN_ReleaseObject):
3827         (NPN_IsKindOfClass):
3828         (NPN_SetExceptionWithUTF8):
3829         (NPN_SetException):
3830         (numberAllocate):
3831         (NPN_CreateNumberWithInt):
3832         (NPN_CreateNumberWithFloat):
3833         (NPN_CreateNumberWithDouble):
3834         (NPN_IntFromNumber):
3835         (NPN_FloatFromNumber):
3836         (NPN_DoubleFromNumber):
3837         (stringAllocate):
3838         (NPN_CreateStringWithUTF8):
3839         (NPN_CreateStringWithUTF16):
3840         (NPN_DeallocateUTF8):
3841         (NPN_UTF8FromString):
3842         (NPN_UTF16FromString):
3843         (NPN_StringLength):
3844         (booleanAllocate):
3845         (NPN_CreateBoolean):
3846         (NPN_BoolFromBoolean):
3847         (nullAllocate):
3848         (NPN_GetNull):
3849         (undefinedAllocate):
3850         (NPN_GetUndefined):
3851         (arrayAllocate):
3852         (arrayDeallocate):
3853         (NPN_CreateArray):
3854         (NPN_CreateArrayV):
3855         (NPN_ObjectAtIndex):
3856         * bindings/npruntime.h:
3857         * bindings/runtime.cpp:
3858         (Instance::createBindingForLanguageInstance):
3859         * bindings/testbindings.cpp:
3860         (initializeIdentifiers):
3861         (myHasProperty):
3862         (myHasMethod):
3863         (myGetProperty):
3864         (mySetProperty):
3865         (logMessage):
3866         (setDoubleValue):
3867         (setIntValue):
3868         (setStringValue):
3869         (setBooleanValue):
3870         (getDoubleValue):
3871         (getIntValue):
3872         (getStringValue):
3873         (getBooleanValue):
3874         (myInvoke):
3875         (myAllocate):
3876         (myInvalidate):
3877         (myDeallocate):
3878         (main):
3879
3880 2004-03-31  Richard Williamson   <rjw@apple.com>
3881
3882         Changed references to NP_runtime.h to npruntime.h
3883         
3884         * JavaScriptCore.pbproj/project.pbxproj:
3885         * bindings/NP_jsobject.h:
3886         * bindings/c/c_class.h:
3887         * bindings/c/c_instance.h:
3888         * bindings/c/c_runtime.h:
3889         * bindings/c/c_utility.h:
3890         * bindings/npruntime.cpp:
3891
3892 2004-03-31  Richard Williamson   <rjw@apple.com>
3893
3894         Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
3895
3896         * JavaScriptCore.pbproj/project.pbxproj:
3897         * bindings/NP_jsobject.h:
3898         * bindings/npruntime.cpp:
3899
3900 === Safari-134 ===
3901
3902 2004-03-23  Richard Williamson   <rjw@apple.com>
3903
3904         Added implementation of KJS::Value <-> NP_Object conversion functions.
3905         Augmented test program for 'C' bindings.
3906         Added asserts and parameter checking to all public API.        
3907
3908         Reviewed by Ken.
3909
3910         * JavaScriptCore.pbproj/project.pbxproj:
3911         * bindings/NP_jsobject.cpp:
3912         (NP_ToString):
3913         * bindings/NP_jsobject.h: Added.
3914         * bindings/NP_runtime.cpp:
3915         (NP_IdentifierFromUTF8):
3916         (NP_IsValidIdentifier):
3917         (NP_GetIdentifiers):
3918         (NP_CreateObject):
3919         (NP_RetainObject):
3920         (NP_ReleaseObject):
3921         (NP_IsKindOfClass):
3922         (NP_SetExceptionWithUTF8):
3923         (NP_SetException):
3924         (NP_IntFromNumber):
3925         (NP_FloatFromNumber):
3926         (NP_DoubleFromNumber):
3927         (NP_CreateStringWithUTF8):
3928         (NP_CreateStringWithUTF16):
3929         (NP_DeallocateUTF8):
3930         (NP_UTF8FromString):
3931         (NP_UTF16FromString):
3932         (NP_StringLength):
3933         (NP_BoolFromBoolean):
3934         * bindings/NP_runtime.h:
3935         * bindings/c/c_instance.cpp:
3936         (CInstance::invokeMethod):
3937         * bindings/c/c_utility.cpp:
3938         (coerceValueToNPString):
3939         (convertValueToNPValueType):
3940         (convertNPValueTypeToValue):
3941         * bindings/c/c_utility.h:
3942         * bindings/test.js:
3943         * bindings/testC.js: Added.
3944         * bindings/testbindings.cpp:
3945         (logMessage):
3946         (setDoubleValue):
3947         (setIntValue):
3948         (setStringValue):
3949         (setBooleanValue):
3950         (getDoubleValue):
3951         (getIntValue):
3952         (getStringValue):
3953         (getBooleanValue):
3954         (myInterfaceInvoke):
3955         (myInterfaceAllocate):
3956
3957 === Safari-133 ===
3958
3959 2004-03-19  Darin Adler  <darin@apple.com>
3960
3961         Reviewed by Ken.
3962
3963         - fixed problem with methods like setUTCHour
3964
3965         * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
3966         GMT vs. local time function based on the utc flag.
3967
3968 2004-03-17  Richard Williamson   <rjw@apple.com>
3969
3970         Added a context parameter to result callbacks use by JavaScriptObject functions.  This was a change requested by Eric Carlson on the QT plugin team.
3971
3972         Reviewed by Ken.
3973
3974         * bindings/NP_jsobject.cpp:
3975         (NP_Call):
3976         (NP_Evaluate):
3977         (NP_GetProperty):
3978         (NP_ToString):
3979         (NP_GetPropertyAtIndex):
3980         * bindings/NP_runtime.h:
3981
3982 2004-03-16  Richard Williamson   <rjw@apple.com>
3983
3984         Fixed 3590169.  Regression (crash) caused by the switch to MethodLists.  Crash when attempting to invoke a method from JavaScript to Java that is not implemented.
3985
3986         Reviewed by John.
3987
3988         * bindings/jni/jni_class.cpp:
3989         (JavaClass::methodsNamed):
3990
3991 2004-03-15  Richard Williamson   <rjw@apple.com>
3992
3993         Fixed 3570854.  Don't attempt to convert Null to strings.  We
3994         were incorrectly converting to "Null".
3995
3996         Actually fixed by Scott Kovatch.
3997
3998         Reviewed by Richard.
3999
4000         * bindings/jni/jni_utility.cpp:
4001         (KJS::Bindings::convertValueToJValue):
4002
4003 === Safari-132 ===
4004
4005 2004-03-11  Richard Williamson   <rjw@apple.com>
4006
4007         Stitched together the NP stuff to our language independent
4008         JavaScript binding stuff.  Very close to being done.
4009         
4010         Added program to test C bindings (and NP stuff).  Just tests
4011         properties.  Will add methods and JavaScript access, etc.
4012
4013         Updated Makefile.am to account for new bindings/c directory.
4014
4015         Change NP_UTF8 from "const char *" to "char" to allow for
4016         declarations like "const NP_UTF8 *" and "NP_UTF8 *".  Ditto
4017         for NP_UTF16.
4018
4019         Added NP_IsValidIdentifier().
4020
4021         Reviewed by Chris.
4022
4023         * JavaScriptCore.pbproj/project.pbxproj:
4024         * Makefile.am:
4025         * bindings/NP_jsobject.cpp:
4026         (identiferFromNPIdentifier):
4027         (NP_Evaluate):
4028         * bindings/NP_runtime.cpp:
4029         (NP_IdentifierFromUTF8):
4030         (NP_IsValidIdentifier):
4031         (NP_GetIdentifiers):
4032         (NP_UTF8FromIdentifier):
4033         (NP_SetExceptionWithUTF8):
4034         (NP_SetException):
4035         (NP_CreateStringWithUTF8):
4036         (NP_CreateStringWithUTF16):
4037         (NP_UTF8FromString):
4038         (NP_UTF16FromString):
4039         * bindings/NP_runtime.h:
4040         * bindings/c/c_class.cpp: Added.
4041         (CClass::_commonDelete):
4042         (CClass::_commonCopy):
4043         (CClass::_commonInit):
4044         (_createClassesByIsAIfNecessary):
4045         (CClass::classForIsA):
4046         (CClass::CClass):
4047         (CClass::name):
4048         (CClass::methodsNamed):
4049         (CClass::fieldNamed):
4050         * bindings/c/c_class.h: Added.
4051         (KJS::Bindings::CClass::~CClass):
4052         (KJS::Bindings::CClass::CClass):
4053         (KJS::Bindings::CClass::operator=):
4054         (KJS::Bindings::CClass::constructorAt):
4055         (KJS::Bindings::CClass::numConstructors):
4056         * bindings/c/c_instance.cpp: Added.
4057         (CInstance::CInstance):
4058         (CInstance::~CInstance):
4059         (CInstance::operator=):
4060         (CInstance::getClass):
4061         (CInstance::begin):
4062         (CInstance::end):
4063         (CInstance::invokeMethod):
4064         (CInstance::defaultValue):
4065         (CInstance::stringValue):
4066         (CInstance::numberValue):
4067         (CInstance::booleanValue):
4068         (CInstance::valueOf):
4069         * bindings/c/c_instance.h: Added.
4070         (KJS::Bindings::CInstance::getObject):
4071         * bindings/c/c_runtime.cpp: Added.
4072         (CField::valueFromInstance):
4073         (CField::setValueToInstance):
4074         * bindings/c/c_runtime.h: Added.
4075         (KJS::Bindings::CField::CField):
4076         (KJS::Bindings::CField::name):
4077         (KJS::Bindings::CField::type):
4078         (KJS::Bindings::CMethod::CMethod):
4079         (KJS::Bindings::CMethod::name):
4080         (KJS::Bindings::CMethod::numParameters):
4081         * bindings/c/c_utility.cpp: Added.
4082         (coerceValueToNPValueType):
4083         (convertValueToNPValueType):
4084         (convertNPValueTypeToValue):
4085         * bindings/c/c_utility.h: Added.
4086         * bindings/make_testbindings:
4087         * bindings/runtime.cpp:
4088         (Instance::createBindingForLanguageInstance):
4089         * bindings/runtime.h:
4090         (KJS::Bindings::Instance::):
4091         * bindings/testbindings.cpp: Added.
4092         (initializeIdentifiers):
4093         (myInterfaceHasProperty):
4094         (myInterfaceHasMethod):
4095         (myInterfaceGetProperty):
4096         (myInterfaceSetProperty):
4097         (myInterfaceInvoke):
4098         (myInterfaceAllocate):
4099         (myInterfaceInvalidate):
4100         (myInterfaceDeallocate):
4101         (GlobalImp::className):
4102         (readJavaScriptFromFile):
4103         (main):
4104
4105 2004-03-10  Richard Williamson   <rjw@apple.com>
4106
4107         Made changes to support new asychronous approach to calls from
4108         plugin to JavaScript
4109
4110         Reviewed by Chris.
4111
4112         * bindings/NP_jsobject.cpp:
4113         (NP_Call):
4114         (NP_Evaluate):
4115         (NP_GetProperty):
4116         (NP_ToString):
4117         (NP_GetPropertyAtIndex):
4118         * bindings/NP_runtime.h:
4119         * bindings/make_testbindings:
4120         * bindings/runtime.cpp:
4121         (Instance::createBindingForLanguageInstance):
4122
4123 2004-03-10  Richard Williamson   <rjw@apple.com>
4124
4125         Updated header to include proposed changes from
4126         plugin-futures list.  Calls from plugin to JavaScript
4127         are now asynchronous.
4128
4129         Reviewed by Chris.
4130
4131         * bindings/NP_runtime.h:
4132
4133 === Safari-131 ===
4134
4135 2004-03-04  Richard Williamson   <rjw@apple.com>
4136
4137         Implementation of NP_JavaScriptObject.  This is the 'C' class
4138         that wraps a JavaScript object.
4139
4140         Reviewed by Chris.
4141
4142         * JavaScriptCore.pbproj/project.pbxproj:
4143         * bindings/NP_jsobject.cpp: Added.
4144         (coerceValueToNPValueType):
4145         (convertValueToNPValueType):
4146         (convertNPValueTypeToValue):
4147         (listFromNPArray):
4148         (jsAllocate):
4149         (jsDeallocate):
4150         (identiferFromNPIdentifier):
4151         (NP_Call):
4152         (NP_Evaluate):
4153         (NP_GetProperty):
4154         (NP_SetProperty):
4155         (NP_RemoveProperty):
4156         (NP_ToString):
4157         (NP_GetPropertyAtIndex):
4158         (NP_SetPropertyAtIndex):
4159         * bindings/NP_runtime.cpp:
4160         (NP_ObjectAtIndex):
4161         * bindings/NP_runtime.h:
4162         * bindings/runtime_object.h:
4163
4164 2004-03-04  Richard Williamson   <rjw@apple.com>
4165
4166         Added NP_Array implementation.  
4167
4168         Changed NP_Boolean to just depend on two static instances, no
4169         space is required for values.
4170
4171         Reviewed by Chris.
4172
4173         * bindings/NP_runtime.cpp:
4174         (NP_CreateBoolean):
4175         (NP_BoolFromBoolean):
4176         (arrayAllocate):
4177         (arrayDeallocate):
4178         (NP_CreateArray):
4179         (NP_CreateArrayV):