3 2004-08-20 Richard Williamson <rjw@apple.com>
5 Implemented new JNI abstraction. We no longer invoke Java methods
6 directly with JNI, rather we call into the plugin. This allows the
7 plugin to dispatch the call to the appropriate VM thread. This
8 change should (will?) fix a whole class of threading related problems with
13 * JavaScriptCore.pbproj/project.pbxproj:
14 * bindings/c/c_instance.h:
15 (KJS::Bindings::CInstance::setExecutionContext):
16 (KJS::Bindings::CInstance::executionContext):
17 * bindings/jni/jni_instance.cpp:
18 (JavaInstance::JavaInstance):
19 (JavaInstance::invokeMethod):
20 (JavaInstance::setExecutionContext):
21 (JavaInstance::executionContext):
22 * bindings/jni/jni_instance.h:
23 * bindings/jni/jni_jsobject.cpp:
24 (JSObject::convertJObjectToValue):
25 * bindings/jni/jni_runtime.cpp:
26 (JavaField::JavaField):
27 (JavaArray::convertJObjectToArray):
28 (JavaField::valueFromInstance):
29 (JavaArray::JavaArray):
31 * bindings/jni/jni_runtime.h:
32 (KJS::Bindings::JavaArray::operator=):
33 (KJS::Bindings::JavaArray::executionContext):
34 * bindings/jni/jni_utility.h:
35 * bindings/objc/objc_instance.h:
36 (KJS::Bindings::ObjcInstance::setExecutionContext):
37 (KJS::Bindings::ObjcInstance::executionContext):
38 * bindings/runtime.cpp:
39 (Instance::createBindingForLanguageInstance):
41 * bindings/runtime_root.h:
42 (KJS::Bindings::RootObject::nativeHandle):
46 2004-08-19 Vicki Murley <vicki@apple.com>
50 * kjs/property_map.cpp:
51 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
53 2004-08-17 Darin Adler <darin@apple.com>
57 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
59 * kjs/property_map.h: Added some private functions.
60 * kjs/property_map.cpp:
61 (KJS::PropertyMap::clear): Set sentinelCount to 0.
62 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
63 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
64 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
65 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
66 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
67 deleted-element sentinels.
68 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
70 2004-08-16 Maciej Stachowiak <mjs@apple.com>
72 Code change by Eric Albert, reviewd by me.
74 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
76 * kjs/date_object.cpp:
77 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
78 entirely would be even better, but is not required to fix this bug.
82 2004-08-16 Richard Williamson <rjw@apple.com>
84 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
86 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
90 * bindings/NP_jsobject.cpp:
92 * bindings/jni/jni_jsobject.cpp:
94 * bindings/objc/WebScriptObject.mm:
95 (-[WebScriptObject evaluateWebScript:]):
97 2004-08-15 Richard Williamson <rjw@apple.com>
99 More updates to np headers. Implemented new NPN functions.
103 * bindings/NP_jsobject.cpp:
107 * bindings/npruntime.h:
109 2004-08-13 Darin Adler <darin@apple.com>
111 - fix build so we can compile again
113 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
114 is good enough so that we can compile, but it's only a stopgap measure, because I think
115 Richard has a newer one he wants to check in.
117 2004-08-12 Richard Williamson <rjw@apple.com>
119 Bring npruntime.h and friends closer to compliance with
124 * JavaScriptCore.pbproj/project.pbxproj:
125 * bindings/NP_jsobject.cpp:
127 (_NPN_CreateScriptObject):
132 (NPN_RemoveProperty):
133 * bindings/NP_jsobject.h:
134 * bindings/c/c_instance.cpp:
135 (CInstance::invokeMethod):
136 * bindings/c/c_utility.cpp:
137 (convertNPVariantToValue):
138 * bindings/npruntime.cpp:
139 (NPN_IdentifierIsString):
142 (NPN_VariantIsUndefined):
144 (NPN_VariantIsInt32):
145 (NPN_VariantIsDouble):
146 (NPN_VariantIsString):
147 (NPN_VariantIsObject):
149 (NPN_VariantToString):
150 (NPN_VariantToInt32):
151 (NPN_VariantToDouble):
152 (NPN_VariantToObject):
153 (NPN_InitializeVariantAsVoid):
154 (NPN_InitializeVariantAsNull):
155 (NPN_InitializeVariantAsUndefined):
156 (NPN_InitializeVariantWithBool):
157 (NPN_InitializeVariantWithInt32):
158 (NPN_InitializeVariantWithDouble):
159 (NPN_InitializeVariantWithString):
160 (NPN_InitializeVariantWithStringCopy):
161 (NPN_InitializeVariantWithObject):
162 (NPN_InitializeVariantWithVariant):
163 (NPN_ReleaseVariantValue):
165 * bindings/npruntime.h:
167 (_NPString::_NPVariant::):
168 * bindings/npruntime_priv.h: Added.
170 2004-08-12 Darin Adler <darin@apple.com>
174 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
177 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
178 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
179 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
180 to skip leading "+" or "-".
184 2004-08-12 Darin Adler <darin@apple.com>
188 - fixed 43 Mozilla JavaScript tests
190 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
191 * kjs/date_object.cpp:
192 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
193 than constructing a number object to pass to it.
194 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
195 (KJS::parseDate): Change to return a double instead of creating the Number object here.
196 (KJS::timeClip): Implement this as specified in the language standard.
198 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
199 flags on the prototype property.
202 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
204 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
206 (KJS::parseDigit): Added. Helper function for parseInt.
207 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
208 strtoll can handle. Also matches standard more closely.
209 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
211 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
213 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
215 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
217 (Lexer::setCode): Clear error state.
218 (Lexer::lex): Set error state if the lexer encounters an error
221 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
222 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
224 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
225 Change round to round values between -0.5 and -0 to -0 instead of +0.
227 * kjs/nodes.h: Add evaluateReference function to GroupNode.
228 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
229 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
230 would change x.y into a value that can't be deleted as a side effect.
232 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
235 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
236 get rid of the fixed size limit for code.
238 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
239 returns the string without creating a new Rep, since I'm using substr in a place where it will
242 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
243 the other day that was making a couple tests fail.
244 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
245 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
246 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
247 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
248 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
250 * kjs/string_object.lut.h: Regenerated.
252 2004-08-11 Darin Adler <darin@apple.com>
254 - fixed a tiny problem with the UTF-16 PCRE check-in
256 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
257 the ctype_meta flag to get set in items that should not have it.
259 * pcre/chartables.c: Regenerated.
261 2004-08-10 Richard Williamson <rjw@apple.com>
263 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
265 The following WebScripting methods are now supported on bound
268 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
269 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
270 - (id)valueForUndefinedKey:(NSString *)key
274 * bindings/c/c_class.cpp:
275 (CClass::fieldNamed):
276 * bindings/c/c_class.h:
277 * bindings/jni/jni_class.cpp:
278 (JavaClass::fieldNamed):
279 * bindings/jni/jni_class.h:
280 * bindings/objc/objc_class.h:
281 (KJS::Bindings::ObjcClass::isa):
282 * bindings/objc/objc_class.mm:
283 (ObjcClass::methodsNamed):
284 (ObjcClass::fieldNamed):
285 (ObjcClass::fallbackObject):
286 * bindings/objc/objc_instance.h:
287 * bindings/objc/objc_instance.mm:
288 (ObjcInstance::invokeMethod):
289 (ObjcInstance::setValueOfField):
290 (ObjcInstance::setValueOfUndefinedField):
291 (ObjcInstance::getValueOfField):
292 (ObjcInstance::getValueOfUndefinedField):
293 * bindings/objc/objc_runtime.h:
294 (KJS::Bindings::ObjcField::~ObjcField):
295 (KJS::Bindings::ObjcField::ObjcField):
296 (KJS::Bindings::ObjcField::operator=):
297 (KJS::Bindings::FallbackObjectImp::classInfo):
298 * bindings/objc/objc_runtime.mm:
299 (ObjcField::ObjcField):
302 (ObjcField::valueFromInstance):
303 (ObjcField::setValueToInstance):
304 (FallbackObjectImp::FallbackObjectImp):
305 (FallbackObjectImp::get):
306 (FallbackObjectImp::put):
307 (FallbackObjectImp::canPut):
308 (FallbackObjectImp::implementsCall):
309 (FallbackObjectImp::call):
310 (FallbackObjectImp::hasProperty):
311 (FallbackObjectImp::deleteProperty):
312 (FallbackObjectImp::defaultValue):
313 * bindings/runtime.h:
314 (KJS::Bindings::Class::fallbackObject):
315 (KJS::Bindings::Instance::getValueOfUndefinedField):
316 (KJS::Bindings::Instance::setValueOfUndefinedField):
317 * bindings/runtime_object.cpp:
318 (RuntimeObjectImp::get):
319 (RuntimeObjectImp::put):
320 (RuntimeObjectImp::canPut):
321 (RuntimeObjectImp::hasProperty):
322 * bindings/testbindings.mm:
323 (-[MyFirstInterface valueForUndefinedKey:]):
324 (-[MyFirstInterface setValue:forUndefinedKey:]):
326 2004-08-10 Darin Adler <darin@apple.com>
330 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
332 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
333 or uint16_t depending on the mode, and used appropriate in the 7 public functions
335 * pcre/pcre.c: Add UTF-16 support to all functions.
336 * pcre/study.c: Ditto.
338 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
339 the mode. Changed declarations to use symbolic constants and typedefs so we size
340 things to ichar when needed.
342 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
343 sized to 16-bit characters instead of 8-bit.
346 (pcre_copy_substring): Use pcre_char instead of char.
347 (pcre_get_substring_list): Ditto.
348 (pcre_free_substring_list): Ditto.
349 (pcre_get_substring): Ditto.
350 (pcre_free_substring): Ditto.
352 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
353 of hard-coding 8-bit table sizes.
355 * pcre/chartables.c: Regenerated.
357 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
358 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
359 is not null. The null string still has a null pointer. This prevents us from
360 passing a null through to the regular expression engine (which results in a null
361 error even when the string length is 0).
364 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
365 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
367 2004-08-09 Darin Adler <darin@apple.com>
371 - fixed 28 Mozilla JavaScript tests
373 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
374 checking the number of arguments for the join method.
376 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
377 than integers, so we aren't limited to 32 bits.
379 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
380 the implementation of the pow operation. Also simplied a case that was handling positive
381 and negative infinity separately.
383 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
384 putting them in a long, so that unsigned shift will work properly.
386 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
388 * kjs/operations.cpp:
389 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
390 sign of isinf; our isinf function returns +1 even for negative infinity.
391 (KJS::isNegInf): And again.
392 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
393 Our floating point already handles the various infinity cases correctly.
395 * kjs/regexp_object.cpp:
396 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
397 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
398 array in cases where we did not match.
399 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
400 "global", "ignoreCase", "multiline", and "source".
402 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
403 string into undefined rather than an empty string. For the slice method, handle an
404 undefined parameter for the limit properly as decribed in the specification, and add
405 the limit to one case that didn't have the limit at all. For the methods that generate
406 HTML strings, use lowercase tags instead of uppercase.
409 (KJS::UChar::toLower): Use u_tolower from the ICU library.
410 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
411 (KJS::UString::append): Fix some math that caused a buffer overflow.
412 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
413 flag) rather than converting them all to 0.
414 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
416 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
418 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
419 the Unicode specification in a few cases where it was wrong before.
420 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
421 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
422 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
423 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
424 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
425 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
426 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
427 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
428 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
430 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
432 * kjs/number_object.lut.h: Regenerated.
434 2004-08-09 Darin Adler <darin@apple.com>
438 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
440 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
441 we get a buffer overflow.
445 2004-08-05 Richard Williamson <rjw@apple.com>
447 Fixed part of 3674747. The QT guys need this for feature freeze.
449 This patch implements support for the
451 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
453 method of objects bound to JavaScript.
458 * bindings/objc/objc_class.mm:
459 (ObjcClass::methodsNamed):
460 (ObjcClass::fieldNamed):
461 * bindings/objc/objc_instance.mm:
462 (ObjcInstance::invokeMethod):
463 * bindings/objc/objc_runtime.h:
464 (KJS::Bindings::ObjcMethod::~ObjcMethod):
465 (KJS::Bindings::ObjcMethod::isFallbackMethod):
466 (KJS::Bindings::ObjcMethod::javaScriptName):
467 * bindings/objc/objc_runtime.mm:
468 (ObjcMethod::ObjcMethod):
469 (ObjcMethod::getMethodSignature):
470 (ObjcMethod::setJavaScriptName):
471 * bindings/testbindings.mm:
473 2004-08-04 Vicki Murley <vicki@apple.com>
477 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
480 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
481 go to the next line and continue parsing the string (instead of failing). This matches
482 behavior in Mac IE and Mozilla.
484 2004-08-03 Kevin Decker <kdecker@apple.com>
488 Rolled in changes from the latest KJS sources that support additional
489 Number.prototype functions.
491 Specifically this patch covers the follow parts of the ECMA 3 spec:
492 15.7.4.5, 15.7.4.6, and 15.7.4.7
495 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
496 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
497 <rdar://problem/3749591> missing Number.toExponential prototype implementation
499 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
500 list of supported identifiers (a macro).
501 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
503 (NumberPrototypeImp::NumberPrototypeImp):
504 (NumberProtoFuncImp::call):
505 * kjs/number_object.h: Added property names for toFixed, toPrecision,
507 (KJS::NumberProtoFuncImp::):
508 * tests/mozilla/expected.html: Update results.
510 2004-08-03 Darin Adler <darin@apple.com>
514 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
516 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
517 we are supposed to just copy the regular expression object, and do so.
518 Also tighten up arguments check to handle case where an actual "undefined"
519 is passed rather than just omitting an argument.
521 * tests/mozilla/expected.html: Update results.
523 2004-08-02 Darin Adler <darin@apple.com>
525 * tests/mozilla/.cvsignore: Added.
526 * tests/mozilla/expected.html: Update results.
528 2004-08-02 Darin Adler <darin@apple.com>
532 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
534 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
535 Append the flags here so more tests paseed.
537 2004-08-02 Darin Adler <darin@apple.com>
541 - fixed a couple things making 5 Mozilla regexp tests pass
543 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
545 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
546 be used as the flags string when no parameter was passed.
548 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
549 Added a class info object for RegExp prototype so it can return
550 a string instead of raising an exception when converting to a string.
552 * tests/mozilla/expected.html: Update results.
554 2004-08-02 Darin Adler <darin@apple.com>
558 - fix crashes in mozilla tests due to mishandling NaN
560 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
561 calls to toInteger so that NaN will get turned into something that fits in an integer.
562 These were the ones John already fixed, but his fix used isnan and the new fix is
565 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
566 after a call to toInteger to handle NaN properly. Also removed separate check
567 for undefined that's not needed.
569 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
570 as in the above two files, but for a lot more functions. Also changed one place with
571 an explicit check for undefined to instead just check isNaN.
573 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
574 like me who don't keep $SYMROOTS in their $PATH.
580 2004-07-26 Kevin Decker <kdecker@apple.com>
582 Changes done by Darin, reviewed by Kevin.
584 - changed testkjs to build in Xcode rather than from Makefile
586 * .cvsignore: Removed obsolete files from this list.
587 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
588 Changed to build target "All" rather than default target. This makes us
589 build the testkjs test tool.
590 * dummy.cpp: Removed.
591 * kjs/.cvsignore: Removed obsolete files from this list, including
592 the testkjs tool, which is now built in the symroots directory.
593 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
594 changed this file. Also this has the nice side effect of causing the tool
595 to be rebuilt in the new location even if there are no other changes in
596 your tree when you check this out.
597 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
598 without setting the execute bit on jsDriver.pl.
600 2004-07-22 Kevin Decker <kdecker@apple.com>
604 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
606 * kjs/function_object.cpp:
607 (FunctionObjectImp::construct):
608 * kjs/function_object.h:
610 (KJS::ObjectImp::construct):
612 (KJS::Object::construct):
614 2004-07-21 Darin Adler <darin@apple.com>
616 * bindings/npruntime.h: Fixed typo.
618 2004-07-19 John Sullivan <sullivan@apple.com>
622 - bulletproofed array.slice() against NAN arguments. Harri noticed this
623 vulnerability in my patch for 3714644
625 * kjs/array_object.cpp:
626 (ArrayProtoFuncImp::call):
627 handle NAN parameters passed to slice() by clamping to 0 and length.
629 2004-07-19 Richard Williamson <rjw@apple.com>
631 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
636 * bindings/jni/jni_jsobject.cpp:
638 (JSObject::JSObject):
640 2004-07-16 John Sullivan <sullivan@apple.com>
644 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
645 hangs browser with javascript
647 * kjs/array_object.cpp:
648 (ArrayProtoFuncImp::call):
649 Check for undefined type for args[0] the same way we were already checking
650 for args[1]. In this case, args was zero-length, but we were treating
651 args[0] like an integer anyway. Resulted in some code looping from a NAN
652 value to 4, taking approximately forever.
654 * JavaScriptCore.pbproj/project.pbxproj:
659 2004-07-14 Maciej Stachowiak <mjs@apple.com>
663 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
664 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
666 * kjs/number_object.cpp:
667 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
669 2004-07-13 Kevin Decker <kdecker@apple.com>
671 Reviewed by kocienda.
673 - made testkjs and JavaScriptCore a subtarget of 'All'
674 - testkjs now builds in $SYMROOTS
676 * JavaScriptCore.pbproj/project.pbxproj:
680 2004-06-24 Chris Blumenberg <cblu@apple.com>
682 Ignore .mode1 files in JavaScriptCore.pbproj
684 Reviewed by kocienda.
686 * JavaScriptCore.pbproj/.cvsignore:
688 2004-06-23 Richard Williamson <rjw@apple.com>
690 Implemented changes for latest npruntime.h.
694 * JavaScriptCore.pbproj/project.pbxproj:
695 * bindings/NP_jsobject.cpp:
696 (listFromVariantArgs):
697 (identiferFromNPIdentifier):
698 (_NPN_CreateScriptObject):
703 (NPN_RemoveProperty):
704 * bindings/NP_jsobject.h:
705 * bindings/c/c_class.cpp:
706 (CClass::methodsNamed):
707 (CClass::fieldNamed):
708 * bindings/c/c_instance.cpp:
709 (CInstance::invokeMethod):
710 * bindings/c/c_utility.cpp:
711 (convertNPVariantToValue):
712 * bindings/c/c_utility.h:
713 * bindings/npruntime.cpp:
714 (stringIdentifierEqual):
715 (stringIdentifierHash):
716 (getStringIdentifierDictionary):
717 (intIdentifierEqual):
719 (getIntIdentifierDictionary):
720 (NPN_GetStringIdentifier):
721 (NPN_GetStringIdentifiers):
722 (NPN_GetIntIdentifier):
723 (NPN_IdentifierIsString):
724 (NPN_UTF8FromIdentifier):
725 (NPN_VariantToInt32):
726 (NPN_VariantToDouble):
728 * bindings/npruntime.h:
729 * bindings/objc/WebScriptObject.mm:
730 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
731 * bindings/runtime_object.cpp:
732 (RuntimeObjectImp::~RuntimeObjectImp):
733 * bindings/runtime_root.cpp:
734 (KJS::Bindings::rootForInterpreter):
735 * bindings/testbindings.cpp:
736 (initializeIdentifiers):
742 === JavaScriptCore-146.1 ===
744 2004-06-16 Richard Williamson <rjw@apple.com>
746 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
748 This turned out to be a show stopper for Dashboard. Accessing a nil
749 ObjC property from JS caused a crash. Similar to the problem
754 * bindings/objc/objc_runtime.mm:
755 (KJS::Bindings::ObjcField::valueFromInstance):
759 2004-06-16 Richard Williamson <rjw@apple.com>
761 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
763 This turned out to be a show stopper for Dashboard. We now
764 return Undefined() when nil is returned from a ObjC method
765 that returns an object type.
769 * bindings/objc/objc_utility.mm:
770 (KJS::Bindings::convertObjcValueToValue):
774 2004-06-15 Richard Williamson <rjw@apple.com>
776 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
778 No longer need to check respondsToSelector: for
779 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
780 because these now have a default implementation on NSObject.
784 * bindings/objc/objc_class.mm:
785 (ObjcClass::methodsNamed):
786 (ObjcClass::fieldNamed):
788 2004-06-14 Darin Adler <darin@apple.com>
792 - fixed some things for GC that Patrick missed, or that happened after the branch
794 * bindings/objc/WebScriptObject.mm:
795 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
796 (-[WebScriptObject finalize]): Added.
798 - added some missing nil checks
800 * bindings/objc/objc_instance.mm:
801 (ObjcInstance::ObjcInstance): Check for nil.
802 (ObjcInstance::~ObjcInstance): Check for nil.
803 (ObjcInstance::operator=): Check for nil.
805 2004-06-14 Darin Adler <darin@apple.com>
807 Reviewed by me, code changes by Patrick Beard.
809 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
811 * bindings/objc/objc_instance.mm:
812 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
813 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
814 (ObjcInstance::operator=): More of the same.
815 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
817 * bindings/objc/objc_runtime.mm:
818 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
819 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
820 (ObjcArray::operator=): More of the same.
822 * bindings/testbindings.mm: Fixed incorrect license.
823 (main): Use [pool drain] if compiling on Tiger.
827 2004-06-10 Kevin Decker <kdecker@apple.com>
833 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
835 (KJS::Lexer::lineNo):
836 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
838 === JavaScriptCore-143.2 ===
840 2004-06-07 Darin Adler <darin@apple.com>
842 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
844 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
845 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
847 === JavaScriptCore-143.1 ===
849 2004-06-04 Kevin Decker <kdecker@apple.com>
853 - fixed <rdar://problem/3680594>
856 (KJS::Error::create):
860 2004-06-04 Darin Adler <darin@apple.com>
862 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
864 2004-06-04 Kevin Decker <kdecker@apple.com>
868 - ObjC bindings do not (yet) pass along sourceurl or line numbers
869 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
870 - changed the wording of an error message
871 - the lexer, parser, and interpreter have been made "sourceURL aware"
872 - stored the url into Error
874 * bindings/NP_jsobject.cpp:
876 * bindings/jni/jni_jsobject.cpp:
878 * bindings/objc/WebScriptObject.mm:
879 (-[WebScriptObject evaluateWebScript:]):
881 (GlobalFuncImp::call):
882 * kjs/function_object.cpp:
883 (FunctionObjectImp::construct):
886 (InterpreterImp::checkSyntax):
887 (InterpreterImp::evaluate):
889 * kjs/interpreter.cpp:
890 (Interpreter::evaluate):
895 (KJS::Lexer::sourceURL):
899 (FunctionCallNode::evaluate):
902 (KJS::Error::create):
905 2004-06-04 Richard Williamson <rjw@apple.com>
907 Fixed crash when attempting to access properties on nil
912 * bindings/objc/objc_instance.mm:
913 (ObjcInstance::getClass):
914 * bindings/runtime_object.cpp:
915 (RuntimeObjectImp::get):
917 * bindings/testbindings.mm:
918 (-[MyFirstInterface getString]):
920 2004-05-27 Kevin Decker <kdecker@apple.com>
924 -revised generated error message content
926 * kjs/error_object.cpp:
927 (ErrorProtoFuncImp::call):
931 (KJS::Error::create):
935 2004-05-27 Richard Williamson <rjw@apple.com>
937 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
941 * bindings/objc/WebScriptObject.h:
943 2004-05-27 Darin Adler <darin@apple.com>
947 - moved to new symlink technique for embedding frameworks
949 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
950 because we don't need it any more.
952 2004-05-24 Richard Williamson <rjw@apple.com>
954 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
955 fixed ClassInfo to correctly reflect inheritance. This is required
956 because of the runtime checks in JSC for arrays, i.e. in
957 the Function objects apply method.
961 * bindings/jni/jni_runtime.cpp:
962 (JavaArray::convertJObjectToArray):
963 * bindings/objc/objc_utility.mm:
964 (KJS::Bindings::convertObjcValueToValue):
965 * bindings/runtime_array.cpp:
966 (RuntimeArrayImp::RuntimeArrayImp):
967 * bindings/runtime_array.h:
968 * bindings/testM.js: Added.
969 * bindings/testbindings.mm:
970 (+[MyFirstInterface webScriptNameForSelector:]):
971 (-[MyFirstInterface logMessages:]):
972 (-[MyFirstInterface logMessage:prefix:]):
973 (-[MyFirstInterface callJSObject::]):
975 2004-05-22 Darin Adler <darin@apple.com>
979 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
981 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
982 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
983 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
984 it hasn't been set explicitly.
988 2004-05-20 Richard Williamson <rjw@apple.com>
990 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
991 can now be referenced like any other WebScriptObject, meaning
992 you can do JS operations on them.
994 All added implementation of finalizeForWebScript.
998 * bindings/objc/WebScriptObject.h:
999 * bindings/objc/WebScriptObject.mm:
1000 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1001 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1002 (-[WebScriptObject KJS::]):
1003 (-[WebScriptObject dealloc]):
1004 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1005 (-[WebScriptObject evaluateWebScript:]):
1006 (-[WebScriptObject setValue:forKey:]):
1007 (-[WebScriptObject valueForKey:]):
1008 (-[WebScriptObject stringRepresentation]):
1009 * bindings/objc/WebScriptObjectPrivate.h:
1010 * bindings/objc/objc_instance.mm:
1011 (ObjcInstance::~ObjcInstance):
1013 2004-05-19 Richard Williamson <rjw@apple.com>
1015 Removed extraneous tabs that were added (by XCode?).
1017 * bindings/objc/WebScriptObject.h:
1019 2004-05-19 Darin Adler <darin@apple.com>
1021 - fixed headers with licenses mangled by Xcode auto-indenting
1023 * bindings/jni/jni_jsobject.cpp:
1024 * bindings/jni/jni_jsobject.h:
1025 * bindings/runtime_array.h:
1026 * bindings/runtime_root.cpp:
1027 * bindings/runtime_root.h:
1029 2004-05-18 Richard Williamson <rjw@apple.com>
1031 Added exception logging. Also check for exception and
1032 set results as appropriate.
1034 Reviewed by Maciej (partially reviewed).
1036 * bindings/objc/WebScriptObject.mm:
1037 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1038 (-[WebScriptObject evaluateWebScript:]):
1039 (-[WebScriptObject setValue:forKey:]):
1040 (-[WebScriptObject valueForKey:]):
1042 2004-05-18 Richard Williamson <rjw@apple.com>
1044 Finsished implementing support for windowScriptObject.
1045 Had to make WebScriptObjectPrivate.h accessible from
1050 * JavaScriptCore.pbproj/project.pbxproj:
1051 * bindings/objc/WebScriptObjectPrivate.h:
1053 2004-05-18 Richard Williamson <rjw@apple.com>
1055 Use KVC to set/get values instead of directly accessing
1060 * bindings/objc/WebScriptObject.mm:
1061 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1062 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1063 * bindings/objc/objc_runtime.mm:
1064 (ObjcField::valueFromInstance):
1065 (convertValueToObjcObject):
1066 (ObjcField::setValueToInstance):
1068 2004-05-17 Richard Williamson <rjw@apple.com>
1070 Implemented new API for WebScriptObject.
1072 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
1073 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
1077 * JavaScriptCore.pbproj/project.pbxproj:
1078 * bindings/c/c_instance.cpp:
1079 (CInstance::invokeMethod):
1080 * bindings/jni/jni_instance.cpp:
1081 (JavaInstance::invokeMethod):
1082 * bindings/jni/jni_jsobject.cpp:
1083 (JSObject::convertValueToJObject):
1084 * bindings/jni/jni_utility.cpp:
1085 (KJS::Bindings::getJNIField):
1086 * bindings/objc/WebScriptObject.mm:
1088 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1089 (-[WebScriptObject KJS::]):
1090 (-[WebScriptObject dealloc]):
1091 (+[WebScriptObject throwException:]):
1093 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1094 (-[WebScriptObject evaluateWebScript:]):
1095 (-[WebScriptObject setValue:forKey:]):
1096 (-[WebScriptObject valueForKey:]):
1097 (-[WebScriptObject stringRepresentation]):
1098 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1099 (+[WebUndefined undefined]):
1100 (-[WebUndefined initWithCoder:]):
1101 (-[WebUndefined encodeWithCoder:]):
1102 (-[WebUndefined copyWithZone:]):
1103 (-[WebUndefined retain]):
1104 (-[WebUndefined release]):
1105 (-[WebUndefined retainCount]):
1106 (-[WebUndefined autorelease]):
1107 (-[WebUndefined dealloc]):
1108 (-[WebUndefined copy]):
1109 (-[WebUndefined replacementObjectForPortCoder:]):
1110 * bindings/objc/WebScriptObjectPrivate.h: Added.
1111 * bindings/objc/objc_class.mm:
1112 (ObjcClass::methodsNamed):
1113 (ObjcClass::fieldNamed):
1114 * bindings/objc/objc_instance.mm:
1115 (ObjcInstance::invokeMethod):
1116 * bindings/objc/objc_jsobject.h:
1117 * bindings/objc/objc_jsobject.mm:
1118 * bindings/objc/objc_runtime.mm:
1119 (ObjcField::valueFromInstance):
1120 * bindings/objc/objc_utility.mm:
1121 (KJS::Bindings::JSMethodNameToObjCMethodName):
1122 (KJS::Bindings::convertValueToObjcValue):
1123 (KJS::Bindings::convertObjcValueToValue):
1124 * bindings/runtime.cpp:
1125 (Instance::setDidExecuteFunction):
1126 (Instance::didExecuteFunction):
1127 (Instance::setValueOfField):
1128 * bindings/runtime.h:
1129 * bindings/testbindings.mm:
1130 (+[MyFirstInterface webScriptNameForSelector:]):
1131 (-[MyFirstInterface callJSObject::]):
1133 2004-05-14 Vicki Murley <vicki@apple.com>
1137 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
1139 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
1143 2004-05-13 Richard Williamson <rjw@apple.com>
1150 * bindings/objc/WebScriptObject.h:
1152 2004-05-13 Richard Williamson <rjw@apple.com>
1154 Approved API changes. Currently unimplemented.
1159 * JavaScriptCore.pbproj/project.pbxproj:
1160 * bindings/objc/WebScriptObject.h: Added.
1161 * bindings/objc/WebScriptObject.mm: Added.
1162 (+[WebScriptObject throwException:]):
1163 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1164 (-[WebScriptObject evaluateWebScript:]):
1165 (-[WebScriptObject stringRepresentation]):
1166 (+[WebUndefined undefined]):
1167 (-[WebUndefined initWithCoder:]):
1168 (-[WebUndefined encodeWithCoder:]):
1169 (-[WebUndefined copyWithZone:]):
1171 2004-05-07 Vicki Murley <vicki@apple.com>
1175 Turn off GC since it uses ppc only instructions (which breaks
1178 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
1182 2004-05-07 Maciej Stachowiak <mjs@apple.com>
1186 - add -funroll-loops=16 compiler option for approx .5% speedup on
1187 HTML iBench and .5-1% speedup on JS iBench.
1189 * JavaScriptCore.pbproj/project.pbxproj:
1191 2004-04-25 Maciej Stachowiak <mjs@apple.com>
1195 Enable full conservative GC mode in addition to test mode. When
1196 conservative GC is enabled, we now get an 11% speed improvement on
1197 the iBench. Also fix some spots I missed before.
1199 Specific noteworth changes:
1201 * kjs/collector.cpp:
1202 (KJS::Collector::markStackObjectsConservatively): Check possible
1203 cell pointers for 8-byte aligment and verify they are not 0.
1205 * kjs/protected_values.cpp:
1206 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
1207 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
1209 (KJS::gcProtectNullTolerant): ...to here...
1210 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
1211 tolerance, and doing the check is expensive.
1213 * kjs/protected_values.cpp:
1214 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
1215 that is still very good.
1220 (KJS::ProtectedValue::ProtectedValue):
1221 (KJS::ProtectedValue::~ProtectedValue):
1222 (KJS::ProtectedValue::operator=):
1223 (KJS::ProtectedObject::ProtectedObject):
1224 (KJS::ProtectedObject::~ProtectedObject):
1225 (KJS::ProtectedObject::operator=):
1226 (KJS::ProtectedReference::ProtectedReference):
1227 (KJS::ProtectedReference::~ProtectedReference):
1228 (KJS::ProtectedReference::operator=):
1229 * kjs/protected_values.cpp:
1230 (KJS::ProtectedValues::getProtectCount):
1231 (KJS::ProtectedValues::increaseProtectCount):
1232 (KJS::ProtectedValues::decreaseProtectCount):
1233 (KJS::ProtectedValues::computeHash):
1234 * bindings/runtime_root.cpp:
1235 (KJS::Bindings::addNativeReference):
1236 (KJS::Bindings::removeNativeReference):
1237 (RootObject::removeAllNativeReferences):
1238 * bindings/runtime_root.h:
1239 (KJS::Bindings::RootObject::~RootObject):
1240 (KJS::Bindings::RootObject::setRootObjectImp):
1241 * kjs/collector.cpp:
1242 (KJS::Collector::allocate):
1243 (KJS::Collector::collect):
1246 (NumberImp::create):
1247 (InterpreterImp::globalInit):
1248 (InterpreterImp::globalClear):
1249 (InterpreterImp::mark):
1251 (KJS::List::derefValues):
1252 (KJS::List::refValues):
1253 (KJS::List::append):
1255 (KJS::ObjectImp::setInternalValue):
1256 (KJS::ObjectImp::putDirect):
1261 (KJS::ValueImp::ValueImp):
1262 (KJS::ValueImp::~ValueImp):
1264 (KJS::Value::Value):
1265 (KJS::Value::~Value):
1266 (KJS::Value::operator=):
1268 2004-04-30 Richard Williamson <rjw@apple.com>
1270 Asking an NSInvocation for it's return value when return type
1271 is void throws an exception. Added check for void return types
1272 to avoid this exception.
1276 * bindings/objc/objc_instance.mm:
1277 (ObjcInstance::invokeMethod):
1279 2004-04-29 Richard Williamson <rjw@apple.com>
1281 Fixed several bad problems with the ObjC bindings. In particular, conversion
1282 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
1286 * bindings/objc/objc_jsobject.h:
1287 * bindings/objc/objc_jsobject.mm:
1288 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
1289 (-[JavaScriptObject KJS::]):
1290 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1291 (-[JavaScriptObject call:arguments:]):
1292 (-[JavaScriptObject evaluate:]):
1293 (-[JavaScriptObject getMember:]):
1294 (-[JavaScriptObject getSlot:]):
1295 * bindings/objc/objc_runtime.mm:
1296 (ObjcField::valueFromInstance):
1297 (ObjcField::setValueToInstance):
1298 * bindings/objc/objc_utility.mm:
1299 (KJS::Bindings::convertValueToObjcValue):
1300 (KJS::Bindings::convertObjcValueToValue):
1301 * bindings/runtime.h:
1302 * bindings/runtime_root.cpp:
1303 (KJS::Bindings::rootForInterpreter):
1304 (KJS::Bindings::addNativeReference):
1305 (KJS::Bindings::removeNativeReference):
1306 * bindings/runtime_root.h:
1307 * bindings/testbindings.mm:
1308 (-[MyFirstInterface logMessage:]):
1309 (-[MyFirstInterface setJSObject:]):
1310 (-[MyFirstInterface callJSObject::]):
1312 2004-04-24 Darin Adler <darin@apple.com>
1316 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
1319 2004-04-23 Maciej Stachowiak <mjs@apple.com>
1323 Implementation of conservative GC, based partly on code from
1324 Darin. It's turned off for now, so it shouldn't have any effect on
1327 * JavaScriptCore.pbproj/project.pbxproj:
1328 * kjs/collector.cpp:
1329 (KJS::Collector::markStackObjectsConservatively):
1330 (KJS::Collector::markProtectedObjects):
1331 (KJS::Collector::collect):
1336 * kjs/protected_values.cpp: Added.
1337 (KJS::ProtectedValues::getProtectCount):
1338 (KJS::ProtectedValues::increaseProtectCount):
1339 (KJS::ProtectedValues::insert):
1340 (KJS::ProtectedValues::decreaseProtectCount):
1341 (KJS::ProtectedValues::expand):
1342 (KJS::ProtectedValues::shrink):
1343 (KJS::ProtectedValues::rehash):
1344 (KJS::ProtectedValues::computeHash):
1345 * kjs/protected_values.h: Added.
1347 (ValueImp::useConservativeMark):
1355 2004-04-22 Richard Williamson <rjw@apple.com>
1357 Fixed build snafu (re-declaration of NPBool in npruntime.h and
1360 * bindings/npruntime.h:
1362 2004-04-22 Richard Williamson <rjw@apple.com>
1364 Updated plugin binding API to reflect latest revision from
1367 Biggest change is the introduction of NPVariant used to represent
1368 value types. NPVariant replaces the use of NPObject for the
1369 exchange of values between scripting environment and native code.
1373 * JavaScriptCore.pbproj/project.pbxproj:
1374 * bindings/NP_jsobject.cpp:
1375 (identiferFromNPIdentifier):
1381 (NPN_GetPropertyAtIndex):
1382 (NPN_SetPropertyAtIndex):
1383 * bindings/c/c_class.cpp:
1384 (CClass::methodsNamed):
1385 (CClass::fieldNamed):
1386 * bindings/c/c_instance.cpp:
1387 (CInstance::invokeMethod):
1388 (CInstance::defaultValue):
1389 * bindings/c/c_runtime.cpp:
1390 (CField::valueFromInstance):
1391 (CField::setValueToInstance):
1392 * bindings/c/c_utility.cpp:
1393 (convertNPStringToUTF16):
1394 (convertUTF8ToUTF16):
1395 (coerceValueToNPVariantStringType):
1396 (convertValueToNPVariant):
1397 (convertNPVariantToValue):
1398 * bindings/c/c_utility.h:
1399 * bindings/npruntime.cpp:
1400 (NPN_GetIdentifier):
1401 (NPN_GetIdentifiers):
1402 (NPN_UTF8FromIdentifier):
1403 (NPN_VariantIsVoid):
1404 (NPN_VariantIsNull):
1405 (NPN_VariantIsUndefined):
1406 (NPN_VariantIsBool):
1407 (NPN_VariantIsInt32):
1408 (NPN_VariantIsDouble):
1409 (NPN_VariantIsString):
1410 (NPN_VariantIsObject):
1411 (NPN_VariantToBool):
1412 (NPN_VariantToString):
1413 (NPN_VariantToInt32):
1414 (NPN_VariantToDouble):
1415 (NPN_VariantToObject):
1416 (NPN_InitializeVariantAsVoid):
1417 (NPN_InitializeVariantAsNull):
1418 (NPN_InitializeVariantAsUndefined):
1419 (NPN_InitializeVariantWithBool):
1420 (NPN_InitializeVariantWithInt32):
1421 (NPN_InitializeVariantWithDouble):
1422 (NPN_InitializeVariantWithString):
1423 (NPN_InitializeVariantWithStringCopy):
1424 (NPN_InitializeVariantWithObject):
1425 (NPN_InitializeVariantWithVariant):
1426 (NPN_ReleaseVariantValue):
1429 (NPN_ReleaseObject):
1430 (NPN_IsKindOfClass):
1431 (NPN_SetExceptionWithUTF8):
1433 * bindings/npruntime.h:
1435 (_NPString::_NPVariant::):
1436 * bindings/testbindings.cpp:
1451 2004-04-22 Darin Adler <darin@apple.com>
1455 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
1458 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
1459 Was resulting in a buffer 2x the needed size.
1460 (KJS::UString::expandPreCapacity): Ditto.
1461 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
1463 2004-04-21 Maciej Stachowiak <mjs@apple.com>
1467 Preliminary change for conservative GC. Create "protected"
1468 subclasses to GC-protect objects when on heap, since we will soon
1469 remove the built-in refcounting of the normal wrapper classes. Use
1472 * JavaScriptCore.pbproj/project.pbxproj:
1475 (KJS::InterpreterImp::globalObject):
1476 * kjs/interpreter.h:
1477 * kjs/property_map.cpp:
1479 * kjs/reference_list.cpp:
1481 2004-04-19 Maciej Stachowiak <mjs@apple.com>
1485 Optimize prepend using the shared substring optimization. Also,
1486 limit the applicability of shared append and shared prepend. If
1487 you overdo it, it does more harm than good, because you create a
1488 bunch of strings that are disqualified from future shared
1489 append/prepend, for not much immediate savings in allocate/copy
1494 (KJS::UString::Rep::create):
1495 (KJS::UString::expandedSize):
1496 (KJS::UString::usedPreCapacity):
1497 (KJS::UString::expandCapacity):
1498 (KJS::UString::expandPreCapacity):
1499 (KJS::UString::UString):
1500 (KJS::UString::append):
1501 (KJS::UString::operator=):
1503 (KJS::UString::Rep::data):
1505 2004-04-16 Maciej Stachowiak <mjs@apple.com>
1506 Reviewed by Richard.
1508 No more need for Completion or Reference to privately inherit from
1509 Value, none of the superclass functionality is used.
1516 2004-04-16 Richard Williamson <rjw@apple.com>
1518 Added interpreter lock protection around object creation.
1522 * bindings/runtime.cpp:
1523 (Instance::createRuntimeObject):
1525 2004-04-16 Maciej Stachowiak <mjs@apple.com>
1529 Another JavaScript speed improvement: use the mechanism from
1530 string append optimization to make taking a substring fast, again
1533 A further 22% improvement on the 24fun string speed test.
1537 (KJS::UString::Rep::create):
1538 (KJS::UString::UString):
1539 (KJS::UString::append):
1540 (KJS::UString::operator=):
1541 (KJS::UString::substr):
1543 (KJS::UString::Rep::data):
1545 2004-04-13 Maciej Stachowiak <mjs@apple.com>
1549 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
1550 - fixed <rdar://problem/3600691>: Table generation test is really slow
1551 - fixed <rdar://problem/3600661>: 24fun date test is really slow
1553 80% speedup on the string test, lesser speedups on the other two.
1555 Two different optimizations here:
1557 1) Avoid large overhead of scanning strings to see if they are all
1558 ASCII before numeric conversion.
1561 (AssignNode::evaluate): Don't convert to integer until we know for
1562 sure the operation will need it. Attempting to convert strings to
1563 numbers is a waste when they are being appended with +=.
1565 2) Avoid huge cost of appending strings.
1567 This is done by allowing multiple strings to share a buffer but
1568 actually use different ranges of it. The first time a string is
1569 appended to, we start leaving at least 10% extra space in the
1570 buffer, so doing N appends to the same string takes O(log N)
1571 mallocs instead of O(N).
1573 * kjs/identifier.cpp:
1574 (KJS::Identifier::equal):
1575 (KJS::Identifier::add):
1578 (KJS::UCharReference::operator=):
1579 (KJS::UCharReference::ref):
1580 (KJS::UString::Rep::create):
1581 (KJS::UString::Rep::destroy):
1582 (KJS::UString::expandedSize):
1583 (KJS::UString::usedCapacity):
1584 (KJS::UString::expandCapacity):
1585 (KJS::UString::UString):
1586 (KJS::UString::null):
1587 (KJS::UString::append):
1588 (KJS::UString::operator=):
1589 (KJS::UString::toStrictUInt32):
1590 (KJS::UString::detach):
1591 (KJS::KJS::operator==):
1593 (KJS::UString::Rep::data):
1594 (KJS::UString::Rep::hash):
1596 2004-04-09 Maciej Stachowiak <mjs@apple.com>
1600 - fix deployment build by avoiding deployment-only warning.
1602 * kjs/scope_chain.cpp:
1603 (KJS::ScopeChain::bottom):
1605 2004-04-09 Maciej Stachowiak <mjs@apple.com>
1609 Changed things so that newly created objects get a prototype based
1610 on the scope chain of the current function, rather than the
1611 interpreter that started execution. This fixes the following bugs:
1613 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
1614 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
1616 * JavaScriptCore.pbproj/project.pbxproj:
1617 * kjs/array_object.cpp:
1618 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1619 (ArrayProtoFuncImp::ArrayProtoFuncImp):
1620 (ArrayProtoFuncImp::call):
1621 (ArrayObjectImp::construct):
1622 * kjs/bool_object.cpp:
1623 (BooleanObjectImp::construct):
1624 * kjs/date_object.cpp:
1625 (DateProtoFuncImp::DateProtoFuncImp):
1626 (DateProtoFuncImp::call):
1627 (DateObjectImp::construct):
1628 * kjs/error_object.cpp:
1629 (ErrorObjectImp::construct):
1631 (FunctionImp::FunctionImp):
1632 (FunctionImp::call):
1633 (DeclaredFunctionImp::construct):
1634 (ArgumentsImp::ArgumentsImp):
1635 (GlobalFuncImp::call):
1636 * kjs/function_object.cpp:
1637 (FunctionProtoFuncImp::call):
1638 (FunctionObjectImp::construct):
1640 (BooleanImp::toObject):
1641 (StringImp::toObject):
1642 (NumberImp::toObject):
1643 (InterpreterImp::InterpreterImp):
1644 (InterpreterImp::clear):
1645 (InterpreterImp::interpreterWithGlobalObject):
1647 * kjs/interpreter.cpp:
1648 (ExecState::lexicalInterpreter):
1649 * kjs/interpreter.h:
1650 (KJS::ExecState::dynamicInterpreter):
1651 (KJS::ExecState::interpreter):
1652 * kjs/math_object.cpp:
1653 (MathFuncImp::MathFuncImp):
1655 (StatementNode::hitStatement):
1656 (StatementNode::abortStatement):
1657 (RegExpNode::evaluate):
1658 (ElementNode::evaluate):
1659 (ArrayNode::evaluate):
1660 (ObjectLiteralNode::evaluate):
1661 (PropertyValueNode::evaluate):
1662 (FunctionCallNode::evaluate):
1663 (FuncDeclNode::processFuncDecl):
1664 (FuncExprNode::evaluate):
1665 * kjs/number_object.cpp:
1666 (NumberObjectImp::construct):
1668 (KJS::ObjectImp::defaultValue):
1669 (KJS::Error::create):
1670 * kjs/object_object.cpp:
1671 (ObjectObjectImp::construct):
1672 * kjs/reference.cpp:
1673 (Reference::putValue):
1674 * kjs/regexp_object.cpp:
1675 (RegExpProtoFuncImp::call):
1676 (RegExpObjectImp::arrayOfMatches):
1677 (RegExpObjectImp::construct):
1678 * kjs/scope_chain.cpp:
1679 (KJS::ScopeChain::bottom):
1680 * kjs/scope_chain.h:
1681 * kjs/string_object.cpp:
1682 (StringProtoFuncImp::StringProtoFuncImp):
1683 (StringProtoFuncImp::call):
1684 (StringObjectImp::construct):
1690 2004-03-31 Richard Williamson <rjw@apple.com>
1692 Tedious renames based on feedback from plugin-futures list.
1693 NP_ functions are renamed with NPN_ prefix.
1694 Types prefix renamed from NP_ to NP.
1695 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
1697 No review because this was just a renaming patch.
1699 * bindings/NP_jsobject.cpp:
1702 (identiferFromNPIdentifier):
1707 (NPN_RemoveProperty):
1709 (NPN_GetPropertyAtIndex):
1710 (NPN_SetPropertyAtIndex):
1711 * bindings/NP_jsobject.h:
1712 * bindings/c/c_class.cpp:
1713 (CClass::_commonInit):
1714 (CClass::classForIsA):
1716 (CClass::methodsNamed):
1717 (CClass::fieldNamed):
1718 * bindings/c/c_class.h:
1719 * bindings/c/c_instance.cpp:
1720 (CInstance::CInstance):
1721 (CInstance::~CInstance):
1722 (CInstance::operator=):
1723 (CInstance::invokeMethod):
1724 (CInstance::defaultValue):
1725 * bindings/c/c_instance.h:
1726 (KJS::Bindings::CInstance::getObject):
1727 * bindings/c/c_runtime.cpp:
1728 (CField::valueFromInstance):
1729 (CField::setValueToInstance):
1730 * bindings/c/c_runtime.h:
1731 (KJS::Bindings::CField::CField):
1732 (KJS::Bindings::CField::name):
1733 (KJS::Bindings::CMethod::CMethod):
1734 (KJS::Bindings::CMethod::name):
1735 * bindings/c/c_utility.cpp:
1736 (coerceValueToNPString):
1737 (convertValueToNPValueType):
1738 (convertNPValueTypeToValue):
1739 * bindings/c/c_utility.h:
1740 * bindings/npruntime.cpp:
1741 (NPN_IdentifierFromUTF8):
1742 (NPN_IsValidIdentifier):
1743 (NPN_GetIdentifiers):
1744 (NPN_UTF8FromIdentifier):
1747 (NPN_ReleaseObject):
1748 (NPN_IsKindOfClass):
1749 (NPN_SetExceptionWithUTF8):
1752 (NPN_CreateNumberWithInt):
1753 (NPN_CreateNumberWithFloat):
1754 (NPN_CreateNumberWithDouble):
1755 (NPN_IntFromNumber):
1756 (NPN_FloatFromNumber):
1757 (NPN_DoubleFromNumber):
1759 (NPN_CreateStringWithUTF8):
1760 (NPN_CreateStringWithUTF16):
1761 (NPN_DeallocateUTF8):
1762 (NPN_UTF8FromString):
1763 (NPN_UTF16FromString):
1766 (NPN_CreateBoolean):
1767 (NPN_BoolFromBoolean):
1770 (undefinedAllocate):
1776 (NPN_ObjectAtIndex):
1777 * bindings/npruntime.h:
1778 * bindings/runtime.cpp:
1779 (Instance::createBindingForLanguageInstance):
1780 * bindings/testbindings.cpp:
1781 (initializeIdentifiers):
1801 2004-03-31 Richard Williamson <rjw@apple.com>
1803 Changed references to NP_runtime.h to npruntime.h
1805 * JavaScriptCore.pbproj/project.pbxproj:
1806 * bindings/NP_jsobject.h:
1807 * bindings/c/c_class.h:
1808 * bindings/c/c_instance.h:
1809 * bindings/c/c_runtime.h:
1810 * bindings/c/c_utility.h:
1811 * bindings/npruntime.cpp:
1813 2004-03-31 Richard Williamson <rjw@apple.com>
1815 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
1817 * JavaScriptCore.pbproj/project.pbxproj:
1818 * bindings/NP_jsobject.h:
1819 * bindings/npruntime.cpp:
1823 2004-03-23 Richard Williamson <rjw@apple.com>
1825 Added implementation of KJS::Value <-> NP_Object conversion functions.
1826 Augmented test program for 'C' bindings.
1827 Added asserts and parameter checking to all public API.
1831 * JavaScriptCore.pbproj/project.pbxproj:
1832 * bindings/NP_jsobject.cpp:
1834 * bindings/NP_jsobject.h: Added.
1835 * bindings/NP_runtime.cpp:
1836 (NP_IdentifierFromUTF8):
1837 (NP_IsValidIdentifier):
1838 (NP_GetIdentifiers):
1843 (NP_SetExceptionWithUTF8):
1846 (NP_FloatFromNumber):
1847 (NP_DoubleFromNumber):
1848 (NP_CreateStringWithUTF8):
1849 (NP_CreateStringWithUTF16):
1850 (NP_DeallocateUTF8):
1851 (NP_UTF8FromString):
1852 (NP_UTF16FromString):
1854 (NP_BoolFromBoolean):
1855 * bindings/NP_runtime.h:
1856 * bindings/c/c_instance.cpp:
1857 (CInstance::invokeMethod):
1858 * bindings/c/c_utility.cpp:
1859 (coerceValueToNPString):
1860 (convertValueToNPValueType):
1861 (convertNPValueTypeToValue):
1862 * bindings/c/c_utility.h:
1864 * bindings/testC.js: Added.
1865 * bindings/testbindings.cpp:
1875 (myInterfaceInvoke):
1876 (myInterfaceAllocate):
1880 2004-03-19 Darin Adler <darin@apple.com>
1884 - fixed problem with methods like setUTCHour
1886 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
1887 GMT vs. local time function based on the utc flag.
1889 2004-03-17 Richard Williamson <rjw@apple.com>
1891 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
1895 * bindings/NP_jsobject.cpp:
1900 (NP_GetPropertyAtIndex):
1901 * bindings/NP_runtime.h:
1903 2004-03-16 Richard Williamson <rjw@apple.com>
1905 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.
1909 * bindings/jni/jni_class.cpp:
1910 (JavaClass::methodsNamed):
1912 2004-03-15 Richard Williamson <rjw@apple.com>
1914 Fixed 3570854. Don't attempt to convert Null to strings. We
1915 were incorrectly converting to "Null".
1917 Actually fixed by Scott Kovatch.
1919 Reviewed by Richard.
1921 * bindings/jni/jni_utility.cpp:
1922 (KJS::Bindings::convertValueToJValue):
1926 2004-03-11 Richard Williamson <rjw@apple.com>
1928 Stitched together the NP stuff to our language independent
1929 JavaScript binding stuff. Very close to being done.
1931 Added program to test C bindings (and NP stuff). Just tests
1932 properties. Will add methods and JavaScript access, etc.
1934 Updated Makefile.am to account for new bindings/c directory.
1936 Change NP_UTF8 from "const char *" to "char" to allow for
1937 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
1940 Added NP_IsValidIdentifier().
1944 * JavaScriptCore.pbproj/project.pbxproj:
1946 * bindings/NP_jsobject.cpp:
1947 (identiferFromNPIdentifier):
1949 * bindings/NP_runtime.cpp:
1950 (NP_IdentifierFromUTF8):
1951 (NP_IsValidIdentifier):
1952 (NP_GetIdentifiers):
1953 (NP_UTF8FromIdentifier):
1954 (NP_SetExceptionWithUTF8):
1956 (NP_CreateStringWithUTF8):
1957 (NP_CreateStringWithUTF16):
1958 (NP_UTF8FromString):
1959 (NP_UTF16FromString):
1960 * bindings/NP_runtime.h:
1961 * bindings/c/c_class.cpp: Added.
1962 (CClass::_commonDelete):
1963 (CClass::_commonCopy):
1964 (CClass::_commonInit):
1965 (_createClassesByIsAIfNecessary):
1966 (CClass::classForIsA):
1969 (CClass::methodsNamed):
1970 (CClass::fieldNamed):
1971 * bindings/c/c_class.h: Added.
1972 (KJS::Bindings::CClass::~CClass):
1973 (KJS::Bindings::CClass::CClass):
1974 (KJS::Bindings::CClass::operator=):
1975 (KJS::Bindings::CClass::constructorAt):
1976 (KJS::Bindings::CClass::numConstructors):
1977 * bindings/c/c_instance.cpp: Added.
1978 (CInstance::CInstance):
1979 (CInstance::~CInstance):
1980 (CInstance::operator=):
1981 (CInstance::getClass):
1984 (CInstance::invokeMethod):
1985 (CInstance::defaultValue):
1986 (CInstance::stringValue):
1987 (CInstance::numberValue):
1988 (CInstance::booleanValue):
1989 (CInstance::valueOf):
1990 * bindings/c/c_instance.h: Added.
1991 (KJS::Bindings::CInstance::getObject):
1992 * bindings/c/c_runtime.cpp: Added.
1993 (CField::valueFromInstance):
1994 (CField::setValueToInstance):
1995 * bindings/c/c_runtime.h: Added.
1996 (KJS::Bindings::CField::CField):
1997 (KJS::Bindings::CField::name):
1998 (KJS::Bindings::CField::type):
1999 (KJS::Bindings::CMethod::CMethod):
2000 (KJS::Bindings::CMethod::name):
2001 (KJS::Bindings::CMethod::numParameters):
2002 * bindings/c/c_utility.cpp: Added.
2003 (coerceValueToNPValueType):
2004 (convertValueToNPValueType):
2005 (convertNPValueTypeToValue):
2006 * bindings/c/c_utility.h: Added.
2007 * bindings/make_testbindings:
2008 * bindings/runtime.cpp:
2009 (Instance::createBindingForLanguageInstance):
2010 * bindings/runtime.h:
2011 (KJS::Bindings::Instance::):
2012 * bindings/testbindings.cpp: Added.
2013 (initializeIdentifiers):
2014 (myInterfaceHasProperty):
2015 (myInterfaceHasMethod):
2016 (myInterfaceGetProperty):
2017 (myInterfaceSetProperty):
2018 (myInterfaceInvoke):
2019 (myInterfaceAllocate):
2020 (myInterfaceInvalidate):
2021 (myInterfaceDeallocate):
2022 (GlobalImp::className):
2023 (readJavaScriptFromFile):
2026 2004-03-10 Richard Williamson <rjw@apple.com>
2028 Made changes to support new asychronous approach to calls from
2029 plugin to JavaScript
2033 * bindings/NP_jsobject.cpp:
2038 (NP_GetPropertyAtIndex):
2039 * bindings/NP_runtime.h:
2040 * bindings/make_testbindings:
2041 * bindings/runtime.cpp:
2042 (Instance::createBindingForLanguageInstance):
2044 2004-03-10 Richard Williamson <rjw@apple.com>
2046 Updated header to include proposed changes from
2047 plugin-futures list. Calls from plugin to JavaScript
2048 are now asynchronous.
2052 * bindings/NP_runtime.h:
2056 2004-03-04 Richard Williamson <rjw@apple.com>
2058 Implementation of NP_JavaScriptObject. This is the 'C' class
2059 that wraps a JavaScript object.
2063 * JavaScriptCore.pbproj/project.pbxproj:
2064 * bindings/NP_jsobject.cpp: Added.
2065 (coerceValueToNPValueType):
2066 (convertValueToNPValueType):
2067 (convertNPValueTypeToValue):
2071 (identiferFromNPIdentifier):
2076 (NP_RemoveProperty):
2078 (NP_GetPropertyAtIndex):
2079 (NP_SetPropertyAtIndex):
2080 * bindings/NP_runtime.cpp:
2082 * bindings/NP_runtime.h:
2083 * bindings/runtime_object.h:
2085 2004-03-04 Richard Williamson <rjw@apple.com>
2087 Added NP_Array implementation.
2089 Changed NP_Boolean to just depend on two static instances, no
2090 space is required for values.
2094 * bindings/NP_runtime.cpp:
2096 (NP_BoolFromBoolean):
2102 * bindings/NP_runtime.h:
2104 2004-03-03 Darin Adler <darin@apple.com>
2108 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
2109 copyright string, and that's all that was in here.
2110 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
2112 2004-03-03 Richard Williamson <rjw@apple.com>
2114 More 'C' binding implementation. Fleshed out all the
2115 'primitive' data types.
2119 * bindings/NP_runtime.cpp:
2124 (NP_CreateStringWithUTF8):
2125 (NP_CreateStringWithUTF16):
2126 (NP_UTF8FromString):
2127 (NP_UTF16FromString):
2130 (booleanDeallocate):
2132 (NP_BoolFromBoolean):
2136 (undefinedAllocate):
2137 (undefinedDeallocate):
2139 * bindings/NP_runtime.h:
2141 2004-03-03 Richard Williamson <rjw@apple.com>
2143 More 'C' binding implementation.
2147 * bindings/NP_runtime.cpp:
2150 (getIdentifierDictionary):
2151 (NP_IdentifierFromUTF8):
2152 (NP_UTF8FromIdentifier):
2157 (NP_CreateNumberWithInt):
2158 (NP_CreateNumberWithFloat):
2159 (NP_CreateNumberWithDouble):
2161 (NP_FloatFromNumber):
2162 (NP_DoubleFromNumber):
2163 * bindings/NP_runtime.h:
2165 2004-03-02 Richard Williamson <rjw@apple.com>
2167 Removed retain/release from NP_Class. Classes will not be allowed to implement their
2168 own customer retain/release scheme.
2172 * bindings/NP_runtime.cpp:
2175 * bindings/NP_runtime.h:
2177 2004-03-02 Richard Williamson <rjw@apple.com>
2179 C binding API. Partial implementation.
2181 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.
2183 Factored root object reference counting scheme. It is now useful independent
2188 * JavaScriptCore.pbproj/project.pbxproj:
2189 * bindings/NP_runtime.cpp: Added.
2190 (NP_IdentifierFromUTF8):
2191 (NP_GetIdentifiers):
2192 (NP_UTF8FromIdentifier):
2202 (NP_RemoveProperty):
2204 (NP_GetPropertyAtIndex):
2205 (NP_SetPropertyAtIndex):
2206 (NP_CreateNumberWithInt):
2207 (NP_CreateNumberWithFloat):
2208 (NP_CreateNumberWithDouble):
2210 (NP_FloatFromNumber):
2211 (NP_DoubleFromNumber):
2212 (NP_CreateStringWithUTF8):
2213 (NP_CreateStringWithUTF16):
2214 (NP_UTF8FromString):
2215 (NP_UTF16FromString):
2217 (NP_BoolFromBoolean):
2223 * bindings/NP_runtime.h: Added.
2224 * bindings/jni/jni_jsobject.cpp:
2226 (JSObject::finalize):
2227 (JSObject::createNative):
2228 (JSObject::convertValueToJObject):
2229 * bindings/jni/jni_jsobject.h:
2230 * bindings/objc/objc_jsobject.h:
2231 * bindings/objc/objc_jsobject.mm:
2233 (windowJavaScriptObject):
2234 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2235 (-[JavaScriptObject dealloc]):
2236 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
2237 (-[JavaScriptObject call:arguments:]):
2238 (-[JavaScriptObject evaluate:]):
2239 (-[JavaScriptObject getMember:]):
2240 (-[JavaScriptObject setMember:value:]):
2241 (-[JavaScriptObject removeMember:]):
2242 (-[JavaScriptObject toString]):
2243 (-[JavaScriptObject getSlot:]):
2244 (-[JavaScriptObject setSlot:value:]):
2245 * bindings/objc/objc_utility.h:
2246 * bindings/objc/objc_utility.mm:
2247 (KJS::Bindings::convertValueToObjcValue):
2248 * bindings/runtime_root.cpp: Added.
2249 (getReferencesByRootDictionary):
2250 (getReferencesDictionary):
2251 (KJS::Bindings::findReferenceDictionary):
2252 (KJS::Bindings::rootForImp):
2253 (KJS::Bindings::addNativeReference):
2254 (KJS::Bindings::removeNativeReference):
2255 (completedJavaScriptAccess):
2256 (initializeJavaScriptAccessLock):
2257 (lockJavaScriptAccess):
2258 (unlockJavaScriptAccess):
2259 (RootObject::dispatchToJavaScriptThread):
2260 (performJavaScriptAccess):
2261 (RootObject::setFindRootObjectForNativeHandleFunction):
2262 (RootObject::removeAllNativeReferences):
2263 * bindings/runtime_root.h: Added.
2264 (KJS::Bindings::RootObject::RootObject):
2265 (KJS::Bindings::RootObject::~RootObject):
2266 (KJS::Bindings::RootObject::setRootObjectImp):
2267 (KJS::Bindings::RootObject::rootObjectImp):
2268 (KJS::Bindings::RootObject::setInterpreter):
2269 (KJS::Bindings::RootObject::interpreter):
2270 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
2271 (KJS::Bindings::RootObject::runLoop):
2272 (KJS::Bindings::RootObject::performJavaScriptSource):
2278 2004-02-18 Richard Williamson <rjw@apple.com>
2280 Added NSNumber/Number conversion.
2282 Removed some unnecessary KJS:: namespace specifiers.
2286 * bindings/objc/objc_utility.mm:
2287 (KJS::Bindings::convertValueToObjcValue):
2288 (KJS::Bindings::convertObjcValueToValue):
2289 * bindings/runtime_array.h:
2291 2004-02-18 Richard Williamson <rjw@apple.com>
2293 Added support for export NSArrays.
2295 Updated valueAt() to take an ExecState so we can throw
2298 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
2299 ObjectiveC classes to control the visibility of their methods in
2304 * bindings/jni/jni_runtime.cpp:
2305 (JavaField::valueFromInstance):
2306 (JavaArray::valueAt):
2307 * bindings/jni/jni_runtime.h:
2308 * bindings/objc/objc_class.mm:
2309 (ObjcClass::methodsNamed):
2310 * bindings/objc/objc_runtime.h:
2311 (KJS::Bindings::ObjcArray::getObjcArray):
2312 * bindings/objc/objc_runtime.mm:
2313 (ObjcField::valueFromInstance):
2314 (ObjcField::setValueToInstance):
2315 (ObjcArray::ObjcArray):
2316 (ObjcArray::~ObjcArray):
2317 (ObjcArray::operator=):
2318 (ObjcArray::setValueAt):
2319 (ObjcArray::valueAt):
2320 (ObjcArray::getLength):
2321 * bindings/objc/objc_utility.mm:
2322 (KJS::Bindings::convertValueToObjcValue):
2323 (KJS::Bindings::convertObjcValueToValue):
2324 * bindings/runtime.cpp:
2325 (Instance::getValueOfField):
2326 * bindings/runtime.h:
2327 * bindings/runtime_array.cpp:
2328 (RuntimeArrayImp::get):
2329 * bindings/runtime_object.cpp:
2330 (RuntimeObjectImp::get):
2332 2004-02-17 Richard Williamson <rjw@apple.com>
2334 Added String <-> NSString conversion.
2335 Added tests of String <-> NSString conversion to test program.
2339 * bindings/objc/objc_utility.mm:
2340 (KJS::Bindings::convertValueToObjcValue):
2341 (KJS::Bindings::convertObjcValueToValue):
2343 * bindings/testbindings.mm:
2344 (-[MyFirstInterface getString]):
2346 2004-02-15 Darin Adler <darin@apple.com>
2350 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
2351 and removing redundant settings of things that match defaults in other build styles.
2353 2004-02-13 Richard Williamson <rjw@apple.com>
2355 Work towards the JavaScript ObjC bindings. The bindings now work for
2356 simple scalar types. testbindings.mm is an illustration of how the
2361 * JavaScriptCore.pbproj/project.pbxproj:
2363 * bindings/jni/jni_class.cpp:
2364 (JavaClass::methodsNamed):
2365 * bindings/jni/jni_class.h:
2366 * bindings/jni/jni_instance.cpp:
2367 (JavaInstance::invokeMethod):
2368 * bindings/jni/jni_instance.h:
2369 * bindings/jni/jni_runtime.h:
2370 (KJS::Bindings::JavaMethod::returnType):
2371 * bindings/make_testbindings: Added.
2372 * bindings/objc/objc_class.h: Added.
2373 (KJS::Bindings::ObjcClass::~ObjcClass):
2374 (KJS::Bindings::ObjcClass::ObjcClass):
2375 (KJS::Bindings::ObjcClass::operator=):
2376 (KJS::Bindings::ObjcClass::constructorAt):
2377 (KJS::Bindings::ObjcClass::numConstructors):
2378 * bindings/objc/objc_class.mm: Added.
2379 (ObjcClass::_commonDelete):
2380 (ObjcClass::_commonCopy):
2381 (ObjcClass::_commonInit):
2382 (_createClassesByIsAIfNecessary):
2383 (ObjcClass::classForIsA):
2384 (ObjcClass::ObjcClass):
2386 (ObjcClass::methodsNamed):
2387 (ObjcClass::fieldNamed):
2388 * bindings/objc/objc_header.h: Added.
2389 * bindings/objc/objc_instance.h: Added.
2390 (KJS::Bindings::ObjcInstance::getObject):
2391 * bindings/objc/objc_instance.mm: Added.
2392 (ObjcInstance::ObjcInstance):
2393 (ObjcInstance::~ObjcInstance):
2394 (ObjcInstance::operator=):
2395 (ObjcInstance::begin):
2396 (ObjcInstance::end):
2397 (ObjcInstance::getClass):
2398 (ObjcInstance::invokeMethod):
2399 (ObjcInstance::defaultValue):
2400 (ObjcInstance::stringValue):
2401 (ObjcInstance::numberValue):
2402 (ObjcInstance::booleanValue):
2403 (ObjcInstance::valueOf):
2404 * bindings/objc/objc_jsobject.h: Added.
2405 * bindings/objc/objc_jsobject.mm: Added.
2406 * bindings/objc/objc_runtime.h:
2407 (KJS::Bindings::ObjcField::~ObjcField):
2408 (KJS::Bindings::ObjcField::ObjcField):
2409 (KJS::Bindings::ObjcField::operator=):
2410 (KJS::Bindings::ObjcMethod::ObjcMethod):
2411 (KJS::Bindings::ObjcMethod::~ObjcMethod):
2412 (KJS::Bindings::ObjcMethod::operator=):
2413 * bindings/objc/objc_runtime.mm: Added.
2414 (ObjcMethod::ObjcMethod):
2416 (ObjcMethod::numParameters):
2417 (ObjcMethod::getMethodSignature):
2418 (ObjcField::ObjcField):
2421 (ObjcField::valueFromInstance):
2422 (ObjcField::setValueToInstance):
2423 * bindings/objc/objc_utility.h: Added.
2425 * bindings/objc/objc_utility.mm: Added.
2426 (KJS::Bindings::JSMethodNameToObjCMethodName):
2427 (KJS::Bindings::convertValueToObjcValue):
2428 (KJS::Bindings::convertObjcValueToValue):
2429 (KJS::Bindings::objcValueTypeForType):
2430 * bindings/runtime.cpp:
2431 (MethodList::MethodList):
2432 (MethodList::operator=):
2433 (Instance::setValueOfField):
2434 (Instance::createBindingForLanguageInstance):
2435 (Instance::createRuntimeObject):
2436 * bindings/runtime.h:
2437 * bindings/runtime_method.cpp:
2438 (RuntimeMethodImp::RuntimeMethodImp):
2439 (RuntimeMethodImp::get):
2440 (RuntimeMethodImp::call):
2441 * bindings/runtime_method.h:
2442 * bindings/runtime_object.cpp:
2443 (RuntimeObjectImp::get):
2444 (RuntimeObjectImp::hasProperty):
2445 * bindings/test.js: Added.
2446 * bindings/testbindings.mm: Added.
2447 (-[MySecondInterface init]):
2448 (-[MyFirstInterface init]):
2449 (-[MyFirstInterface dealloc]):
2450 (+[MyFirstInterface JavaScriptNameForSelector:]):
2451 (-[MyFirstInterface getInt]):
2452 (-[MyFirstInterface setInt:]):
2453 (-[MyFirstInterface getMySecondInterface]):
2454 (-[MyFirstInterface logMessage:]):
2455 (GlobalImp::className):
2456 (readJavaScriptFromFile):
2461 2004-02-08 Darin Adler <darin@apple.com>
2465 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
2467 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
2468 macros from working right in C++ code that uses the <cctype> header.
2471 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
2472 (KJS::UTF8SequenceLengthNonASCII): Added.
2473 (KJS::inlineUTF8SequenceLength): Added.
2474 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
2475 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2476 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
2477 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2478 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2480 - fixed the test program so it won't hit the interpreter lock assertion
2482 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
2486 2004-02-06 Richard Williamson <rjw@apple.com>
2488 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.
2492 * bindings/jni/jni_jsobject.cpp:
2493 (JSObject::toString):
2494 * bindings/jni/jni_utility.cpp:
2495 (KJS::Bindings::convertValueToJValue):
2497 2004-02-02 Darin Adler <darin@apple.com>
2501 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
2503 * kjs/array_object.cpp:
2504 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
2505 we start putting values in. This prevents new Array(2147483647) from causing trouble.
2506 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
2507 number is out of range. This prevents new Array(-1) from causing trouble.
2509 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
2511 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
2512 casting to int. Results now match those in other browsers.
2514 2004-02-02 Darin Adler <darin@apple.com>
2518 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
2519 - fixed other related overflow issues
2521 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
2523 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
2524 must not restrict values to the range of a particular integer type.
2525 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
2526 proper handling for negative results from fmod.
2527 (ValueImp::toUInt32): Ditto.
2528 (ValueImp::toUInt16): Ditto.
2529 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
2531 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
2532 out-of-integer-range values better in the slice function.
2533 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
2534 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
2535 out-of-integer-range values better in the toString function.
2536 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
2537 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
2538 and substr functions.
2542 2004-01-30 Richard Williamson <rjw@apple.com>
2544 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
2548 * bindings/jni/jni_instance.cpp:
2549 (JavaInstance::stringValue):
2551 2004-01-26 Darin Adler <darin@apple.com>
2553 * Makefile.am: Switch from pbxbuild to xcodebuild.
2555 2004-01-22 Richard Williamson <rjw@apple.com>
2557 Added stubs for ObjC language binding to JavaScript.
2559 * JavaScriptCore.pbproj/project.pbxproj:
2560 * bindings/jni/jni_runtime.h:
2561 * bindings/objc/objc_runtime.h: Added.
2562 (KJS::Bindings::ObjcParameter::ObjcParameter):
2563 (KJS::Bindings::ObjcParameter::~ObjcParameter):
2564 (KJS::Bindings::ObjcParameter::operator=):
2565 (KJS::Bindings::ObjcParameter::type):
2566 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
2567 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
2568 (KJS::Bindings::ObjcConstructor::_commonCopy):
2569 (KJS::Bindings::ObjcConstructor::operator=):
2570 (KJS::Bindings::ObjcConstructor::value):
2571 (KJS::Bindings::ObjcConstructor::parameterAt):
2572 (KJS::Bindings::ObjcConstructor::numParameters):
2573 (KJS::Bindings::ObjcField::ObjcField):
2574 (KJS::Bindings::ObjcField::~ObjcField):
2575 * bindings/runtime.h:
2577 2004-01-22 Richard Williamson <rjw@apple.com>
2579 Simplified JavaString by using UString as backing store. This
2580 revealed a bug in CString's assignment operator which I fixed.
2582 Removed some dead code.
2586 * bindings/jni/jni_runtime.h:
2587 (KJS::Bindings::JavaString::JavaString):
2588 (KJS::Bindings::JavaString::_commonInit):
2589 (KJS::Bindings::JavaString::UTF8String):
2590 (KJS::Bindings::JavaString::uchars):
2591 (KJS::Bindings::JavaString::length):
2592 (KJS::Bindings::JavaString::ustring):
2593 * bindings/runtime_object.cpp:
2594 (RuntimeObjectImp::RuntimeObjectImp):
2595 * bindings/runtime_object.h:
2597 (KJS::CString::CString):
2598 (KJS::CString::operator=):
2604 2004-01-16 Richard Williamson <rjw@apple.com>
2606 Fixed 3525853. We weren't handling mapping to overloaded Java
2607 methods very well. Even though this is undefined the other
2608 browsers support it. Also fixed a bug with returning arrays
2609 from Java functions.
2613 * bindings/jni/jni_class.cpp:
2614 (JavaClass::_commonInit):
2615 (JavaClass::methodsNamed):
2616 * bindings/jni/jni_class.h:
2617 * bindings/jni/jni_instance.cpp:
2618 (JavaInstance::invokeMethod):
2619 * bindings/jni/jni_instance.h:
2620 * bindings/jni/jni_runtime.cpp:
2621 (JavaArray::convertJObjectToArray):
2622 (JavaField::valueFromInstance):
2623 (JavaMethod::signature):
2624 (JavaArray::valueAt):
2625 * bindings/jni/jni_runtime.h:
2626 * bindings/jni_jsobject.cpp:
2628 (JSObject::convertJObjectToValue):
2629 * bindings/runtime.cpp:
2630 (MethodList::addMethod):
2631 (MethodList::length):
2632 (MethodList::methodAt):
2633 (MethodList::~MethodList):
2634 * bindings/runtime.h:
2635 (KJS::Bindings::MethodList::MethodList):
2636 * bindings/runtime_method.cpp:
2637 (RuntimeMethodImp::RuntimeMethodImp):
2638 (RuntimeMethodImp::get):
2639 (RuntimeMethodImp::call):
2640 * bindings/runtime_method.h:
2641 * bindings/runtime_object.cpp:
2642 (RuntimeObjectImp::get):
2643 (RuntimeObjectImp::hasProperty):
2645 2004-01-16 Richard Williamson <rjw@apple.com>
2647 Fixed 3531229. Another place that needs the Push/PopLocalFrame
2648 protection implemented for 3530401.
2652 * bindings/runtime_method.cpp:
2653 (RuntimeMethodImp::call):
2655 2004-01-15 Richard Williamson <rjw@apple.com>
2657 Fixed 3530401. JNI doesn't cleanup local refs created on the
2658 main thread. IMO this is a bad bug in our JMI implementation.
2660 To work-around the problem I explicitly delete all local refs.
2661 Further, I've added Push/PopLocalFrame calls to catch any refs
2662 that I may have missed. This will guarantee that we don't leak
2663 any Java references.
2667 * bindings/jni/jni_class.cpp:
2668 (JavaClass::_commonInit):
2669 (JavaClass::JavaClass):
2670 * bindings/jni/jni_instance.cpp:
2671 (JavaInstance::begin):
2672 (JavaInstance::end):
2673 * bindings/jni/jni_instance.h:
2674 * bindings/jni/jni_runtime.cpp:
2675 (JavaConstructor::JavaConstructor):
2676 (JavaMethod::JavaMethod):
2677 * bindings/jni_jsobject.cpp:
2678 (JSObject::listFromJArray):
2679 * bindings/runtime.h:
2680 (KJS::Bindings::Instance::begin):
2681 (KJS::Bindings::Instance::end):
2682 * bindings/runtime_object.cpp:
2683 (RuntimeObjectImp::get):
2684 (RuntimeObjectImp::put):
2685 (RuntimeObjectImp::canPut):
2686 (RuntimeObjectImp::hasProperty):
2687 (RuntimeObjectImp::defaultValue):
2689 2004-01-15 Vicki Murley <vicki@apple.com>
2693 * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
2695 2004-01-14 Richard Williamson <rjw@apple.com>
2697 Fixed 3529466. With recent changes to Java plugin we must no
2698 longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
2702 * bindings/jni/jni_instance.cpp:
2703 (JObjectWrapper::JObjectWrapper):
2707 2004-01-14 Richard Williamson <rjw@apple.com>
2711 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.
2715 * bindings/jni_jsobject.cpp:
2717 (removeJavaReference):
2718 (RootObject::removeAllJavaReferencesForRoot):
2721 2004-01-13 Richard Williamson <rjw@apple.com>
2725 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.
2729 * bindings/jni_jsobject.h:
2730 (KJS::Bindings::RootObject::~RootObject):
2736 2004-01-06 Richard Williamson <rjw@apple.com>
2738 Fixed 3521814. Finalize messages weren't being dispatched!
2742 * bindings/jni_jsobject.cpp:
2745 2004-01-05 Richard Williamson <rjw@apple.com>
2747 Added cache of JNI method IDs to minimize allocations. This mitigates the problem
2748 described by 3515579.
2750 Also cleanup up logging of Java exceptions.
2754 * bindings/jni/jni_class.cpp:
2755 (JavaClass::classForInstance):
2756 * bindings/jni/jni_instance.cpp:
2757 (JavaInstance::JavaInstance):
2758 (JavaInstance::getClass):
2759 (JavaInstance::invokeMethod):
2760 (JObjectWrapper::JObjectWrapper):
2761 (JObjectWrapper::~JObjectWrapper):
2762 * bindings/jni/jni_instance.h:
2763 (KJS::Bindings::JavaInstance::operator=):
2764 * bindings/jni/jni_runtime.cpp:
2765 (JavaMethod::JavaMethod):
2766 (JavaMethod::methodID):
2767 * bindings/jni/jni_runtime.h:
2768 (KJS::Bindings::JavaMethod::JavaMethod):
2769 * bindings/jni/jni_utility.cpp:
2773 (KJS::Bindings::getMethodID):
2774 (KJS::Bindings::callJNIVoidMethodIDA):
2775 (KJS::Bindings::callJNIObjectMethodIDA):
2776 (KJS::Bindings::callJNIByteMethodIDA):
2777 (KJS::Bindings::callJNICharMethodIDA):
2778 (KJS::Bindings::callJNIShortMethodIDA):
2779 (KJS::Bindings::callJNIIntMethodIDA):
2780 (KJS::Bindings::callJNILongMethodIDA):
2781 (KJS::Bindings::callJNIFloatMethodIDA):
2782 (KJS::Bindings::callJNIDoubleMethodIDA):
2783 (KJS::Bindings::callJNIBooleanMethodIDA):
2784 (KJS::Bindings::getCharactersFromJStringInEnv):
2785 (KJS::Bindings::getUCharactersFromJStringInEnv):
2786 (KJS::Bindings::getJNIField):
2787 * bindings/jni/jni_utility.h:
2789 l2003-12-23 John Sullivan <sullivan@apple.com>
2791 * JavaScriptCore.pbproj/project.pbxproj:
2792 Xcode version wars, harmless
2794 2003-12-23 Darin Adler <darin@apple.com>
2796 Reviewed by John (concept, not code, which is just the old code coming back).
2798 - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
2800 * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
2801 mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
2803 2003-12-19 Richard Williamson <rjw@apple.com>
2805 Fixed 3515597. When an error occurs we need
2806 to make sure result values are zeroed.
2808 Cleaned up logs by adding a newline.
2812 * bindings/jni/jni_utility.cpp:
2813 (KJS::Bindings::getJavaVM):
2814 (KJS::Bindings::getJNIEnv):
2817 (KJS::Bindings::getJNIField):
2818 * bindings/jni_jsobject.cpp:
2819 (JSObject::convertValueToJObject):
2823 2003-12-17 Richard Williamson <rjw@apple.com>
2825 Ensure that all the symbols we export are in the KJS
2826 namespace (3512245).
2828 Also renamed JavaString.characters() to JavaString.UTF8String()
2829 for enhanced clarity.
2831 Added some sanity checking to constructor of JObjectWrapper.
2836 * bindings/jni/jni_class.cpp:
2837 * bindings/jni/jni_class.h:
2838 * bindings/jni/jni_instance.cpp:
2839 (JavaInstance::invokeMethod):
2840 (JObjectWrapper::JObjectWrapper):
2841 * bindings/jni/jni_instance.h:
2842 * bindings/jni/jni_runtime.cpp:
2843 (JavaParameter::JavaParameter):
2844 (JavaField::JavaField):
2845 (JavaMethod::JavaMethod):
2846 (JavaMethod::signature):
2847 * bindings/jni/jni_runtime.h:
2848 (KJS::Bindings::JavaString::ascii):
2849 (KJS::Bindings::JavaString::UTF8String):
2850 (KJS::Bindings::JavaString::JavaString):
2851 (KJS::Bindings::JavaString::_commonInit):
2852 (KJS::Bindings::JavaString::uchars):
2853 (KJS::Bindings::JavaString::length):
2854 (KJS::Bindings::JavaString::ustring):
2855 (KJS::Bindings::JavaParameter::type):
2856 (KJS::Bindings::JavaField::name):
2857 (KJS::Bindings::JavaField::type):
2858 (KJS::Bindings::JavaMethod::name):
2859 (KJS::Bindings::JavaMethod::returnType):
2860 * bindings/jni/jni_utility.cpp:
2861 (KJS::Bindings::getJavaVM):
2862 (KJS::Bindings::getJNIEnv):
2863 (KJS::Bindings::callJNIVoidMethod):
2864 (KJS::Bindings::callJNIObjectMethod):
2865 (KJS::Bindings::callJNIBooleanMethod):
2866 (KJS::Bindings::callJNIByteMethod):
2867 (KJS::Bindings::callJNICharMethod):
2868 (KJS::Bindings::callJNIShortMethod):
2869 (KJS::Bindings::callJNIIntMethod):
2870 (KJS::Bindings::callJNILongMethod):
2871 (KJS::Bindings::callJNIFloatMethod):
2872 (KJS::Bindings::callJNIDoubleMethod):
2873 (KJS::Bindings::callJNIVoidMethodA):
2874 (KJS::Bindings::callJNIObjectMethodA):
2875 (KJS::Bindings::callJNIByteMethodA):
2876 (KJS::Bindings::callJNICharMethodA):
2877 (KJS::Bindings::callJNIShortMethodA):
2878 (KJS::Bindings::callJNIIntMethodA):
2879 (KJS::Bindings::callJNILongMethodA):
2880 (KJS::Bindings::callJNIFloatMethodA):
2881 (KJS::Bindings::callJNIDoubleMethodA):
2882 (KJS::Bindings::callJNIBooleanMethodA):
2883 (KJS::Bindings::getCharactersFromJString):
2884 (KJS::Bindings::releaseCharactersForJString):
2885 (KJS::Bindings::getCharactersFromJStringInEnv):
2886 (KJS::Bindings::releaseCharactersForJStringInEnv):
2887 (KJS::Bindings::getUCharactersFromJStringInEnv):
2888 (KJS::Bindings::releaseUCharactersForJStringInEnv):
2889 (KJS::Bindings::JNITypeFromClassName):
2890 (KJS::Bindings::signatureFromPrimitiveType):
2891 (KJS::Bindings::JNITypeFromPrimitiveType):
2892 (KJS::Bindings::getJNIField):
2893 (KJS::Bindings::convertValueToJValue):
2894 * bindings/jni/jni_utility.h:
2895 * bindings/jni_jsobject.cpp:
2896 (KJS::Bindings::JSObject::invoke):
2897 (KJS::Bindings::JSObject::JSObject):
2898 (KJS::Bindings::JSObject::call):
2899 (KJS::Bindings::JSObject::eval):
2900 (KJS::Bindings::JSObject::getMember):
2901 (KJS::Bindings::JSObject::setMember):
2902 (KJS::Bindings::JSObject::removeMember):
2903 (KJS::Bindings::JSObject::getSlot):
2904 (KJS::Bindings::JSObject::setSlot):
2905 (KJS::Bindings::JSObject::toString):
2906 (KJS::Bindings::JSObject::finalize):
2907 (KJS::Bindings::JSObject::createNative):
2908 (KJS::Bindings::JSObject::convertValueToJObject):
2909 (KJS::Bindings::JSObject::convertJObjectToValue):
2910 (KJS::Bindings::JSObject::listFromJArray):
2911 * bindings/jni_jsobject.h:
2912 * bindings/runtime.cpp:
2913 * bindings/runtime.h:
2914 * bindings/runtime_method.cpp:
2915 * bindings/runtime_method.h:
2919 2003-12-16 Richard Williamson <rjw@apple.com>
2921 Ack! More assertions. Lock ALL entry points into the interpreter!
2926 * bindings/jni_jsobject.cpp:
2927 (Bindings::JSObject::call):
2928 (Bindings::JSObject::eval):
2929 (Bindings::JSObject::getMember):
2930 (Bindings::JSObject::setMember):
2931 (Bindings::JSObject::removeMember):
2932 (Bindings::JSObject::getSlot):
2933 (Bindings::JSObject::setSlot):
2934 (Bindings::JSObject::convertJObjectToValue):
2936 2003-12-15 Richard Williamson <rjw@apple.com>
2938 Fixed a couple of snafus and removed some logging.
2942 * bindings/jni_jsobject.cpp:
2943 (Bindings::performJavaScriptAccess):
2944 (Bindings::completedJavaScriptAccess):
2945 (Bindings::dispatchToJavaScriptThread):
2946 Removed some annoying JS_LOG clutter.
2948 (Bindings::RootObject::removeAllJavaReferencesForRoot):
2949 Fixed allocation of key buffer that was called after it was needed.
2951 (Bindings::JSObject::invoke):
2952 (Bindings::JSObject::JSObject):
2953 (Bindings::JSObject::getMember):
2954 (Bindings::JSObject::getSlot):
2955 Added additional interpreter locks around getMember and getSlot.
2956 These functions may cause allocation of JS impls.
2958 2003-12-15 Richard Williamson <rjw@apple.com>
2960 args weren't passed to 'call' invocation. d'oh.
2961 lock interpreter when we create instances of JS impls.
2965 * bindings/jni_jsobject.cpp:
2966 (Bindings::JSObject::call):
2967 (Bindings::JSObject::eval):
2968 (Bindings::JSObject::getMember):
2969 (Bindings::JSObject::setMember):
2970 (Bindings::JSObject::getSlot):
2971 (Bindings::JSObject::convertValueToJObject):
2972 (Bindings::JSObject::convertJObjectToValue):
2973 (Bindings::JSObject::listFromJArray):
2974 * bindings/jni_jsobject.h:
2976 2003-12-15 Richard Williamson <rjw@apple.com>
2978 Last piece of LiveConnect! This checkin adds implementation
2979 of the Java to JavaScript object conversion functions.
2983 * bindings/jni/jni_instance.cpp:
2984 (JavaInstance::invokeMethod):
2985 * bindings/jni/jni_utility.cpp:
2986 * bindings/jni/jni_utility.h:
2987 * bindings/jni_jsobject.cpp:
2988 (Bindings::JSObject::invoke):
2989 (Bindings::JSObject::call):
2990 (Bindings::JSObject::eval):
2991 (Bindings::JSObject::getMember):
2992 (Bindings::JSObject::setMember):
2993 (Bindings::JSObject::getSlot):
2994 (Bindings::JSObject::setSlot):
2995 (Bindings::JSObject::createNative):
2996 (Bindings::JSObject::convertValueToJObject):
2997 (Bindings::JSObject::convertJObjectToValue):
2998 (Bindings::JSObject::listFromJArray):
2999 * bindings/jni_jsobject.h:
3001 * bindings/runtime_method.cpp:
3002 (RuntimeMethodImp::get):
3003 (RuntimeMethodImp::codeType):
3004 (RuntimeMethodImp::execute):
3006 2003-12-12 Richard Williamson <rjw@apple.com>
3008 Added implementation of stubs in JSObject. All that
3009 remains is a couple of simple conversion functions stubs and
3010 we're done with LiveConnect. Also, changed string passing to
3011 JS to use uchars instead of chars.
3015 * bindings/jni/jni_runtime.h:
3016 (Bindings::JavaString::JavaString):
3017 (Bindings::JavaString::_commonInit):
3018 (Bindings::JavaString::_commonCopy):
3019 (Bindings::JavaString::_commonDelete):
3020 (Bindings::JavaString::~JavaString):
3021 (Bindings::JavaString::operator=):
3022 (Bindings::JavaString::uchars):
3023 (Bindings::JavaString::length):
3024 (Bindings::JavaString::ustring):
3025 * bindings/jni/jni_utility.cpp:
3026 (getUCharactersFromJStringInEnv):
3027 (releaseUCharactersForJStringInEnv):
3028 (convertValueToJObject):
3029 (convertJObjectToValue):
3030 * bindings/jni/jni_utility.h:
3031 * bindings/jni_jsobject.cpp:
3032 (Bindings::JSObject::invoke):
3033 (Bindings::JSObject::call):
3034 (Bindings::JSObject::eval):
3035 (Bindings::JSObject::getMember):
3036 (Bindings::JSObject::setMember):
3037 (Bindings::JSObject::removeMember):
3038 (Bindings::JSObject::getSlot):
3039 (Bindings::JSObject::setSlot):
3040 * bindings/jni_jsobject.h:
3042 2003-12-12 Richard Williamson <rjw@apple.com>
3044 Ensure that all calls from Java into JavaScript are
3045 performed on a designated thread (the main thread).
3049 * bindings/jni_jsobject.cpp:
3050 (isJavaScriptThread):
3052 (Bindings::performJavaScriptAccess):
3053 (Bindings::completedJavaScriptAccess):
3054 (Bindings::initializeJavaScriptAccessLock):
3055 (Bindings::lockJavaScriptAccess):
3056 (Bindings::unlockJavaScriptAccess):
3057 (Bindings::dispatchToJavaScriptThread):
3058 (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
3059 (Bindings::RootObject::removeAllJavaReferencesForRoot):
3060 (Bindings::JSObject::invoke):
3061 (Bindings::JSObject::JSObject):
3062 (Bindings::JSObject::call):
3063 (Bindings::JSObject::eval):
3064 (Bindings::JSObject::getMember):
3065 (Bindings::JSObject::setMember):
3066 (Bindings::JSObject::removeMember):
3067 (Bindings::JSObject::getSlot):
3068 (Bindings::JSObject::setSlot):
3069 (Bindings::JSObject::toString):
3070 (Bindings::JSObject::finalize):
3071 (Bindings::JSObject::getWindow):
3072 * bindings/jni_jsobject.h:
3073 (Bindings::RootObject::~RootObject):
3074 (Bindings::RootObject::findRootObjectForNativeHandleFunction):
3075 (Bindings::RootObject::runLoop):
3076 (Bindings::RootObject::performJavaScriptSource):
3079 2003-12-11 Richard Williamson <rjw@apple.com>
3081 Added support for calling a JavaScript function from
3082 Java. Right now this only works for void func(void)
3083 functions, but the conversion of args and return values
3086 Cleaned up and verified reference counting scheme, and
3087 dereferencing of vended JavaScript objects when applet is
3088 destroyed (actually when part is destroyed).
3090 Removed link hack for testkjs now that the Java folks think
3091 they have a solution for the 1.4.2 JavaVM link problem. Although
3092 Greg B. thinks his solution may cause problems for the 1.3.1
3093 version of the VM!?!
3098 * bindings/jni/jni_runtime.h:
3099 (Bindings::JavaString::JavaString):
3100 * bindings/jni/jni_utility.cpp:
3101 (convertValueToJValue):
3102 (convertValueToJObject):
3104 * bindings/jni/jni_utility.h:
3105 * bindings/jni_jsobject.cpp:
3106 (KJS_setFindRootObjectForNativeHandleFunction):
3107 (KJS_findRootObjectForNativeHandleFunction):
3108 (getReferencesByRootDictionary):
3109 (getReferencesDictionary):
3110 (findReferenceDictionary):
3113 (removeJavaReference):
3114 * bindings/jni_jsobject.h:
3115 (Bindings::RootObject::RootObject):
3116 (Bindings::RootObject::~RootObject):
3117 (Bindings::RootObject::setRootObjectImp):
3118 (Bindings::RootObject::rootObjectImp):
3119 (Bindings::RootObject::setInterpreter):
3120 (Bindings::RootObject::interpreter):
3124 2003-12-10 Darin Adler <darin@apple.com>
3128 - fixed regression in JavaScript tests reported by the KDE guys
3129 - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
3131 * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
3133 (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
3134 tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
3135 and binary compatibility than default parameter values.
3136 (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
3138 * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
3139 "tolerate empty string" parameter.
3141 2003-12-10 Richard Williamson <rjw@apple.com>
3143 Added code to manage reference counting of JavaScript
3144 objects passed to Java. Also added implementation of
3145 KJS_JSCreateNativeJSObject. This is the function that
3146 provides the root object to Java (KJS::Window).
3150 * JavaScriptCore.pbproj/project.pbxproj:
3151 * bindings/jni_jsobject.cpp:
3152 (KJS_setFindObjectForNativeHandleFunction):
3153 (KJS_findObjectForNativeHandleFunction):
3154 (getReferencesByOwnerDictionary):
3155 (getReferencesDictionary):
3156 (findReferenceDictionary):
3158 (removeJavaReference):
3159 (removeAllJavaReferencesForOwner):
3160 * bindings/jni_jsobject.h:
3162 2003-12-09 Richard Williamson <rjw@apple.com>
3164 LiveConnect stubs that correspond to the native methods
3165 on JSObject. These will be called from the new Java plugin
3166 when an instance of JSObject is instantiated and messaged.
3167 When these are implemented the Java will be able to originate
3168 calls into JavaScript.
3170 Also a temporary work-around added to Makefile.am to solve
3171 a link problem. The 1.4.2 JavaVM accidentally links against
3172 libobjc. This call a failure linking testkjs. Mike Hay is
3173 working with someone to fix the problem (3505587).
3177 * JavaScriptCore.pbproj/project.pbxproj:
3179 * bindings/jni_jsobject.cpp: Added.
3180 (KJS_JSCreateNativeJSObject):
3181 (KJS_JSObject_JSFinalize):
3182 (KJS_JSObject_JSObjectCall):
3183 (KJS_JSObject_JSObjectEval):
3184 (KJS_JSObject_JSObjectGetMember):
3185 (KJS_JSObject_JSObjectSetMember):
3186 (KJS_JSObject_JSObjectRemoveMember):
3187 (KJS_JSObject_JSObjectGetSlot):
3188 (KJS_JSObject_JSObjectSetSlot):
3189 (KJS_JSObject_JSObjectToString):
3190 * bindings/jni_jsobject.h: Added.
3192 2003-12-09 Maciej Stachowiak <mjs@apple.com>
3196 <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
3198 * kjs/collector.cpp:
3199 (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
3200 (KJS::Collector::collect): likewise
3202 2003-12-08 Richard Williamson <rjw@apple.com>
3204 LiveConnect: The last piece of the JavaScript side of the
3205 LiveConnect implementation. This change adds support for
3206 setting/getting values from Java arrays in JavaScript.
3210 * bindings/jni/jni_instance.h:
3211 * bindings/jni/jni_runtime.cpp:
3212 (JavaField::JavaField):
3213 (convertJObjectToArray):
3214 (JavaArray::JavaArray):
3215 (JavaArray::~JavaArray):
3216 (JavaArray::setValueAt):
3217 (JavaArray::valueAt):
3218 (JavaArray::getLength):
3219 * bindings/jni/jni_runtime.h:
3220 (Bindings::JavaArray::operator=):
3221 (Bindings::JavaArray::javaArray):
3222 * bindings/jni/jni_utility.cpp:
3223 (JNITypeFromPrimitiveType):
3224 (convertValueToJValue):
3225 * bindings/jni/jni_utility.h:
3226 * bindings/runtime.h:
3227 * bindings/runtime_array.cpp:
3228 (RuntimeArrayImp::RuntimeArrayImp):
3229 (RuntimeArrayImp::~RuntimeArrayImp):
3230 (RuntimeArrayImp::get):
3231 (RuntimeArrayImp::put):
3232 (RuntimeArrayImp::hasProperty):
3233 * bindings/runtime_array.h:
3234 (KJS::RuntimeArrayImp::getLength):
3235 (KJS::RuntimeArrayImp::getConcreteArray):
3236 * bindings/runtime_object.cpp:
3237 (RuntimeObjectImp::get):
3238 (RuntimeObjectImp::canPut):
3239 (RuntimeObjectImp::hasProperty):
3241 2003-12-05 Richard Williamson <rjw@apple.com>
3243 LiveConnect: Part 1 of supporting JS bindings to
3244 native language arrays.
3248 * JavaScriptCore.pbproj/project.pbxproj:
3249 * bindings/jni/jni_runtime.cpp:
3250 (JavaField::JavaField):
3251 (convertJObjectToArray):
3252 (JavaField::valueFromInstance):
3253 (JavaField::setValueToInstance):
3254 * bindings/jni/jni_runtime.h:
3255 * bindings/runtime.cpp:
3256 (Instance::setValueOfField):
3257 * bindings/runtime.h:
3258 (Bindings::Array::~Array):
3260 2003-12-04 Richard Williamson <rjw@apple.com>
3262 LiveConnect: Moved defaultValue into concrete implementation because
3263 more intelligent conversion can be perform with knowledge
3264 of the class of the original instance.
3268 * bindings/jni/jni_class.cpp:
3269 (JavaClass::isNumberClass):
3270 (JavaClass::isBooleanClass):
3271 (JavaClass::isStringClass):
3272 * bindings/jni/jni_class.h:
3273 * bindings/jni/jni_instance.cpp:
3274 (JavaInstance::defaultValue):
3275 (JavaInstance::valueOf):
3276 * bindings/jni/jni_instance.h:
3277 (Bindings::JavaInstance::javaInstance):
3278 * bindings/runtime.h:
3279 * bindings/runtime_object.cpp:
3280 (RuntimeObjectImp::defaultValue):
3282 2003-12-04 Richard Williamson <rjw@apple.com>
3284 LiveConnect: Added support for setting the value of Java
3289 * bindings/jni/jni_instance.cpp:
3290 (JavaInstance::invokeMethod):
3291 * bindings/jni/jni_runtime.cpp:
3292 (JavaParameter::JavaParameter):
3293 (JavaField::JavaField):
3294 (JavaField::valueFromInstance):
3295 (JavaField::setValueToInstance):
3296 (JavaMethod::JavaMethod):
3297 * bindings/jni/jni_runtime.h:
3298 (Bindings::JavaField::getJNIType):
3299 * bindings/jni/jni_utility.cpp:
3300 (JNITypeFromClassName):
3301 (convertValueToJValue):
3302 * bindings/jni/jni_utility.h:
3303 * bindings/runtime.cpp:
3304 (Instance::setValueOfField):
3305 * bindings/runtime.h:
3306 * bindings/runtime_object.cpp:
3307 (RuntimeObjectImp::get):
3308 (RuntimeObjectImp::put):
3309 (RuntimeObjectImp::defaultValue):
3311 2003-12-04 Richard Williamson <rjw@apple.com>
3313 Added support for string conversions.
3314 Changed various JavaString member variables to be inline.
3315 Implemented defaultValue for context relevant type coercion.
3319 * bindings/jni/jni_class.cpp:
3320 (JavaClass::JavaClass):
3321 (JavaClass::setClassName):
3322 (JavaClass::classForInstance):
3323 * bindings/jni/jni_class.h:
3324 * bindings/jni/jni_instance.cpp:
3325 (JavaInstance::stringValue):
3326 (JavaInstance::numberValue):
3327 (JavaInstance::booleanValue):
3328 (JavaInstance::invokeMethod):
3329 * bindings/jni/jni_instance.h:
3330 * bindings/jni/jni_runtime.cpp:
3331 (JavaParameter::JavaParameter):
3332 (JavaField::JavaField):
3333 (JavaMethod::JavaMethod):
3335 (JavaMethod::signature):
3336 * bindings/jni/jni_runtime.h:
3337 (Bindings::JavaString::JavaString):
3338 (Bindings::JavaString::~JavaString):
3339 (Bindings::JavaString::operator=):
3340 (Bindings::JavaString::characters):
3341 (Bindings::JavaParameter::JavaParameter):
3342 (Bindings::JavaParameter::~JavaParameter):
3343 (Bindings::JavaParameter::operator=):
3344 (Bindings::JavaParameter::type):
3345 (Bindings::JavaField::JavaField):
3346 (Bindings::JavaField::~JavaField):
3347 (Bindings::JavaField::operator=):
3348 (Bindings::JavaField::name):
3349 (Bindings::JavaField::type):
3350 (Bindings::JavaMethod::JavaMethod):
3351 (Bindings::JavaMethod::_commonDelete):
3352 (Bindings::JavaMethod::name):
3353 (Bindings::JavaMethod::returnType):
3354 * bindings/jni/jni_utility.cpp:
3355 (convertValueToJValue):
3356 * bindings/runtime.h:
3357 (Bindings::Instance::valueOf):
3358 * bindings/runtime_method.cpp:
3359 (RuntimeMethodImp::call):
3360 * bindings/runtime_object.cpp:
3361 (RuntimeObjectImp::RuntimeObjectImp):
3362 (RuntimeObjectImp::get):
3363 (RuntimeObjectImp::defaultValue):
3364 * bindings/runtime_object.h:
3365 (KJS::RuntimeObjectImp::classInfo):
3369 2003-12-03 Richard Williamson <rjw@apple.com>
3371 LiveConnect: Added support for parameter passing to Java and conversion
3376 * bindings/jni/jni_instance.cpp:
3377 (JavaInstance::invokeMethod):
3378 * bindings/jni/jni_instance.h:
3379 * bindings/jni/jni_runtime.cpp:
3380 (JavaParameter::JavaParameter):
3381 (JavaMethod::JavaMethod):
3382 (JavaMethod::signature):
3383 * bindings/jni/jni_runtime.h:
3384 (Bindings::JavaParameter::JavaParameter):
3385 (Bindings::JavaParameter::operator=):
3386 (Bindings::JavaParameter::getJNIType):
3387 * bindings/jni/jni_utility.cpp:
3388 (callJNIBooleanMethodA):
3389 (convertValueToJValue):
3390 * bindings/jni/jni_utility.h:
3391 * bindings/runtime.h:
3392 * bindings/runtime_method.cpp:
3393 (RuntimeMethodImp::call):
3394 * bindings/runtime_object.cpp:
3395 (RuntimeObjectImp::get):
3397 2003-12-02 Richard Williamson <rjw@apple.com>
3399 Added support for calling simple methods in Java from JavaScript.
3400 (void return and no parameters). Yay, LiveConnect lives.
3402 Still need write argument and return value conversion code.
3406 * JavaScriptCore.pbproj/project.pbxproj:
3407 * bindings/jni/jni_instance.cpp:
3408 (JavaInstance::getClass):
3409 (JavaInstance::invokeMethod):
3410 * bindings/jni/jni_instance.h:
3411 * bindings/jni/jni_runtime.cpp:
3412 (JavaMethod::JavaMethod):
3413 (JavaMethod::signature):
3414 (JavaMethod::JNIReturnType):
3415 * bindings/jni/jni_runtime.h:
3416 (Bindings::JavaMethod::_commonDelete):
3417 (Bindings::JavaMethod::_commonCopy):
3418 (Bindings::JavaMethod::name):
3419 * bindings/jni/jni_utility.cpp:
3420 (signatureFromPrimitiveType):
3421 * bindings/jni/jni_utility.h:
3422 * bindings/runtime.h:
3423 * bindings/runtime_method.cpp: Added.
3424 (RuntimeMethodImp::RuntimeMethodImp):
3425 (RuntimeMethodImp::~RuntimeMethodImp):
3426 (RuntimeMethodImp::get):
3427 (RuntimeMethodImp::implementsCall):
3428 (RuntimeMethodImp::call):
3429 (RuntimeMethodImp::codeType):
3430 (RuntimeMethodImp::execute):
3431 * bindings/runtime_method.h: Added.
3432 * bindings/runtime_object.cpp:
3433 (RuntimeObjectImp::RuntimeObjectImp):
3434 (RuntimeObjectImp::get):
3435 * bindings/runtime_object.h:
3437 (FunctionImp::FunctionImp):
3438 * kjs/interpreter.h:
3440 2003-12-01 Darin Adler <darin@apple.com>
3444 - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
3446 * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
3447 This indirectly caused the string.replace bug.
3449 2003-12-02 Maciej Stachowiak <mjs@apple.com>
3451 Merged patches from Harri Porten and David Faure to fix:
3453 <rdar://problem/3497643>: reproducible crash printing self-referential array
3455 * kjs/array_object.cpp:
3456 (ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown.
3458 (FunctionCallNode::evaluate): Move function call depth check from here...
3460 (KJS::Object::call): ...to here.
3461 * kjs/object.h: Un-inline Object::call now that it does more.
3463 2003-12-01 Richard Williamson <rjw@apple.com>
3465 Fixed mistake in method signatures used to get boolean and integer fields.
3469 * bindings/jni/jni_runtime.cpp:
3470 (JavaField::valueFromInstance):
3472 2003-12-01 Richard Williamson <rjw@apple.com>
3474 Fixed parameter passing to applet. Child elements are NOT valid in setStyle(). So we now create the widget before needed with createWidgetIfNecessary. This either happens when doing the first layout, or when JavaScript first references the applet element.
3476 Fixed early delete of the the main applet instance. When the JS collector cleaned up the last JS object referring to the applet instance we were deleting the java instance. This caused the applet instance cached on the applet element to be invalid. The applet instance is the only Java object not to be cleaned up by the JS collector.
3478 Added support for getting at Java object fields.
3482 * JavaScriptCore.pbproj/project.pbxproj:
3484 * bindings/jni/jni_instance.cpp:
3485 (JObjectWrapper::JObjectWrapper):
3486 * bindings/jni/jni_instance.h:
3487 (Bindings::JObjectWrapper::~JObjectWrapper):
3488 * bindings/jni/jni_runtime.cpp:
3489 (JavaField::valueFromInstance):
3490 * bindings/runtime_object.cpp:
3491 (RuntimeObjectImp::~RuntimeObjectImp):
3492 (RuntimeObjectImp::RuntimeObjectImp):
3493 (RuntimeObjectImp::get):
3494 (RuntimeObjectImp::deleteProperty):
3495 * bindings/runtime_object.h:
3499 2003-11-21 Maciej Stachowiak <mjs@apple.com>
3501 Patch from Harri Porten, reviewed by me.
3503 - fixed 3491712 - String slice with negative arguments does not offset from end of string
3505 * kjs/string_object.cpp:
3506 (StringProtoFuncImp::call): Handle negative arguments as offsets from end by
3507 adding length and clamping to [0,length-1].
3509 2003-11-21 Maciej Stachowiak <mjs@apple.com>
3511 Patch from Harri Porten, reviewed by me.
3513 - fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash
3515 * kjs/function_object.cpp:
3516 (FunctionProtoFuncImp::call): Nest parentheses properly.
3518 2003-11-20 Richard Williamson <rjw@apple.com>
3520 More LiveConnect stuff. Primitive Java fields are now
3521 accessible from JavaScript! Yay!
3525 * bindings/jni/jni_class.cpp:
3526 (JavaClass::methodNamed):
3527 (JavaClass::fieldNamed):
3528 * bindings/jni/jni_class.h:
3529 (Bindings::JavaClass::_commonDelete):
3530 * bindings/jni/jni_instance.cpp:
3531 (JavaInstance::JavaInstance):
3532 (JavaInstance::~JavaInstance):
3533 (JavaInstance::getClass):
3534 * bindings/jni/jni_instance.h:
3535 (Bindings::JavaInstance::javaInstance):
3536 * bindings/jni/jni_runtime.cpp:
3537 (JavaField::JavaField):
3538 (JavaField::valueFromInstance):
3539 * bindings/jni/jni_runtime.h:
3540 (Bindings::JavaField::JavaField):
3541 (Bindings::JavaField::~JavaField):
3542 (Bindings::JavaField::operator=):
3543 * bindings/jni/jni_utility.cpp:
3546 (callJNIVoidMethod):
3547 (callJNIObjectMethod):
3548 (callJNIBooleanMethod):
3549 (callJNIByteMethod):
3550 (callJNICharMethod):
3551 (callJNIShortMethod):
3553 (callJNILongMethod):
3554 (callJNIFloatMethod):
3555 (callJNIDoubleMethod):
3556 (callJNIVoidMethodA):
3557 (callJNIObjectMethodA):
3558 (callJNIByteMethodA):
3559 (callJNICharMethodA):
3560 (callJNIShortMethodA):
3561 (callJNIIntMethodA):
3562 (callJNILongMethodA):
3563 (callJNIFloatMethodA):
3564 (callJNIDoubleMethodA):
3565 (releaseCharactersForJStringInEnv):
3566 (primitiveTypeFromClassName):
3568 * bindings/jni/jni_utility.h:
3569 * bindings/runtime.cpp:
3570 (Instance::createBindingForLanguageInstance):
3571 (Instance::getValueOfField):
3572 * bindings/runtime.h:
3573 * bindings/runtime_object.cpp: