1 2004-10-05 Richard Williamson <rjw@apple.com>
3 Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
7 * bindings/NP_jsobject.cpp:
9 * bindings/npruntime.cpp:
10 (_NPN_SetExceptionWithUTF8):
11 * bindings/objc/WebScriptObject.mm:
12 (+[WebScriptObject throwException:]):
14 (KJS::InterpreterImp::context):
16 2004-10-05 Richard Williamson <rjw@apple.com>
18 Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
22 * bindings/objc/objc_utility.mm:
23 (KJS::Bindings::convertObjcValueToValue):
25 2004-10-04 Darin Adler <darin@apple.com>
29 - rolled in a fix the KDE folks did for the operations that generate HTML fragments
31 * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
33 - rolled out an old workaround we don't need any more
35 * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
36 required it is no longer there.
38 2004-09-30 Richard Williamson <rjw@apple.com>
40 Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
44 * bindings/NP_jsobject.cpp:
48 * bindings/c/c_class.cpp:
49 (CClass::methodsNamed):
51 * bindings/c/c_class.h:
52 * bindings/c/c_instance.cpp:
53 (CInstance::invokeMethod):
54 * bindings/jni/jni_class.cpp:
55 (JavaClass::methodsNamed):
56 * bindings/jni/jni_class.h:
57 * bindings/npruntime.h:
58 * bindings/objc/objc_class.h:
59 * bindings/objc/objc_class.mm:
60 (ObjcClass::methodsNamed):
62 * bindings/runtime_object.cpp:
63 (RuntimeObjectImp::get):
64 (RuntimeObjectImp::hasProperty):
66 2004-09-29 Chris Blumenberg <cblu@apple.com>
68 Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
72 * JavaScriptCore.pbproj/project.pbxproj:
73 * bindings/NP_jsobject.cpp:
74 (_NPN_CreateScriptObject):
80 (_NPN_RemoveProperty):
83 * bindings/c/c_class.cpp:
84 (CClass::methodsNamed):
86 * bindings/c/c_instance.cpp:
87 (CInstance::CInstance):
88 (CInstance::~CInstance):
89 (CInstance::operator=):
90 (CInstance::invokeMethod):
91 (CInstance::invokeDefaultMethod):
92 * bindings/c/c_runtime.cpp:
93 * bindings/c/c_runtime.h:
94 (KJS::Bindings::CField::name):
95 (KJS::Bindings::CMethod::name):
96 * bindings/npruntime.cpp:
97 (_NPN_GetStringIdentifier):
98 (_NPN_GetStringIdentifiers):
99 (_NPN_GetIntIdentifier):
100 (_NPN_IdentifierIsString):
101 (_NPN_UTF8FromIdentifier):
102 (_NPN_IntFromIdentifier):
103 (NPN_InitializeVariantWithObject):
104 (_NPN_ReleaseVariantValue):
107 (_NPN_ReleaseObject):
108 (_NPN_SetExceptionWithUTF8):
111 2004-09-26 Darin Adler <darin@apple.com>
113 * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
114 low() to get Unicode value of character, and just use unicode().
116 2004-09-26 Darin Adler <darin@apple.com>
118 - refine charAt/charCodeAt fix slightly
120 * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
121 omitted parameter, as we do everywhere else, and as other browsers do here.
123 2004-09-26 Darin Adler <darin@apple.com>
127 - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
129 * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
130 the program. We were doing this properly for functions, but not entire programs.
132 - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
134 * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
135 and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
137 * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
143 2004-09-14 Richard Williamson <rjw@apple.com>
145 1. Add class parameter to object allocation function. This is somewhat redundant, given that
146 the allocation function is in the class function vector, but people wanted to use the same
147 allocation function for different classes.
149 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
151 3. Add support for a default function on an object. This is a feature that ActiveX supports,
152 and will allow JavaScript code to be written that will look exactly the same for both ActiveX
153 plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
154 'Objective-C' bindings.
156 There bugs are covered by
158 <rdar://problem/3776343> Support for default functions in the JavaScript bindings
159 <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
160 <rdar://problem/3674754> Need to implement latest npruntime.h
164 * bindings/NP_jsobject.cpp:
168 * bindings/c/c_class.cpp:
169 * bindings/c/c_instance.cpp:
170 (CInstance::CInstance):
171 (CInstance::operator=):
172 (CInstance::invokeMethod):
173 (CInstance::invokeDefaultMethod):
174 * bindings/c/c_instance.h:
175 * bindings/c/c_runtime.cpp:
176 * bindings/c/c_runtime.h:
177 * bindings/jni/jni_instance.cpp:
178 (JavaInstance::invokeDefaultMethod):
179 * bindings/jni/jni_instance.h:
180 * bindings/npruntime.cpp:
182 * bindings/npruntime.h:
183 * bindings/objc/WebScriptObject.h:
184 * bindings/objc/objc_class.mm:
185 (ObjcClass::fallbackObject):
186 * bindings/objc/objc_instance.h:
187 * bindings/objc/objc_instance.mm:
188 (ObjcInstance::invokeDefaultMethod):
189 * bindings/objc/objc_runtime.h:
190 * bindings/objc/objc_runtime.mm:
191 (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
192 (ObjcFallbackObjectImp::get):
193 (ObjcFallbackObjectImp::put):
194 (ObjcFallbackObjectImp::canPut):
195 (ObjcFallbackObjectImp::implementsCall):
196 (ObjcFallbackObjectImp::call):
197 (ObjcFallbackObjectImp::hasProperty):
198 (ObjcFallbackObjectImp::deleteProperty):
199 (ObjcFallbackObjectImp::defaultValue):
200 * bindings/runtime.h:
201 (KJS::Bindings::Class::fallbackObject):
202 (KJS::Bindings::Instance::getValueOfUndefinedField):
203 (KJS::Bindings::Instance::setValueOfUndefinedField):
204 (KJS::Bindings::Instance::valueOf):
205 * bindings/runtime_object.cpp:
206 (RuntimeObjectImp::implementsCall):
207 (RuntimeObjectImp::call):
208 * bindings/runtime_object.h:
210 2004-09-13 Maciej Stachowiak <mjs@apple.com>
214 <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
216 * kjs/string_object.cpp:
217 (StringProtoFuncImp::call): Replaced implementation of replace()
218 method with function below...
219 (replace): In order to avoid excessive allocation and copying,
220 figure out the ranges of the original string and replacement
221 strings to be assembled, instead of constantly creating new
222 strings at each substitution. The old behavior is basically O(N^2)
223 for a global replace on a pattern that matches many places in the
225 (regExpIsGlobal): Helper function for the above.
226 (expandSourceRanges): ditto
227 (pushSourceRange): ditto
228 (expandReplacements): ditto
229 (pushReplacement): ditto
231 (KJS::UString::spliceSubstringsWithSeparators): New method that
232 pieces together substring ranges of this string together with
233 specified separators, all at one go.
235 (KJS::UString::Range::Range): Added new helper class to represent
238 2004-09-14 Maciej Stachowiak <mjs@apple.com>
242 - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
245 (KJS::GlobalFuncImp::call): Make sure to escape null
246 characters. This is a bug in the new code that made part of the
249 2004-09-13 Darin Adler <darin@apple.com>
251 Reviewed by Kevin and Maciej.
253 - new function to support fix for DIG bug in WebCore
255 * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
256 * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
258 2004-09-12 Darin Adler <darin@apple.com>
260 * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
261 of escape and unescape.
263 2004-09-12 Darin Adler <darin@apple.com>
267 - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
269 * kjs/date_object.cpp:
270 (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
271 uses CFDateFormatter.
272 (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
274 2004-09-09 Maciej Stachowiak <mjs@apple.com>
278 <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
281 (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
282 ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
284 (Lexer::isHexDigit): Made static and non-const.
289 2004-09-06 Darin Adler <darin@apple.com>
291 * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
295 2004-09-01 Richard Williamson <rjw@apple.com>
297 Add pid to exception messages (to help debug dashboard clients).
301 * kjs/interpreter.cpp:
302 (Interpreter::evaluate):
306 2004-08-20 Richard Williamson <rjw@apple.com>
308 Implemented new JNI abstraction. We no longer invoke Java methods
309 directly with JNI, rather we call into the plugin. This allows the
310 plugin to dispatch the call to the appropriate VM thread. This
311 change should (will?) fix a whole class of threading related problems with
316 * JavaScriptCore.pbproj/project.pbxproj:
317 * bindings/c/c_instance.h:
318 (KJS::Bindings::CInstance::setExecutionContext):
319 (KJS::Bindings::CInstance::executionContext):
320 * bindings/jni/jni_instance.cpp:
321 (JavaInstance::JavaInstance):
322 (JavaInstance::invokeMethod):
323 (JavaInstance::setExecutionContext):
324 (JavaInstance::executionContext):
325 * bindings/jni/jni_instance.h:
326 * bindings/jni/jni_jsobject.cpp:
327 (JSObject::convertJObjectToValue):
328 * bindings/jni/jni_runtime.cpp:
329 (JavaField::JavaField):
330 (JavaArray::convertJObjectToArray):
331 (JavaField::valueFromInstance):
332 (JavaArray::JavaArray):
333 (JavaArray::valueAt):
334 * bindings/jni/jni_runtime.h:
335 (KJS::Bindings::JavaArray::operator=):
336 (KJS::Bindings::JavaArray::executionContext):
337 * bindings/jni/jni_utility.h:
338 * bindings/objc/objc_instance.h:
339 (KJS::Bindings::ObjcInstance::setExecutionContext):
340 (KJS::Bindings::ObjcInstance::executionContext):
341 * bindings/runtime.cpp:
342 (Instance::createBindingForLanguageInstance):
343 * bindings/runtime.h:
344 * bindings/runtime_root.h:
345 (KJS::Bindings::RootObject::nativeHandle):
349 2004-08-19 Vicki Murley <vicki@apple.com>
353 * kjs/property_map.cpp:
354 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
356 2004-08-17 Darin Adler <darin@apple.com>
360 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
362 * kjs/property_map.h: Added some private functions.
363 * kjs/property_map.cpp:
364 (KJS::PropertyMap::clear): Set sentinelCount to 0.
365 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
366 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
367 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
368 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
369 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
370 deleted-element sentinels.
371 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
373 2004-08-16 Maciej Stachowiak <mjs@apple.com>
375 Code change by Eric Albert, reviewd by me.
377 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
379 * kjs/date_object.cpp:
380 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
381 entirely would be even better, but is not required to fix this bug.
385 2004-08-16 Richard Williamson <rjw@apple.com>
387 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
389 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
393 * bindings/NP_jsobject.cpp:
395 * bindings/jni/jni_jsobject.cpp:
397 * bindings/objc/WebScriptObject.mm:
398 (-[WebScriptObject evaluateWebScript:]):
400 2004-08-15 Richard Williamson <rjw@apple.com>
402 More updates to np headers. Implemented new NPN functions.
406 * bindings/NP_jsobject.cpp:
410 * bindings/npruntime.h:
412 2004-08-13 Darin Adler <darin@apple.com>
414 - fix build so we can compile again
416 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
417 is good enough so that we can compile, but it's only a stopgap measure, because I think
418 Richard has a newer one he wants to check in.
420 2004-08-12 Richard Williamson <rjw@apple.com>
422 Bring npruntime.h and friends closer to compliance with
427 * JavaScriptCore.pbproj/project.pbxproj:
428 * bindings/NP_jsobject.cpp:
430 (_NPN_CreateScriptObject):
435 (NPN_RemoveProperty):
436 * bindings/NP_jsobject.h:
437 * bindings/c/c_instance.cpp:
438 (CInstance::invokeMethod):
439 * bindings/c/c_utility.cpp:
440 (convertNPVariantToValue):
441 * bindings/npruntime.cpp:
442 (NPN_IdentifierIsString):
445 (NPN_VariantIsUndefined):
447 (NPN_VariantIsInt32):
448 (NPN_VariantIsDouble):
449 (NPN_VariantIsString):
450 (NPN_VariantIsObject):
452 (NPN_VariantToString):
453 (NPN_VariantToInt32):
454 (NPN_VariantToDouble):
455 (NPN_VariantToObject):
456 (NPN_InitializeVariantAsVoid):
457 (NPN_InitializeVariantAsNull):
458 (NPN_InitializeVariantAsUndefined):
459 (NPN_InitializeVariantWithBool):
460 (NPN_InitializeVariantWithInt32):
461 (NPN_InitializeVariantWithDouble):
462 (NPN_InitializeVariantWithString):
463 (NPN_InitializeVariantWithStringCopy):
464 (NPN_InitializeVariantWithObject):
465 (NPN_InitializeVariantWithVariant):
466 (NPN_ReleaseVariantValue):
468 * bindings/npruntime.h:
470 (_NPString::_NPVariant::):
471 * bindings/npruntime_priv.h: Added.
473 2004-08-12 Darin Adler <darin@apple.com>
477 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
480 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
481 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
482 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
483 to skip leading "+" or "-".
487 2004-08-12 Darin Adler <darin@apple.com>
491 - fixed 43 Mozilla JavaScript tests
493 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
494 * kjs/date_object.cpp:
495 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
496 than constructing a number object to pass to it.
497 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
498 (KJS::parseDate): Change to return a double instead of creating the Number object here.
499 (KJS::timeClip): Implement this as specified in the language standard.
501 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
502 flags on the prototype property.
505 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
507 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
509 (KJS::parseDigit): Added. Helper function for parseInt.
510 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
511 strtoll can handle. Also matches standard more closely.
512 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
514 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
516 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
518 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
520 (Lexer::setCode): Clear error state.
521 (Lexer::lex): Set error state if the lexer encounters an error
524 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
525 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
527 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
528 Change round to round values between -0.5 and -0 to -0 instead of +0.
530 * kjs/nodes.h: Add evaluateReference function to GroupNode.
531 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
532 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
533 would change x.y into a value that can't be deleted as a side effect.
535 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
538 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
539 get rid of the fixed size limit for code.
541 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
542 returns the string without creating a new Rep, since I'm using substr in a place where it will
545 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
546 the other day that was making a couple tests fail.
547 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
548 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
549 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
550 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
551 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
553 * kjs/string_object.lut.h: Regenerated.
555 2004-08-11 Darin Adler <darin@apple.com>
557 - fixed a tiny problem with the UTF-16 PCRE check-in
559 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
560 the ctype_meta flag to get set in items that should not have it.
562 * pcre/chartables.c: Regenerated.
564 2004-08-10 Richard Williamson <rjw@apple.com>
566 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
568 The following WebScripting methods are now supported on bound
571 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
572 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
573 - (id)valueForUndefinedKey:(NSString *)key
577 * bindings/c/c_class.cpp:
578 (CClass::fieldNamed):
579 * bindings/c/c_class.h:
580 * bindings/jni/jni_class.cpp:
581 (JavaClass::fieldNamed):
582 * bindings/jni/jni_class.h:
583 * bindings/objc/objc_class.h:
584 (KJS::Bindings::ObjcClass::isa):
585 * bindings/objc/objc_class.mm:
586 (ObjcClass::methodsNamed):
587 (ObjcClass::fieldNamed):
588 (ObjcClass::fallbackObject):
589 * bindings/objc/objc_instance.h:
590 * bindings/objc/objc_instance.mm:
591 (ObjcInstance::invokeMethod):
592 (ObjcInstance::setValueOfField):
593 (ObjcInstance::setValueOfUndefinedField):
594 (ObjcInstance::getValueOfField):
595 (ObjcInstance::getValueOfUndefinedField):
596 * bindings/objc/objc_runtime.h:
597 (KJS::Bindings::ObjcField::~ObjcField):
598 (KJS::Bindings::ObjcField::ObjcField):
599 (KJS::Bindings::ObjcField::operator=):
600 (KJS::Bindings::FallbackObjectImp::classInfo):
601 * bindings/objc/objc_runtime.mm:
602 (ObjcField::ObjcField):
605 (ObjcField::valueFromInstance):
606 (ObjcField::setValueToInstance):
607 (FallbackObjectImp::FallbackObjectImp):
608 (FallbackObjectImp::get):
609 (FallbackObjectImp::put):
610 (FallbackObjectImp::canPut):
611 (FallbackObjectImp::implementsCall):
612 (FallbackObjectImp::call):
613 (FallbackObjectImp::hasProperty):
614 (FallbackObjectImp::deleteProperty):
615 (FallbackObjectImp::defaultValue):
616 * bindings/runtime.h:
617 (KJS::Bindings::Class::fallbackObject):
618 (KJS::Bindings::Instance::getValueOfUndefinedField):
619 (KJS::Bindings::Instance::setValueOfUndefinedField):
620 * bindings/runtime_object.cpp:
621 (RuntimeObjectImp::get):
622 (RuntimeObjectImp::put):
623 (RuntimeObjectImp::canPut):
624 (RuntimeObjectImp::hasProperty):
625 * bindings/testbindings.mm:
626 (-[MyFirstInterface valueForUndefinedKey:]):
627 (-[MyFirstInterface setValue:forUndefinedKey:]):
629 2004-08-10 Darin Adler <darin@apple.com>
633 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
635 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
636 or uint16_t depending on the mode, and used appropriate in the 7 public functions
638 * pcre/pcre.c: Add UTF-16 support to all functions.
639 * pcre/study.c: Ditto.
641 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
642 the mode. Changed declarations to use symbolic constants and typedefs so we size
643 things to ichar when needed.
645 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
646 sized to 16-bit characters instead of 8-bit.
649 (pcre_copy_substring): Use pcre_char instead of char.
650 (pcre_get_substring_list): Ditto.
651 (pcre_free_substring_list): Ditto.
652 (pcre_get_substring): Ditto.
653 (pcre_free_substring): Ditto.
655 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
656 of hard-coding 8-bit table sizes.
658 * pcre/chartables.c: Regenerated.
660 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
661 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
662 is not null. The null string still has a null pointer. This prevents us from
663 passing a null through to the regular expression engine (which results in a null
664 error even when the string length is 0).
667 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
668 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
670 2004-08-09 Darin Adler <darin@apple.com>
674 - fixed 28 Mozilla JavaScript tests
676 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
677 checking the number of arguments for the join method.
679 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
680 than integers, so we aren't limited to 32 bits.
682 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
683 the implementation of the pow operation. Also simplied a case that was handling positive
684 and negative infinity separately.
686 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
687 putting them in a long, so that unsigned shift will work properly.
689 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
691 * kjs/operations.cpp:
692 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
693 sign of isinf; our isinf function returns +1 even for negative infinity.
694 (KJS::isNegInf): And again.
695 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
696 Our floating point already handles the various infinity cases correctly.
698 * kjs/regexp_object.cpp:
699 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
700 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
701 array in cases where we did not match.
702 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
703 "global", "ignoreCase", "multiline", and "source".
705 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
706 string into undefined rather than an empty string. For the slice method, handle an
707 undefined parameter for the limit properly as decribed in the specification, and add
708 the limit to one case that didn't have the limit at all. For the methods that generate
709 HTML strings, use lowercase tags instead of uppercase.
712 (KJS::UChar::toLower): Use u_tolower from the ICU library.
713 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
714 (KJS::UString::append): Fix some math that caused a buffer overflow.
715 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
716 flag) rather than converting them all to 0.
717 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
719 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
721 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
722 the Unicode specification in a few cases where it was wrong before.
723 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
724 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
725 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
726 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
727 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
728 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
729 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
730 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
731 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
733 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
735 * kjs/number_object.lut.h: Regenerated.
737 2004-08-09 Darin Adler <darin@apple.com>
741 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
743 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
744 we get a buffer overflow.
748 2004-08-05 Richard Williamson <rjw@apple.com>
750 Fixed part of 3674747. The QT guys need this for feature freeze.
752 This patch implements support for the
754 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
756 method of objects bound to JavaScript.
761 * bindings/objc/objc_class.mm:
762 (ObjcClass::methodsNamed):
763 (ObjcClass::fieldNamed):
764 * bindings/objc/objc_instance.mm:
765 (ObjcInstance::invokeMethod):
766 * bindings/objc/objc_runtime.h:
767 (KJS::Bindings::ObjcMethod::~ObjcMethod):
768 (KJS::Bindings::ObjcMethod::isFallbackMethod):
769 (KJS::Bindings::ObjcMethod::javaScriptName):
770 * bindings/objc/objc_runtime.mm:
771 (ObjcMethod::ObjcMethod):
772 (ObjcMethod::getMethodSignature):
773 (ObjcMethod::setJavaScriptName):
774 * bindings/testbindings.mm:
776 2004-08-04 Vicki Murley <vicki@apple.com>
780 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
783 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
784 go to the next line and continue parsing the string (instead of failing). This matches
785 behavior in Mac IE and Mozilla.
787 2004-08-03 Kevin Decker <kdecker@apple.com>
791 Rolled in changes from the latest KJS sources that support additional
792 Number.prototype functions.
794 Specifically this patch covers the follow parts of the ECMA 3 spec:
795 15.7.4.5, 15.7.4.6, and 15.7.4.7
798 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
799 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
800 <rdar://problem/3749591> missing Number.toExponential prototype implementation
802 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
803 list of supported identifiers (a macro).
804 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
806 (NumberPrototypeImp::NumberPrototypeImp):
807 (NumberProtoFuncImp::call):
808 * kjs/number_object.h: Added property names for toFixed, toPrecision,
810 (KJS::NumberProtoFuncImp::):
811 * tests/mozilla/expected.html: Update results.
813 2004-08-03 Darin Adler <darin@apple.com>
817 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
819 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
820 we are supposed to just copy the regular expression object, and do so.
821 Also tighten up arguments check to handle case where an actual "undefined"
822 is passed rather than just omitting an argument.
824 * tests/mozilla/expected.html: Update results.
826 2004-08-02 Darin Adler <darin@apple.com>
828 * tests/mozilla/.cvsignore: Added.
829 * tests/mozilla/expected.html: Update results.
831 2004-08-02 Darin Adler <darin@apple.com>
835 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
837 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
838 Append the flags here so more tests paseed.
840 2004-08-02 Darin Adler <darin@apple.com>
844 - fixed a couple things making 5 Mozilla regexp tests pass
846 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
848 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
849 be used as the flags string when no parameter was passed.
851 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
852 Added a class info object for RegExp prototype so it can return
853 a string instead of raising an exception when converting to a string.
855 * tests/mozilla/expected.html: Update results.
857 2004-08-02 Darin Adler <darin@apple.com>
861 - fix crashes in mozilla tests due to mishandling NaN
863 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
864 calls to toInteger so that NaN will get turned into something that fits in an integer.
865 These were the ones John already fixed, but his fix used isnan and the new fix is
868 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
869 after a call to toInteger to handle NaN properly. Also removed separate check
870 for undefined that's not needed.
872 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
873 as in the above two files, but for a lot more functions. Also changed one place with
874 an explicit check for undefined to instead just check isNaN.
876 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
877 like me who don't keep $SYMROOTS in their $PATH.
883 2004-07-26 Kevin Decker <kdecker@apple.com>
885 Changes done by Darin, reviewed by Kevin.
887 - changed testkjs to build in Xcode rather than from Makefile
889 * .cvsignore: Removed obsolete files from this list.
890 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
891 Changed to build target "All" rather than default target. This makes us
892 build the testkjs test tool.
893 * dummy.cpp: Removed.
894 * kjs/.cvsignore: Removed obsolete files from this list, including
895 the testkjs tool, which is now built in the symroots directory.
896 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
897 changed this file. Also this has the nice side effect of causing the tool
898 to be rebuilt in the new location even if there are no other changes in
899 your tree when you check this out.
900 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
901 without setting the execute bit on jsDriver.pl.
903 2004-07-22 Kevin Decker <kdecker@apple.com>
907 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
909 * kjs/function_object.cpp:
910 (FunctionObjectImp::construct):
911 * kjs/function_object.h:
913 (KJS::ObjectImp::construct):
915 (KJS::Object::construct):
917 2004-07-21 Darin Adler <darin@apple.com>
919 * bindings/npruntime.h: Fixed typo.
921 2004-07-19 John Sullivan <sullivan@apple.com>
925 - bulletproofed array.slice() against NAN arguments. Harri noticed this
926 vulnerability in my patch for 3714644
928 * kjs/array_object.cpp:
929 (ArrayProtoFuncImp::call):
930 handle NAN parameters passed to slice() by clamping to 0 and length.
932 2004-07-19 Richard Williamson <rjw@apple.com>
934 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
939 * bindings/jni/jni_jsobject.cpp:
941 (JSObject::JSObject):
943 2004-07-16 John Sullivan <sullivan@apple.com>
947 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
948 hangs browser with javascript
950 * kjs/array_object.cpp:
951 (ArrayProtoFuncImp::call):
952 Check for undefined type for args[0] the same way we were already checking
953 for args[1]. In this case, args was zero-length, but we were treating
954 args[0] like an integer anyway. Resulted in some code looping from a NAN
955 value to 4, taking approximately forever.
957 * JavaScriptCore.pbproj/project.pbxproj:
962 2004-07-14 Maciej Stachowiak <mjs@apple.com>
966 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
967 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
969 * kjs/number_object.cpp:
970 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
972 2004-07-13 Kevin Decker <kdecker@apple.com>
974 Reviewed by kocienda.
976 - made testkjs and JavaScriptCore a subtarget of 'All'
977 - testkjs now builds in $SYMROOTS
979 * JavaScriptCore.pbproj/project.pbxproj:
983 2004-06-24 Chris Blumenberg <cblu@apple.com>
985 Ignore .mode1 files in JavaScriptCore.pbproj
987 Reviewed by kocienda.
989 * JavaScriptCore.pbproj/.cvsignore:
991 2004-06-23 Richard Williamson <rjw@apple.com>
993 Implemented changes for latest npruntime.h.
997 * JavaScriptCore.pbproj/project.pbxproj:
998 * bindings/NP_jsobject.cpp:
999 (listFromVariantArgs):
1000 (identiferFromNPIdentifier):
1001 (_NPN_CreateScriptObject):
1006 (NPN_RemoveProperty):
1007 * bindings/NP_jsobject.h:
1008 * bindings/c/c_class.cpp:
1009 (CClass::methodsNamed):
1010 (CClass::fieldNamed):
1011 * bindings/c/c_instance.cpp:
1012 (CInstance::invokeMethod):
1013 * bindings/c/c_utility.cpp:
1014 (convertNPVariantToValue):
1015 * bindings/c/c_utility.h:
1016 * bindings/npruntime.cpp:
1017 (stringIdentifierEqual):
1018 (stringIdentifierHash):
1019 (getStringIdentifierDictionary):
1020 (intIdentifierEqual):
1021 (intIdentifierHash):
1022 (getIntIdentifierDictionary):
1023 (NPN_GetStringIdentifier):
1024 (NPN_GetStringIdentifiers):
1025 (NPN_GetIntIdentifier):
1026 (NPN_IdentifierIsString):
1027 (NPN_UTF8FromIdentifier):
1028 (NPN_VariantToInt32):
1029 (NPN_VariantToDouble):
1031 * bindings/npruntime.h:
1032 * bindings/objc/WebScriptObject.mm:
1033 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1034 * bindings/runtime_object.cpp:
1035 (RuntimeObjectImp::~RuntimeObjectImp):
1036 * bindings/runtime_root.cpp:
1037 (KJS::Bindings::rootForInterpreter):
1038 * bindings/testbindings.cpp:
1039 (initializeIdentifiers):
1045 === JavaScriptCore-146.1 ===
1047 2004-06-16 Richard Williamson <rjw@apple.com>
1049 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1051 This turned out to be a show stopper for Dashboard. Accessing a nil
1052 ObjC property from JS caused a crash. Similar to the problem
1053 3696112 fixed below.
1057 * bindings/objc/objc_runtime.mm:
1058 (KJS::Bindings::ObjcField::valueFromInstance):
1062 2004-06-16 Richard Williamson <rjw@apple.com>
1064 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1066 This turned out to be a show stopper for Dashboard. We now
1067 return Undefined() when nil is returned from a ObjC method
1068 that returns an object type.
1072 * bindings/objc/objc_utility.mm:
1073 (KJS::Bindings::convertObjcValueToValue):
1077 2004-06-15 Richard Williamson <rjw@apple.com>
1079 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1081 No longer need to check respondsToSelector: for
1082 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1083 because these now have a default implementation on NSObject.
1087 * bindings/objc/objc_class.mm:
1088 (ObjcClass::methodsNamed):
1089 (ObjcClass::fieldNamed):
1091 2004-06-14 Darin Adler <darin@apple.com>
1095 - fixed some things for GC that Patrick missed, or that happened after the branch
1097 * bindings/objc/WebScriptObject.mm:
1098 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1099 (-[WebScriptObject finalize]): Added.
1101 - added some missing nil checks
1103 * bindings/objc/objc_instance.mm:
1104 (ObjcInstance::ObjcInstance): Check for nil.
1105 (ObjcInstance::~ObjcInstance): Check for nil.
1106 (ObjcInstance::operator=): Check for nil.
1108 2004-06-14 Darin Adler <darin@apple.com>
1110 Reviewed by me, code changes by Patrick Beard.
1112 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1114 * bindings/objc/objc_instance.mm:
1115 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1116 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1117 (ObjcInstance::operator=): More of the same.
1118 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1120 * bindings/objc/objc_runtime.mm:
1121 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1122 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1123 (ObjcArray::operator=): More of the same.
1125 * bindings/testbindings.mm: Fixed incorrect license.
1126 (main): Use [pool drain] if compiling on Tiger.
1130 2004-06-10 Kevin Decker <kdecker@apple.com>
1136 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1138 (KJS::Lexer::lineNo):
1139 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1141 === JavaScriptCore-143.2 ===
1143 2004-06-07 Darin Adler <darin@apple.com>
1145 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1147 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1148 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1150 === JavaScriptCore-143.1 ===
1152 2004-06-04 Kevin Decker <kdecker@apple.com>
1156 - fixed <rdar://problem/3680594>
1159 (KJS::Error::create):
1163 2004-06-04 Darin Adler <darin@apple.com>
1165 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1167 2004-06-04 Kevin Decker <kdecker@apple.com>
1171 - ObjC bindings do not (yet) pass along sourceurl or line numbers
1172 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1173 - changed the wording of an error message
1174 - the lexer, parser, and interpreter have been made "sourceURL aware"
1175 - stored the url into Error
1177 * bindings/NP_jsobject.cpp:
1179 * bindings/jni/jni_jsobject.cpp:
1181 * bindings/objc/WebScriptObject.mm:
1182 (-[WebScriptObject evaluateWebScript:]):
1184 (GlobalFuncImp::call):
1185 * kjs/function_object.cpp:
1186 (FunctionObjectImp::construct):
1189 (InterpreterImp::checkSyntax):
1190 (InterpreterImp::evaluate):
1192 * kjs/interpreter.cpp:
1193 (Interpreter::evaluate):
1194 * kjs/interpreter.h:
1198 (KJS::Lexer::sourceURL):
1202 (FunctionCallNode::evaluate):
1205 (KJS::Error::create):
1208 2004-06-04 Richard Williamson <rjw@apple.com>
1210 Fixed crash when attempting to access properties on nil
1215 * bindings/objc/objc_instance.mm:
1216 (ObjcInstance::getClass):
1217 * bindings/runtime_object.cpp:
1218 (RuntimeObjectImp::get):
1219 * bindings/testM.js:
1220 * bindings/testbindings.mm:
1221 (-[MyFirstInterface getString]):
1223 2004-05-27 Kevin Decker <kdecker@apple.com>
1227 -revised generated error message content
1229 * kjs/error_object.cpp:
1230 (ErrorProtoFuncImp::call):
1234 (KJS::Error::create):
1238 2004-05-27 Richard Williamson <rjw@apple.com>
1240 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1244 * bindings/objc/WebScriptObject.h:
1246 2004-05-27 Darin Adler <darin@apple.com>
1250 - moved to new symlink technique for embedding frameworks
1252 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1253 because we don't need it any more.
1255 2004-05-24 Richard Williamson <rjw@apple.com>
1257 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1258 fixed ClassInfo to correctly reflect inheritance. This is required
1259 because of the runtime checks in JSC for arrays, i.e. in
1260 the Function objects apply method.
1264 * bindings/jni/jni_runtime.cpp:
1265 (JavaArray::convertJObjectToArray):
1266 * bindings/objc/objc_utility.mm:
1267 (KJS::Bindings::convertObjcValueToValue):
1268 * bindings/runtime_array.cpp:
1269 (RuntimeArrayImp::RuntimeArrayImp):
1270 * bindings/runtime_array.h:
1271 * bindings/testM.js: Added.
1272 * bindings/testbindings.mm:
1273 (+[MyFirstInterface webScriptNameForSelector:]):
1274 (-[MyFirstInterface logMessages:]):
1275 (-[MyFirstInterface logMessage:prefix:]):
1276 (-[MyFirstInterface callJSObject::]):
1278 2004-05-22 Darin Adler <darin@apple.com>
1282 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
1284 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
1285 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
1286 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
1287 it hasn't been set explicitly.
1291 2004-05-20 Richard Williamson <rjw@apple.com>
1293 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
1294 can now be referenced like any other WebScriptObject, meaning
1295 you can do JS operations on them.
1297 All added implementation of finalizeForWebScript.
1301 * bindings/objc/WebScriptObject.h:
1302 * bindings/objc/WebScriptObject.mm:
1303 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1304 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1305 (-[WebScriptObject KJS::]):
1306 (-[WebScriptObject dealloc]):
1307 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1308 (-[WebScriptObject evaluateWebScript:]):
1309 (-[WebScriptObject setValue:forKey:]):
1310 (-[WebScriptObject valueForKey:]):
1311 (-[WebScriptObject stringRepresentation]):
1312 * bindings/objc/WebScriptObjectPrivate.h:
1313 * bindings/objc/objc_instance.mm:
1314 (ObjcInstance::~ObjcInstance):
1316 2004-05-19 Richard Williamson <rjw@apple.com>
1318 Removed extraneous tabs that were added (by XCode?).
1320 * bindings/objc/WebScriptObject.h:
1322 2004-05-19 Darin Adler <darin@apple.com>
1324 - fixed headers with licenses mangled by Xcode auto-indenting
1326 * bindings/jni/jni_jsobject.cpp:
1327 * bindings/jni/jni_jsobject.h:
1328 * bindings/runtime_array.h:
1329 * bindings/runtime_root.cpp:
1330 * bindings/runtime_root.h:
1332 2004-05-18 Richard Williamson <rjw@apple.com>
1334 Added exception logging. Also check for exception and
1335 set results as appropriate.
1337 Reviewed by Maciej (partially reviewed).
1339 * bindings/objc/WebScriptObject.mm:
1340 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1341 (-[WebScriptObject evaluateWebScript:]):
1342 (-[WebScriptObject setValue:forKey:]):
1343 (-[WebScriptObject valueForKey:]):
1345 2004-05-18 Richard Williamson <rjw@apple.com>
1347 Finsished implementing support for windowScriptObject.
1348 Had to make WebScriptObjectPrivate.h accessible from
1353 * JavaScriptCore.pbproj/project.pbxproj:
1354 * bindings/objc/WebScriptObjectPrivate.h:
1356 2004-05-18 Richard Williamson <rjw@apple.com>
1358 Use KVC to set/get values instead of directly accessing
1363 * bindings/objc/WebScriptObject.mm:
1364 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1365 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1366 * bindings/objc/objc_runtime.mm:
1367 (ObjcField::valueFromInstance):
1368 (convertValueToObjcObject):
1369 (ObjcField::setValueToInstance):
1371 2004-05-17 Richard Williamson <rjw@apple.com>
1373 Implemented new API for WebScriptObject.
1375 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
1376 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
1380 * JavaScriptCore.pbproj/project.pbxproj:
1381 * bindings/c/c_instance.cpp:
1382 (CInstance::invokeMethod):
1383 * bindings/jni/jni_instance.cpp:
1384 (JavaInstance::invokeMethod):
1385 * bindings/jni/jni_jsobject.cpp:
1386 (JSObject::convertValueToJObject):
1387 * bindings/jni/jni_utility.cpp:
1388 (KJS::Bindings::getJNIField):
1389 * bindings/objc/WebScriptObject.mm:
1391 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1392 (-[WebScriptObject KJS::]):
1393 (-[WebScriptObject dealloc]):
1394 (+[WebScriptObject throwException:]):
1396 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1397 (-[WebScriptObject evaluateWebScript:]):
1398 (-[WebScriptObject setValue:forKey:]):
1399 (-[WebScriptObject valueForKey:]):
1400 (-[WebScriptObject stringRepresentation]):
1401 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1402 (+[WebUndefined undefined]):
1403 (-[WebUndefined initWithCoder:]):
1404 (-[WebUndefined encodeWithCoder:]):
1405 (-[WebUndefined copyWithZone:]):
1406 (-[WebUndefined retain]):
1407 (-[WebUndefined release]):
1408 (-[WebUndefined retainCount]):
1409 (-[WebUndefined autorelease]):
1410 (-[WebUndefined dealloc]):
1411 (-[WebUndefined copy]):
1412 (-[WebUndefined replacementObjectForPortCoder:]):
1413 * bindings/objc/WebScriptObjectPrivate.h: Added.
1414 * bindings/objc/objc_class.mm:
1415 (ObjcClass::methodsNamed):
1416 (ObjcClass::fieldNamed):
1417 * bindings/objc/objc_instance.mm:
1418 (ObjcInstance::invokeMethod):
1419 * bindings/objc/objc_jsobject.h:
1420 * bindings/objc/objc_jsobject.mm:
1421 * bindings/objc/objc_runtime.mm:
1422 (ObjcField::valueFromInstance):
1423 * bindings/objc/objc_utility.mm:
1424 (KJS::Bindings::JSMethodNameToObjCMethodName):
1425 (KJS::Bindings::convertValueToObjcValue):
1426 (KJS::Bindings::convertObjcValueToValue):
1427 * bindings/runtime.cpp:
1428 (Instance::setDidExecuteFunction):
1429 (Instance::didExecuteFunction):
1430 (Instance::setValueOfField):
1431 * bindings/runtime.h:
1432 * bindings/testbindings.mm:
1433 (+[MyFirstInterface webScriptNameForSelector:]):
1434 (-[MyFirstInterface callJSObject::]):
1436 2004-05-14 Vicki Murley <vicki@apple.com>
1440 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
1442 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
1446 2004-05-13 Richard Williamson <rjw@apple.com>
1453 * bindings/objc/WebScriptObject.h:
1455 2004-05-13 Richard Williamson <rjw@apple.com>
1457 Approved API changes. Currently unimplemented.
1462 * JavaScriptCore.pbproj/project.pbxproj:
1463 * bindings/objc/WebScriptObject.h: Added.
1464 * bindings/objc/WebScriptObject.mm: Added.
1465 (+[WebScriptObject throwException:]):
1466 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1467 (-[WebScriptObject evaluateWebScript:]):
1468 (-[WebScriptObject stringRepresentation]):
1469 (+[WebUndefined undefined]):
1470 (-[WebUndefined initWithCoder:]):
1471 (-[WebUndefined encodeWithCoder:]):
1472 (-[WebUndefined copyWithZone:]):
1474 2004-05-07 Vicki Murley <vicki@apple.com>
1478 Turn off GC since it uses ppc only instructions (which breaks
1481 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
1485 2004-05-07 Maciej Stachowiak <mjs@apple.com>
1489 - add -funroll-loops=16 compiler option for approx .5% speedup on
1490 HTML iBench and .5-1% speedup on JS iBench.
1492 * JavaScriptCore.pbproj/project.pbxproj:
1494 2004-04-25 Maciej Stachowiak <mjs@apple.com>
1498 Enable full conservative GC mode in addition to test mode. When
1499 conservative GC is enabled, we now get an 11% speed improvement on
1500 the iBench. Also fix some spots I missed before.
1502 Specific noteworth changes:
1504 * kjs/collector.cpp:
1505 (KJS::Collector::markStackObjectsConservatively): Check possible
1506 cell pointers for 8-byte aligment and verify they are not 0.
1508 * kjs/protected_values.cpp:
1509 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
1510 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
1512 (KJS::gcProtectNullTolerant): ...to here...
1513 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
1514 tolerance, and doing the check is expensive.
1516 * kjs/protected_values.cpp:
1517 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
1518 that is still very good.
1523 (KJS::ProtectedValue::ProtectedValue):
1524 (KJS::ProtectedValue::~ProtectedValue):
1525 (KJS::ProtectedValue::operator=):
1526 (KJS::ProtectedObject::ProtectedObject):
1527 (KJS::ProtectedObject::~ProtectedObject):
1528 (KJS::ProtectedObject::operator=):
1529 (KJS::ProtectedReference::ProtectedReference):
1530 (KJS::ProtectedReference::~ProtectedReference):
1531 (KJS::ProtectedReference::operator=):
1532 * kjs/protected_values.cpp:
1533 (KJS::ProtectedValues::getProtectCount):
1534 (KJS::ProtectedValues::increaseProtectCount):
1535 (KJS::ProtectedValues::decreaseProtectCount):
1536 (KJS::ProtectedValues::computeHash):
1537 * bindings/runtime_root.cpp:
1538 (KJS::Bindings::addNativeReference):
1539 (KJS::Bindings::removeNativeReference):
1540 (RootObject::removeAllNativeReferences):
1541 * bindings/runtime_root.h:
1542 (KJS::Bindings::RootObject::~RootObject):
1543 (KJS::Bindings::RootObject::setRootObjectImp):
1544 * kjs/collector.cpp:
1545 (KJS::Collector::allocate):
1546 (KJS::Collector::collect):
1549 (NumberImp::create):
1550 (InterpreterImp::globalInit):
1551 (InterpreterImp::globalClear):
1552 (InterpreterImp::mark):
1554 (KJS::List::derefValues):
1555 (KJS::List::refValues):
1556 (KJS::List::append):
1558 (KJS::ObjectImp::setInternalValue):
1559 (KJS::ObjectImp::putDirect):
1564 (KJS::ValueImp::ValueImp):
1565 (KJS::ValueImp::~ValueImp):
1567 (KJS::Value::Value):
1568 (KJS::Value::~Value):
1569 (KJS::Value::operator=):
1571 2004-04-30 Richard Williamson <rjw@apple.com>
1573 Asking an NSInvocation for it's return value when return type
1574 is void throws an exception. Added check for void return types
1575 to avoid this exception.
1579 * bindings/objc/objc_instance.mm:
1580 (ObjcInstance::invokeMethod):
1582 2004-04-29 Richard Williamson <rjw@apple.com>
1584 Fixed several bad problems with the ObjC bindings. In particular, conversion
1585 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
1589 * bindings/objc/objc_jsobject.h:
1590 * bindings/objc/objc_jsobject.mm:
1591 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
1592 (-[JavaScriptObject KJS::]):
1593 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1594 (-[JavaScriptObject call:arguments:]):
1595 (-[JavaScriptObject evaluate:]):
1596 (-[JavaScriptObject getMember:]):
1597 (-[JavaScriptObject getSlot:]):
1598 * bindings/objc/objc_runtime.mm:
1599 (ObjcField::valueFromInstance):
1600 (ObjcField::setValueToInstance):
1601 * bindings/objc/objc_utility.mm:
1602 (KJS::Bindings::convertValueToObjcValue):
1603 (KJS::Bindings::convertObjcValueToValue):
1604 * bindings/runtime.h:
1605 * bindings/runtime_root.cpp:
1606 (KJS::Bindings::rootForInterpreter):
1607 (KJS::Bindings::addNativeReference):
1608 (KJS::Bindings::removeNativeReference):
1609 * bindings/runtime_root.h:
1610 * bindings/testbindings.mm:
1611 (-[MyFirstInterface logMessage:]):
1612 (-[MyFirstInterface setJSObject:]):
1613 (-[MyFirstInterface callJSObject::]):
1615 2004-04-24 Darin Adler <darin@apple.com>
1619 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
1622 2004-04-23 Maciej Stachowiak <mjs@apple.com>
1626 Implementation of conservative GC, based partly on code from
1627 Darin. It's turned off for now, so it shouldn't have any effect on
1630 * JavaScriptCore.pbproj/project.pbxproj:
1631 * kjs/collector.cpp:
1632 (KJS::Collector::markStackObjectsConservatively):
1633 (KJS::Collector::markProtectedObjects):
1634 (KJS::Collector::collect):
1639 * kjs/protected_values.cpp: Added.
1640 (KJS::ProtectedValues::getProtectCount):
1641 (KJS::ProtectedValues::increaseProtectCount):
1642 (KJS::ProtectedValues::insert):
1643 (KJS::ProtectedValues::decreaseProtectCount):
1644 (KJS::ProtectedValues::expand):
1645 (KJS::ProtectedValues::shrink):
1646 (KJS::ProtectedValues::rehash):
1647 (KJS::ProtectedValues::computeHash):
1648 * kjs/protected_values.h: Added.
1650 (ValueImp::useConservativeMark):
1658 2004-04-22 Richard Williamson <rjw@apple.com>
1660 Fixed build snafu (re-declaration of NPBool in npruntime.h and
1663 * bindings/npruntime.h:
1665 2004-04-22 Richard Williamson <rjw@apple.com>
1667 Updated plugin binding API to reflect latest revision from
1670 Biggest change is the introduction of NPVariant used to represent
1671 value types. NPVariant replaces the use of NPObject for the
1672 exchange of values between scripting environment and native code.
1676 * JavaScriptCore.pbproj/project.pbxproj:
1677 * bindings/NP_jsobject.cpp:
1678 (identiferFromNPIdentifier):
1684 (NPN_GetPropertyAtIndex):
1685 (NPN_SetPropertyAtIndex):
1686 * bindings/c/c_class.cpp:
1687 (CClass::methodsNamed):
1688 (CClass::fieldNamed):
1689 * bindings/c/c_instance.cpp:
1690 (CInstance::invokeMethod):
1691 (CInstance::defaultValue):
1692 * bindings/c/c_runtime.cpp:
1693 (CField::valueFromInstance):
1694 (CField::setValueToInstance):
1695 * bindings/c/c_utility.cpp:
1696 (convertNPStringToUTF16):
1697 (convertUTF8ToUTF16):
1698 (coerceValueToNPVariantStringType):
1699 (convertValueToNPVariant):
1700 (convertNPVariantToValue):
1701 * bindings/c/c_utility.h:
1702 * bindings/npruntime.cpp:
1703 (NPN_GetIdentifier):
1704 (NPN_GetIdentifiers):
1705 (NPN_UTF8FromIdentifier):
1706 (NPN_VariantIsVoid):
1707 (NPN_VariantIsNull):
1708 (NPN_VariantIsUndefined):
1709 (NPN_VariantIsBool):
1710 (NPN_VariantIsInt32):
1711 (NPN_VariantIsDouble):
1712 (NPN_VariantIsString):
1713 (NPN_VariantIsObject):
1714 (NPN_VariantToBool):
1715 (NPN_VariantToString):
1716 (NPN_VariantToInt32):
1717 (NPN_VariantToDouble):
1718 (NPN_VariantToObject):
1719 (NPN_InitializeVariantAsVoid):
1720 (NPN_InitializeVariantAsNull):
1721 (NPN_InitializeVariantAsUndefined):
1722 (NPN_InitializeVariantWithBool):
1723 (NPN_InitializeVariantWithInt32):
1724 (NPN_InitializeVariantWithDouble):
1725 (NPN_InitializeVariantWithString):
1726 (NPN_InitializeVariantWithStringCopy):
1727 (NPN_InitializeVariantWithObject):
1728 (NPN_InitializeVariantWithVariant):
1729 (NPN_ReleaseVariantValue):
1732 (NPN_ReleaseObject):
1733 (NPN_IsKindOfClass):
1734 (NPN_SetExceptionWithUTF8):
1736 * bindings/npruntime.h:
1738 (_NPString::_NPVariant::):
1739 * bindings/testbindings.cpp:
1754 2004-04-22 Darin Adler <darin@apple.com>
1758 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
1761 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
1762 Was resulting in a buffer 2x the needed size.
1763 (KJS::UString::expandPreCapacity): Ditto.
1764 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
1766 2004-04-21 Maciej Stachowiak <mjs@apple.com>
1770 Preliminary change for conservative GC. Create "protected"
1771 subclasses to GC-protect objects when on heap, since we will soon
1772 remove the built-in refcounting of the normal wrapper classes. Use
1775 * JavaScriptCore.pbproj/project.pbxproj:
1778 (KJS::InterpreterImp::globalObject):
1779 * kjs/interpreter.h:
1780 * kjs/property_map.cpp:
1782 * kjs/reference_list.cpp:
1784 2004-04-19 Maciej Stachowiak <mjs@apple.com>
1788 Optimize prepend using the shared substring optimization. Also,
1789 limit the applicability of shared append and shared prepend. If
1790 you overdo it, it does more harm than good, because you create a
1791 bunch of strings that are disqualified from future shared
1792 append/prepend, for not much immediate savings in allocate/copy
1797 (KJS::UString::Rep::create):
1798 (KJS::UString::expandedSize):
1799 (KJS::UString::usedPreCapacity):
1800 (KJS::UString::expandCapacity):
1801 (KJS::UString::expandPreCapacity):
1802 (KJS::UString::UString):
1803 (KJS::UString::append):
1804 (KJS::UString::operator=):
1806 (KJS::UString::Rep::data):
1808 2004-04-16 Maciej Stachowiak <mjs@apple.com>
1809 Reviewed by Richard.
1811 No more need for Completion or Reference to privately inherit from
1812 Value, none of the superclass functionality is used.
1819 2004-04-16 Richard Williamson <rjw@apple.com>
1821 Added interpreter lock protection around object creation.
1825 * bindings/runtime.cpp:
1826 (Instance::createRuntimeObject):
1828 2004-04-16 Maciej Stachowiak <mjs@apple.com>
1832 Another JavaScript speed improvement: use the mechanism from
1833 string append optimization to make taking a substring fast, again
1836 A further 22% improvement on the 24fun string speed test.
1840 (KJS::UString::Rep::create):
1841 (KJS::UString::UString):
1842 (KJS::UString::append):
1843 (KJS::UString::operator=):
1844 (KJS::UString::substr):
1846 (KJS::UString::Rep::data):
1848 2004-04-13 Maciej Stachowiak <mjs@apple.com>
1852 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
1853 - fixed <rdar://problem/3600691>: Table generation test is really slow
1854 - fixed <rdar://problem/3600661>: 24fun date test is really slow
1856 80% speedup on the string test, lesser speedups on the other two.
1858 Two different optimizations here:
1860 1) Avoid large overhead of scanning strings to see if they are all
1861 ASCII before numeric conversion.
1864 (AssignNode::evaluate): Don't convert to integer until we know for
1865 sure the operation will need it. Attempting to convert strings to
1866 numbers is a waste when they are being appended with +=.
1868 2) Avoid huge cost of appending strings.
1870 This is done by allowing multiple strings to share a buffer but
1871 actually use different ranges of it. The first time a string is
1872 appended to, we start leaving at least 10% extra space in the
1873 buffer, so doing N appends to the same string takes O(log N)
1874 mallocs instead of O(N).
1876 * kjs/identifier.cpp:
1877 (KJS::Identifier::equal):
1878 (KJS::Identifier::add):
1881 (KJS::UCharReference::operator=):
1882 (KJS::UCharReference::ref):
1883 (KJS::UString::Rep::create):
1884 (KJS::UString::Rep::destroy):
1885 (KJS::UString::expandedSize):
1886 (KJS::UString::usedCapacity):
1887 (KJS::UString::expandCapacity):
1888 (KJS::UString::UString):
1889 (KJS::UString::null):
1890 (KJS::UString::append):
1891 (KJS::UString::operator=):
1892 (KJS::UString::toStrictUInt32):
1893 (KJS::UString::detach):
1894 (KJS::KJS::operator==):
1896 (KJS::UString::Rep::data):
1897 (KJS::UString::Rep::hash):
1899 2004-04-09 Maciej Stachowiak <mjs@apple.com>
1903 - fix deployment build by avoiding deployment-only warning.
1905 * kjs/scope_chain.cpp:
1906 (KJS::ScopeChain::bottom):
1908 2004-04-09 Maciej Stachowiak <mjs@apple.com>
1912 Changed things so that newly created objects get a prototype based
1913 on the scope chain of the current function, rather than the
1914 interpreter that started execution. This fixes the following bugs:
1916 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
1917 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
1919 * JavaScriptCore.pbproj/project.pbxproj:
1920 * kjs/array_object.cpp:
1921 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1922 (ArrayProtoFuncImp::ArrayProtoFuncImp):
1923 (ArrayProtoFuncImp::call):
1924 (ArrayObjectImp::construct):
1925 * kjs/bool_object.cpp:
1926 (BooleanObjectImp::construct):
1927 * kjs/date_object.cpp:
1928 (DateProtoFuncImp::DateProtoFuncImp):
1929 (DateProtoFuncImp::call):
1930 (DateObjectImp::construct):
1931 * kjs/error_object.cpp:
1932 (ErrorObjectImp::construct):
1934 (FunctionImp::FunctionImp):
1935 (FunctionImp::call):
1936 (DeclaredFunctionImp::construct):
1937 (ArgumentsImp::ArgumentsImp):
1938 (GlobalFuncImp::call):
1939 * kjs/function_object.cpp:
1940 (FunctionProtoFuncImp::call):
1941 (FunctionObjectImp::construct):
1943 (BooleanImp::toObject):
1944 (StringImp::toObject):
1945 (NumberImp::toObject):
1946 (InterpreterImp::InterpreterImp):
1947 (InterpreterImp::clear):
1948 (InterpreterImp::interpreterWithGlobalObject):
1950 * kjs/interpreter.cpp:
1951 (ExecState::lexicalInterpreter):
1952 * kjs/interpreter.h:
1953 (KJS::ExecState::dynamicInterpreter):
1954 (KJS::ExecState::interpreter):
1955 * kjs/math_object.cpp:
1956 (MathFuncImp::MathFuncImp):
1958 (StatementNode::hitStatement):
1959 (StatementNode::abortStatement):
1960 (RegExpNode::evaluate):
1961 (ElementNode::evaluate):
1962 (ArrayNode::evaluate):
1963 (ObjectLiteralNode::evaluate):
1964 (PropertyValueNode::evaluate):
1965 (FunctionCallNode::evaluate):
1966 (FuncDeclNode::processFuncDecl):
1967 (FuncExprNode::evaluate):
1968 * kjs/number_object.cpp:
1969 (NumberObjectImp::construct):
1971 (KJS::ObjectImp::defaultValue):
1972 (KJS::Error::create):
1973 * kjs/object_object.cpp:
1974 (ObjectObjectImp::construct):
1975 * kjs/reference.cpp:
1976 (Reference::putValue):
1977 * kjs/regexp_object.cpp:
1978 (RegExpProtoFuncImp::call):
1979 (RegExpObjectImp::arrayOfMatches):
1980 (RegExpObjectImp::construct):
1981 * kjs/scope_chain.cpp:
1982 (KJS::ScopeChain::bottom):
1983 * kjs/scope_chain.h:
1984 * kjs/string_object.cpp:
1985 (StringProtoFuncImp::StringProtoFuncImp):
1986 (StringProtoFuncImp::call):
1987 (StringObjectImp::construct):
1993 2004-03-31 Richard Williamson <rjw@apple.com>
1995 Tedious renames based on feedback from plugin-futures list.
1996 NP_ functions are renamed with NPN_ prefix.
1997 Types prefix renamed from NP_ to NP.
1998 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
2000 No review because this was just a renaming patch.
2002 * bindings/NP_jsobject.cpp:
2005 (identiferFromNPIdentifier):
2010 (NPN_RemoveProperty):
2012 (NPN_GetPropertyAtIndex):
2013 (NPN_SetPropertyAtIndex):
2014 * bindings/NP_jsobject.h:
2015 * bindings/c/c_class.cpp:
2016 (CClass::_commonInit):
2017 (CClass::classForIsA):
2019 (CClass::methodsNamed):
2020 (CClass::fieldNamed):
2021 * bindings/c/c_class.h:
2022 * bindings/c/c_instance.cpp:
2023 (CInstance::CInstance):
2024 (CInstance::~CInstance):
2025 (CInstance::operator=):
2026 (CInstance::invokeMethod):
2027 (CInstance::defaultValue):
2028 * bindings/c/c_instance.h:
2029 (KJS::Bindings::CInstance::getObject):
2030 * bindings/c/c_runtime.cpp:
2031 (CField::valueFromInstance):
2032 (CField::setValueToInstance):
2033 * bindings/c/c_runtime.h:
2034 (KJS::Bindings::CField::CField):
2035 (KJS::Bindings::CField::name):
2036 (KJS::Bindings::CMethod::CMethod):
2037 (KJS::Bindings::CMethod::name):
2038 * bindings/c/c_utility.cpp:
2039 (coerceValueToNPString):
2040 (convertValueToNPValueType):
2041 (convertNPValueTypeToValue):
2042 * bindings/c/c_utility.h:
2043 * bindings/npruntime.cpp:
2044 (NPN_IdentifierFromUTF8):
2045 (NPN_IsValidIdentifier):
2046 (NPN_GetIdentifiers):
2047 (NPN_UTF8FromIdentifier):
2050 (NPN_ReleaseObject):
2051 (NPN_IsKindOfClass):
2052 (NPN_SetExceptionWithUTF8):
2055 (NPN_CreateNumberWithInt):
2056 (NPN_CreateNumberWithFloat):
2057 (NPN_CreateNumberWithDouble):
2058 (NPN_IntFromNumber):
2059 (NPN_FloatFromNumber):
2060 (NPN_DoubleFromNumber):
2062 (NPN_CreateStringWithUTF8):
2063 (NPN_CreateStringWithUTF16):
2064 (NPN_DeallocateUTF8):
2065 (NPN_UTF8FromString):
2066 (NPN_UTF16FromString):
2069 (NPN_CreateBoolean):
2070 (NPN_BoolFromBoolean):
2073 (undefinedAllocate):
2079 (NPN_ObjectAtIndex):
2080 * bindings/npruntime.h:
2081 * bindings/runtime.cpp:
2082 (Instance::createBindingForLanguageInstance):
2083 * bindings/testbindings.cpp:
2084 (initializeIdentifiers):
2104 2004-03-31 Richard Williamson <rjw@apple.com>
2106 Changed references to NP_runtime.h to npruntime.h
2108 * JavaScriptCore.pbproj/project.pbxproj:
2109 * bindings/NP_jsobject.h:
2110 * bindings/c/c_class.h:
2111 * bindings/c/c_instance.h:
2112 * bindings/c/c_runtime.h:
2113 * bindings/c/c_utility.h:
2114 * bindings/npruntime.cpp:
2116 2004-03-31 Richard Williamson <rjw@apple.com>
2118 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2120 * JavaScriptCore.pbproj/project.pbxproj:
2121 * bindings/NP_jsobject.h:
2122 * bindings/npruntime.cpp:
2126 2004-03-23 Richard Williamson <rjw@apple.com>
2128 Added implementation of KJS::Value <-> NP_Object conversion functions.
2129 Augmented test program for 'C' bindings.
2130 Added asserts and parameter checking to all public API.
2134 * JavaScriptCore.pbproj/project.pbxproj:
2135 * bindings/NP_jsobject.cpp:
2137 * bindings/NP_jsobject.h: Added.
2138 * bindings/NP_runtime.cpp:
2139 (NP_IdentifierFromUTF8):
2140 (NP_IsValidIdentifier):
2141 (NP_GetIdentifiers):
2146 (NP_SetExceptionWithUTF8):
2149 (NP_FloatFromNumber):
2150 (NP_DoubleFromNumber):
2151 (NP_CreateStringWithUTF8):
2152 (NP_CreateStringWithUTF16):
2153 (NP_DeallocateUTF8):
2154 (NP_UTF8FromString):
2155 (NP_UTF16FromString):
2157 (NP_BoolFromBoolean):
2158 * bindings/NP_runtime.h:
2159 * bindings/c/c_instance.cpp:
2160 (CInstance::invokeMethod):
2161 * bindings/c/c_utility.cpp:
2162 (coerceValueToNPString):
2163 (convertValueToNPValueType):
2164 (convertNPValueTypeToValue):
2165 * bindings/c/c_utility.h:
2167 * bindings/testC.js: Added.
2168 * bindings/testbindings.cpp:
2178 (myInterfaceInvoke):
2179 (myInterfaceAllocate):
2183 2004-03-19 Darin Adler <darin@apple.com>
2187 - fixed problem with methods like setUTCHour
2189 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2190 GMT vs. local time function based on the utc flag.
2192 2004-03-17 Richard Williamson <rjw@apple.com>
2194 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
2198 * bindings/NP_jsobject.cpp:
2203 (NP_GetPropertyAtIndex):
2204 * bindings/NP_runtime.h:
2206 2004-03-16 Richard Williamson <rjw@apple.com>
2208 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.
2212 * bindings/jni/jni_class.cpp:
2213 (JavaClass::methodsNamed):
2215 2004-03-15 Richard Williamson <rjw@apple.com>
2217 Fixed 3570854. Don't attempt to convert Null to strings. We
2218 were incorrectly converting to "Null".
2220 Actually fixed by Scott Kovatch.
2222 Reviewed by Richard.
2224 * bindings/jni/jni_utility.cpp:
2225 (KJS::Bindings::convertValueToJValue):
2229 2004-03-11 Richard Williamson <rjw@apple.com>
2231 Stitched together the NP stuff to our language independent
2232 JavaScript binding stuff. Very close to being done.
2234 Added program to test C bindings (and NP stuff). Just tests
2235 properties. Will add methods and JavaScript access, etc.
2237 Updated Makefile.am to account for new bindings/c directory.
2239 Change NP_UTF8 from "const char *" to "char" to allow for
2240 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
2243 Added NP_IsValidIdentifier().
2247 * JavaScriptCore.pbproj/project.pbxproj:
2249 * bindings/NP_jsobject.cpp:
2250 (identiferFromNPIdentifier):
2252 * bindings/NP_runtime.cpp:
2253 (NP_IdentifierFromUTF8):
2254 (NP_IsValidIdentifier):
2255 (NP_GetIdentifiers):
2256 (NP_UTF8FromIdentifier):
2257 (NP_SetExceptionWithUTF8):
2259 (NP_CreateStringWithUTF8):
2260 (NP_CreateStringWithUTF16):
2261 (NP_UTF8FromString):
2262 (NP_UTF16FromString):
2263 * bindings/NP_runtime.h:
2264 * bindings/c/c_class.cpp: Added.
2265 (CClass::_commonDelete):
2266 (CClass::_commonCopy):
2267 (CClass::_commonInit):
2268 (_createClassesByIsAIfNecessary):
2269 (CClass::classForIsA):
2272 (CClass::methodsNamed):
2273 (CClass::fieldNamed):
2274 * bindings/c/c_class.h: Added.
2275 (KJS::Bindings::CClass::~CClass):
2276 (KJS::Bindings::CClass::CClass):
2277 (KJS::Bindings::CClass::operator=):
2278 (KJS::Bindings::CClass::constructorAt):
2279 (KJS::Bindings::CClass::numConstructors):
2280 * bindings/c/c_instance.cpp: Added.
2281 (CInstance::CInstance):
2282 (CInstance::~CInstance):
2283 (CInstance::operator=):
2284 (CInstance::getClass):
2287 (CInstance::invokeMethod):
2288 (CInstance::defaultValue):
2289 (CInstance::stringValue):
2290 (CInstance::numberValue):
2291 (CInstance::booleanValue):
2292 (CInstance::valueOf):
2293 * bindings/c/c_instance.h: Added.
2294 (KJS::Bindings::CInstance::getObject):
2295 * bindings/c/c_runtime.cpp: Added.
2296 (CField::valueFromInstance):
2297 (CField::setValueToInstance):
2298 * bindings/c/c_runtime.h: Added.
2299 (KJS::Bindings::CField::CField):
2300 (KJS::Bindings::CField::name):
2301 (KJS::Bindings::CField::type):
2302 (KJS::Bindings::CMethod::CMethod):
2303 (KJS::Bindings::CMethod::name):
2304 (KJS::Bindings::CMethod::numParameters):
2305 * bindings/c/c_utility.cpp: Added.
2306 (coerceValueToNPValueType):
2307 (convertValueToNPValueType):
2308 (convertNPValueTypeToValue):
2309 * bindings/c/c_utility.h: Added.
2310 * bindings/make_testbindings:
2311 * bindings/runtime.cpp:
2312 (Instance::createBindingForLanguageInstance):
2313 * bindings/runtime.h:
2314 (KJS::Bindings::Instance::):
2315 * bindings/testbindings.cpp: Added.
2316 (initializeIdentifiers):
2317 (myInterfaceHasProperty):
2318 (myInterfaceHasMethod):
2319 (myInterfaceGetProperty):
2320 (myInterfaceSetProperty):
2321 (myInterfaceInvoke):
2322 (myInterfaceAllocate):
2323 (myInterfaceInvalidate):
2324 (myInterfaceDeallocate):
2325 (GlobalImp::className):
2326 (readJavaScriptFromFile):
2329 2004-03-10 Richard Williamson <rjw@apple.com>
2331 Made changes to support new asychronous approach to calls from
2332 plugin to JavaScript
2336 * bindings/NP_jsobject.cpp:
2341 (NP_GetPropertyAtIndex):
2342 * bindings/NP_runtime.h:
2343 * bindings/make_testbindings:
2344 * bindings/runtime.cpp:
2345 (Instance::createBindingForLanguageInstance):
2347 2004-03-10 Richard Williamson <rjw@apple.com>
2349 Updated header to include proposed changes from
2350 plugin-futures list. Calls from plugin to JavaScript
2351 are now asynchronous.
2355 * bindings/NP_runtime.h:
2359 2004-03-04 Richard Williamson <rjw@apple.com>
2361 Implementation of NP_JavaScriptObject. This is the 'C' class
2362 that wraps a JavaScript object.
2366 * JavaScriptCore.pbproj/project.pbxproj:
2367 * bindings/NP_jsobject.cpp: Added.
2368 (coerceValueToNPValueType):
2369 (convertValueToNPValueType):
2370 (convertNPValueTypeToValue):
2374 (identiferFromNPIdentifier):
2379 (NP_RemoveProperty):
2381 (NP_GetPropertyAtIndex):
2382 (NP_SetPropertyAtIndex):
2383 * bindings/NP_runtime.cpp:
2385 * bindings/NP_runtime.h:
2386 * bindings/runtime_object.h:
2388 2004-03-04 Richard Williamson <rjw@apple.com>
2390 Added NP_Array implementation.
2392 Changed NP_Boolean to just depend on two static instances, no
2393 space is required for values.
2397 * bindings/NP_runtime.cpp:
2399 (NP_BoolFromBoolean):
2405 * bindings/NP_runtime.h:
2407 2004-03-03 Darin Adler <darin@apple.com>
2411 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
2412 copyright string, and that's all that was in here.
2413 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
2415 2004-03-03 Richard Williamson <rjw@apple.com>
2417 More 'C' binding implementation. Fleshed out all the
2418 'primitive' data types.
2422 * bindings/NP_runtime.cpp:
2427 (NP_CreateStringWithUTF8):
2428 (NP_CreateStringWithUTF16):
2429 (NP_UTF8FromString):
2430 (NP_UTF16FromString):
2433 (booleanDeallocate):
2435 (NP_BoolFromBoolean):
2439 (undefinedAllocate):
2440 (undefinedDeallocate):
2442 * bindings/NP_runtime.h:
2444 2004-03-03 Richard Williamson <rjw@apple.com>
2446 More 'C' binding implementation.
2450 * bindings/NP_runtime.cpp:
2453 (getIdentifierDictionary):
2454 (NP_IdentifierFromUTF8):
2455 (NP_UTF8FromIdentifier):
2460 (NP_CreateNumberWithInt):
2461 (NP_CreateNumberWithFloat):
2462 (NP_CreateNumberWithDouble):
2464 (NP_FloatFromNumber):
2465 (NP_DoubleFromNumber):
2466 * bindings/NP_runtime.h:
2468 2004-03-02 Richard Williamson <rjw@apple.com>
2470 Removed retain/release from NP_Class. Classes will not be allowed to implement their
2471 own customer retain/release scheme.
2475 * bindings/NP_runtime.cpp:
2478 * bindings/NP_runtime.h:
2480 2004-03-02 Richard Williamson <rjw@apple.com>
2482 C binding API. Partial implementation.
2484 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.
2486 Factored root object reference counting scheme. It is now useful independent
2491 * JavaScriptCore.pbproj/project.pbxproj:
2492 * bindings/NP_runtime.cpp: Added.
2493 (NP_IdentifierFromUTF8):
2494 (NP_GetIdentifiers):
2495 (NP_UTF8FromIdentifier):
2505 (NP_RemoveProperty):
2507 (NP_GetPropertyAtIndex):
2508 (NP_SetPropertyAtIndex):
2509 (NP_CreateNumberWithInt):
2510 (NP_CreateNumberWithFloat):
2511 (NP_CreateNumberWithDouble):
2513 (NP_FloatFromNumber):
2514 (NP_DoubleFromNumber):
2515 (NP_CreateStringWithUTF8):
2516 (NP_CreateStringWithUTF16):
2517 (NP_UTF8FromString):
2518 (NP_UTF16FromString):
2520 (NP_BoolFromBoolean):
2526 * bindings/NP_runtime.h: Added.
2527 * bindings/jni/jni_jsobject.cpp:
2529 (JSObject::finalize):
2530 (JSObject::createNative):
2531 (JSObject::convertValueToJObject):
2532 * bindings/jni/jni_jsobject.h:
2533 * bindings/objc/objc_jsobject.h:
2534 * bindings/objc/objc_jsobject.mm:
2536 (windowJavaScriptObject):
2537 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2538 (-[JavaScriptObject dealloc]):
2539 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
2540 (-[JavaScriptObject call:arguments:]):
2541 (-[JavaScriptObject evaluate:]):
2542 (-[JavaScriptObject getMember:]):
2543 (-[JavaScriptObject setMember:value:]):
2544 (-[JavaScriptObject removeMember:]):
2545 (-[JavaScriptObject toString]):
2546 (-[JavaScriptObject getSlot:]):
2547 (-[JavaScriptObject setSlot:value:]):
2548 * bindings/objc/objc_utility.h:
2549 * bindings/objc/objc_utility.mm:
2550 (KJS::Bindings::convertValueToObjcValue):
2551 * bindings/runtime_root.cpp: Added.
2552 (getReferencesByRootDictionary):
2553 (getReferencesDictionary):
2554 (KJS::Bindings::findReferenceDictionary):
2555 (KJS::Bindings::rootForImp):
2556 (KJS::Bindings::addNativeReference):
2557 (KJS::Bindings::removeNativeReference):
2558 (completedJavaScriptAccess):
2559 (initializeJavaScriptAccessLock):
2560 (lockJavaScriptAccess):
2561 (unlockJavaScriptAccess):
2562 (RootObject::dispatchToJavaScriptThread):
2563 (performJavaScriptAccess):
2564 (RootObject::setFindRootObjectForNativeHandleFunction):
2565 (RootObject::removeAllNativeReferences):
2566 * bindings/runtime_root.h: Added.
2567 (KJS::Bindings::RootObject::RootObject):
2568 (KJS::Bindings::RootObject::~RootObject):
2569 (KJS::Bindings::RootObject::setRootObjectImp):
2570 (KJS::Bindings::RootObject::rootObjectImp):
2571 (KJS::Bindings::RootObject::setInterpreter):
2572 (KJS::Bindings::RootObject::interpreter):
2573 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
2574 (KJS::Bindings::RootObject::runLoop):
2575 (KJS::Bindings::RootObject::performJavaScriptSource):
2581 2004-02-18 Richard Williamson <rjw@apple.com>
2583 Added NSNumber/Number conversion.
2585 Removed some unnecessary KJS:: namespace specifiers.
2589 * bindings/objc/objc_utility.mm:
2590 (KJS::Bindings::convertValueToObjcValue):
2591 (KJS::Bindings::convertObjcValueToValue):
2592 * bindings/runtime_array.h:
2594 2004-02-18 Richard Williamson <rjw@apple.com>
2596 Added support for export NSArrays.
2598 Updated valueAt() to take an ExecState so we can throw
2601 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
2602 ObjectiveC classes to control the visibility of their methods in
2607 * bindings/jni/jni_runtime.cpp:
2608 (JavaField::valueFromInstance):
2609 (JavaArray::valueAt):
2610 * bindings/jni/jni_runtime.h:
2611 * bindings/objc/objc_class.mm:
2612 (ObjcClass::methodsNamed):
2613 * bindings/objc/objc_runtime.h:
2614 (KJS::Bindings::ObjcArray::getObjcArray):
2615 * bindings/objc/objc_runtime.mm:
2616 (ObjcField::valueFromInstance):
2617 (ObjcField::setValueToInstance):
2618 (ObjcArray::ObjcArray):
2619 (ObjcArray::~ObjcArray):
2620 (ObjcArray::operator=):
2621 (ObjcArray::setValueAt):
2622 (ObjcArray::valueAt):
2623 (ObjcArray::getLength):
2624 * bindings/objc/objc_utility.mm:
2625 (KJS::Bindings::convertValueToObjcValue):
2626 (KJS::Bindings::convertObjcValueToValue):
2627 * bindings/runtime.cpp:
2628 (Instance::getValueOfField):
2629 * bindings/runtime.h:
2630 * bindings/runtime_array.cpp:
2631 (RuntimeArrayImp::get):
2632 * bindings/runtime_object.cpp:
2633 (RuntimeObjectImp::get):
2635 2004-02-17 Richard Williamson <rjw@apple.com>
2637 Added String <-> NSString conversion.
2638 Added tests of String <-> NSString conversion to test program.
2642 * bindings/objc/objc_utility.mm:
2643 (KJS::Bindings::convertValueToObjcValue):
2644 (KJS::Bindings::convertObjcValueToValue):
2646 * bindings/testbindings.mm:
2647 (-[MyFirstInterface getString]):
2649 2004-02-15 Darin Adler <darin@apple.com>
2653 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
2654 and removing redundant settings of things that match defaults in other build styles.
2656 2004-02-13 Richard Williamson <rjw@apple.com>
2658 Work towards the JavaScript ObjC bindings. The bindings now work for
2659 simple scalar types. testbindings.mm is an illustration of how the
2664 * JavaScriptCore.pbproj/project.pbxproj:
2666 * bindings/jni/jni_class.cpp:
2667 (JavaClass::methodsNamed):
2668 * bindings/jni/jni_class.h:
2669 * bindings/jni/jni_instance.cpp:
2670 (JavaInstance::invokeMethod):
2671 * bindings/jni/jni_instance.h:
2672 * bindings/jni/jni_runtime.h:
2673 (KJS::Bindings::JavaMethod::returnType):
2674 * bindings/make_testbindings: Added.
2675 * bindings/objc/objc_class.h: Added.
2676 (KJS::Bindings::ObjcClass::~ObjcClass):
2677 (KJS::Bindings::ObjcClass::ObjcClass):
2678 (KJS::Bindings::ObjcClass::operator=):
2679 (KJS::Bindings::ObjcClass::constructorAt):
2680 (KJS::Bindings::ObjcClass::numConstructors):
2681 * bindings/objc/objc_class.mm: Added.
2682 (ObjcClass::_commonDelete):
2683 (ObjcClass::_commonCopy):
2684 (ObjcClass::_commonInit):
2685 (_createClassesByIsAIfNecessary):
2686 (ObjcClass::classForIsA):
2687 (ObjcClass::ObjcClass):
2689 (ObjcClass::methodsNamed):
2690 (ObjcClass::fieldNamed):
2691 * bindings/objc/objc_header.h: Added.
2692 * bindings/objc/objc_instance.h: Added.
2693 (KJS::Bindings::ObjcInstance::getObject):
2694 * bindings/objc/objc_instance.mm: Added.
2695 (ObjcInstance::ObjcInstance):
2696 (ObjcInstance::~ObjcInstance):
2697 (ObjcInstance::operator=):
2698 (ObjcInstance::begin):
2699 (ObjcInstance::end):
2700 (ObjcInstance::getClass):
2701 (ObjcInstance::invokeMethod):
2702 (ObjcInstance::defaultValue):
2703 (ObjcInstance::stringValue):
2704 (ObjcInstance::numberValue):
2705 (ObjcInstance::booleanValue):
2706 (ObjcInstance::valueOf):
2707 * bindings/objc/objc_jsobject.h: Added.
2708 * bindings/objc/objc_jsobject.mm: Added.
2709 * bindings/objc/objc_runtime.h:
2710 (KJS::Bindings::ObjcField::~ObjcField):
2711 (KJS::Bindings::ObjcField::ObjcField):
2712 (KJS::Bindings::ObjcField::operator=):
2713 (KJS::Bindings::ObjcMethod::ObjcMethod):
2714 (KJS::Bindings::ObjcMethod::~ObjcMethod):
2715 (KJS::Bindings::ObjcMethod::operator=):
2716 * bindings/objc/objc_runtime.mm: Added.
2717 (ObjcMethod::ObjcMethod):
2719 (ObjcMethod::numParameters):
2720 (ObjcMethod::getMethodSignature):
2721 (ObjcField::ObjcField):
2724 (ObjcField::valueFromInstance):
2725 (ObjcField::setValueToInstance):
2726 * bindings/objc/objc_utility.h: Added.
2728 * bindings/objc/objc_utility.mm: Added.
2729 (KJS::Bindings::JSMethodNameToObjCMethodName):
2730 (KJS::Bindings::convertValueToObjcValue):
2731 (KJS::Bindings::convertObjcValueToValue):
2732 (KJS::Bindings::objcValueTypeForType):
2733 * bindings/runtime.cpp:
2734 (MethodList::MethodList):
2735 (MethodList::operator=):
2736 (Instance::setValueOfField):
2737 (Instance::createBindingForLanguageInstance):
2738 (Instance::createRuntimeObject):
2739 * bindings/runtime.h:
2740 * bindings/runtime_method.cpp:
2741 (RuntimeMethodImp::RuntimeMethodImp):
2742 (RuntimeMethodImp::get):
2743 (RuntimeMethodImp::call):
2744 * bindings/runtime_method.h:
2745 * bindings/runtime_object.cpp:
2746 (RuntimeObjectImp::get):
2747 (RuntimeObjectImp::hasProperty):
2748 * bindings/test.js: Added.
2749 * bindings/testbindings.mm: Added.
2750 (-[MySecondInterface init]):
2751 (-[MyFirstInterface init]):
2752 (-[MyFirstInterface dealloc]):
2753 (+[MyFirstInterface JavaScriptNameForSelector:]):
2754 (-[MyFirstInterface getInt]):
2755 (-[MyFirstInterface setInt:]):
2756 (-[MyFirstInterface getMySecondInterface]):
2757 (-[MyFirstInterface logMessage:]):
2758 (GlobalImp::className):
2759 (readJavaScriptFromFile):
2764 2004-02-08 Darin Adler <darin@apple.com>
2768 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
2770 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
2771 macros from working right in C++ code that uses the <cctype> header.
2774 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
2775 (KJS::UTF8SequenceLengthNonASCII): Added.
2776 (KJS::inlineUTF8SequenceLength): Added.
2777 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
2778 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2779 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
2780 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2781 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2783 - fixed the test program so it won't hit the interpreter lock assertion
2785 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
2789 2004-02-06 Richard Williamson <rjw@apple.com>
2791 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.
2795 * bindings/jni/jni_jsobject.cpp:
2796 (JSObject::toString):
2797 * bindings/jni/jni_utility.cpp:
2798 (KJS::Bindings::convertValueToJValue):
2800 2004-02-02 Darin Adler <darin@apple.com>
2804 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
2806 * kjs/array_object.cpp:
2807 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
2808 we start putting values in. This prevents new Array(2147483647) from causing trouble.
2809 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
2810 number is out of range. This prevents new Array(-1) from causing trouble.
2812 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
2814 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
2815 casting to int. Results now match those in other browsers.
2817 2004-02-02 Darin Adler <darin@apple.com>
2821 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
2822 - fixed other related overflow issues
2824 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
2826 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
2827 must not restrict values to the range of a particular integer type.
2828 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
2829 proper handling for negative results from fmod.
2830 (ValueImp::toUInt32): Ditto.
2831 (ValueImp::toUInt16): Ditto.
2832 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
2834 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
2835 out-of-integer-range values better in the slice function.
2836 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
2837 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
2838 out-of-integer-range values better in the toString function.
2839 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
2840 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
2841 and substr functions.
2845 2004-01-30 Richard Williamson <rjw@apple.com>
2847 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
2851 * bindings/jni/jni_instance.cpp:
2852 (JavaInstance::stringValue):
2854 2004-01-26 Darin Adler <darin@apple.com>
2856 * Makefile.am: Switch from pbxbuild to xcodebuild.
2858 2004-01-22 Richard Williamson <rjw@apple.com>
2860 Added stubs for ObjC language binding to JavaScript.
2862 * JavaScriptCore.pbproj/project.pbxproj:
2863 * bindings/jni/jni_runtime.h:
2864 * bindings/objc/objc_runtime.h: Added.
2865 (KJS::Bindings::ObjcParameter::ObjcParameter):
2866 (KJS::Bindings::ObjcParameter::~ObjcParameter):
2867 (KJS::Bindings::ObjcParameter::operator=):
2868 (KJS::Bindings::ObjcParameter::type):
2869 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
2870 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
2871 (KJS::Bindings::ObjcConstructor::_commonCopy):
2872 (KJS::Bindings::ObjcConstructor::operator=):
2873 (KJS::Bindings::ObjcConstructor::value):
2874 (KJS::Bindings::ObjcConstructor::parameterAt):
2875 (KJS::Bindings::ObjcConstructor::numParameters):
2876 (KJS::Bindings::ObjcField::ObjcField):
2877 (KJS::Bindings::ObjcField::~ObjcField):
2878 * bindings/runtime.h:
2880 2004-01-22 Richard Williamson <rjw@apple.com>
2882 Simplified JavaString by using UString as backing store. This
2883 revealed a bug in CString's assignment operator which I fixed.
2885 Removed some dead code.
2889 * bindings/jni/jni_runtime.h:
2890 (KJS::Bindings::JavaString::JavaString):
2891 (KJS::Bindings::JavaString::_commonInit):
2892 (KJS::Bindings::JavaString::UTF8String):
2893 (KJS::Bindings::JavaString::uchars):
2894 (KJS::Bindings::JavaString::length):
2895 (KJS::Bindings::JavaString::ustring):
2896 * bindings/runtime_object.cpp:
2897 (RuntimeObjectImp::RuntimeObjectImp):
2898 * bindings/runtime_object.h:
2900 (KJS::CString::CString):
2901 (KJS::CString::operator=):
2907 2004-01-16 Richard Williamson <rjw@apple.com>
2909 Fixed 3525853. We weren't handling mapping to overloaded Java
2910 methods very well. Even though this is undefined the other
2911 browsers support it. Also fixed a bug with returning arrays
2912 from Java functions.
2916 * bindings/jni/jni_class.cpp:
2917 (JavaClass::_commonInit):
2918 (JavaClass::methodsNamed):
2919 * bindings/jni/jni_class.h:
2920 * bindings/jni/jni_instance.cpp:
2921 (JavaInstance::invokeMethod):
2922 * bindings/jni/jni_instance.h:
2923 * bindings/jni/jni_runtime.cpp:
2924 (JavaArray::convertJObjectToArray):
2925 (JavaField::valueFromInstance):
2926 (JavaMethod::signature):
2927 (JavaArray::valueAt):
2928 * bindings/jni/jni_runtime.h:
2929 * bindings/jni_jsobject.cpp:
2931 (JSObject::convertJObjectToValue):
2932 * bindings/runtime.cpp:
2933 (MethodList::addMethod):
2934 (MethodList::length):
2935 (MethodList::methodAt):
2936 (MethodList::~MethodList):
2937 * bindings/runtime.h:
2938 (KJS::Bindings::MethodList::MethodList):
2939 * bindings/runtime_method.cpp:
2940 (RuntimeMethodImp::RuntimeMethodImp):
2941 (RuntimeMethodImp::get):
2942 (RuntimeMethodImp::call):
2943 * bindings/runtime_method.h:
2944 * bindings/runtime_object.cpp:
2945 (RuntimeObjectImp::get):
2946 (RuntimeObjectImp::hasProperty):
2948 2004-01-16 Richard Williamson <rjw@apple.com>
2950 Fixed 3531229. Another place that needs the Push/PopLocalFrame
2951 protection implemented for 3530401.
2955 * bindings/runtime_method.cpp:
2956 (RuntimeMethodImp::call):
2958 2004-01-15 Richard Williamson <rjw@apple.com>
2960 Fixed 3530401. JNI doesn't cleanup local refs created on the
2961 main thread. IMO this is a bad bug in our JMI implementation.
2963 To work-around the problem I explicitly delete all local refs.
2964 Further, I've added Push/PopLocalFrame calls to catch any refs
2965 that I may have missed. This will guarantee that we don't leak
2966 any Java references.
2970 * bindings/jni/jni_class.cpp:
2971 (JavaClass::_commonInit):
2972 (JavaClass::JavaClass):
2973 * bindings/jni/jni_instance.cpp:
2974 (JavaInstance::begin):
2975 (JavaInstance::end):
2976 * bindings/jni/jni_instance.h:
2977 * bindings/jni/jni_runtime.cpp:
2978 (JavaConstructor::JavaConstructor):
2979 (JavaMethod::JavaMethod):
2980 * bindings/jni_jsobject.cpp:
2981 (JSObject::listFromJArray):
2982 * bindings/runtime.h:
2983 (KJS::Bindings::Instance::begin):
2984 (KJS::Bindings::Instance::end):
2985 * bindings/runtime_object.cpp:
2986 (RuntimeObjectImp::get):
2987 (RuntimeObjectImp::put):
2988 (RuntimeObjectImp::canPut):
2989 (RuntimeObjectImp::hasProperty):
2990 (RuntimeObjectImp::defaultValue):
2992 2004-01-15 Vicki Murley <vicki@apple.com>
2996 * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
2998 2004-01-14 Richard Williamson <rjw@apple.com>
3000 Fixed 3529466. With recent changes to Java plugin we must no
3001 longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
3005 * bindings/jni/jni_instance.cpp:
3006 (JObjectWrapper::JObjectWrapper):
3010 2004-01-14 Richard Williamson <rjw@apple.com>
3014 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.
3018 * bindings/jni_jsobject.cpp:
3020 (removeJavaReference):
3021 (RootObject::removeAllJavaReferencesForRoot):
3024 2004-01-13 Richard Williamson <rjw@apple.com>
3028 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.
3032 * bindings/jni_jsobject.h:
3033 (KJS::Bindings::RootObject::~RootObject):
3039 2004-01-06 Richard Williamson <rjw@apple.com>
3041 Fixed 3521814. Finalize messages weren't being dispatched!
3045 * bindings/jni_jsobject.cpp:
3048 2004-01-05 Richard Williamson <rjw@apple.com>
3050 Added cache of JNI method IDs to minimize allocations. This mitigates the problem
3051 described by 3515579.
3053 Also cleanup up logging of Java exceptions.
3057 * bindings/jni/jni_class.cpp:
3058 (JavaClass::classForInstance):
3059 * bindings/jni/jni_instance.cpp:
3060 (JavaInstance::JavaInstance):
3061 (JavaInstance::getClass):
3062 (JavaInstance::invokeMethod):
3063 (JObjectWrapper::JObjectWrapper):
3064 (JObjectWrapper::~JObjectWrapper):
3065 * bindings/jni/jni_instance.h:
3066 (KJS::Bindings::JavaInstance::operator=):
3067 * bindings/jni/jni_runtime.cpp:
3068 (JavaMethod::JavaMethod):
3069 (JavaMethod::methodID):
3070 * bindings/jni/jni_runtime.h:
3071 (KJS::Bindings::JavaMethod::JavaMethod):
3072 * bindings/jni/jni_utility.cpp:
3076 (KJS::Bindings::getMethodID):
3077 (KJS::Bindings::callJNIVoidMethodIDA):
3078 (KJS::Bindings::callJNIObjectMethodIDA):
3079 (KJS::Bindings::callJNIByteMethodIDA):
3080 (KJS::Bindings::callJNICharMethodIDA):
3081 (KJS::Bindings::callJNIShortMethodIDA):
3082 (KJS::Bindings::callJNIIntMethodIDA):
3083 (KJS::Bindings::callJNILongMethodIDA):
3084 (KJS::Bindings::callJNIFloatMethodIDA):
3085 (KJS::Bindings::callJNIDoubleMethodIDA):
3086 (KJS::Bindings::callJNIBooleanMethodIDA):
3087 (KJS::Bindings::getCharactersFromJStringInEnv):
3088 (KJS::Bindings::getUCharactersFromJStringInEnv):
3089 (KJS::Bindings::getJNIField):
3090 * bindings/jni/jni_utility.h:
3092 l2003-12-23 John Sullivan <sullivan@apple.com>
3094 * JavaScriptCore.pbproj/project.pbxproj:
3095 Xcode version wars, harmless
3097 2003-12-23 Darin Adler <darin@apple.com>
3099 Reviewed by John (concept, not code, which is just the old code coming back).
3101 - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
3103 * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
3104 mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
3106 2003-12-19 Richard Williamson <rjw@apple.com>
3108 Fixed 3515597. When an error occurs we need
3109 to make sure result values are zeroed.
3111 Cleaned up logs by adding a newline.
3115 * bindings/jni/jni_utility.cpp:
3116 (KJS::Bindings::getJavaVM):
3117 (KJS::Bindings::getJNIEnv):
3120 (KJS::Bindings::getJNIField):
3121 * bindings/jni_jsobject.cpp:
3122 (JSObject::convertValueToJObject):
3126 2003-12-17 Richard Williamson <rjw@apple.com>
3128 Ensure that all the symbols we export are in the KJS
3129 namespace (3512245).
3131 Also renamed JavaString.characters() to JavaString.UTF8String()
3132 for enhanced clarity.
3134 Added some sanity checking to constructor of JObjectWrapper.
3139 * bindings/jni/jni_class.cpp:
3140 * bindings/jni/jni_class.h:
3141 * bindings/jni/jni_instance.cpp:
3142 (JavaInstance::invokeMethod):
3143 (JObjectWrapper::JObjectWrapper):
3144 * bindings/jni/jni_instance.h:
3145 * bindings/jni/jni_runtime.cpp:
3146 (JavaParameter::JavaParameter):
3147 (JavaField::JavaField):
3148 (JavaMethod::JavaMethod):
3149 (JavaMethod::signature):
3150 * bindings/jni/jni_runtime.h:
3151 (KJS::Bindings::JavaString::ascii):
3152 (KJS::Bindings::JavaString::UTF8String):
3153 (KJS::Bindings::JavaString::JavaString):
3154 (KJS::Bindings::JavaString::_commonInit):
3155 (KJS::Bindings::JavaString::uchars):
3156 (KJS::Bindings::JavaString::length):
3157 (KJS::Bindings::JavaString::ustring):
3158 (KJS::Bindings::JavaParameter::type):
3159 (KJS::Bindings::JavaField::name):
3160 (KJS::Bindings::JavaField::type):
3161 (KJS::Bindings::JavaMethod::name):
3162 (KJS::Bindings::JavaMethod::returnType):
3163 * bindings/jni/jni_utility.cpp:
3164 (KJS::Bindings::getJavaVM):
3165 (KJS::Bindings::getJNIEnv):
3166 (KJS::Bindings::callJNIVoidMethod):
3167 (KJS::Bindings::callJNIObjectMethod):
3168 (KJS::Bindings::callJNIBooleanMethod):
3169 (KJS::Bindings::callJNIByteMethod):
3170 (KJS::Bindings::callJNICharMethod):
3171 (KJS::Bindings::callJNIShortMethod):
3172 (KJS::Bindings::callJNIIntMethod):
3173 (KJS::Bindings::callJNILongMethod):
3174 (KJS::Bindings::callJNIFloatMethod):
3175 (KJS::Bindings::callJNIDoubleMethod):
3176 (KJS::Bindings::callJNIVoidMethodA):
3177 (KJS::Bindings::callJNIObjectMethodA):
3178 (KJS::Bindings::callJNIByteMethodA):
3179 (KJS::Bindings::callJNICharMethodA):
3180 (KJS::Bindings::callJNIShortMethodA):
3181 (KJS::Bindings::callJNIIntMethodA):
3182 (KJS::Bindings::callJNILongMethodA):
3183 (KJS::Bindings::callJNIFloatMethodA):
3184 (KJS::Bindings::callJNIDoubleMethodA):
3185 (KJS::Bindings::callJNIBooleanMethodA):
3186 (KJS::Bindings::getCharactersFromJString):
3187 (KJS::Bindings::releaseCharactersForJString):
3188 (KJS::Bindings::getCharactersFromJStringInEnv):
3189 (KJS::Bindings::releaseCharactersForJStringInEnv):
3190 (KJS::Bindings::getUCharactersFromJStringInEnv):
3191 (KJS::Bindings::releaseUCharactersForJStringInEnv):
3192 (KJS::Bindings::JNITypeFromClassName):
3193 (KJS::Bindings::signatureFromPrimitiveType):
3194 (KJS::Bindings::JNITypeFromPrimitiveType):
3195 (KJS::Bindings::getJNIField):
3196 (KJS::Bindings::convertValueToJValue):
3197 * bindings/jni/jni_utility.h:
3198 * bindings/jni_jsobject.cpp:
3199 (KJS::Bindings::JSObject::invoke):
3200 (KJS::Bindings::JSObject::JSObject):
3201 (KJS::Bindings::JSObject::call):
3202 (KJS::Bindings::JSObject::eval):
3203 (KJS::Bindings::JSObject::getMember):
3204 (KJS::Bindings::JSObject::setMember):
3205 (KJS::Bindings::JSObject::removeMember):
3206 (KJS::Bindings::JSObject::getSlot):
3207 (KJS::Bindings::JSObject::setSlot):
3208 (KJS::Bindings::JSObject::toString):
3209 (KJS::Bindings::JSObject::finalize):
3210 (KJS::Bindings::JSObject::createNative):
3211 (KJS::Bindings::JSObject::convertValueToJObject):
3212 (KJS::Bindings::JSObject::convertJObjectToValue):
3213 (KJS::Bindings::JSObject::listFromJArray):
3214 * bindings/jni_jsobject.h:
3215 * bindings/runtime.cpp:
3216 * bindings/runtime.h:
3217 * bindings/runtime_method.cpp:
3218 * bindings/runtime_method.h:
3222 2003-12-16 Richard Williamson <rjw@apple.com>
3224 Ack! More assertions. Lock ALL entry points into the interpreter!
3229 * bindings/jni_jsobject.cpp:
3230 (Bindings::JSObject::call):
3231 (Bindings::JSObject::eval):
3232 (Bindings::JSObject::getMember):
3233 (Bindings::JSObject::setMember):
3234 (Bindings::JSObject::removeMember):
3235 (Bindings::JSObject::getSlot):
3236 (Bindings::JSObject::setSlot):
3237 (Bindings::JSObject::convertJObjectToValue):
3239 2003-12-15 Richard Williamson <rjw@apple.com>
3241 Fixed a couple of snafus and removed some logging.
3245 * bindings/jni_jsobject.cpp:
3246 (Bindings::performJavaScriptAccess):
3247 (Bindings::completedJavaScriptAccess):
3248 (Bindings::dispatchToJavaScriptThread):
3249 Removed some annoying JS_LOG clutter.
3251 (Bindings::RootObject::removeAllJavaReferencesForRoot):
3252 Fixed allocation of key buffer that was called after it was needed.
3254 (Bindings::JSObject::invoke):
3255 (Bindings::JSObject::JSObject):
3256 (Bindings::JSObject::getMember):
3257 (Bindings::JSObject::getSlot):
3258 Added additional interpreter locks around getMember and getSlot.
3259 These functions may cause allocation of JS impls.
3261 2003-12-15 Richard Williamson <rjw@apple.com>
3263 args weren't passed to 'call' invocation. d'oh.
3264 lock interpreter when we create instances of JS impls.
3268 * bindings/jni_jsobject.cpp:
3269 (Bindings::JSObject::call):
3270 (Bindings::JSObject::eval):
3271 (Bindings::JSObject::getMember):
3272 (Bindings::JSObject::setMember):
3273 (Bindings::JSObject::getSlot):
3274 (Bindings::JSObject::convertValueToJObject):
3275 (Bindings::JSObject::convertJObjectToValue):
3276 (Bindings::JSObject::listFromJArray):
3277 * bindings/jni_jsobject.h:
3279 2003-12-15 Richard Williamson <rjw@apple.com>
3281 Last piece of LiveConnect! This checkin adds implementation
3282 of the Java to JavaScript object conversion functions.
3286 * bindings/jni/jni_instance.cpp:
3287 (JavaInstance::invokeMethod):
3288 * bindings/jni/jni_utility.cpp:
3289 * bindings/jni/jni_utility.h:
3290 * bindings/jni_jsobject.cpp:
3291 (Bindings::JSObject::invoke):
3292 (Bindings::JSObject::call):
3293 (Bindings::JSObject::eval):
3294 (Bindings::JSObject::getMember):
3295 (Bindings::JSObject::setMember):
3296 (Bindings::JSObject::getSlot):
3297 (Bindings::JSObject::setSlot):
3298 (Bindings::JSObject::createNative):
3299 (Bindings::JSObject::convertValueToJObject):
3300 (Bindings::JSObject::convertJObjectToValue):
3301 (Bindings::JSObject::listFromJArray):
3302 * bindings/jni_jsobject.h:
3304 * bindings/runtime_method.cpp:
3305 (RuntimeMethodImp::get):
3306 (RuntimeMethodImp::codeType):
3307 (RuntimeMethodImp::execute):
3309 2003-12-12 Richard Williamson <rjw@apple.com>
3311 Added implementation of stubs in JSObject. All that
3312 remains is a couple of simple conversion functions stubs and
3313 we're done with LiveConnect. Also, changed string passing to
3314 JS to use uchars instead of chars.
3318 * bindings/jni/jni_runtime.h:
3319 (Bindings::JavaString::JavaString):
3320 (Bindings::JavaString::_commonInit):
3321 (Bindings::JavaString::_commonCopy):
3322 (Bindings::JavaString::_commonDelete):
3323 (Bindings::JavaString::~JavaString):
3324 (Bindings::JavaString::operator=):
3325 (Bindings::JavaString::uchars):
3326 (Bindings::JavaString::length):
3327 (Bindings::JavaString::ustring):
3328 * bindings/jni/jni_utility.cpp:
3329 (getUCharactersFromJStringInEnv):
3330 (releaseUCharactersForJStringInEnv):
3331 (convertValueToJObject):
3332 (convertJObjectToValue):
3333 * bindings/jni/jni_utility.h:
3334 * bindings/jni_jsobject.cpp:
3335 (Bindings::JSObject::invoke):
3336 (Bindings::JSObject::call):
3337 (Bindings::JSObject::eval):
3338 (Bindings::JSObject::getMember):
3339 (Bindings::JSObject::setMember):
3340 (Bindings::JSObject::removeMember):
3341 (Bindings::JSObject::getSlot):
3342 (Bindings::JSObject::setSlot):
3343 * bindings/jni_jsobject.h:
3345 2003-12-12 Richard Williamson <rjw@apple.com>
3347 Ensure that all calls from Java into JavaScript are
3348 performed on a designated thread (the main thread).
3352 * bindings/jni_jsobject.cpp:
3353 (isJavaScriptThread):
3355 (Bindings::performJavaScriptAccess):
3356 (Bindings::completedJavaScriptAccess):
3357 (Bindings::initializeJavaScriptAccessLock):
3358 (Bindings::lockJavaScriptAccess):
3359 (Bindings::unlockJavaScriptAccess):
3360 (Bindings::dispatchToJavaScriptThread):
3361 (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
3362 (Bindings::RootObject::removeAllJavaReferencesForRoot):
3363 (Bindings::JSObject::invoke):
3364 (Bindings::JSObject::JSObject):
3365 (Bindings::JSObject::call):
3366 (Bindings::JSObject::eval):
3367 (Bindings::JSObject::getMember):
3368 (Bindings::JSObject::setMember):
3369 (Bindings::JSObject::removeMember):
3370 (Bindings::JSObject::getSlot):
3371 (Bindings::JSObject::setSlot):
3372 (Bindings::JSObject::toString):
3373 (Bindings::JSObject::finalize):
3374 (Bindings::JSObject::getWindow):
3375 * bindings/jni_jsobject.h:
3376 (Bindings::RootObject::~RootObject):
3377 (Bindings::RootObject::findRootObjectForNativeHandleFunction):
3378 (Bindings::RootObject::runLoop):
3379 (Bindings::RootObject::performJavaScriptSource):
3382 2003-12-11 Richard Williamson <rjw@apple.com>
3384 Added support for calling a JavaScript function from
3385 Java. Right now this only works for void func(void)
3386 functions, but the conversion of args and return values
3389 Cleaned up and verified reference counting scheme, and
3390 dereferencing of vended JavaScript objects when applet is
3391 destroyed (actually when part is destroyed).
3393 Removed link hack for testkjs now that the Java folks think
3394 they have a solution for the 1.4.2 JavaVM link problem. Although
3395 Greg B. thinks his solution may cause problems for the 1.3.1
3396 version of the VM!?!
3401 * bindings/jni/jni_runtime.h:
3402 (Bindings::JavaString::JavaString):
3403 * bindings/jni/jni_utility.cpp:
3404 (convertValueToJValue):
3405 (convertValueToJObject):
3407 * bindings/jni/jni_utility.h:
3408 * bindings/jni_jsobject.cpp:
3409 (KJS_setFindRootObjectForNativeHandleFunction):
3410 (KJS_findRootObjectForNativeHandleFunction):
3411 (getReferencesByRootDictionary):
3412 (getReferencesDictionary):
3413 (findReferenceDictionary):
3416 (removeJavaReference):
3417 * bindings/jni_jsobject.h:
3418 (Bindings::RootObject::RootObject):
3419 (Bindings::RootObject::~RootObject):
3420 (Bindings::RootObject::setRootObjectImp):
3421 (Bindings::RootObject::rootObjectImp):
3422 (Bindings::RootObject::setInterpreter):
3423 (Bindings::RootObject::interpreter):
3427 2003-12-10 Darin Adler <darin@apple.com>
3431 - fixed regression in JavaScript tests reported by the KDE guys
3432 - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
3434 * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
3436 (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
3437 tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
3438 and binary compatibility than default parameter values.
3439 (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
3441 * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
3442 "tolerate empty string" parameter.
3444 2003-12-10 Richard Williamson <rjw@apple.com>
3446 Added code to manage reference counting of JavaScript
3447 objects passed to Java. Also added implementation of
3448 KJS_JSCreateNativeJSObject. This is the function that
3449 provides the root object to Java (KJS::Window).
3453 * JavaScriptCore.pbproj/project.pbxproj:
3454 * bindings/jni_jsobject.cpp:
3455 (KJS_setFindObjectForNativeHandleFunction):
3456 (KJS_findObjectForNativeHandleFunction):
3457 (getReferencesByOwnerDictionary):
3458 (getReferencesDictionary):
3459 (findReferenceDictionary):
3461 (removeJavaReference):
3462 (removeAllJavaReferencesForOwner):
3463 * bindings/jni_jsobject.h:
3465 2003-12-09 Richard Williamson <rjw@apple.com>
3467 LiveConnect stubs that correspond to the native methods
3468 on JSObject. These will be called from the new Java plugin
3469 when an instance of JSObject is instantiated and messaged.
3470 When these are implemented the Java will be able to originate
3471 calls into JavaScript.
3473 Also a temporary work-around added to Makefile.am to solve
3474 a link problem. The 1.4.2 JavaVM accidentally links against
3475 libobjc. This call a failure linking testkjs. Mike Hay is
3476 working with someone to fix the problem (3505587).
3480 * JavaScriptCore.pbproj/project.pbxproj:
3482 * bindings/jni_jsobject.cpp: Added.
3483 (KJS_JSCreateNativeJSObject):
3484 (KJS_JSObject_JSFinalize):
3485 (KJS_JSObject_JSObjectCall):
3486 (KJS_JSObject_JSObjectEval):
3487 (KJS_JSObject_JSObjectGetMember):
3488 (KJS_JSObject_JSObjectSetMember):
3489 (KJS_JSObject_JSObjectRemoveMember):
3490 (KJS_JSObject_JSObjectGetSlot):
3491 (KJS_JSObject_JSObjectSetSlot):
3492 (KJS_JSObject_JSObjectToString):
3493 * bindings/jni_jsobject.h: Added.
3495 2003-12-09 Maciej Stachowiak <mjs@apple.com>
3499 <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
3501 * kjs/collector.cpp:
3502 (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
3503 (KJS::Collector::collect): likewise
3505 2003-12-08 Richard Williamson <rjw@apple.com>
3507 LiveConnect: The last piece of the JavaScript side of the
3508 LiveConnect implementation. This change adds support for
3509 setting/getting values from Java arrays in JavaScript.
3513 * bindings/jni/jni_instance.h:
3514 * bindings/jni/jni_runtime.cpp:
3515 (JavaField::JavaField):
3516 (convertJObjectToArray):
3517 (JavaArray::JavaArray):
3518 (JavaArray::~JavaArray):
3519 (JavaArray::setValueAt):
3520 (JavaArray::valueAt):
3521 (JavaArray::getLength):
3522 * bindings/jni/jni_runtime.h:
3523 (Bindings::JavaArray::operator=):
3524 (Bindings::JavaArray::javaArray):
3525 * bindings/jni/jni_utility.cpp:
3526 (JNITypeFromPrimitiveType):
3527 (convertValueToJValue):
3528 * bindings/jni/jni_utility.h:
3529 * bindings/runtime.h:
3530 * bindings/runtime_array.cpp:
3531 (RuntimeArrayImp::RuntimeArrayImp):
3532 (RuntimeArrayImp::~RuntimeArrayImp):
3533 (RuntimeArrayImp::get):
3534 (RuntimeArrayImp::put):
3535 (RuntimeArrayImp::hasProperty):
3536 * bindings/runtime_array.h:
3537 (KJS::RuntimeArrayImp::getLength):
3538 (KJS::RuntimeArrayImp::getConcreteArray):
3539 * bindings/runtime_object.cpp:
3540 (RuntimeObjectImp::get):
3541 (RuntimeObjectImp::canPut):
3542 (RuntimeObjectImp::hasProperty):
3544 2003-12-05 Richard Williamson <rjw@apple.com>
3546 LiveConnect: Part 1 of supporting JS bindings to
3547 native language arrays.
3551 * JavaScriptCore.pbproj/project.pbxproj:
3552 * bindings/jni/jni_runtime.cpp:
3553 (JavaField::JavaField):
3554 (convertJObjectToArray):
3555 (JavaField::valueFromInstance):
3556 (JavaField::setValueToInstance):
3557 * bindings/jni/jni_runtime.h:
3558 * bindings/runtime.cpp:
3559 (Instance::setValueOfField):
3560 * bindings/runtime.h:
3561 (Bindings::Array::~Array):
3563 2003-12-04 Richard Williamson <rjw@apple.com>
3565 LiveConnect: Moved defaultValue into concrete implementation because
3566 more intelligent conversion can be perform with knowledge
3567 of the class of the original instance.