3 2004-10-05 Richard Williamson <rjw@apple.com>
5 Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
9 * bindings/NP_jsobject.cpp:
11 * bindings/npruntime.cpp:
12 (_NPN_SetExceptionWithUTF8):
13 * bindings/objc/WebScriptObject.mm:
14 (+[WebScriptObject throwException:]):
16 (KJS::InterpreterImp::context):
18 2004-10-05 Richard Williamson <rjw@apple.com>
20 Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
24 * bindings/objc/objc_utility.mm:
25 (KJS::Bindings::convertObjcValueToValue):
27 2004-10-04 Darin Adler <darin@apple.com>
31 - rolled in a fix the KDE folks did for the operations that generate HTML fragments
33 * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
35 - rolled out an old workaround we don't need any more
37 * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
38 required it is no longer there.
40 2004-09-30 Richard Williamson <rjw@apple.com>
42 Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
46 * bindings/NP_jsobject.cpp:
50 * bindings/c/c_class.cpp:
51 (CClass::methodsNamed):
53 * bindings/c/c_class.h:
54 * bindings/c/c_instance.cpp:
55 (CInstance::invokeMethod):
56 * bindings/jni/jni_class.cpp:
57 (JavaClass::methodsNamed):
58 * bindings/jni/jni_class.h:
59 * bindings/npruntime.h:
60 * bindings/objc/objc_class.h:
61 * bindings/objc/objc_class.mm:
62 (ObjcClass::methodsNamed):
64 * bindings/runtime_object.cpp:
65 (RuntimeObjectImp::get):
66 (RuntimeObjectImp::hasProperty):
68 2004-09-29 Chris Blumenberg <cblu@apple.com>
70 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.
74 * JavaScriptCore.pbproj/project.pbxproj:
75 * bindings/NP_jsobject.cpp:
76 (_NPN_CreateScriptObject):
82 (_NPN_RemoveProperty):
85 * bindings/c/c_class.cpp:
86 (CClass::methodsNamed):
88 * bindings/c/c_instance.cpp:
89 (CInstance::CInstance):
90 (CInstance::~CInstance):
91 (CInstance::operator=):
92 (CInstance::invokeMethod):
93 (CInstance::invokeDefaultMethod):
94 * bindings/c/c_runtime.cpp:
95 * bindings/c/c_runtime.h:
96 (KJS::Bindings::CField::name):
97 (KJS::Bindings::CMethod::name):
98 * bindings/npruntime.cpp:
99 (_NPN_GetStringIdentifier):
100 (_NPN_GetStringIdentifiers):
101 (_NPN_GetIntIdentifier):
102 (_NPN_IdentifierIsString):
103 (_NPN_UTF8FromIdentifier):
104 (_NPN_IntFromIdentifier):
105 (NPN_InitializeVariantWithObject):
106 (_NPN_ReleaseVariantValue):
109 (_NPN_ReleaseObject):
110 (_NPN_SetExceptionWithUTF8):
113 2004-09-26 Darin Adler <darin@apple.com>
115 * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
116 low() to get Unicode value of character, and just use unicode().
118 2004-09-26 Darin Adler <darin@apple.com>
120 - refine charAt/charCodeAt fix slightly
122 * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
123 omitted parameter, as we do everywhere else, and as other browsers do here.
125 2004-09-26 Darin Adler <darin@apple.com>
129 - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
131 * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
132 the program. We were doing this properly for functions, but not entire programs.
134 - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
136 * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
137 and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
139 * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
145 2004-09-14 Richard Williamson <rjw@apple.com>
147 1. Add class parameter to object allocation function. This is somewhat redundant, given that
148 the allocation function is in the class function vector, but people wanted to use the same
149 allocation function for different classes.
151 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
153 3. Add support for a default function on an object. This is a feature that ActiveX supports,
154 and will allow JavaScript code to be written that will look exactly the same for both ActiveX
155 plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
156 'Objective-C' bindings.
158 There bugs are covered by
160 <rdar://problem/3776343> Support for default functions in the JavaScript bindings
161 <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
162 <rdar://problem/3674754> Need to implement latest npruntime.h
166 * bindings/NP_jsobject.cpp:
170 * bindings/c/c_class.cpp:
171 * bindings/c/c_instance.cpp:
172 (CInstance::CInstance):
173 (CInstance::operator=):
174 (CInstance::invokeMethod):
175 (CInstance::invokeDefaultMethod):
176 * bindings/c/c_instance.h:
177 * bindings/c/c_runtime.cpp:
178 * bindings/c/c_runtime.h:
179 * bindings/jni/jni_instance.cpp:
180 (JavaInstance::invokeDefaultMethod):
181 * bindings/jni/jni_instance.h:
182 * bindings/npruntime.cpp:
184 * bindings/npruntime.h:
185 * bindings/objc/WebScriptObject.h:
186 * bindings/objc/objc_class.mm:
187 (ObjcClass::fallbackObject):
188 * bindings/objc/objc_instance.h:
189 * bindings/objc/objc_instance.mm:
190 (ObjcInstance::invokeDefaultMethod):
191 * bindings/objc/objc_runtime.h:
192 * bindings/objc/objc_runtime.mm:
193 (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
194 (ObjcFallbackObjectImp::get):
195 (ObjcFallbackObjectImp::put):
196 (ObjcFallbackObjectImp::canPut):
197 (ObjcFallbackObjectImp::implementsCall):
198 (ObjcFallbackObjectImp::call):
199 (ObjcFallbackObjectImp::hasProperty):
200 (ObjcFallbackObjectImp::deleteProperty):
201 (ObjcFallbackObjectImp::defaultValue):
202 * bindings/runtime.h:
203 (KJS::Bindings::Class::fallbackObject):
204 (KJS::Bindings::Instance::getValueOfUndefinedField):
205 (KJS::Bindings::Instance::setValueOfUndefinedField):
206 (KJS::Bindings::Instance::valueOf):
207 * bindings/runtime_object.cpp:
208 (RuntimeObjectImp::implementsCall):
209 (RuntimeObjectImp::call):
210 * bindings/runtime_object.h:
212 2004-09-13 Maciej Stachowiak <mjs@apple.com>
216 <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
218 * kjs/string_object.cpp:
219 (StringProtoFuncImp::call): Replaced implementation of replace()
220 method with function below...
221 (replace): In order to avoid excessive allocation and copying,
222 figure out the ranges of the original string and replacement
223 strings to be assembled, instead of constantly creating new
224 strings at each substitution. The old behavior is basically O(N^2)
225 for a global replace on a pattern that matches many places in the
227 (regExpIsGlobal): Helper function for the above.
228 (expandSourceRanges): ditto
229 (pushSourceRange): ditto
230 (expandReplacements): ditto
231 (pushReplacement): ditto
233 (KJS::UString::spliceSubstringsWithSeparators): New method that
234 pieces together substring ranges of this string together with
235 specified separators, all at one go.
237 (KJS::UString::Range::Range): Added new helper class to represent
240 2004-09-14 Maciej Stachowiak <mjs@apple.com>
244 - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
247 (KJS::GlobalFuncImp::call): Make sure to escape null
248 characters. This is a bug in the new code that made part of the
251 2004-09-13 Darin Adler <darin@apple.com>
253 Reviewed by Kevin and Maciej.
255 - new function to support fix for DIG bug in WebCore
257 * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
258 * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
260 2004-09-12 Darin Adler <darin@apple.com>
262 * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
263 of escape and unescape.
265 2004-09-12 Darin Adler <darin@apple.com>
269 - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
271 * kjs/date_object.cpp:
272 (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
273 uses CFDateFormatter.
274 (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
276 2004-09-09 Maciej Stachowiak <mjs@apple.com>
280 <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
283 (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
284 ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
286 (Lexer::isHexDigit): Made static and non-const.
291 2004-09-06 Darin Adler <darin@apple.com>
293 * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
297 2004-09-01 Richard Williamson <rjw@apple.com>
299 Add pid to exception messages (to help debug dashboard clients).
303 * kjs/interpreter.cpp:
304 (Interpreter::evaluate):
308 2004-08-20 Richard Williamson <rjw@apple.com>
310 Implemented new JNI abstraction. We no longer invoke Java methods
311 directly with JNI, rather we call into the plugin. This allows the
312 plugin to dispatch the call to the appropriate VM thread. This
313 change should (will?) fix a whole class of threading related problems with
318 * JavaScriptCore.pbproj/project.pbxproj:
319 * bindings/c/c_instance.h:
320 (KJS::Bindings::CInstance::setExecutionContext):
321 (KJS::Bindings::CInstance::executionContext):
322 * bindings/jni/jni_instance.cpp:
323 (JavaInstance::JavaInstance):
324 (JavaInstance::invokeMethod):
325 (JavaInstance::setExecutionContext):
326 (JavaInstance::executionContext):
327 * bindings/jni/jni_instance.h:
328 * bindings/jni/jni_jsobject.cpp:
329 (JSObject::convertJObjectToValue):
330 * bindings/jni/jni_runtime.cpp:
331 (JavaField::JavaField):
332 (JavaArray::convertJObjectToArray):
333 (JavaField::valueFromInstance):
334 (JavaArray::JavaArray):
335 (JavaArray::valueAt):
336 * bindings/jni/jni_runtime.h:
337 (KJS::Bindings::JavaArray::operator=):
338 (KJS::Bindings::JavaArray::executionContext):
339 * bindings/jni/jni_utility.h:
340 * bindings/objc/objc_instance.h:
341 (KJS::Bindings::ObjcInstance::setExecutionContext):
342 (KJS::Bindings::ObjcInstance::executionContext):
343 * bindings/runtime.cpp:
344 (Instance::createBindingForLanguageInstance):
345 * bindings/runtime.h:
346 * bindings/runtime_root.h:
347 (KJS::Bindings::RootObject::nativeHandle):
351 2004-08-19 Vicki Murley <vicki@apple.com>
355 * kjs/property_map.cpp:
356 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
358 2004-08-17 Darin Adler <darin@apple.com>
362 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
364 * kjs/property_map.h: Added some private functions.
365 * kjs/property_map.cpp:
366 (KJS::PropertyMap::clear): Set sentinelCount to 0.
367 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
368 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
369 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
370 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
371 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
372 deleted-element sentinels.
373 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
375 2004-08-16 Maciej Stachowiak <mjs@apple.com>
377 Code change by Eric Albert, reviewd by me.
379 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
381 * kjs/date_object.cpp:
382 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
383 entirely would be even better, but is not required to fix this bug.
387 2004-08-16 Richard Williamson <rjw@apple.com>
389 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
391 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
395 * bindings/NP_jsobject.cpp:
397 * bindings/jni/jni_jsobject.cpp:
399 * bindings/objc/WebScriptObject.mm:
400 (-[WebScriptObject evaluateWebScript:]):
402 2004-08-15 Richard Williamson <rjw@apple.com>
404 More updates to np headers. Implemented new NPN functions.
408 * bindings/NP_jsobject.cpp:
412 * bindings/npruntime.h:
414 2004-08-13 Darin Adler <darin@apple.com>
416 - fix build so we can compile again
418 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
419 is good enough so that we can compile, but it's only a stopgap measure, because I think
420 Richard has a newer one he wants to check in.
422 2004-08-12 Richard Williamson <rjw@apple.com>
424 Bring npruntime.h and friends closer to compliance with
429 * JavaScriptCore.pbproj/project.pbxproj:
430 * bindings/NP_jsobject.cpp:
432 (_NPN_CreateScriptObject):
437 (NPN_RemoveProperty):
438 * bindings/NP_jsobject.h:
439 * bindings/c/c_instance.cpp:
440 (CInstance::invokeMethod):
441 * bindings/c/c_utility.cpp:
442 (convertNPVariantToValue):
443 * bindings/npruntime.cpp:
444 (NPN_IdentifierIsString):
447 (NPN_VariantIsUndefined):
449 (NPN_VariantIsInt32):
450 (NPN_VariantIsDouble):
451 (NPN_VariantIsString):
452 (NPN_VariantIsObject):
454 (NPN_VariantToString):
455 (NPN_VariantToInt32):
456 (NPN_VariantToDouble):
457 (NPN_VariantToObject):
458 (NPN_InitializeVariantAsVoid):
459 (NPN_InitializeVariantAsNull):
460 (NPN_InitializeVariantAsUndefined):
461 (NPN_InitializeVariantWithBool):
462 (NPN_InitializeVariantWithInt32):
463 (NPN_InitializeVariantWithDouble):
464 (NPN_InitializeVariantWithString):
465 (NPN_InitializeVariantWithStringCopy):
466 (NPN_InitializeVariantWithObject):
467 (NPN_InitializeVariantWithVariant):
468 (NPN_ReleaseVariantValue):
470 * bindings/npruntime.h:
472 (_NPString::_NPVariant::):
473 * bindings/npruntime_priv.h: Added.
475 2004-08-12 Darin Adler <darin@apple.com>
479 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
482 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
483 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
484 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
485 to skip leading "+" or "-".
489 2004-08-12 Darin Adler <darin@apple.com>
493 - fixed 43 Mozilla JavaScript tests
495 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
496 * kjs/date_object.cpp:
497 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
498 than constructing a number object to pass to it.
499 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
500 (KJS::parseDate): Change to return a double instead of creating the Number object here.
501 (KJS::timeClip): Implement this as specified in the language standard.
503 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
504 flags on the prototype property.
507 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
509 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
511 (KJS::parseDigit): Added. Helper function for parseInt.
512 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
513 strtoll can handle. Also matches standard more closely.
514 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
516 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
518 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
520 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
522 (Lexer::setCode): Clear error state.
523 (Lexer::lex): Set error state if the lexer encounters an error
526 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
527 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
529 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
530 Change round to round values between -0.5 and -0 to -0 instead of +0.
532 * kjs/nodes.h: Add evaluateReference function to GroupNode.
533 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
534 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
535 would change x.y into a value that can't be deleted as a side effect.
537 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
540 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
541 get rid of the fixed size limit for code.
543 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
544 returns the string without creating a new Rep, since I'm using substr in a place where it will
547 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
548 the other day that was making a couple tests fail.
549 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
550 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
551 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
552 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
553 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
555 * kjs/string_object.lut.h: Regenerated.
557 2004-08-11 Darin Adler <darin@apple.com>
559 - fixed a tiny problem with the UTF-16 PCRE check-in
561 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
562 the ctype_meta flag to get set in items that should not have it.
564 * pcre/chartables.c: Regenerated.
566 2004-08-10 Richard Williamson <rjw@apple.com>
568 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
570 The following WebScripting methods are now supported on bound
573 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
574 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
575 - (id)valueForUndefinedKey:(NSString *)key
579 * bindings/c/c_class.cpp:
580 (CClass::fieldNamed):
581 * bindings/c/c_class.h:
582 * bindings/jni/jni_class.cpp:
583 (JavaClass::fieldNamed):
584 * bindings/jni/jni_class.h:
585 * bindings/objc/objc_class.h:
586 (KJS::Bindings::ObjcClass::isa):
587 * bindings/objc/objc_class.mm:
588 (ObjcClass::methodsNamed):
589 (ObjcClass::fieldNamed):
590 (ObjcClass::fallbackObject):
591 * bindings/objc/objc_instance.h:
592 * bindings/objc/objc_instance.mm:
593 (ObjcInstance::invokeMethod):
594 (ObjcInstance::setValueOfField):
595 (ObjcInstance::setValueOfUndefinedField):
596 (ObjcInstance::getValueOfField):
597 (ObjcInstance::getValueOfUndefinedField):
598 * bindings/objc/objc_runtime.h:
599 (KJS::Bindings::ObjcField::~ObjcField):
600 (KJS::Bindings::ObjcField::ObjcField):
601 (KJS::Bindings::ObjcField::operator=):
602 (KJS::Bindings::FallbackObjectImp::classInfo):
603 * bindings/objc/objc_runtime.mm:
604 (ObjcField::ObjcField):
607 (ObjcField::valueFromInstance):
608 (ObjcField::setValueToInstance):
609 (FallbackObjectImp::FallbackObjectImp):
610 (FallbackObjectImp::get):
611 (FallbackObjectImp::put):
612 (FallbackObjectImp::canPut):
613 (FallbackObjectImp::implementsCall):
614 (FallbackObjectImp::call):
615 (FallbackObjectImp::hasProperty):
616 (FallbackObjectImp::deleteProperty):
617 (FallbackObjectImp::defaultValue):
618 * bindings/runtime.h:
619 (KJS::Bindings::Class::fallbackObject):
620 (KJS::Bindings::Instance::getValueOfUndefinedField):
621 (KJS::Bindings::Instance::setValueOfUndefinedField):
622 * bindings/runtime_object.cpp:
623 (RuntimeObjectImp::get):
624 (RuntimeObjectImp::put):
625 (RuntimeObjectImp::canPut):
626 (RuntimeObjectImp::hasProperty):
627 * bindings/testbindings.mm:
628 (-[MyFirstInterface valueForUndefinedKey:]):
629 (-[MyFirstInterface setValue:forUndefinedKey:]):
631 2004-08-10 Darin Adler <darin@apple.com>
635 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
637 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
638 or uint16_t depending on the mode, and used appropriate in the 7 public functions
640 * pcre/pcre.c: Add UTF-16 support to all functions.
641 * pcre/study.c: Ditto.
643 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
644 the mode. Changed declarations to use symbolic constants and typedefs so we size
645 things to ichar when needed.
647 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
648 sized to 16-bit characters instead of 8-bit.
651 (pcre_copy_substring): Use pcre_char instead of char.
652 (pcre_get_substring_list): Ditto.
653 (pcre_free_substring_list): Ditto.
654 (pcre_get_substring): Ditto.
655 (pcre_free_substring): Ditto.
657 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
658 of hard-coding 8-bit table sizes.
660 * pcre/chartables.c: Regenerated.
662 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
663 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
664 is not null. The null string still has a null pointer. This prevents us from
665 passing a null through to the regular expression engine (which results in a null
666 error even when the string length is 0).
669 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
670 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
672 2004-08-09 Darin Adler <darin@apple.com>
676 - fixed 28 Mozilla JavaScript tests
678 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
679 checking the number of arguments for the join method.
681 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
682 than integers, so we aren't limited to 32 bits.
684 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
685 the implementation of the pow operation. Also simplied a case that was handling positive
686 and negative infinity separately.
688 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
689 putting them in a long, so that unsigned shift will work properly.
691 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
693 * kjs/operations.cpp:
694 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
695 sign of isinf; our isinf function returns +1 even for negative infinity.
696 (KJS::isNegInf): And again.
697 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
698 Our floating point already handles the various infinity cases correctly.
700 * kjs/regexp_object.cpp:
701 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
702 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
703 array in cases where we did not match.
704 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
705 "global", "ignoreCase", "multiline", and "source".
707 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
708 string into undefined rather than an empty string. For the slice method, handle an
709 undefined parameter for the limit properly as decribed in the specification, and add
710 the limit to one case that didn't have the limit at all. For the methods that generate
711 HTML strings, use lowercase tags instead of uppercase.
714 (KJS::UChar::toLower): Use u_tolower from the ICU library.
715 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
716 (KJS::UString::append): Fix some math that caused a buffer overflow.
717 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
718 flag) rather than converting them all to 0.
719 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
721 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
723 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
724 the Unicode specification in a few cases where it was wrong before.
725 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
726 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
727 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
728 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
729 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
730 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
731 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
732 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
733 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
735 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
737 * kjs/number_object.lut.h: Regenerated.
739 2004-08-09 Darin Adler <darin@apple.com>
743 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
745 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
746 we get a buffer overflow.
750 2004-08-05 Richard Williamson <rjw@apple.com>
752 Fixed part of 3674747. The QT guys need this for feature freeze.
754 This patch implements support for the
756 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
758 method of objects bound to JavaScript.
763 * bindings/objc/objc_class.mm:
764 (ObjcClass::methodsNamed):
765 (ObjcClass::fieldNamed):
766 * bindings/objc/objc_instance.mm:
767 (ObjcInstance::invokeMethod):
768 * bindings/objc/objc_runtime.h:
769 (KJS::Bindings::ObjcMethod::~ObjcMethod):
770 (KJS::Bindings::ObjcMethod::isFallbackMethod):
771 (KJS::Bindings::ObjcMethod::javaScriptName):
772 * bindings/objc/objc_runtime.mm:
773 (ObjcMethod::ObjcMethod):
774 (ObjcMethod::getMethodSignature):
775 (ObjcMethod::setJavaScriptName):
776 * bindings/testbindings.mm:
778 2004-08-04 Vicki Murley <vicki@apple.com>
782 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
785 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
786 go to the next line and continue parsing the string (instead of failing). This matches
787 behavior in Mac IE and Mozilla.
789 2004-08-03 Kevin Decker <kdecker@apple.com>
793 Rolled in changes from the latest KJS sources that support additional
794 Number.prototype functions.
796 Specifically this patch covers the follow parts of the ECMA 3 spec:
797 15.7.4.5, 15.7.4.6, and 15.7.4.7
800 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
801 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
802 <rdar://problem/3749591> missing Number.toExponential prototype implementation
804 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
805 list of supported identifiers (a macro).
806 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
808 (NumberPrototypeImp::NumberPrototypeImp):
809 (NumberProtoFuncImp::call):
810 * kjs/number_object.h: Added property names for toFixed, toPrecision,
812 (KJS::NumberProtoFuncImp::):
813 * tests/mozilla/expected.html: Update results.
815 2004-08-03 Darin Adler <darin@apple.com>
819 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
821 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
822 we are supposed to just copy the regular expression object, and do so.
823 Also tighten up arguments check to handle case where an actual "undefined"
824 is passed rather than just omitting an argument.
826 * tests/mozilla/expected.html: Update results.
828 2004-08-02 Darin Adler <darin@apple.com>
830 * tests/mozilla/.cvsignore: Added.
831 * tests/mozilla/expected.html: Update results.
833 2004-08-02 Darin Adler <darin@apple.com>
837 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
839 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
840 Append the flags here so more tests paseed.
842 2004-08-02 Darin Adler <darin@apple.com>
846 - fixed a couple things making 5 Mozilla regexp tests pass
848 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
850 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
851 be used as the flags string when no parameter was passed.
853 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
854 Added a class info object for RegExp prototype so it can return
855 a string instead of raising an exception when converting to a string.
857 * tests/mozilla/expected.html: Update results.
859 2004-08-02 Darin Adler <darin@apple.com>
863 - fix crashes in mozilla tests due to mishandling NaN
865 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
866 calls to toInteger so that NaN will get turned into something that fits in an integer.
867 These were the ones John already fixed, but his fix used isnan and the new fix is
870 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
871 after a call to toInteger to handle NaN properly. Also removed separate check
872 for undefined that's not needed.
874 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
875 as in the above two files, but for a lot more functions. Also changed one place with
876 an explicit check for undefined to instead just check isNaN.
878 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
879 like me who don't keep $SYMROOTS in their $PATH.
885 2004-07-26 Kevin Decker <kdecker@apple.com>
887 Changes done by Darin, reviewed by Kevin.
889 - changed testkjs to build in Xcode rather than from Makefile
891 * .cvsignore: Removed obsolete files from this list.
892 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
893 Changed to build target "All" rather than default target. This makes us
894 build the testkjs test tool.
895 * dummy.cpp: Removed.
896 * kjs/.cvsignore: Removed obsolete files from this list, including
897 the testkjs tool, which is now built in the symroots directory.
898 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
899 changed this file. Also this has the nice side effect of causing the tool
900 to be rebuilt in the new location even if there are no other changes in
901 your tree when you check this out.
902 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
903 without setting the execute bit on jsDriver.pl.
905 2004-07-22 Kevin Decker <kdecker@apple.com>
909 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
911 * kjs/function_object.cpp:
912 (FunctionObjectImp::construct):
913 * kjs/function_object.h:
915 (KJS::ObjectImp::construct):
917 (KJS::Object::construct):
919 2004-07-21 Darin Adler <darin@apple.com>
921 * bindings/npruntime.h: Fixed typo.
923 2004-07-19 John Sullivan <sullivan@apple.com>
927 - bulletproofed array.slice() against NAN arguments. Harri noticed this
928 vulnerability in my patch for 3714644
930 * kjs/array_object.cpp:
931 (ArrayProtoFuncImp::call):
932 handle NAN parameters passed to slice() by clamping to 0 and length.
934 2004-07-19 Richard Williamson <rjw@apple.com>
936 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
941 * bindings/jni/jni_jsobject.cpp:
943 (JSObject::JSObject):
945 2004-07-16 John Sullivan <sullivan@apple.com>
949 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
950 hangs browser with javascript
952 * kjs/array_object.cpp:
953 (ArrayProtoFuncImp::call):
954 Check for undefined type for args[0] the same way we were already checking
955 for args[1]. In this case, args was zero-length, but we were treating
956 args[0] like an integer anyway. Resulted in some code looping from a NAN
957 value to 4, taking approximately forever.
959 * JavaScriptCore.pbproj/project.pbxproj:
964 2004-07-14 Maciej Stachowiak <mjs@apple.com>
968 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
969 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
971 * kjs/number_object.cpp:
972 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
974 2004-07-13 Kevin Decker <kdecker@apple.com>
976 Reviewed by kocienda.
978 - made testkjs and JavaScriptCore a subtarget of 'All'
979 - testkjs now builds in $SYMROOTS
981 * JavaScriptCore.pbproj/project.pbxproj:
985 2004-06-24 Chris Blumenberg <cblu@apple.com>
987 Ignore .mode1 files in JavaScriptCore.pbproj
989 Reviewed by kocienda.
991 * JavaScriptCore.pbproj/.cvsignore:
993 2004-06-23 Richard Williamson <rjw@apple.com>
995 Implemented changes for latest npruntime.h.
999 * JavaScriptCore.pbproj/project.pbxproj:
1000 * bindings/NP_jsobject.cpp:
1001 (listFromVariantArgs):
1002 (identiferFromNPIdentifier):
1003 (_NPN_CreateScriptObject):
1008 (NPN_RemoveProperty):
1009 * bindings/NP_jsobject.h:
1010 * bindings/c/c_class.cpp:
1011 (CClass::methodsNamed):
1012 (CClass::fieldNamed):
1013 * bindings/c/c_instance.cpp:
1014 (CInstance::invokeMethod):
1015 * bindings/c/c_utility.cpp:
1016 (convertNPVariantToValue):
1017 * bindings/c/c_utility.h:
1018 * bindings/npruntime.cpp:
1019 (stringIdentifierEqual):
1020 (stringIdentifierHash):
1021 (getStringIdentifierDictionary):
1022 (intIdentifierEqual):
1023 (intIdentifierHash):
1024 (getIntIdentifierDictionary):
1025 (NPN_GetStringIdentifier):
1026 (NPN_GetStringIdentifiers):
1027 (NPN_GetIntIdentifier):
1028 (NPN_IdentifierIsString):
1029 (NPN_UTF8FromIdentifier):
1030 (NPN_VariantToInt32):
1031 (NPN_VariantToDouble):
1033 * bindings/npruntime.h:
1034 * bindings/objc/WebScriptObject.mm:
1035 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1036 * bindings/runtime_object.cpp:
1037 (RuntimeObjectImp::~RuntimeObjectImp):
1038 * bindings/runtime_root.cpp:
1039 (KJS::Bindings::rootForInterpreter):
1040 * bindings/testbindings.cpp:
1041 (initializeIdentifiers):
1047 === JavaScriptCore-146.1 ===
1049 2004-06-16 Richard Williamson <rjw@apple.com>
1051 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1053 This turned out to be a show stopper for Dashboard. Accessing a nil
1054 ObjC property from JS caused a crash. Similar to the problem
1055 3696112 fixed below.
1059 * bindings/objc/objc_runtime.mm:
1060 (KJS::Bindings::ObjcField::valueFromInstance):
1064 2004-06-16 Richard Williamson <rjw@apple.com>
1066 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1068 This turned out to be a show stopper for Dashboard. We now
1069 return Undefined() when nil is returned from a ObjC method
1070 that returns an object type.
1074 * bindings/objc/objc_utility.mm:
1075 (KJS::Bindings::convertObjcValueToValue):
1079 2004-06-15 Richard Williamson <rjw@apple.com>
1081 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1083 No longer need to check respondsToSelector: for
1084 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1085 because these now have a default implementation on NSObject.
1089 * bindings/objc/objc_class.mm:
1090 (ObjcClass::methodsNamed):
1091 (ObjcClass::fieldNamed):
1093 2004-06-14 Darin Adler <darin@apple.com>
1097 - fixed some things for GC that Patrick missed, or that happened after the branch
1099 * bindings/objc/WebScriptObject.mm:
1100 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1101 (-[WebScriptObject finalize]): Added.
1103 - added some missing nil checks
1105 * bindings/objc/objc_instance.mm:
1106 (ObjcInstance::ObjcInstance): Check for nil.
1107 (ObjcInstance::~ObjcInstance): Check for nil.
1108 (ObjcInstance::operator=): Check for nil.
1110 2004-06-14 Darin Adler <darin@apple.com>
1112 Reviewed by me, code changes by Patrick Beard.
1114 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1116 * bindings/objc/objc_instance.mm:
1117 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1118 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1119 (ObjcInstance::operator=): More of the same.
1120 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1122 * bindings/objc/objc_runtime.mm:
1123 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1124 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1125 (ObjcArray::operator=): More of the same.
1127 * bindings/testbindings.mm: Fixed incorrect license.
1128 (main): Use [pool drain] if compiling on Tiger.
1132 2004-06-10 Kevin Decker <kdecker@apple.com>
1138 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1140 (KJS::Lexer::lineNo):
1141 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1143 === JavaScriptCore-143.2 ===
1145 2004-06-07 Darin Adler <darin@apple.com>
1147 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1149 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1150 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1152 === JavaScriptCore-143.1 ===
1154 2004-06-04 Kevin Decker <kdecker@apple.com>
1158 - fixed <rdar://problem/3680594>
1161 (KJS::Error::create):
1165 2004-06-04 Darin Adler <darin@apple.com>
1167 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1169 2004-06-04 Kevin Decker <kdecker@apple.com>
1173 - ObjC bindings do not (yet) pass along sourceurl or line numbers
1174 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1175 - changed the wording of an error message
1176 - the lexer, parser, and interpreter have been made "sourceURL aware"
1177 - stored the url into Error
1179 * bindings/NP_jsobject.cpp:
1181 * bindings/jni/jni_jsobject.cpp:
1183 * bindings/objc/WebScriptObject.mm:
1184 (-[WebScriptObject evaluateWebScript:]):
1186 (GlobalFuncImp::call):
1187 * kjs/function_object.cpp:
1188 (FunctionObjectImp::construct):
1191 (InterpreterImp::checkSyntax):
1192 (InterpreterImp::evaluate):
1194 * kjs/interpreter.cpp:
1195 (Interpreter::evaluate):
1196 * kjs/interpreter.h:
1200 (KJS::Lexer::sourceURL):
1204 (FunctionCallNode::evaluate):
1207 (KJS::Error::create):
1210 2004-06-04 Richard Williamson <rjw@apple.com>
1212 Fixed crash when attempting to access properties on nil
1217 * bindings/objc/objc_instance.mm:
1218 (ObjcInstance::getClass):
1219 * bindings/runtime_object.cpp:
1220 (RuntimeObjectImp::get):
1221 * bindings/testM.js:
1222 * bindings/testbindings.mm:
1223 (-[MyFirstInterface getString]):
1225 2004-05-27 Kevin Decker <kdecker@apple.com>
1229 -revised generated error message content
1231 * kjs/error_object.cpp:
1232 (ErrorProtoFuncImp::call):
1236 (KJS::Error::create):
1240 2004-05-27 Richard Williamson <rjw@apple.com>
1242 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1246 * bindings/objc/WebScriptObject.h:
1248 2004-05-27 Darin Adler <darin@apple.com>
1252 - moved to new symlink technique for embedding frameworks
1254 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1255 because we don't need it any more.
1257 2004-05-24 Richard Williamson <rjw@apple.com>
1259 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1260 fixed ClassInfo to correctly reflect inheritance. This is required
1261 because of the runtime checks in JSC for arrays, i.e. in
1262 the Function objects apply method.
1266 * bindings/jni/jni_runtime.cpp:
1267 (JavaArray::convertJObjectToArray):
1268 * bindings/objc/objc_utility.mm:
1269 (KJS::Bindings::convertObjcValueToValue):
1270 * bindings/runtime_array.cpp:
1271 (RuntimeArrayImp::RuntimeArrayImp):
1272 * bindings/runtime_array.h:
1273 * bindings/testM.js: Added.
1274 * bindings/testbindings.mm:
1275 (+[MyFirstInterface webScriptNameForSelector:]):
1276 (-[MyFirstInterface logMessages:]):
1277 (-[MyFirstInterface logMessage:prefix:]):
1278 (-[MyFirstInterface callJSObject::]):
1280 2004-05-22 Darin Adler <darin@apple.com>
1284 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
1286 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
1287 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
1288 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
1289 it hasn't been set explicitly.
1293 2004-05-20 Richard Williamson <rjw@apple.com>
1295 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
1296 can now be referenced like any other WebScriptObject, meaning
1297 you can do JS operations on them.
1299 All added implementation of finalizeForWebScript.
1303 * bindings/objc/WebScriptObject.h:
1304 * bindings/objc/WebScriptObject.mm:
1305 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1306 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1307 (-[WebScriptObject KJS::]):
1308 (-[WebScriptObject dealloc]):
1309 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1310 (-[WebScriptObject evaluateWebScript:]):
1311 (-[WebScriptObject setValue:forKey:]):
1312 (-[WebScriptObject valueForKey:]):
1313 (-[WebScriptObject stringRepresentation]):
1314 * bindings/objc/WebScriptObjectPrivate.h:
1315 * bindings/objc/objc_instance.mm:
1316 (ObjcInstance::~ObjcInstance):
1318 2004-05-19 Richard Williamson <rjw@apple.com>
1320 Removed extraneous tabs that were added (by XCode?).
1322 * bindings/objc/WebScriptObject.h:
1324 2004-05-19 Darin Adler <darin@apple.com>
1326 - fixed headers with licenses mangled by Xcode auto-indenting
1328 * bindings/jni/jni_jsobject.cpp:
1329 * bindings/jni/jni_jsobject.h:
1330 * bindings/runtime_array.h:
1331 * bindings/runtime_root.cpp:
1332 * bindings/runtime_root.h:
1334 2004-05-18 Richard Williamson <rjw@apple.com>
1336 Added exception logging. Also check for exception and
1337 set results as appropriate.
1339 Reviewed by Maciej (partially reviewed).
1341 * bindings/objc/WebScriptObject.mm:
1342 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1343 (-[WebScriptObject evaluateWebScript:]):
1344 (-[WebScriptObject setValue:forKey:]):
1345 (-[WebScriptObject valueForKey:]):
1347 2004-05-18 Richard Williamson <rjw@apple.com>
1349 Finsished implementing support for windowScriptObject.
1350 Had to make WebScriptObjectPrivate.h accessible from
1355 * JavaScriptCore.pbproj/project.pbxproj:
1356 * bindings/objc/WebScriptObjectPrivate.h:
1358 2004-05-18 Richard Williamson <rjw@apple.com>
1360 Use KVC to set/get values instead of directly accessing
1365 * bindings/objc/WebScriptObject.mm:
1366 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1367 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1368 * bindings/objc/objc_runtime.mm:
1369 (ObjcField::valueFromInstance):
1370 (convertValueToObjcObject):
1371 (ObjcField::setValueToInstance):
1373 2004-05-17 Richard Williamson <rjw@apple.com>
1375 Implemented new API for WebScriptObject.
1377 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
1378 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
1382 * JavaScriptCore.pbproj/project.pbxproj:
1383 * bindings/c/c_instance.cpp:
1384 (CInstance::invokeMethod):
1385 * bindings/jni/jni_instance.cpp:
1386 (JavaInstance::invokeMethod):
1387 * bindings/jni/jni_jsobject.cpp:
1388 (JSObject::convertValueToJObject):
1389 * bindings/jni/jni_utility.cpp:
1390 (KJS::Bindings::getJNIField):
1391 * bindings/objc/WebScriptObject.mm:
1393 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1394 (-[WebScriptObject KJS::]):
1395 (-[WebScriptObject dealloc]):
1396 (+[WebScriptObject throwException:]):
1398 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1399 (-[WebScriptObject evaluateWebScript:]):
1400 (-[WebScriptObject setValue:forKey:]):
1401 (-[WebScriptObject valueForKey:]):
1402 (-[WebScriptObject stringRepresentation]):
1403 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1404 (+[WebUndefined undefined]):
1405 (-[WebUndefined initWithCoder:]):
1406 (-[WebUndefined encodeWithCoder:]):
1407 (-[WebUndefined copyWithZone:]):
1408 (-[WebUndefined retain]):
1409 (-[WebUndefined release]):
1410 (-[WebUndefined retainCount]):
1411 (-[WebUndefined autorelease]):
1412 (-[WebUndefined dealloc]):
1413 (-[WebUndefined copy]):
1414 (-[WebUndefined replacementObjectForPortCoder:]):
1415 * bindings/objc/WebScriptObjectPrivate.h: Added.
1416 * bindings/objc/objc_class.mm:
1417 (ObjcClass::methodsNamed):
1418 (ObjcClass::fieldNamed):
1419 * bindings/objc/objc_instance.mm:
1420 (ObjcInstance::invokeMethod):
1421 * bindings/objc/objc_jsobject.h:
1422 * bindings/objc/objc_jsobject.mm:
1423 * bindings/objc/objc_runtime.mm:
1424 (ObjcField::valueFromInstance):
1425 * bindings/objc/objc_utility.mm:
1426 (KJS::Bindings::JSMethodNameToObjCMethodName):
1427 (KJS::Bindings::convertValueToObjcValue):
1428 (KJS::Bindings::convertObjcValueToValue):
1429 * bindings/runtime.cpp:
1430 (Instance::setDidExecuteFunction):
1431 (Instance::didExecuteFunction):
1432 (Instance::setValueOfField):
1433 * bindings/runtime.h:
1434 * bindings/testbindings.mm:
1435 (+[MyFirstInterface webScriptNameForSelector:]):
1436 (-[MyFirstInterface callJSObject::]):
1438 2004-05-14 Vicki Murley <vicki@apple.com>
1442 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
1444 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
1448 2004-05-13 Richard Williamson <rjw@apple.com>
1455 * bindings/objc/WebScriptObject.h:
1457 2004-05-13 Richard Williamson <rjw@apple.com>
1459 Approved API changes. Currently unimplemented.
1464 * JavaScriptCore.pbproj/project.pbxproj:
1465 * bindings/objc/WebScriptObject.h: Added.
1466 * bindings/objc/WebScriptObject.mm: Added.
1467 (+[WebScriptObject throwException:]):
1468 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1469 (-[WebScriptObject evaluateWebScript:]):
1470 (-[WebScriptObject stringRepresentation]):
1471 (+[WebUndefined undefined]):
1472 (-[WebUndefined initWithCoder:]):
1473 (-[WebUndefined encodeWithCoder:]):
1474 (-[WebUndefined copyWithZone:]):
1476 2004-05-07 Vicki Murley <vicki@apple.com>
1480 Turn off GC since it uses ppc only instructions (which breaks
1483 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
1487 2004-05-07 Maciej Stachowiak <mjs@apple.com>
1491 - add -funroll-loops=16 compiler option for approx .5% speedup on
1492 HTML iBench and .5-1% speedup on JS iBench.
1494 * JavaScriptCore.pbproj/project.pbxproj:
1496 2004-04-25 Maciej Stachowiak <mjs@apple.com>
1500 Enable full conservative GC mode in addition to test mode. When
1501 conservative GC is enabled, we now get an 11% speed improvement on
1502 the iBench. Also fix some spots I missed before.
1504 Specific noteworth changes:
1506 * kjs/collector.cpp:
1507 (KJS::Collector::markStackObjectsConservatively): Check possible
1508 cell pointers for 8-byte aligment and verify they are not 0.
1510 * kjs/protected_values.cpp:
1511 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
1512 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
1514 (KJS::gcProtectNullTolerant): ...to here...
1515 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
1516 tolerance, and doing the check is expensive.
1518 * kjs/protected_values.cpp:
1519 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
1520 that is still very good.
1525 (KJS::ProtectedValue::ProtectedValue):
1526 (KJS::ProtectedValue::~ProtectedValue):
1527 (KJS::ProtectedValue::operator=):
1528 (KJS::ProtectedObject::ProtectedObject):
1529 (KJS::ProtectedObject::~ProtectedObject):
1530 (KJS::ProtectedObject::operator=):
1531 (KJS::ProtectedReference::ProtectedReference):
1532 (KJS::ProtectedReference::~ProtectedReference):
1533 (KJS::ProtectedReference::operator=):
1534 * kjs/protected_values.cpp:
1535 (KJS::ProtectedValues::getProtectCount):
1536 (KJS::ProtectedValues::increaseProtectCount):
1537 (KJS::ProtectedValues::decreaseProtectCount):
1538 (KJS::ProtectedValues::computeHash):
1539 * bindings/runtime_root.cpp:
1540 (KJS::Bindings::addNativeReference):
1541 (KJS::Bindings::removeNativeReference):
1542 (RootObject::removeAllNativeReferences):
1543 * bindings/runtime_root.h:
1544 (KJS::Bindings::RootObject::~RootObject):
1545 (KJS::Bindings::RootObject::setRootObjectImp):
1546 * kjs/collector.cpp:
1547 (KJS::Collector::allocate):
1548 (KJS::Collector::collect):
1551 (NumberImp::create):
1552 (InterpreterImp::globalInit):
1553 (InterpreterImp::globalClear):
1554 (InterpreterImp::mark):
1556 (KJS::List::derefValues):
1557 (KJS::List::refValues):
1558 (KJS::List::append):
1560 (KJS::ObjectImp::setInternalValue):
1561 (KJS::ObjectImp::putDirect):
1566 (KJS::ValueImp::ValueImp):
1567 (KJS::ValueImp::~ValueImp):
1569 (KJS::Value::Value):
1570 (KJS::Value::~Value):
1571 (KJS::Value::operator=):
1573 2004-04-30 Richard Williamson <rjw@apple.com>
1575 Asking an NSInvocation for it's return value when return type
1576 is void throws an exception. Added check for void return types
1577 to avoid this exception.
1581 * bindings/objc/objc_instance.mm:
1582 (ObjcInstance::invokeMethod):
1584 2004-04-29 Richard Williamson <rjw@apple.com>
1586 Fixed several bad problems with the ObjC bindings. In particular, conversion
1587 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
1591 * bindings/objc/objc_jsobject.h:
1592 * bindings/objc/objc_jsobject.mm:
1593 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
1594 (-[JavaScriptObject KJS::]):
1595 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1596 (-[JavaScriptObject call:arguments:]):
1597 (-[JavaScriptObject evaluate:]):
1598 (-[JavaScriptObject getMember:]):
1599 (-[JavaScriptObject getSlot:]):
1600 * bindings/objc/objc_runtime.mm:
1601 (ObjcField::valueFromInstance):
1602 (ObjcField::setValueToInstance):
1603 * bindings/objc/objc_utility.mm:
1604 (KJS::Bindings::convertValueToObjcValue):
1605 (KJS::Bindings::convertObjcValueToValue):
1606 * bindings/runtime.h:
1607 * bindings/runtime_root.cpp:
1608 (KJS::Bindings::rootForInterpreter):
1609 (KJS::Bindings::addNativeReference):
1610 (KJS::Bindings::removeNativeReference):
1611 * bindings/runtime_root.h:
1612 * bindings/testbindings.mm:
1613 (-[MyFirstInterface logMessage:]):
1614 (-[MyFirstInterface setJSObject:]):
1615 (-[MyFirstInterface callJSObject::]):
1617 2004-04-24 Darin Adler <darin@apple.com>
1621 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
1624 2004-04-23 Maciej Stachowiak <mjs@apple.com>
1628 Implementation of conservative GC, based partly on code from
1629 Darin. It's turned off for now, so it shouldn't have any effect on
1632 * JavaScriptCore.pbproj/project.pbxproj:
1633 * kjs/collector.cpp:
1634 (KJS::Collector::markStackObjectsConservatively):
1635 (KJS::Collector::markProtectedObjects):
1636 (KJS::Collector::collect):
1641 * kjs/protected_values.cpp: Added.
1642 (KJS::ProtectedValues::getProtectCount):
1643 (KJS::ProtectedValues::increaseProtectCount):
1644 (KJS::ProtectedValues::insert):
1645 (KJS::ProtectedValues::decreaseProtectCount):
1646 (KJS::ProtectedValues::expand):
1647 (KJS::ProtectedValues::shrink):
1648 (KJS::ProtectedValues::rehash):
1649 (KJS::ProtectedValues::computeHash):
1650 * kjs/protected_values.h: Added.
1652 (ValueImp::useConservativeMark):
1660 2004-04-22 Richard Williamson <rjw@apple.com>
1662 Fixed build snafu (re-declaration of NPBool in npruntime.h and
1665 * bindings/npruntime.h:
1667 2004-04-22 Richard Williamson <rjw@apple.com>
1669 Updated plugin binding API to reflect latest revision from
1672 Biggest change is the introduction of NPVariant used to represent
1673 value types. NPVariant replaces the use of NPObject for the
1674 exchange of values between scripting environment and native code.
1678 * JavaScriptCore.pbproj/project.pbxproj:
1679 * bindings/NP_jsobject.cpp:
1680 (identiferFromNPIdentifier):
1686 (NPN_GetPropertyAtIndex):
1687 (NPN_SetPropertyAtIndex):
1688 * bindings/c/c_class.cpp:
1689 (CClass::methodsNamed):
1690 (CClass::fieldNamed):
1691 * bindings/c/c_instance.cpp:
1692 (CInstance::invokeMethod):
1693 (CInstance::defaultValue):
1694 * bindings/c/c_runtime.cpp:
1695 (CField::valueFromInstance):
1696 (CField::setValueToInstance):
1697 * bindings/c/c_utility.cpp:
1698 (convertNPStringToUTF16):
1699 (convertUTF8ToUTF16):
1700 (coerceValueToNPVariantStringType):
1701 (convertValueToNPVariant):
1702 (convertNPVariantToValue):
1703 * bindings/c/c_utility.h:
1704 * bindings/npruntime.cpp:
1705 (NPN_GetIdentifier):
1706 (NPN_GetIdentifiers):
1707 (NPN_UTF8FromIdentifier):
1708 (NPN_VariantIsVoid):
1709 (NPN_VariantIsNull):
1710 (NPN_VariantIsUndefined):
1711 (NPN_VariantIsBool):
1712 (NPN_VariantIsInt32):
1713 (NPN_VariantIsDouble):
1714 (NPN_VariantIsString):
1715 (NPN_VariantIsObject):
1716 (NPN_VariantToBool):
1717 (NPN_VariantToString):
1718 (NPN_VariantToInt32):
1719 (NPN_VariantToDouble):
1720 (NPN_VariantToObject):
1721 (NPN_InitializeVariantAsVoid):
1722 (NPN_InitializeVariantAsNull):
1723 (NPN_InitializeVariantAsUndefined):
1724 (NPN_InitializeVariantWithBool):
1725 (NPN_InitializeVariantWithInt32):
1726 (NPN_InitializeVariantWithDouble):
1727 (NPN_InitializeVariantWithString):
1728 (NPN_InitializeVariantWithStringCopy):
1729 (NPN_InitializeVariantWithObject):
1730 (NPN_InitializeVariantWithVariant):
1731 (NPN_ReleaseVariantValue):
1734 (NPN_ReleaseObject):
1735 (NPN_IsKindOfClass):
1736 (NPN_SetExceptionWithUTF8):
1738 * bindings/npruntime.h:
1740 (_NPString::_NPVariant::):
1741 * bindings/testbindings.cpp:
1756 2004-04-22 Darin Adler <darin@apple.com>
1760 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
1763 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
1764 Was resulting in a buffer 2x the needed size.
1765 (KJS::UString::expandPreCapacity): Ditto.
1766 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
1768 2004-04-21 Maciej Stachowiak <mjs@apple.com>
1772 Preliminary change for conservative GC. Create "protected"
1773 subclasses to GC-protect objects when on heap, since we will soon
1774 remove the built-in refcounting of the normal wrapper classes. Use
1777 * JavaScriptCore.pbproj/project.pbxproj:
1780 (KJS::InterpreterImp::globalObject):
1781 * kjs/interpreter.h:
1782 * kjs/property_map.cpp:
1784 * kjs/reference_list.cpp:
1786 2004-04-19 Maciej Stachowiak <mjs@apple.com>
1790 Optimize prepend using the shared substring optimization. Also,
1791 limit the applicability of shared append and shared prepend. If
1792 you overdo it, it does more harm than good, because you create a
1793 bunch of strings that are disqualified from future shared
1794 append/prepend, for not much immediate savings in allocate/copy
1799 (KJS::UString::Rep::create):
1800 (KJS::UString::expandedSize):
1801 (KJS::UString::usedPreCapacity):
1802 (KJS::UString::expandCapacity):
1803 (KJS::UString::expandPreCapacity):
1804 (KJS::UString::UString):
1805 (KJS::UString::append):
1806 (KJS::UString::operator=):
1808 (KJS::UString::Rep::data):
1810 2004-04-16 Maciej Stachowiak <mjs@apple.com>
1811 Reviewed by Richard.
1813 No more need for Completion or Reference to privately inherit from
1814 Value, none of the superclass functionality is used.
1821 2004-04-16 Richard Williamson <rjw@apple.com>
1823 Added interpreter lock protection around object creation.
1827 * bindings/runtime.cpp:
1828 (Instance::createRuntimeObject):
1830 2004-04-16 Maciej Stachowiak <mjs@apple.com>
1834 Another JavaScript speed improvement: use the mechanism from
1835 string append optimization to make taking a substring fast, again
1838 A further 22% improvement on the 24fun string speed test.
1842 (KJS::UString::Rep::create):
1843 (KJS::UString::UString):
1844 (KJS::UString::append):
1845 (KJS::UString::operator=):
1846 (KJS::UString::substr):
1848 (KJS::UString::Rep::data):
1850 2004-04-13 Maciej Stachowiak <mjs@apple.com>
1854 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
1855 - fixed <rdar://problem/3600691>: Table generation test is really slow
1856 - fixed <rdar://problem/3600661>: 24fun date test is really slow
1858 80% speedup on the string test, lesser speedups on the other two.
1860 Two different optimizations here:
1862 1) Avoid large overhead of scanning strings to see if they are all
1863 ASCII before numeric conversion.
1866 (AssignNode::evaluate): Don't convert to integer until we know for
1867 sure the operation will need it. Attempting to convert strings to
1868 numbers is a waste when they are being appended with +=.
1870 2) Avoid huge cost of appending strings.
1872 This is done by allowing multiple strings to share a buffer but
1873 actually use different ranges of it. The first time a string is
1874 appended to, we start leaving at least 10% extra space in the
1875 buffer, so doing N appends to the same string takes O(log N)
1876 mallocs instead of O(N).
1878 * kjs/identifier.cpp:
1879 (KJS::Identifier::equal):
1880 (KJS::Identifier::add):
1883 (KJS::UCharReference::operator=):
1884 (KJS::UCharReference::ref):
1885 (KJS::UString::Rep::create):
1886 (KJS::UString::Rep::destroy):
1887 (KJS::UString::expandedSize):
1888 (KJS::UString::usedCapacity):
1889 (KJS::UString::expandCapacity):
1890 (KJS::UString::UString):
1891 (KJS::UString::null):
1892 (KJS::UString::append):
1893 (KJS::UString::operator=):
1894 (KJS::UString::toStrictUInt32):
1895 (KJS::UString::detach):
1896 (KJS::KJS::operator==):
1898 (KJS::UString::Rep::data):
1899 (KJS::UString::Rep::hash):
1901 2004-04-09 Maciej Stachowiak <mjs@apple.com>
1905 - fix deployment build by avoiding deployment-only warning.
1907 * kjs/scope_chain.cpp:
1908 (KJS::ScopeChain::bottom):
1910 2004-04-09 Maciej Stachowiak <mjs@apple.com>
1914 Changed things so that newly created objects get a prototype based
1915 on the scope chain of the current function, rather than the
1916 interpreter that started execution. This fixes the following bugs:
1918 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
1919 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
1921 * JavaScriptCore.pbproj/project.pbxproj:
1922 * kjs/array_object.cpp:
1923 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1924 (ArrayProtoFuncImp::ArrayProtoFuncImp):
1925 (ArrayProtoFuncImp::call):
1926 (ArrayObjectImp::construct):
1927 * kjs/bool_object.cpp:
1928 (BooleanObjectImp::construct):
1929 * kjs/date_object.cpp:
1930 (DateProtoFuncImp::DateProtoFuncImp):
1931 (DateProtoFuncImp::call):
1932 (DateObjectImp::construct):
1933 * kjs/error_object.cpp:
1934 (ErrorObjectImp::construct):
1936 (FunctionImp::FunctionImp):
1937 (FunctionImp::call):
1938 (DeclaredFunctionImp::construct):
1939 (ArgumentsImp::ArgumentsImp):
1940 (GlobalFuncImp::call):
1941 * kjs/function_object.cpp:
1942 (FunctionProtoFuncImp::call):
1943 (FunctionObjectImp::construct):
1945 (BooleanImp::toObject):
1946 (StringImp::toObject):
1947 (NumberImp::toObject):
1948 (InterpreterImp::InterpreterImp):
1949 (InterpreterImp::clear):
1950 (InterpreterImp::interpreterWithGlobalObject):
1952 * kjs/interpreter.cpp:
1953 (ExecState::lexicalInterpreter):
1954 * kjs/interpreter.h:
1955 (KJS::ExecState::dynamicInterpreter):
1956 (KJS::ExecState::interpreter):
1957 * kjs/math_object.cpp:
1958 (MathFuncImp::MathFuncImp):
1960 (StatementNode::hitStatement):
1961 (StatementNode::abortStatement):
1962 (RegExpNode::evaluate):
1963 (ElementNode::evaluate):
1964 (ArrayNode::evaluate):
1965 (ObjectLiteralNode::evaluate):
1966 (PropertyValueNode::evaluate):
1967 (FunctionCallNode::evaluate):
1968 (FuncDeclNode::processFuncDecl):
1969 (FuncExprNode::evaluate):
1970 * kjs/number_object.cpp:
1971 (NumberObjectImp::construct):
1973 (KJS::ObjectImp::defaultValue):
1974 (KJS::Error::create):
1975 * kjs/object_object.cpp:
1976 (ObjectObjectImp::construct):
1977 * kjs/reference.cpp:
1978 (Reference::putValue):
1979 * kjs/regexp_object.cpp:
1980 (RegExpProtoFuncImp::call):
1981 (RegExpObjectImp::arrayOfMatches):
1982 (RegExpObjectImp::construct):
1983 * kjs/scope_chain.cpp:
1984 (KJS::ScopeChain::bottom):
1985 * kjs/scope_chain.h:
1986 * kjs/string_object.cpp:
1987 (StringProtoFuncImp::StringProtoFuncImp):
1988 (StringProtoFuncImp::call):
1989 (StringObjectImp::construct):
1995 2004-03-31 Richard Williamson <rjw@apple.com>
1997 Tedious renames based on feedback from plugin-futures list.
1998 NP_ functions are renamed with NPN_ prefix.
1999 Types prefix renamed from NP_ to NP.
2000 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
2002 No review because this was just a renaming patch.
2004 * bindings/NP_jsobject.cpp:
2007 (identiferFromNPIdentifier):
2012 (NPN_RemoveProperty):
2014 (NPN_GetPropertyAtIndex):
2015 (NPN_SetPropertyAtIndex):
2016 * bindings/NP_jsobject.h:
2017 * bindings/c/c_class.cpp:
2018 (CClass::_commonInit):
2019 (CClass::classForIsA):
2021 (CClass::methodsNamed):
2022 (CClass::fieldNamed):
2023 * bindings/c/c_class.h:
2024 * bindings/c/c_instance.cpp:
2025 (CInstance::CInstance):
2026 (CInstance::~CInstance):
2027 (CInstance::operator=):
2028 (CInstance::invokeMethod):
2029 (CInstance::defaultValue):
2030 * bindings/c/c_instance.h:
2031 (KJS::Bindings::CInstance::getObject):
2032 * bindings/c/c_runtime.cpp:
2033 (CField::valueFromInstance):
2034 (CField::setValueToInstance):
2035 * bindings/c/c_runtime.h:
2036 (KJS::Bindings::CField::CField):
2037 (KJS::Bindings::CField::name):
2038 (KJS::Bindings::CMethod::CMethod):
2039 (KJS::Bindings::CMethod::name):
2040 * bindings/c/c_utility.cpp:
2041 (coerceValueToNPString):
2042 (convertValueToNPValueType):
2043 (convertNPValueTypeToValue):
2044 * bindings/c/c_utility.h:
2045 * bindings/npruntime.cpp:
2046 (NPN_IdentifierFromUTF8):
2047 (NPN_IsValidIdentifier):
2048 (NPN_GetIdentifiers):
2049 (NPN_UTF8FromIdentifier):
2052 (NPN_ReleaseObject):
2053 (NPN_IsKindOfClass):
2054 (NPN_SetExceptionWithUTF8):
2057 (NPN_CreateNumberWithInt):
2058 (NPN_CreateNumberWithFloat):
2059 (NPN_CreateNumberWithDouble):
2060 (NPN_IntFromNumber):
2061 (NPN_FloatFromNumber):
2062 (NPN_DoubleFromNumber):
2064 (NPN_CreateStringWithUTF8):
2065 (NPN_CreateStringWithUTF16):
2066 (NPN_DeallocateUTF8):
2067 (NPN_UTF8FromString):
2068 (NPN_UTF16FromString):
2071 (NPN_CreateBoolean):
2072 (NPN_BoolFromBoolean):
2075 (undefinedAllocate):
2081 (NPN_ObjectAtIndex):
2082 * bindings/npruntime.h:
2083 * bindings/runtime.cpp:
2084 (Instance::createBindingForLanguageInstance):
2085 * bindings/testbindings.cpp:
2086 (initializeIdentifiers):
2106 2004-03-31 Richard Williamson <rjw@apple.com>
2108 Changed references to NP_runtime.h to npruntime.h
2110 * JavaScriptCore.pbproj/project.pbxproj:
2111 * bindings/NP_jsobject.h:
2112 * bindings/c/c_class.h:
2113 * bindings/c/c_instance.h:
2114 * bindings/c/c_runtime.h:
2115 * bindings/c/c_utility.h:
2116 * bindings/npruntime.cpp:
2118 2004-03-31 Richard Williamson <rjw@apple.com>
2120 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2122 * JavaScriptCore.pbproj/project.pbxproj:
2123 * bindings/NP_jsobject.h:
2124 * bindings/npruntime.cpp:
2128 2004-03-23 Richard Williamson <rjw@apple.com>
2130 Added implementation of KJS::Value <-> NP_Object conversion functions.
2131 Augmented test program for 'C' bindings.
2132 Added asserts and parameter checking to all public API.
2136 * JavaScriptCore.pbproj/project.pbxproj:
2137 * bindings/NP_jsobject.cpp:
2139 * bindings/NP_jsobject.h: Added.
2140 * bindings/NP_runtime.cpp:
2141 (NP_IdentifierFromUTF8):
2142 (NP_IsValidIdentifier):
2143 (NP_GetIdentifiers):
2148 (NP_SetExceptionWithUTF8):
2151 (NP_FloatFromNumber):
2152 (NP_DoubleFromNumber):
2153 (NP_CreateStringWithUTF8):
2154 (NP_CreateStringWithUTF16):
2155 (NP_DeallocateUTF8):
2156 (NP_UTF8FromString):
2157 (NP_UTF16FromString):
2159 (NP_BoolFromBoolean):
2160 * bindings/NP_runtime.h:
2161 * bindings/c/c_instance.cpp:
2162 (CInstance::invokeMethod):
2163 * bindings/c/c_utility.cpp:
2164 (coerceValueToNPString):
2165 (convertValueToNPValueType):
2166 (convertNPValueTypeToValue):
2167 * bindings/c/c_utility.h:
2169 * bindings/testC.js: Added.
2170 * bindings/testbindings.cpp:
2180 (myInterfaceInvoke):
2181 (myInterfaceAllocate):
2185 2004-03-19 Darin Adler <darin@apple.com>
2189 - fixed problem with methods like setUTCHour
2191 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2192 GMT vs. local time function based on the utc flag.
2194 2004-03-17 Richard Williamson <rjw@apple.com>
2196 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
2200 * bindings/NP_jsobject.cpp:
2205 (NP_GetPropertyAtIndex):
2206 * bindings/NP_runtime.h:
2208 2004-03-16 Richard Williamson <rjw@apple.com>
2210 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.
2214 * bindings/jni/jni_class.cpp:
2215 (JavaClass::methodsNamed):
2217 2004-03-15 Richard Williamson <rjw@apple.com>
2219 Fixed 3570854. Don't attempt to convert Null to strings. We
2220 were incorrectly converting to "Null".
2222 Actually fixed by Scott Kovatch.
2224 Reviewed by Richard.
2226 * bindings/jni/jni_utility.cpp:
2227 (KJS::Bindings::convertValueToJValue):
2231 2004-03-11 Richard Williamson <rjw@apple.com>
2233 Stitched together the NP stuff to our language independent
2234 JavaScript binding stuff. Very close to being done.
2236 Added program to test C bindings (and NP stuff). Just tests
2237 properties. Will add methods and JavaScript access, etc.
2239 Updated Makefile.am to account for new bindings/c directory.
2241 Change NP_UTF8 from "const char *" to "char" to allow for
2242 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
2245 Added NP_IsValidIdentifier().
2249 * JavaScriptCore.pbproj/project.pbxproj:
2251 * bindings/NP_jsobject.cpp:
2252 (identiferFromNPIdentifier):
2254 * bindings/NP_runtime.cpp:
2255 (NP_IdentifierFromUTF8):
2256 (NP_IsValidIdentifier):
2257 (NP_GetIdentifiers):
2258 (NP_UTF8FromIdentifier):
2259 (NP_SetExceptionWithUTF8):
2261 (NP_CreateStringWithUTF8):
2262 (NP_CreateStringWithUTF16):
2263 (NP_UTF8FromString):
2264 (NP_UTF16FromString):
2265 * bindings/NP_runtime.h:
2266 * bindings/c/c_class.cpp: Added.
2267 (CClass::_commonDelete):
2268 (CClass::_commonCopy):
2269 (CClass::_commonInit):
2270 (_createClassesByIsAIfNecessary):
2271 (CClass::classForIsA):
2274 (CClass::methodsNamed):
2275 (CClass::fieldNamed):
2276 * bindings/c/c_class.h: Added.
2277 (KJS::Bindings::CClass::~CClass):
2278 (KJS::Bindings::CClass::CClass):
2279 (KJS::Bindings::CClass::operator=):
2280 (KJS::Bindings::CClass::constructorAt):
2281 (KJS::Bindings::CClass::numConstructors):
2282 * bindings/c/c_instance.cpp: Added.
2283 (CInstance::CInstance):
2284 (CInstance::~CInstance):
2285 (CInstance::operator=):
2286 (CInstance::getClass):
2289 (CInstance::invokeMethod):
2290 (CInstance::defaultValue):
2291 (CInstance::stringValue):
2292 (CInstance::numberValue):
2293 (CInstance::booleanValue):
2294 (CInstance::valueOf):
2295 * bindings/c/c_instance.h: Added.
2296 (KJS::Bindings::CInstance::getObject):
2297 * bindings/c/c_runtime.cpp: Added.
2298 (CField::valueFromInstance):
2299 (CField::setValueToInstance):
2300 * bindings/c/c_runtime.h: Added.
2301 (KJS::Bindings::CField::CField):
2302 (KJS::Bindings::CField::name):
2303 (KJS::Bindings::CField::type):
2304 (KJS::Bindings::CMethod::CMethod):
2305 (KJS::Bindings::CMethod::name):
2306 (KJS::Bindings::CMethod::numParameters):
2307 * bindings/c/c_utility.cpp: Added.
2308 (coerceValueToNPValueType):
2309 (convertValueToNPValueType):
2310 (convertNPValueTypeToValue):
2311 * bindings/c/c_utility.h: Added.
2312 * bindings/make_testbindings:
2313 * bindings/runtime.cpp:
2314 (Instance::createBindingForLanguageInstance):
2315 * bindings/runtime.h:
2316 (KJS::Bindings::Instance::):
2317 * bindings/testbindings.cpp: Added.
2318 (initializeIdentifiers):
2319 (myInterfaceHasProperty):
2320 (myInterfaceHasMethod):
2321 (myInterfaceGetProperty):
2322 (myInterfaceSetProperty):
2323 (myInterfaceInvoke):
2324 (myInterfaceAllocate):
2325 (myInterfaceInvalidate):
2326 (myInterfaceDeallocate):
2327 (GlobalImp::className):
2328 (readJavaScriptFromFile):
2331 2004-03-10 Richard Williamson <rjw@apple.com>
2333 Made changes to support new asychronous approach to calls from
2334 plugin to JavaScript
2338 * bindings/NP_jsobject.cpp:
2343 (NP_GetPropertyAtIndex):
2344 * bindings/NP_runtime.h:
2345 * bindings/make_testbindings:
2346 * bindings/runtime.cpp:
2347 (Instance::createBindingForLanguageInstance):
2349 2004-03-10 Richard Williamson <rjw@apple.com>
2351 Updated header to include proposed changes from
2352 plugin-futures list. Calls from plugin to JavaScript
2353 are now asynchronous.
2357 * bindings/NP_runtime.h:
2361 2004-03-04 Richard Williamson <rjw@apple.com>
2363 Implementation of NP_JavaScriptObject. This is the 'C' class
2364 that wraps a JavaScript object.
2368 * JavaScriptCore.pbproj/project.pbxproj:
2369 * bindings/NP_jsobject.cpp: Added.
2370 (coerceValueToNPValueType):
2371 (convertValueToNPValueType):
2372 (convertNPValueTypeToValue):
2376 (identiferFromNPIdentifier):
2381 (NP_RemoveProperty):
2383 (NP_GetPropertyAtIndex):
2384 (NP_SetPropertyAtIndex):
2385 * bindings/NP_runtime.cpp:
2387 * bindings/NP_runtime.h:
2388 * bindings/runtime_object.h:
2390 2004-03-04 Richard Williamson <rjw@apple.com>
2392 Added NP_Array implementation.
2394 Changed NP_Boolean to just depend on two static instances, no
2395 space is required for values.
2399 * bindings/NP_runtime.cpp:
2401 (NP_BoolFromBoolean):
2407 * bindings/NP_runtime.h:
2409 2004-03-03 Darin Adler <darin@apple.com>
2413 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
2414 copyright string, and that's all that was in here.
2415 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
2417 2004-03-03 Richard Williamson <rjw@apple.com>
2419 More 'C' binding implementation. Fleshed out all the
2420 'primitive' data types.
2424 * bindings/NP_runtime.cpp:
2429 (NP_CreateStringWithUTF8):
2430 (NP_CreateStringWithUTF16):
2431 (NP_UTF8FromString):
2432 (NP_UTF16FromString):
2435 (booleanDeallocate):
2437 (NP_BoolFromBoolean):
2441 (undefinedAllocate):
2442 (undefinedDeallocate):
2444 * bindings/NP_runtime.h:
2446 2004-03-03 Richard Williamson <rjw@apple.com>
2448 More 'C' binding implementation.
2452 * bindings/NP_runtime.cpp:
2455 (getIdentifierDictionary):
2456 (NP_IdentifierFromUTF8):
2457 (NP_UTF8FromIdentifier):
2462 (NP_CreateNumberWithInt):
2463 (NP_CreateNumberWithFloat):
2464 (NP_CreateNumberWithDouble):
2466 (NP_FloatFromNumber):
2467 (NP_DoubleFromNumber):
2468 * bindings/NP_runtime.h:
2470 2004-03-02 Richard Williamson <rjw@apple.com>
2472 Removed retain/release from NP_Class. Classes will not be allowed to implement their
2473 own customer retain/release scheme.
2477 * bindings/NP_runtime.cpp:
2480 * bindings/NP_runtime.h:
2482 2004-03-02 Richard Williamson <rjw@apple.com>
2484 C binding API. Partial implementation.
2486 Completed ObjectiveC bindings (not based on the C API). These will re-implemented over the C binding API, but I wanted to get this code in the tree.
2488 Factored root object reference counting scheme. It is now useful independent
2493 * JavaScriptCore.pbproj/project.pbxproj:
2494 * bindings/NP_runtime.cpp: Added.
2495 (NP_IdentifierFromUTF8):
2496 (NP_GetIdentifiers):
2497 (NP_UTF8FromIdentifier):
2507 (NP_RemoveProperty):
2509 (NP_GetPropertyAtIndex):
2510 (NP_SetPropertyAtIndex):
2511 (NP_CreateNumberWithInt):
2512 (NP_CreateNumberWithFloat):
2513 (NP_CreateNumberWithDouble):
2515 (NP_FloatFromNumber):
2516 (NP_DoubleFromNumber):
2517 (NP_CreateStringWithUTF8):
2518 (NP_CreateStringWithUTF16):
2519 (NP_UTF8FromString):
2520 (NP_UTF16FromString):
2522 (NP_BoolFromBoolean):
2528 * bindings/NP_runtime.h: Added.
2529 * bindings/jni/jni_jsobject.cpp:
2531 (JSObject::finalize):
2532 (JSObject::createNative):
2533 (JSObject::convertValueToJObject):
2534 * bindings/jni/jni_jsobject.h:
2535 * bindings/objc/objc_jsobject.h:
2536 * bindings/objc/objc_jsobject.mm:
2538 (windowJavaScriptObject):
2539 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2540 (-[JavaScriptObject dealloc]):
2541 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
2542 (-[JavaScriptObject call:arguments:]):
2543 (-[JavaScriptObject evaluate:]):
2544 (-[JavaScriptObject getMember:]):
2545 (-[JavaScriptObject setMember:value:]):
2546 (-[JavaScriptObject removeMember:]):
2547 (-[JavaScriptObject toString]):
2548 (-[JavaScriptObject getSlot:]):
2549 (-[JavaScriptObject setSlot:value:]):
2550 * bindings/objc/objc_utility.h:
2551 * bindings/objc/objc_utility.mm:
2552 (KJS::Bindings::convertValueToObjcValue):
2553 * bindings/runtime_root.cpp: Added.
2554 (getReferencesByRootDictionary):
2555 (getReferencesDictionary):
2556 (KJS::Bindings::findReferenceDictionary):
2557 (KJS::Bindings::rootForImp):
2558 (KJS::Bindings::addNativeReference):
2559 (KJS::Bindings::removeNativeReference):
2560 (completedJavaScriptAccess):
2561 (initializeJavaScriptAccessLock):
2562 (lockJavaScriptAccess):
2563 (unlockJavaScriptAccess):
2564 (RootObject::dispatchToJavaScriptThread):
2565 (performJavaScriptAccess):
2566 (RootObject::setFindRootObjectForNativeHandleFunction):
2567 (RootObject::removeAllNativeReferences):
2568 * bindings/runtime_root.h: Added.
2569 (KJS::Bindings::RootObject::RootObject):
2570 (KJS::Bindings::RootObject::~RootObject):
2571 (KJS::Bindings::RootObject::setRootObjectImp):
2572 (KJS::Bindings::RootObject::rootObjectImp):
2573 (KJS::Bindings::RootObject::setInterpreter):
2574 (KJS::Bindings::RootObject::interpreter):
2575 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
2576 (KJS::Bindings::RootObject::runLoop):
2577 (KJS::Bindings::RootObject::performJavaScriptSource):
2583 2004-02-18 Richard Williamson <rjw@apple.com>
2585 Added NSNumber/Number conversion.
2587 Removed some unnecessary KJS:: namespace specifiers.
2591 * bindings/objc/objc_utility.mm:
2592 (KJS::Bindings::convertValueToObjcValue):
2593 (KJS::Bindings::convertObjcValueToValue):
2594 * bindings/runtime_array.h:
2596 2004-02-18 Richard Williamson <rjw@apple.com>
2598 Added support for export NSArrays.
2600 Updated valueAt() to take an ExecState so we can throw
2603 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
2604 ObjectiveC classes to control the visibility of their methods in
2609 * bindings/jni/jni_runtime.cpp:
2610 (JavaField::valueFromInstance):
2611 (JavaArray::valueAt):
2612 * bindings/jni/jni_runtime.h:
2613 * bindings/objc/objc_class.mm:
2614 (ObjcClass::methodsNamed):
2615 * bindings/objc/objc_runtime.h:
2616 (KJS::Bindings::ObjcArray::getObjcArray):
2617 * bindings/objc/objc_runtime.mm:
2618 (ObjcField::valueFromInstance):
2619 (ObjcField::setValueToInstance):
2620 (ObjcArray::ObjcArray):
2621 (ObjcArray::~ObjcArray):
2622 (ObjcArray::operator=):
2623 (ObjcArray::setValueAt):
2624 (ObjcArray::valueAt):
2625 (ObjcArray::getLength):
2626 * bindings/objc/objc_utility.mm:
2627 (KJS::Bindings::convertValueToObjcValue):
2628 (KJS::Bindings::convertObjcValueToValue):
2629 * bindings/runtime.cpp:
2630 (Instance::getValueOfField):
2631 * bindings/runtime.h:
2632 * bindings/runtime_array.cpp:
2633 (RuntimeArrayImp::get):
2634 * bindings/runtime_object.cpp:
2635 (RuntimeObjectImp::get):
2637 2004-02-17 Richard Williamson <rjw@apple.com>
2639 Added String <-> NSString conversion.
2640 Added tests of String <-> NSString conversion to test program.
2644 * bindings/objc/objc_utility.mm:
2645 (KJS::Bindings::convertValueToObjcValue):
2646 (KJS::Bindings::convertObjcValueToValue):
2648 * bindings/testbindings.mm:
2649 (-[MyFirstInterface getString]):
2651 2004-02-15 Darin Adler <darin@apple.com>
2655 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
2656 and removing redundant settings of things that match defaults in other build styles.
2658 2004-02-13 Richard Williamson <rjw@apple.com>
2660 Work towards the JavaScript ObjC bindings. The bindings now work for
2661 simple scalar types. testbindings.mm is an illustration of how the
2666 * JavaScriptCore.pbproj/project.pbxproj:
2668 * bindings/jni/jni_class.cpp:
2669 (JavaClass::methodsNamed):
2670 * bindings/jni/jni_class.h:
2671 * bindings/jni/jni_instance.cpp:
2672 (JavaInstance::invokeMethod):
2673 * bindings/jni/jni_instance.h:
2674 * bindings/jni/jni_runtime.h:
2675 (KJS::Bindings::JavaMethod::returnType):
2676 * bindings/make_testbindings: Added.
2677 * bindings/objc/objc_class.h: Added.
2678 (KJS::Bindings::ObjcClass::~ObjcClass):
2679 (KJS::Bindings::ObjcClass::ObjcClass):
2680 (KJS::Bindings::ObjcClass::operator=):
2681 (KJS::Bindings::ObjcClass::constructorAt):
2682 (KJS::Bindings::ObjcClass::numConstructors):
2683 * bindings/objc/objc_class.mm: Added.
2684 (ObjcClass::_commonDelete):
2685 (ObjcClass::_commonCopy):
2686 (ObjcClass::_commonInit):
2687 (_createClassesByIsAIfNecessary):
2688 (ObjcClass::classForIsA):
2689 (ObjcClass::ObjcClass):
2691 (ObjcClass::methodsNamed):
2692 (ObjcClass::fieldNamed):
2693 * bindings/objc/objc_header.h: Added.
2694 * bindings/objc/objc_instance.h: Added.
2695 (KJS::Bindings::ObjcInstance::getObject):
2696 * bindings/objc/objc_instance.mm: Added.
2697 (ObjcInstance::ObjcInstance):
2698 (ObjcInstance::~ObjcInstance):
2699 (ObjcInstance::operator=):
2700 (ObjcInstance::begin):
2701 (ObjcInstance::end):
2702 (ObjcInstance::getClass):
2703 (ObjcInstance::invokeMethod):
2704 (ObjcInstance::defaultValue):
2705 (ObjcInstance::stringValue):
2706 (ObjcInstance::numberValue):
2707 (ObjcInstance::booleanValue):
2708 (ObjcInstance::valueOf):
2709 * bindings/objc/objc_jsobject.h: Added.
2710 * bindings/objc/objc_jsobject.mm: Added.
2711 * bindings/objc/objc_runtime.h:
2712 (KJS::Bindings::ObjcField::~ObjcField):
2713 (KJS::Bindings::ObjcField::ObjcField):
2714 (KJS::Bindings::ObjcField::operator=):
2715 (KJS::Bindings::ObjcMethod::ObjcMethod):
2716 (KJS::Bindings::ObjcMethod::~ObjcMethod):
2717 (KJS::Bindings::ObjcMethod::operator=):
2718 * bindings/objc/objc_runtime.mm: Added.
2719 (ObjcMethod::ObjcMethod):
2721 (ObjcMethod::numParameters):
2722 (ObjcMethod::getMethodSignature):
2723 (ObjcField::ObjcField):
2726 (ObjcField::valueFromInstance):
2727 (ObjcField::setValueToInstance):
2728 * bindings/objc/objc_utility.h: Added.
2730 * bindings/objc/objc_utility.mm: Added.
2731 (KJS::Bindings::JSMethodNameToObjCMethodName):
2732 (KJS::Bindings::convertValueToObjcValue):
2733 (KJS::Bindings::convertObjcValueToValue):
2734 (KJS::Bindings::objcValueTypeForType):
2735 * bindings/runtime.cpp:
2736 (MethodList::MethodList):
2737 (MethodList::operator=):
2738 (Instance::setValueOfField):
2739 (Instance::createBindingForLanguageInstance):
2740 (Instance::createRuntimeObject):
2741 * bindings/runtime.h:
2742 * bindings/runtime_method.cpp:
2743 (RuntimeMethodImp::RuntimeMethodImp):
2744 (RuntimeMethodImp::get):
2745 (RuntimeMethodImp::call):
2746 * bindings/runtime_method.h:
2747 * bindings/runtime_object.cpp:
2748 (RuntimeObjectImp::get):
2749 (RuntimeObjectImp::hasProperty):
2750 * bindings/test.js: Added.
2751 * bindings/testbindings.mm: Added.
2752 (-[MySecondInterface init]):
2753 (-[MyFirstInterface init]):
2754 (-[MyFirstInterface dealloc]):
2755 (+[MyFirstInterface JavaScriptNameForSelector:]):
2756 (-[MyFirstInterface getInt]):
2757 (-[MyFirstInterface setInt:]):
2758 (-[MyFirstInterface getMySecondInterface]):
2759 (-[MyFirstInterface logMessage:]):
2760 (GlobalImp::className):
2761 (readJavaScriptFromFile):
2766 2004-02-08 Darin Adler <darin@apple.com>
2770 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
2772 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
2773 macros from working right in C++ code that uses the <cctype> header.
2776 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
2777 (KJS::UTF8SequenceLengthNonASCII): Added.
2778 (KJS::inlineUTF8SequenceLength): Added.
2779 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
2780 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2781 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
2782 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2783 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2785 - fixed the test program so it won't hit the interpreter lock assertion
2787 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
2791 2004-02-06 Richard Williamson <rjw@apple.com>
2793 Fixed 3550242 and 3546977. The first diff prevents an assert from firing. The second diff prevents a JavaScript exception, caused be an invalid conversion, which has a downstream consequence of preventing a valid conversion.
2797 * bindings/jni/jni_jsobject.cpp:
2798 (JSObject::toString):
2799 * bindings/jni/jni_utility.cpp:
2800 (KJS::Bindings::convertValueToJValue):
2802 2004-02-02 Darin Adler <darin@apple.com>
2806 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
2808 * kjs/array_object.cpp:
2809 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
2810 we start putting values in. This prevents new Array(2147483647) from causing trouble.
2811 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
2812 number is out of range. This prevents new Array(-1) from causing trouble.
2814 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
2816 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
2817 casting to int. Results now match those in other browsers.
2819 2004-02-02 Darin Adler <darin@apple.com>
2823 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
2824 - fixed other related overflow issues
2826 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
2828 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
2829 must not restrict values to the range of a particular integer type.
2830 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
2831 proper handling for negative results from fmod.
2832 (ValueImp::toUInt32): Ditto.
2833 (ValueImp::toUInt16): Ditto.
2834 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
2836 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
2837 out-of-integer-range values better in the slice function.
2838 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
2839 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
2840 out-of-integer-range values better in the toString function.
2841 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
2842 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
2843 and substr functions.
2847 2004-01-30 Richard Williamson <rjw@apple.com>
2849 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
2853 * bindings/jni/jni_instance.cpp:
2854 (JavaInstance::stringValue):
2856 2004-01-26 Darin Adler <darin@apple.com>
2858 * Makefile.am: Switch from pbxbuild to xcodebuild.
2860 2004-01-22 Richard Williamson <rjw@apple.com>
2862 Added stubs for ObjC language binding to JavaScript.
2864 * JavaScriptCore.pbproj/project.pbxproj:
2865 * bindings/jni/jni_runtime.h:
2866 * bindings/objc/objc_runtime.h: Added.
2867 (KJS::Bindings::ObjcParameter::ObjcParameter):
2868 (KJS::Bindings::ObjcParameter::~ObjcParameter):
2869 (KJS::Bindings::ObjcParameter::operator=):
2870 (KJS::Bindings::ObjcParameter::type):
2871 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
2872 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
2873 (KJS::Bindings::ObjcConstructor::_commonCopy):
2874 (KJS::Bindings::ObjcConstructor::operator=):
2875 (KJS::Bindings::ObjcConstructor::value):
2876 (KJS::Bindings::ObjcConstructor::parameterAt):
2877 (KJS::Bindings::ObjcConstructor::numParameters):
2878 (KJS::Bindings::ObjcField::ObjcField):
2879 (KJS::Bindings::ObjcField::~ObjcField):
2880 * bindings/runtime.h:
2882 2004-01-22 Richard Williamson <rjw@apple.com>
2884 Simplified JavaString by using UString as backing store. This
2885 revealed a bug in CString's assignment operator which I fixed.
2887 Removed some dead code.
2891 * bindings/jni/jni_runtime.h:
2892 (KJS::Bindings::JavaString::JavaString):
2893 (KJS::Bindings::JavaString::_commonInit):
2894 (KJS::Bindings::JavaString::UTF8String):
2895 (KJS::Bindings::JavaString::uchars):
2896 (KJS::Bindings::JavaString::length):
2897 (KJS::Bindings::JavaString::ustring):
2898 * bindings/runtime_object.cpp:
2899 (RuntimeObjectImp::RuntimeObjectImp):
2900 * bindings/runtime_object.h:
2902 (KJS::CString::CString):
2903 (KJS::CString::operator=):
2909 2004-01-16 Richard Williamson <rjw@apple.com>
2911 Fixed 3525853. We weren't handling mapping to overloaded Java
2912 methods very well. Even though this is undefined the other
2913 browsers support it. Also fixed a bug with returning arrays
2914 from Java functions.
2918 * bindings/jni/jni_class.cpp:
2919 (JavaClass::_commonInit):
2920 (JavaClass::methodsNamed):
2921 * bindings/jni/jni_class.h:
2922 * bindings/jni/jni_instance.cpp:
2923 (JavaInstance::invokeMethod):
2924 * bindings/jni/jni_instance.h:
2925 * bindings/jni/jni_runtime.cpp:
2926 (JavaArray::convertJObjectToArray):
2927 (JavaField::valueFromInstance):
2928 (JavaMethod::signature):
2929 (JavaArray::valueAt):
2930 * bindings/jni/jni_runtime.h:
2931 * bindings/jni_jsobject.cpp:
2933 (JSObject::convertJObjectToValue):
2934 * bindings/runtime.cpp:
2935 (MethodList::addMethod):
2936 (MethodList::length):
2937 (MethodList::methodAt):
2938 (MethodList::~MethodList):
2939 * bindings/runtime.h:
2940 (KJS::Bindings::MethodList::MethodList):
2941 * bindings/runtime_method.cpp:
2942 (RuntimeMethodImp::RuntimeMethodImp):
2943 (RuntimeMethodImp::get):
2944 (RuntimeMethodImp::call):
2945 * bindings/runtime_method.h:
2946 * bindings/runtime_object.cpp:
2947 (RuntimeObjectImp::get):
2948 (RuntimeObjectImp::hasProperty):
2950 2004-01-16 Richard Williamson <rjw@apple.com>
2952 Fixed 3531229. Another place that needs the Push/PopLocalFrame
2953 protection implemented for 3530401.
2957 * bindings/runtime_method.cpp:
2958 (RuntimeMethodImp::call):
2960 2004-01-15 Richard Williamson <rjw@apple.com>
2962 Fixed 3530401. JNI doesn't cleanup local refs created on the
2963 main thread. IMO this is a bad bug in our JMI implementation.
2965 To work-around the problem I explicitly delete all local refs.
2966 Further, I've added Push/PopLocalFrame calls to catch any refs
2967 that I may have missed. This will guarantee that we don't leak
2968 any Java references.
2972 * bindings/jni/jni_class.cpp:
2973 (JavaClass::_commonInit):
2974 (JavaClass::JavaClass):
2975 * bindings/jni/jni_instance.cpp:
2976 (JavaInstance::begin):
2977 (JavaInstance::end):
2978 * bindings/jni/jni_instance.h:
2979 * bindings/jni/jni_runtime.cpp:
2980 (JavaConstructor::JavaConstructor):
2981 (JavaMethod::JavaMethod):
2982 * bindings/jni_jsobject.cpp:
2983 (JSObject::listFromJArray):
2984 * bindings/runtime.h:
2985 (KJS::Bindings::Instance::begin):
2986 (KJS::Bindings::Instance::end):
2987 * bindings/runtime_object.cpp:
2988 (RuntimeObjectImp::get):
2989 (RuntimeObjectImp::put):
2990 (RuntimeObjectImp::canPut):
2991 (RuntimeObjectImp::hasProperty):
2992 (RuntimeObjectImp::defaultValue):
2994 2004-01-15 Vicki Murley <vicki@apple.com>
2998 * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
3000 2004-01-14 Richard Williamson <rjw@apple.com>
3002 Fixed 3529466. With recent changes to Java plugin we must no
3003 longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
3007 * bindings/jni/jni_instance.cpp:
3008 (JObjectWrapper::JObjectWrapper):
3012 2004-01-14 Richard Williamson <rjw@apple.com>
3016 Finalize may be called on an JSObject after we've already remove all our references. The assert in this case is firing because we've received a finalize call from Java for an instance that we no longer know about. The fix is to check in finalize that we're getting a call on an instance that we still care about.
3020 * bindings/jni_jsobject.cpp:
3022 (removeJavaReference):
3023 (RootObject::removeAllJavaReferencesForRoot):
3026 2004-01-13 Richard Williamson <rjw@apple.com>
3030 The run loop that is used to execute JavaScript (in practice, always the main run loop) is held in a class variable. It is set and retained once and should not be released. Unfortunately is it being released when the 'root' object on a LiveConnect applet is released. This has the symptom of eventually causing an deallocation of the main run loop! Usually after about 5 instantiations/destructions of a LiveConnect applet. The CFRelease of the run loop was removed.
3034 * bindings/jni_jsobject.h:
3035 (KJS::Bindings::RootObject::~RootObject):
3041 2004-01-06 Richard Williamson <rjw@apple.com>
3043 Fixed 3521814. Finalize messages weren't being dispatched!
3047 * bindings/jni_jsobject.cpp:
3050 2004-01-05 Richard Williamson <rjw@apple.com>
3052 Added cache of JNI method IDs to minimize allocations. This mitigates the problem
3053 described by 3515579.
3055 Also cleanup up logging of Java exceptions.
3059 * bindings/jni/jni_class.cpp:
3060 (JavaClass::classForInstance):
3061 * bindings/jni/jni_instance.cpp:
3062 (JavaInstance::JavaInstance):
3063 (JavaInstance::getClass):
3064 (JavaInstance::invokeMethod):
3065 (JObjectWrapper::JObjectWrapper):
3066 (JObjectWrapper::~JObjectWrapper):
3067 * bindings/jni/jni_instance.h:
3068 (KJS::Bindings::JavaInstance::operator=):
3069 * bindings/jni/jni_runtime.cpp:
3070 (JavaMethod::JavaMethod):
3071 (JavaMethod::methodID):
3072 * bindings/jni/jni_runtime.h:
3073 (KJS::Bindings::JavaMethod::JavaMethod):
3074 * bindings/jni/jni_utility.cpp:
3078 (KJS::Bindings::getMethodID):
3079 (KJS::Bindings::callJNIVoidMethodIDA):
3080 (KJS::Bindings::callJNIObjectMethodIDA):
3081 (KJS::Bindings::callJNIByteMethodIDA):
3082 (KJS::Bindings::callJNICharMethodIDA):
3083 (KJS::Bindings::callJNIShortMethodIDA):
3084 (KJS::Bindings::callJNIIntMethodIDA):
3085 (KJS::Bindings::callJNILongMethodIDA):
3086 (KJS::Bindings::callJNIFloatMethodIDA):
3087 (KJS::Bindings::callJNIDoubleMethodIDA):
3088 (KJS::Bindings::callJNIBooleanMethodIDA):
3089 (KJS::Bindings::getCharactersFromJStringInEnv):
3090 (KJS::Bindings::getUCharactersFromJStringInEnv):
3091 (KJS::Bindings::getJNIField):
3092 * bindings/jni/jni_utility.h:
3094 l2003-12-23 John Sullivan <sullivan@apple.com>
3096 * JavaScriptCore.pbproj/project.pbxproj:
3097 Xcode version wars, harmless
3099 2003-12-23 Darin Adler <darin@apple.com>
3101 Reviewed by John (concept, not code, which is just the old code coming back).
3103 - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
3105 * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
3106 mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
3108 2003-12-19 Richard Williamson <rjw@apple.com>
3110 Fixed 3515597. When an error occurs we need
3111 to make sure result values are zeroed.
3113 Cleaned up logs by adding a newline.
3117 * bindings/jni/jni_utility.cpp:
3118 (KJS::Bindings::getJavaVM):
3119 (KJS::Bindings::getJNIEnv):
3122 (KJS::Bindings::getJNIField):
3123 * bindings/jni_jsobject.cpp:
3124 (JSObject::convertValueToJObject):
3128 2003-12-17 Richard Williamson <rjw@apple.com>
3130 Ensure that all the symbols we export are in the KJS
3131 namespace (3512245).
3133 Also renamed JavaString.characters() to JavaString.UTF8String()
3134 for enhanced clarity.
3136 Added some sanity checking to constructor of JObjectWrapper.
3141 * bindings/jni/jni_class.cpp:
3142 * bindings/jni/jni_class.h:
3143 * bindings/jni/jni_instance.cpp:
3144 (JavaInstance::invokeMethod):
3145 (JObjectWrapper::JObjectWrapper):
3146 * bindings/jni/jni_instance.h:
3147 * bindings/jni/jni_runtime.cpp:
3148 (JavaParameter::JavaParameter):
3149 (JavaField::JavaField):
3150 (JavaMethod::JavaMethod):
3151 (JavaMethod::signature):
3152 * bindings/jni/jni_runtime.h:
3153 (KJS::Bindings::JavaString::ascii):
3154 (KJS::Bindings::JavaString::UTF8String):
3155 (KJS::Bindings::JavaString::JavaString):
3156 (KJS::Bindings::JavaString::_commonInit):
3157 (KJS::Bindings::JavaString::uchars):
3158 (KJS::Bindings::JavaString::length):
3159 (KJS::Bindings::JavaString::ustring):
3160 (KJS::Bindings::JavaParameter::type):
3161 (KJS::Bindings::JavaField::name):
3162 (KJS::Bindings::JavaField::type):
3163 (KJS::Bindings::JavaMethod::name):
3164 (KJS::Bindings::JavaMethod::returnType):
3165 * bindings/jni/jni_utility.cpp:
3166 (KJS::Bindings::getJavaVM):
3167 (KJS::Bindings::getJNIEnv):
3168 (KJS::Bindings::callJNIVoidMethod):
3169 (KJS::Bindings::callJNIObjectMethod):
3170 (KJS::Bindings::callJNIBooleanMethod):
3171 (KJS::Bindings::callJNIByteMethod):
3172 (KJS::Bindings::callJNICharMethod):
3173 (KJS::Bindings::callJNIShortMethod):
3174 (KJS::Bindings::callJNIIntMethod):
3175 (KJS::Bindings::callJNILongMethod):
3176 (KJS::Bindings::callJNIFloatMethod):
3177 (KJS::Bindings::callJNIDoubleMethod):
3178 (KJS::Bindings::callJNIVoidMethodA):
3179 (KJS::Bindings::callJNIObjectMethodA):
3180 (KJS::Bindings::callJNIByteMethodA):
3181 (KJS::Bindings::callJNICharMethodA):
3182 (KJS::Bindings::callJNIShortMethodA):
3183 (KJS::Bindings::callJNIIntMethodA):
3184 (KJS::Bindings::callJNILongMethodA):
3185 (KJS::Bindings::callJNIFloatMethodA):
3186 (KJS::Bindings::callJNIDoubleMethodA):
3187 (KJS::Bindings::callJNIBooleanMethodA):
3188 (KJS::Bindings::getCharactersFromJString):
3189 (KJS::Bindings::releaseCharactersForJString):
3190 (KJS::Bindings::getCharactersFromJStringInEnv):
3191 (KJS::Bindings::releaseCharactersForJStringInEnv):
3192 (KJS::Bindings::getUCharactersFromJStringInEnv):
3193 (KJS::Bindings::releaseUCharactersForJStringInEnv):
3194 (KJS::Bindings::JNITypeFromClassName):
3195 (KJS::Bindings::signatureFromPrimitiveType):
3196 (KJS::Bindings::JNITypeFromPrimitiveType):
3197 (KJS::Bindings::getJNIField):
3198 (KJS::Bindings::convertValueToJValue):
3199 * bindings/jni/jni_utility.h:
3200 * bindings/jni_jsobject.cpp:
3201 (KJS::Bindings::JSObject::invoke):
3202 (KJS::Bindings::JSObject::JSObject):
3203 (KJS::Bindings::JSObject::call):
3204 (KJS::Bindings::JSObject::eval):
3205 (KJS::Bindings::JSObject::getMember):
3206 (KJS::Bindings::JSObject::setMember):
3207 (KJS::Bindings::JSObject::removeMember):
3208 (KJS::Bindings::JSObject::getSlot):
3209 (KJS::Bindings::JSObject::setSlot):
3210 (KJS::Bindings::JSObject::toString):
3211 (KJS::Bindings::JSObject::finalize):
3212 (KJS::Bindings::JSObject::createNative):
3213 (KJS::Bindings::JSObject::convertValueToJObject):
3214 (KJS::Bindings::JSObject::convertJObjectToValue):
3215 (KJS::Bindings::JSObject::listFromJArray):
3216 * bindings/jni_jsobject.h:
3217 * bindings/runtime.cpp:
3218 * bindings/runtime.h:
3219 * bindings/runtime_method.cpp:
3220 * bindings/runtime_method.h:
3224 2003-12-16 Richard Williamson <rjw@apple.com>
3226 Ack! More assertions. Lock ALL entry points into the interpreter!
3231 * bindings/jni_jsobject.cpp:
3232 (Bindings::JSObject::call):
3233 (Bindings::JSObject::eval):
3234 (Bindings::JSObject::getMember):
3235 (Bindings::JSObject::setMember):
3236 (Bindings::JSObject::removeMember):
3237 (Bindings::JSObject::getSlot):
3238 (Bindings::JSObject::setSlot):
3239 (Bindings::JSObject::convertJObjectToValue):
3241 2003-12-15 Richard Williamson <rjw@apple.com>
3243 Fixed a couple of snafus and removed some logging.
3247 * bindings/jni_jsobject.cpp:
3248 (Bindings::performJavaScriptAccess):
3249 (Bindings::completedJavaScriptAccess):
3250 (Bindings::dispatchToJavaScriptThread):
3251 Removed some annoying JS_LOG clutter.
3253 (Bindings::RootObject::removeAllJavaReferencesForRoot):
3254 Fixed allocation of key buffer that was called after it was needed.
3256 (Bindings::JSObject::invoke):
3257 (Bindings::JSObject::JSObject):
3258 (Bindings::JSObject::getMember):
3259 (Bindings::JSObject::getSlot):
3260 Added additional interpreter locks around getMember and getSlot.
3261 These functions may cause allocation of JS impls.
3263 2003-12-15 Richard Williamson <rjw@apple.com>
3265 args weren't passed to 'call' invocation. d'oh.
3266 lock interpreter when we create instances of JS impls.
3270 * bindings/jni_jsobject.cpp:
3271 (Bindings::JSObject::call):
3272 (Bindings::JSObject::eval):
3273 (Bindings::JSObject::getMember):
3274 (Bindings::JSObject::setMember):
3275 (Bindings::JSObject::getSlot):
3276 (Bindings::JSObject::convertValueToJObject):
3277 (Bindings::JSObject::convertJObjectToValue):
3278 (Bindings::JSObject::listFromJArray):
3279 * bindings/jni_jsobject.h:
3281 2003-12-15 Richard Williamson <rjw@apple.com>
3283 Last piece of LiveConnect! This checkin adds implementation
3284 of the Java to JavaScript object conversion functions.
3288 * bindings/jni/jni_instance.cpp:
3289 (JavaInstance::invokeMethod):
3290 * bindings/jni/jni_utility.cpp:
3291 * bindings/jni/jni_utility.h:
3292 * bindings/jni_jsobject.cpp:
3293 (Bindings::JSObject::invoke):
3294 (Bindings::JSObject::call):
3295 (Bindings::JSObject::eval):
3296 (Bindings::JSObject::getMember):
3297 (Bindings::JSObject::setMember):
3298 (Bindings::JSObject::getSlot):
3299 (Bindings::JSObject::setSlot):
3300 (Bindings::JSObject::createNative):
3301 (Bindings::JSObject::convertValueToJObject):
3302 (Bindings::JSObject::convertJObjectToValue):
3303 (Bindings::JSObject::listFromJArray):
3304 * bindings/jni_jsobject.h:
3306 * bindings/runtime_method.cpp:
3307 (RuntimeMethodImp::get):
3308 (RuntimeMethodImp::codeType):
3309 (RuntimeMethodImp::execute):
3311 2003-12-12 Richard Williamson <rjw@apple.com>
3313 Added implementation of stubs in JSObject. All that
3314 remains is a couple of simple conversion functions stubs and
3315 we're done with LiveConnect. Also, changed string passing to
3316 JS to use uchars instead of chars.
3320 * bindings/jni/jni_runtime.h:
3321 (Bindings::JavaString::JavaString):
3322 (Bindings::JavaString::_commonInit):
3323 (Bindings::JavaString::_commonCopy):
3324 (Bindings::JavaString::_commonDelete):
3325 (Bindings::JavaString::~JavaString):
3326 (Bindings::JavaString::operator=):
3327 (Bindings::JavaString::uchars):
3328 (Bindings::JavaString::length):
3329 (Bindings::JavaString::ustring):
3330 * bindings/jni/jni_utility.cpp:
3331 (getUCharactersFromJStringInEnv):
3332 (releaseUCharactersForJStringInEnv):
3333 (convertValueToJObject):
3334 (convertJObjectToValue):
3335 * bindings/jni/jni_utility.h:
3336 * bindings/jni_jsobject.cpp:
3337 (Bindings::JSObject::invoke):
3338 (Bindings::JSObject::call):
3339 (Bindings::JSObject::eval):
3340 (Bindings::JSObject::getMember):
3341 (Bindings::JSObject::setMember):
3342 (Bindings::JSObject::removeMember):
3343 (Bindings::JSObject::getSlot):
3344 (Bindings::JSObject::setSlot):
3345 * bindings/jni_jsobject.h:
3347 2003-12-12 Richard Williamson <rjw@apple.com>
3349 Ensure that all calls from Java into JavaScript are
3350 performed on a designated thread (the main thread).
3354 * bindings/jni_jsobject.cpp:
3355 (isJavaScriptThread):
3357 (Bindings::performJavaScriptAccess):
3358 (Bindings::completedJavaScriptAccess):
3359 (Bindings::initializeJavaScriptAccessLock):
3360 (Bindings::lockJavaScriptAccess):
3361 (Bindings::unlockJavaScriptAccess):
3362 (Bindings::dispatchToJavaScriptThread):
3363 (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
3364 (Bindings::RootObject::removeAllJavaReferencesForRoot):
3365 (Bindings::JSObject::invoke):
3366 (Bindings::JSObject::JSObject):
3367 (Bindings::JSObject::call):
3368 (Bindings::JSObject::eval):
3369 (Bindings::JSObject::getMember):
3370 (Bindings::JSObject::setMember):
3371 (Bindings::JSObject::removeMember):
3372 (Bindings::JSObject::getSlot):
3373 (Bindings::JSObject::setSlot):
3374 (Bindings::JSObject::toString):
3375 (Bindings::JSObject::finalize):
3376 (Bindings::JSObject::getWindow):
3377 * bindings/jni_jsobject.h:
3378 (Bindings::RootObject::~RootObject):
3379 (Bindings::RootObject::findRootObjectForNativeHandleFunction):
3380 (Bindings::RootObject::runLoop):
3381 (Bindings::RootObject::performJavaScriptSource):
3384 2003-12-11 Richard Williamson <rjw@apple.com>
3386 Added support for calling a JavaScript function from
3387 Java. Right now this only works for void func(void)
3388 functions, but the conversion of args and return values
3391 Cleaned up and verified reference counting scheme, and
3392 dereferencing of vended JavaScript objects when applet is
3393 destroyed (actually when part is destroyed).
3395 Removed link hack for testkjs now that the Java folks think
3396 they have a solution for the 1.4.2 JavaVM link problem. Although
3397 Greg B. thinks his solution may cause problems for the 1.3.1
3398 version of the VM!?!
3403 * bindings/jni/jni_runtime.h:
3404 (Bindings::JavaString::JavaString):
3405 * bindings/jni/jni_utility.cpp:
3406 (convertValueToJValue):
3407 (convertValueToJObject):
3409 * bindings/jni/jni_utility.h:
3410 * bindings/jni_jsobject.cpp:
3411 (KJS_setFindRootObjectForNativeHandleFunction):
3412 (KJS_findRootObjectForNativeHandleFunction):
3413 (getReferencesByRootDictionary):
3414 (getReferencesDictionary):
3415 (findReferenceDictionary):
3418 (removeJavaReference):
3419 * bindings/jni_jsobject.h:
3420 (Bindings::RootObject::RootObject):
3421 (Bindings::RootObject::~RootObject):
3422 (Bindings::RootObject::setRootObjectImp):
3423 (Bindings::RootObject::rootObjectImp):
3424 (Bindings::RootObject::setInterpreter):
3425 (Bindings::RootObject::interpreter):
3429 2003-12-10 Darin Adler <darin@apple.com>
3433 - fixed regression in JavaScript tests reported by the KDE guys
3434 - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
3436 * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
3438 (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
3439 tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
3440 and binary compatibility than default parameter values.
3441 (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
3443 * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
3444 "tolerate empty string" parameter.
3446 2003-12-10 Richard Williamson <rjw@apple.com>
3448 Added code to manage reference counting of JavaScript
3449 objects passed to Java. Also added implementation of
3450 KJS_JSCreateNativeJSObject. This is the function that
3451 provides the root object to Java (KJS::Window).
3455 * JavaScriptCore.pbproj/project.pbxproj:
3456 * bindings/jni_jsobject.cpp:
3457 (KJS_setFindObjectForNativeHandleFunction):
3458 (KJS_findObjectForNativeHandleFunction):
3459 (getReferencesByOwnerDictionary):
3460 (getReferencesDictionary):
3461 (findReferenceDictionary):
3463 (removeJavaReference):
3464 (removeAllJavaReferencesForOwner):
3465 * bindings/jni_jsobject.h:
3467 2003-12-09 Richard Williamson <rjw@apple.com>
3469 LiveConnect stubs that correspond to the native methods
3470 on JSObject. These will be called from the new Java plugin
3471 when an instance of JSObject is instantiated and messaged.
3472 When these are implemented the Java will be able to originate
3473 calls into JavaScript.
3475 Also a temporary work-around added to Makefile.am to solve
3476 a link problem. The 1.4.2 JavaVM accidentally links against
3477 libobjc. This call a failure linking testkjs. Mike Hay is
3478 working with someone to fix the problem (3505587).
3482 * JavaScriptCore.pbproj/project.pbxproj:
3484 * bindings/jni_jsobject.cpp: Added.
3485 (KJS_JSCreateNativeJSObject):
3486 (KJS_JSObject_JSFinalize):
3487 (KJS_JSObject_JSObjectCall):
3488 (KJS_JSObject_JSObjectEval):
3489 (KJS_JSObject_JSObjectGetMember):
3490 (KJS_JSObject_JSObjectSetMember):
3491 (KJS_JSObject_JSObjectRemoveMember):
3492 (KJS_JSObject_JSObjectGetSlot):
3493 (KJS_JSObject_JSObjectSetSlot):
3494 (KJS_JSObject_JSObjectToString):
3495 * bindings/jni_jsobject.h: Added.
3497 2003-12-09 Maciej Stachowiak <mjs@apple.com>
3501 <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
3503 * kjs/collector.cpp:
3504 (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
3505 (KJS::Collector::collect): likewise
3507 2003-12-08 Richard Williamson <rjw@apple.com>
3509 LiveConnect: The last piece of the JavaScript side of the
3510 LiveConnect implementation. This change adds support for
3511 setting/getting values from Java arrays in JavaScript.
3515 * bindings/jni/jni_instance.h:
3516 * bindings/jni/jni_runtime.cpp:
3517 (JavaField::JavaField):
3518 (convertJObjectToArray):
3519 (JavaArray::JavaArray):
3520 (JavaArray::~JavaArray):
3521 (JavaArray::setValueAt):
3522 (JavaArray::valueAt):
3523 (JavaArray::getLength):
3524 * bindings/jni/jni_runtime.h:
3525 (Bindings::JavaArray::operator=):
3526 (Bindings::JavaArray::javaArray):
3527 * bindings/jni/jni_utility.cpp:
3528 (JNITypeFromPrimitiveType):
3529 (convertValueToJValue):
3530 * bindings/jni/jni_utility.h:
3531 * bindings/runtime.h:
3532 * bindings/runtime_array.cpp:
3533 (RuntimeArrayImp::RuntimeArrayImp):
3534 (RuntimeArrayImp::~RuntimeArrayImp):
3535 (RuntimeArrayImp::get):
3536 (RuntimeArrayImp::put):
3537 (RuntimeArrayImp::hasProperty):
3538 * bindings/runtime_array.h:
3539 (KJS::RuntimeArrayImp::getLength):
3540 (KJS::RuntimeArrayImp::getConcreteArray):
3541 * bindings/runtime_object.cpp:
3542 (RuntimeObjectImp::get):
3543 (RuntimeObjectImp::canPut):
3544 (RuntimeObjectImp::hasProperty):
3546 2003-12-05 Richard Williamson <rjw@apple.com>
3548 LiveConnect: Part 1 of supporting JS bindings to
3549 native language arrays.
3553 * JavaScriptCore.pbproj/project.pbxproj:
3554 * bindings/jni/jni_runtime.cpp:
3555 (JavaField::JavaField):
3556 (convertJObjectToArray):
3557 (JavaField::valueFromInstance):
3558 (JavaField::setValueToInstance):
3559 * bindings/jni/jni_runtime.h:
3560 * bindings/runtime.cpp:
3561 (Instance::setValueOfField):
3562 * bindings/runtime.h:
3563 (Bindings::Array::~Array):
3565 2003-12-04 Richard Williamson <rjw@apple.com>
3567 LiveConnect: Moved defaultValue into concrete implementation because
3568 more intelligent conversion can be perform with knowledge
3569 of the class of the original instance.