1 2004-11-21 Maciej Stachowiak <mjs@apple.com>
5 <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
8 (KJS::Collector::Thread::Thread):
9 (KJS::destroyRegisteredThread):
10 (KJS::initializeRegisteredThreadKey):
11 (KJS::Collector::registerThread):
12 (KJS::Collector::markStackObjectsConservatively):
13 (KJS::Collector::markCurrentThreadConservatively):
14 (KJS::Collector::markOtherThreadConservatively):
22 2004-11-15 Richard Williamson <rjw@apple.com>
24 Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
28 * bindings/objc/objc_instance.mm:
29 (ObjcInstance::stringValue):
30 * bindings/objc/objc_utility.h:
31 * bindings/objc/objc_utility.mm:
32 (KJS::Bindings::convertNSStringToString):
33 (KJS::Bindings::convertObjcValueToValue):
37 2004-11-09 Chris Blumenberg <cblu@apple.com>
39 Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
44 * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
45 * bindings/softlinking.c: Added.
47 (getFunctionPointer): new
48 (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
52 2004-11-04 Darin Adler <darin@apple.com>
56 - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
57 - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
58 and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
59 than allocating a new one
61 * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
62 (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
63 of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
64 actually allocate only the very first time it's called.
65 (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
66 shared instance since there can be only one).
67 (-[WebUndefined copyWithZone:]): Ditto.
68 (-[WebUndefined retain]): Ditto.
69 (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
71 (-[WebUndefined autorelease]): Simplified to just return self (see above).
72 (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
73 (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
74 a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
76 (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
77 No need to call init, since that's a no-op for this class.
79 2004-11-03 David Harrison <harrison@apple.com>
83 Eliminate the use of a marker file to determine how to build.
88 2004-11-01 Richard Williamson <rjw@apple.com>
90 Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
94 * bindings/c/c_instance.cpp:
95 (CInstance::invokeMethod):
96 (CInstance::invokeDefaultMethod):
97 Initialize out parameters to void type.
99 * bindings/c/c_runtime.cpp:
100 (CField::valueFromInstance):
101 (CField::setValueToInstance):
102 Initialize out parameters to void type.
103 Also added additional checks to protect against classes that
104 don't implement all functions.
106 2004-11-01 Richard Williamson <rjw@apple.com>
108 Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
113 * bindings/objc/WebScriptObject.mm:
114 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
115 Added additional conversion Undefined -> WebUndefined.
116 * bindings/objc/objc_utility.mm:
117 (KJS::Bindings::convertObjcValueToValue):
118 Added additional conversion WebUndefined -> Undefined.
120 2004-11-01 Darin Adler <darin@apple.com>
122 - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
124 * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
125 this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
126 report to match the contents of the file.
132 2004-10-22 Ken Kocienda <kocienda@apple.com>
136 * JavaScriptCore.pbproj/project.pbxproj:
137 Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
141 2004-10-13 Richard Williamson <rjw@apple.com>
143 Moved boolean checks prior to NSNumber checks. booleans are
146 Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
150 * bindings/objc/objc_utility.mm:
151 (KJS::Bindings::convertObjcValueToValue):
153 2004-10-12 Richard Williamson <rjw@apple.com>
155 Fixed access to DOM object via WebScriptObject API.
156 The execution context for DOM objects wasn't being found.
157 <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
161 * bindings/objc/WebScriptObject.mm:
163 (-[WebScriptObject KJS::Bindings::]):
164 (-[WebScriptObject callWebScriptMethod:withArguments:]):
165 (-[WebScriptObject evaluateWebScript:]):
166 (-[WebScriptObject setValue:forKey:]):
167 (-[WebScriptObject valueForKey:]):
168 (-[WebScriptObject stringRepresentation]):
169 * bindings/objc/WebScriptObjectPrivate.h:
171 2004-10-09 Darin Adler <darin@apple.com>
175 - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
177 * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
178 creating an init routine.
180 * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
181 require a global constructor that creates an init routine.
183 2004-10-09 Darin Adler <darin@apple.com>
187 - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
189 * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
190 work with the window object of the page the function is in, not the page of the caller. This
191 is what all other browsers do. This code was hidden before by the "everything is defined on
192 window object" hack in WebCore.
194 2004-10-07 Richard Williamson <rjw@apple.com>
196 Added simple JavaScript call tracing. Very useful for
197 debugging complex pages.
199 Tracing is only available in development builds and is
202 (gdb) set traceJavaScript = 1
206 setTraceJavaScript(true)
208 Function, args, and return values are printed to console. Very
213 * kjs/function_object.cpp:
214 (FunctionProtoFuncImp::call):
220 2004-10-05 Richard Williamson <rjw@apple.com>
222 Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
226 * bindings/NP_jsobject.cpp:
228 * bindings/npruntime.cpp:
229 (_NPN_SetExceptionWithUTF8):
230 * bindings/objc/WebScriptObject.mm:
231 (+[WebScriptObject throwException:]):
233 (KJS::InterpreterImp::context):
235 2004-10-05 Richard Williamson <rjw@apple.com>
237 Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
241 * bindings/objc/objc_utility.mm:
242 (KJS::Bindings::convertObjcValueToValue):
244 2004-10-04 Darin Adler <darin@apple.com>
248 - rolled in a fix the KDE folks did for the operations that generate HTML fragments
250 * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
252 - rolled out an old workaround we don't need any more
254 * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
255 required it is no longer there.
257 2004-09-30 Richard Williamson <rjw@apple.com>
259 Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
263 * bindings/NP_jsobject.cpp:
267 * bindings/c/c_class.cpp:
268 (CClass::methodsNamed):
269 (CClass::fieldNamed):
270 * bindings/c/c_class.h:
271 * bindings/c/c_instance.cpp:
272 (CInstance::invokeMethod):
273 * bindings/jni/jni_class.cpp:
274 (JavaClass::methodsNamed):
275 * bindings/jni/jni_class.h:
276 * bindings/npruntime.h:
277 * bindings/objc/objc_class.h:
278 * bindings/objc/objc_class.mm:
279 (ObjcClass::methodsNamed):
280 * bindings/runtime.h:
281 * bindings/runtime_object.cpp:
282 (RuntimeObjectImp::get):
283 (RuntimeObjectImp::hasProperty):
285 2004-09-29 Chris Blumenberg <cblu@apple.com>
287 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.
291 * JavaScriptCore.pbproj/project.pbxproj:
292 * bindings/NP_jsobject.cpp:
293 (_NPN_CreateScriptObject):
294 (_NPN_InvokeDefault):
299 (_NPN_RemoveProperty):
302 * bindings/c/c_class.cpp:
303 (CClass::methodsNamed):
304 (CClass::fieldNamed):
305 * bindings/c/c_instance.cpp:
306 (CInstance::CInstance):
307 (CInstance::~CInstance):
308 (CInstance::operator=):
309 (CInstance::invokeMethod):
310 (CInstance::invokeDefaultMethod):
311 * bindings/c/c_runtime.cpp:
312 * bindings/c/c_runtime.h:
313 (KJS::Bindings::CField::name):
314 (KJS::Bindings::CMethod::name):
315 * bindings/npruntime.cpp:
316 (_NPN_GetStringIdentifier):
317 (_NPN_GetStringIdentifiers):
318 (_NPN_GetIntIdentifier):
319 (_NPN_IdentifierIsString):
320 (_NPN_UTF8FromIdentifier):
321 (_NPN_IntFromIdentifier):
322 (NPN_InitializeVariantWithObject):
323 (_NPN_ReleaseVariantValue):
326 (_NPN_ReleaseObject):
327 (_NPN_SetExceptionWithUTF8):
330 2004-09-26 Darin Adler <darin@apple.com>
332 * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
333 low() to get Unicode value of character, and just use unicode().
335 2004-09-26 Darin Adler <darin@apple.com>
337 - refine charAt/charCodeAt fix slightly
339 * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
340 omitted parameter, as we do everywhere else, and as other browsers do here.
342 2004-09-26 Darin Adler <darin@apple.com>
346 - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
348 * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
349 the program. We were doing this properly for functions, but not entire programs.
351 - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
353 * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
354 and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
356 * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
362 2004-09-14 Richard Williamson <rjw@apple.com>
364 1. Add class parameter to object allocation function. This is somewhat redundant, given that
365 the allocation function is in the class function vector, but people wanted to use the same
366 allocation function for different classes.
368 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
370 3. Add support for a default function on an object. This is a feature that ActiveX supports,
371 and will allow JavaScript code to be written that will look exactly the same for both ActiveX
372 plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
373 'Objective-C' bindings.
375 There bugs are covered by
377 <rdar://problem/3776343> Support for default functions in the JavaScript bindings
378 <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
379 <rdar://problem/3674754> Need to implement latest npruntime.h
383 * bindings/NP_jsobject.cpp:
387 * bindings/c/c_class.cpp:
388 * bindings/c/c_instance.cpp:
389 (CInstance::CInstance):
390 (CInstance::operator=):
391 (CInstance::invokeMethod):
392 (CInstance::invokeDefaultMethod):
393 * bindings/c/c_instance.h:
394 * bindings/c/c_runtime.cpp:
395 * bindings/c/c_runtime.h:
396 * bindings/jni/jni_instance.cpp:
397 (JavaInstance::invokeDefaultMethod):
398 * bindings/jni/jni_instance.h:
399 * bindings/npruntime.cpp:
401 * bindings/npruntime.h:
402 * bindings/objc/WebScriptObject.h:
403 * bindings/objc/objc_class.mm:
404 (ObjcClass::fallbackObject):
405 * bindings/objc/objc_instance.h:
406 * bindings/objc/objc_instance.mm:
407 (ObjcInstance::invokeDefaultMethod):
408 * bindings/objc/objc_runtime.h:
409 * bindings/objc/objc_runtime.mm:
410 (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
411 (ObjcFallbackObjectImp::get):
412 (ObjcFallbackObjectImp::put):
413 (ObjcFallbackObjectImp::canPut):
414 (ObjcFallbackObjectImp::implementsCall):
415 (ObjcFallbackObjectImp::call):
416 (ObjcFallbackObjectImp::hasProperty):
417 (ObjcFallbackObjectImp::deleteProperty):
418 (ObjcFallbackObjectImp::defaultValue):
419 * bindings/runtime.h:
420 (KJS::Bindings::Class::fallbackObject):
421 (KJS::Bindings::Instance::getValueOfUndefinedField):
422 (KJS::Bindings::Instance::setValueOfUndefinedField):
423 (KJS::Bindings::Instance::valueOf):
424 * bindings/runtime_object.cpp:
425 (RuntimeObjectImp::implementsCall):
426 (RuntimeObjectImp::call):
427 * bindings/runtime_object.h:
429 2004-09-13 Maciej Stachowiak <mjs@apple.com>
433 <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
435 * kjs/string_object.cpp:
436 (StringProtoFuncImp::call): Replaced implementation of replace()
437 method with function below...
438 (replace): In order to avoid excessive allocation and copying,
439 figure out the ranges of the original string and replacement
440 strings to be assembled, instead of constantly creating new
441 strings at each substitution. The old behavior is basically O(N^2)
442 for a global replace on a pattern that matches many places in the
444 (regExpIsGlobal): Helper function for the above.
445 (expandSourceRanges): ditto
446 (pushSourceRange): ditto
447 (expandReplacements): ditto
448 (pushReplacement): ditto
450 (KJS::UString::spliceSubstringsWithSeparators): New method that
451 pieces together substring ranges of this string together with
452 specified separators, all at one go.
454 (KJS::UString::Range::Range): Added new helper class to represent
457 2004-09-14 Maciej Stachowiak <mjs@apple.com>
461 - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
464 (KJS::GlobalFuncImp::call): Make sure to escape null
465 characters. This is a bug in the new code that made part of the
468 2004-09-13 Darin Adler <darin@apple.com>
470 Reviewed by Kevin and Maciej.
472 - new function to support fix for DIG bug in WebCore
474 * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
475 * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
477 2004-09-12 Darin Adler <darin@apple.com>
479 * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
480 of escape and unescape.
482 2004-09-12 Darin Adler <darin@apple.com>
486 - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
488 * kjs/date_object.cpp:
489 (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
490 uses CFDateFormatter.
491 (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
493 2004-09-09 Maciej Stachowiak <mjs@apple.com>
497 <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
500 (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
501 ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
503 (Lexer::isHexDigit): Made static and non-const.
508 2004-09-06 Darin Adler <darin@apple.com>
510 * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
514 2004-09-01 Richard Williamson <rjw@apple.com>
516 Add pid to exception messages (to help debug dashboard clients).
520 * kjs/interpreter.cpp:
521 (Interpreter::evaluate):
525 2004-08-20 Richard Williamson <rjw@apple.com>
527 Implemented new JNI abstraction. We no longer invoke Java methods
528 directly with JNI, rather we call into the plugin. This allows the
529 plugin to dispatch the call to the appropriate VM thread. This
530 change should (will?) fix a whole class of threading related problems with
535 * JavaScriptCore.pbproj/project.pbxproj:
536 * bindings/c/c_instance.h:
537 (KJS::Bindings::CInstance::setExecutionContext):
538 (KJS::Bindings::CInstance::executionContext):
539 * bindings/jni/jni_instance.cpp:
540 (JavaInstance::JavaInstance):
541 (JavaInstance::invokeMethod):
542 (JavaInstance::setExecutionContext):
543 (JavaInstance::executionContext):
544 * bindings/jni/jni_instance.h:
545 * bindings/jni/jni_jsobject.cpp:
546 (JSObject::convertJObjectToValue):
547 * bindings/jni/jni_runtime.cpp:
548 (JavaField::JavaField):
549 (JavaArray::convertJObjectToArray):
550 (JavaField::valueFromInstance):
551 (JavaArray::JavaArray):
552 (JavaArray::valueAt):
553 * bindings/jni/jni_runtime.h:
554 (KJS::Bindings::JavaArray::operator=):
555 (KJS::Bindings::JavaArray::executionContext):
556 * bindings/jni/jni_utility.h:
557 * bindings/objc/objc_instance.h:
558 (KJS::Bindings::ObjcInstance::setExecutionContext):
559 (KJS::Bindings::ObjcInstance::executionContext):
560 * bindings/runtime.cpp:
561 (Instance::createBindingForLanguageInstance):
562 * bindings/runtime.h:
563 * bindings/runtime_root.h:
564 (KJS::Bindings::RootObject::nativeHandle):
568 2004-08-19 Vicki Murley <vicki@apple.com>
572 * kjs/property_map.cpp:
573 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
575 2004-08-17 Darin Adler <darin@apple.com>
579 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
581 * kjs/property_map.h: Added some private functions.
582 * kjs/property_map.cpp:
583 (KJS::PropertyMap::clear): Set sentinelCount to 0.
584 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
585 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
586 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
587 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
588 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
589 deleted-element sentinels.
590 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
592 2004-08-16 Maciej Stachowiak <mjs@apple.com>
594 Code change by Eric Albert, reviewd by me.
596 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
598 * kjs/date_object.cpp:
599 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
600 entirely would be even better, but is not required to fix this bug.
604 2004-08-16 Richard Williamson <rjw@apple.com>
606 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
608 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
612 * bindings/NP_jsobject.cpp:
614 * bindings/jni/jni_jsobject.cpp:
616 * bindings/objc/WebScriptObject.mm:
617 (-[WebScriptObject evaluateWebScript:]):
619 2004-08-15 Richard Williamson <rjw@apple.com>
621 More updates to np headers. Implemented new NPN functions.
625 * bindings/NP_jsobject.cpp:
629 * bindings/npruntime.h:
631 2004-08-13 Darin Adler <darin@apple.com>
633 - fix build so we can compile again
635 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
636 is good enough so that we can compile, but it's only a stopgap measure, because I think
637 Richard has a newer one he wants to check in.
639 2004-08-12 Richard Williamson <rjw@apple.com>
641 Bring npruntime.h and friends closer to compliance with
646 * JavaScriptCore.pbproj/project.pbxproj:
647 * bindings/NP_jsobject.cpp:
649 (_NPN_CreateScriptObject):
654 (NPN_RemoveProperty):
655 * bindings/NP_jsobject.h:
656 * bindings/c/c_instance.cpp:
657 (CInstance::invokeMethod):
658 * bindings/c/c_utility.cpp:
659 (convertNPVariantToValue):
660 * bindings/npruntime.cpp:
661 (NPN_IdentifierIsString):
664 (NPN_VariantIsUndefined):
666 (NPN_VariantIsInt32):
667 (NPN_VariantIsDouble):
668 (NPN_VariantIsString):
669 (NPN_VariantIsObject):
671 (NPN_VariantToString):
672 (NPN_VariantToInt32):
673 (NPN_VariantToDouble):
674 (NPN_VariantToObject):
675 (NPN_InitializeVariantAsVoid):
676 (NPN_InitializeVariantAsNull):
677 (NPN_InitializeVariantAsUndefined):
678 (NPN_InitializeVariantWithBool):
679 (NPN_InitializeVariantWithInt32):
680 (NPN_InitializeVariantWithDouble):
681 (NPN_InitializeVariantWithString):
682 (NPN_InitializeVariantWithStringCopy):
683 (NPN_InitializeVariantWithObject):
684 (NPN_InitializeVariantWithVariant):
685 (NPN_ReleaseVariantValue):
687 * bindings/npruntime.h:
689 (_NPString::_NPVariant::):
690 * bindings/npruntime_priv.h: Added.
692 2004-08-12 Darin Adler <darin@apple.com>
696 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
699 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
700 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
701 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
702 to skip leading "+" or "-".
706 2004-08-12 Darin Adler <darin@apple.com>
710 - fixed 43 Mozilla JavaScript tests
712 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
713 * kjs/date_object.cpp:
714 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
715 than constructing a number object to pass to it.
716 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
717 (KJS::parseDate): Change to return a double instead of creating the Number object here.
718 (KJS::timeClip): Implement this as specified in the language standard.
720 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
721 flags on the prototype property.
724 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
726 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
728 (KJS::parseDigit): Added. Helper function for parseInt.
729 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
730 strtoll can handle. Also matches standard more closely.
731 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
733 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
735 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
737 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
739 (Lexer::setCode): Clear error state.
740 (Lexer::lex): Set error state if the lexer encounters an error
743 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
744 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
746 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
747 Change round to round values between -0.5 and -0 to -0 instead of +0.
749 * kjs/nodes.h: Add evaluateReference function to GroupNode.
750 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
751 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
752 would change x.y into a value that can't be deleted as a side effect.
754 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
757 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
758 get rid of the fixed size limit for code.
760 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
761 returns the string without creating a new Rep, since I'm using substr in a place where it will
764 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
765 the other day that was making a couple tests fail.
766 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
767 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
768 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
769 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
770 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
772 * kjs/string_object.lut.h: Regenerated.
774 2004-08-11 Darin Adler <darin@apple.com>
776 - fixed a tiny problem with the UTF-16 PCRE check-in
778 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
779 the ctype_meta flag to get set in items that should not have it.
781 * pcre/chartables.c: Regenerated.
783 2004-08-10 Richard Williamson <rjw@apple.com>
785 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
787 The following WebScripting methods are now supported on bound
790 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
791 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
792 - (id)valueForUndefinedKey:(NSString *)key
796 * bindings/c/c_class.cpp:
797 (CClass::fieldNamed):
798 * bindings/c/c_class.h:
799 * bindings/jni/jni_class.cpp:
800 (JavaClass::fieldNamed):
801 * bindings/jni/jni_class.h:
802 * bindings/objc/objc_class.h:
803 (KJS::Bindings::ObjcClass::isa):
804 * bindings/objc/objc_class.mm:
805 (ObjcClass::methodsNamed):
806 (ObjcClass::fieldNamed):
807 (ObjcClass::fallbackObject):
808 * bindings/objc/objc_instance.h:
809 * bindings/objc/objc_instance.mm:
810 (ObjcInstance::invokeMethod):
811 (ObjcInstance::setValueOfField):
812 (ObjcInstance::setValueOfUndefinedField):
813 (ObjcInstance::getValueOfField):
814 (ObjcInstance::getValueOfUndefinedField):
815 * bindings/objc/objc_runtime.h:
816 (KJS::Bindings::ObjcField::~ObjcField):
817 (KJS::Bindings::ObjcField::ObjcField):
818 (KJS::Bindings::ObjcField::operator=):
819 (KJS::Bindings::FallbackObjectImp::classInfo):
820 * bindings/objc/objc_runtime.mm:
821 (ObjcField::ObjcField):
824 (ObjcField::valueFromInstance):
825 (ObjcField::setValueToInstance):
826 (FallbackObjectImp::FallbackObjectImp):
827 (FallbackObjectImp::get):
828 (FallbackObjectImp::put):
829 (FallbackObjectImp::canPut):
830 (FallbackObjectImp::implementsCall):
831 (FallbackObjectImp::call):
832 (FallbackObjectImp::hasProperty):
833 (FallbackObjectImp::deleteProperty):
834 (FallbackObjectImp::defaultValue):
835 * bindings/runtime.h:
836 (KJS::Bindings::Class::fallbackObject):
837 (KJS::Bindings::Instance::getValueOfUndefinedField):
838 (KJS::Bindings::Instance::setValueOfUndefinedField):
839 * bindings/runtime_object.cpp:
840 (RuntimeObjectImp::get):
841 (RuntimeObjectImp::put):
842 (RuntimeObjectImp::canPut):
843 (RuntimeObjectImp::hasProperty):
844 * bindings/testbindings.mm:
845 (-[MyFirstInterface valueForUndefinedKey:]):
846 (-[MyFirstInterface setValue:forUndefinedKey:]):
848 2004-08-10 Darin Adler <darin@apple.com>
852 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
854 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
855 or uint16_t depending on the mode, and used appropriate in the 7 public functions
857 * pcre/pcre.c: Add UTF-16 support to all functions.
858 * pcre/study.c: Ditto.
860 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
861 the mode. Changed declarations to use symbolic constants and typedefs so we size
862 things to ichar when needed.
864 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
865 sized to 16-bit characters instead of 8-bit.
868 (pcre_copy_substring): Use pcre_char instead of char.
869 (pcre_get_substring_list): Ditto.
870 (pcre_free_substring_list): Ditto.
871 (pcre_get_substring): Ditto.
872 (pcre_free_substring): Ditto.
874 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
875 of hard-coding 8-bit table sizes.
877 * pcre/chartables.c: Regenerated.
879 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
880 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
881 is not null. The null string still has a null pointer. This prevents us from
882 passing a null through to the regular expression engine (which results in a null
883 error even when the string length is 0).
886 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
887 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
889 2004-08-09 Darin Adler <darin@apple.com>
893 - fixed 28 Mozilla JavaScript tests
895 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
896 checking the number of arguments for the join method.
898 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
899 than integers, so we aren't limited to 32 bits.
901 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
902 the implementation of the pow operation. Also simplied a case that was handling positive
903 and negative infinity separately.
905 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
906 putting them in a long, so that unsigned shift will work properly.
908 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
910 * kjs/operations.cpp:
911 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
912 sign of isinf; our isinf function returns +1 even for negative infinity.
913 (KJS::isNegInf): And again.
914 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
915 Our floating point already handles the various infinity cases correctly.
917 * kjs/regexp_object.cpp:
918 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
919 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
920 array in cases where we did not match.
921 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
922 "global", "ignoreCase", "multiline", and "source".
924 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
925 string into undefined rather than an empty string. For the slice method, handle an
926 undefined parameter for the limit properly as decribed in the specification, and add
927 the limit to one case that didn't have the limit at all. For the methods that generate
928 HTML strings, use lowercase tags instead of uppercase.
931 (KJS::UChar::toLower): Use u_tolower from the ICU library.
932 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
933 (KJS::UString::append): Fix some math that caused a buffer overflow.
934 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
935 flag) rather than converting them all to 0.
936 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
938 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
940 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
941 the Unicode specification in a few cases where it was wrong before.
942 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
943 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
944 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
945 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
946 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
947 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
948 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
949 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
950 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
952 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
954 * kjs/number_object.lut.h: Regenerated.
956 2004-08-09 Darin Adler <darin@apple.com>
960 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
962 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
963 we get a buffer overflow.
967 2004-08-05 Richard Williamson <rjw@apple.com>
969 Fixed part of 3674747. The QT guys need this for feature freeze.
971 This patch implements support for the
973 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
975 method of objects bound to JavaScript.
980 * bindings/objc/objc_class.mm:
981 (ObjcClass::methodsNamed):
982 (ObjcClass::fieldNamed):
983 * bindings/objc/objc_instance.mm:
984 (ObjcInstance::invokeMethod):
985 * bindings/objc/objc_runtime.h:
986 (KJS::Bindings::ObjcMethod::~ObjcMethod):
987 (KJS::Bindings::ObjcMethod::isFallbackMethod):
988 (KJS::Bindings::ObjcMethod::javaScriptName):
989 * bindings/objc/objc_runtime.mm:
990 (ObjcMethod::ObjcMethod):
991 (ObjcMethod::getMethodSignature):
992 (ObjcMethod::setJavaScriptName):
993 * bindings/testbindings.mm:
995 2004-08-04 Vicki Murley <vicki@apple.com>
999 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
1002 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
1003 go to the next line and continue parsing the string (instead of failing). This matches
1004 behavior in Mac IE and Mozilla.
1006 2004-08-03 Kevin Decker <kdecker@apple.com>
1010 Rolled in changes from the latest KJS sources that support additional
1011 Number.prototype functions.
1013 Specifically this patch covers the follow parts of the ECMA 3 spec:
1014 15.7.4.5, 15.7.4.6, and 15.7.4.7
1017 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
1018 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
1019 <rdar://problem/3749591> missing Number.toExponential prototype implementation
1021 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
1022 list of supported identifiers (a macro).
1023 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
1024 and toExponential().
1025 (NumberPrototypeImp::NumberPrototypeImp):
1026 (NumberProtoFuncImp::call):
1027 * kjs/number_object.h: Added property names for toFixed, toPrecision,
1029 (KJS::NumberProtoFuncImp::):
1030 * tests/mozilla/expected.html: Update results.
1032 2004-08-03 Darin Adler <darin@apple.com>
1036 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
1038 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
1039 we are supposed to just copy the regular expression object, and do so.
1040 Also tighten up arguments check to handle case where an actual "undefined"
1041 is passed rather than just omitting an argument.
1043 * tests/mozilla/expected.html: Update results.
1045 2004-08-02 Darin Adler <darin@apple.com>
1047 * tests/mozilla/.cvsignore: Added.
1048 * tests/mozilla/expected.html: Update results.
1050 2004-08-02 Darin Adler <darin@apple.com>
1054 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
1056 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
1057 Append the flags here so more tests paseed.
1059 2004-08-02 Darin Adler <darin@apple.com>
1063 - fixed a couple things making 5 Mozilla regexp tests pass
1065 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
1067 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
1068 be used as the flags string when no parameter was passed.
1070 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
1071 Added a class info object for RegExp prototype so it can return
1072 a string instead of raising an exception when converting to a string.
1074 * tests/mozilla/expected.html: Update results.
1076 2004-08-02 Darin Adler <darin@apple.com>
1080 - fix crashes in mozilla tests due to mishandling NaN
1082 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
1083 calls to toInteger so that NaN will get turned into something that fits in an integer.
1084 These were the ones John already fixed, but his fix used isnan and the new fix is
1087 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
1088 after a call to toInteger to handle NaN properly. Also removed separate check
1089 for undefined that's not needed.
1091 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
1092 as in the above two files, but for a lot more functions. Also changed one place with
1093 an explicit check for undefined to instead just check isNaN.
1095 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
1096 like me who don't keep $SYMROOTS in their $PATH.
1102 2004-07-26 Kevin Decker <kdecker@apple.com>
1104 Changes done by Darin, reviewed by Kevin.
1106 - changed testkjs to build in Xcode rather than from Makefile
1108 * .cvsignore: Removed obsolete files from this list.
1109 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
1110 Changed to build target "All" rather than default target. This makes us
1111 build the testkjs test tool.
1112 * dummy.cpp: Removed.
1113 * kjs/.cvsignore: Removed obsolete files from this list, including
1114 the testkjs tool, which is now built in the symroots directory.
1115 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
1116 changed this file. Also this has the nice side effect of causing the tool
1117 to be rebuilt in the new location even if there are no other changes in
1118 your tree when you check this out.
1119 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
1120 without setting the execute bit on jsDriver.pl.
1122 2004-07-22 Kevin Decker <kdecker@apple.com>
1126 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
1128 * kjs/function_object.cpp:
1129 (FunctionObjectImp::construct):
1130 * kjs/function_object.h:
1132 (KJS::ObjectImp::construct):
1134 (KJS::Object::construct):
1136 2004-07-21 Darin Adler <darin@apple.com>
1138 * bindings/npruntime.h: Fixed typo.
1140 2004-07-19 John Sullivan <sullivan@apple.com>
1144 - bulletproofed array.slice() against NAN arguments. Harri noticed this
1145 vulnerability in my patch for 3714644
1147 * kjs/array_object.cpp:
1148 (ArrayProtoFuncImp::call):
1149 handle NAN parameters passed to slice() by clamping to 0 and length.
1151 2004-07-19 Richard Williamson <rjw@apple.com>
1153 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
1158 * bindings/jni/jni_jsobject.cpp:
1160 (JSObject::JSObject):
1162 2004-07-16 John Sullivan <sullivan@apple.com>
1166 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
1167 hangs browser with javascript
1169 * kjs/array_object.cpp:
1170 (ArrayProtoFuncImp::call):
1171 Check for undefined type for args[0] the same way we were already checking
1172 for args[1]. In this case, args was zero-length, but we were treating
1173 args[0] like an integer anyway. Resulted in some code looping from a NAN
1174 value to 4, taking approximately forever.
1176 * JavaScriptCore.pbproj/project.pbxproj:
1181 2004-07-14 Maciej Stachowiak <mjs@apple.com>
1185 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
1186 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
1188 * kjs/number_object.cpp:
1189 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
1191 2004-07-13 Kevin Decker <kdecker@apple.com>
1193 Reviewed by kocienda.
1195 - made testkjs and JavaScriptCore a subtarget of 'All'
1196 - testkjs now builds in $SYMROOTS
1198 * JavaScriptCore.pbproj/project.pbxproj:
1202 2004-06-24 Chris Blumenberg <cblu@apple.com>
1204 Ignore .mode1 files in JavaScriptCore.pbproj
1206 Reviewed by kocienda.
1208 * JavaScriptCore.pbproj/.cvsignore:
1210 2004-06-23 Richard Williamson <rjw@apple.com>
1212 Implemented changes for latest npruntime.h.
1216 * JavaScriptCore.pbproj/project.pbxproj:
1217 * bindings/NP_jsobject.cpp:
1218 (listFromVariantArgs):
1219 (identiferFromNPIdentifier):
1220 (_NPN_CreateScriptObject):
1225 (NPN_RemoveProperty):
1226 * bindings/NP_jsobject.h:
1227 * bindings/c/c_class.cpp:
1228 (CClass::methodsNamed):
1229 (CClass::fieldNamed):
1230 * bindings/c/c_instance.cpp:
1231 (CInstance::invokeMethod):
1232 * bindings/c/c_utility.cpp:
1233 (convertNPVariantToValue):
1234 * bindings/c/c_utility.h:
1235 * bindings/npruntime.cpp:
1236 (stringIdentifierEqual):
1237 (stringIdentifierHash):
1238 (getStringIdentifierDictionary):
1239 (intIdentifierEqual):
1240 (intIdentifierHash):
1241 (getIntIdentifierDictionary):
1242 (NPN_GetStringIdentifier):
1243 (NPN_GetStringIdentifiers):
1244 (NPN_GetIntIdentifier):
1245 (NPN_IdentifierIsString):
1246 (NPN_UTF8FromIdentifier):
1247 (NPN_VariantToInt32):
1248 (NPN_VariantToDouble):
1250 * bindings/npruntime.h:
1251 * bindings/objc/WebScriptObject.mm:
1252 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1253 * bindings/runtime_object.cpp:
1254 (RuntimeObjectImp::~RuntimeObjectImp):
1255 * bindings/runtime_root.cpp:
1256 (KJS::Bindings::rootForInterpreter):
1257 * bindings/testbindings.cpp:
1258 (initializeIdentifiers):
1264 === JavaScriptCore-146.1 ===
1266 2004-06-16 Richard Williamson <rjw@apple.com>
1268 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1270 This turned out to be a show stopper for Dashboard. Accessing a nil
1271 ObjC property from JS caused a crash. Similar to the problem
1272 3696112 fixed below.
1276 * bindings/objc/objc_runtime.mm:
1277 (KJS::Bindings::ObjcField::valueFromInstance):
1281 2004-06-16 Richard Williamson <rjw@apple.com>
1283 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1285 This turned out to be a show stopper for Dashboard. We now
1286 return Undefined() when nil is returned from a ObjC method
1287 that returns an object type.
1291 * bindings/objc/objc_utility.mm:
1292 (KJS::Bindings::convertObjcValueToValue):
1296 2004-06-15 Richard Williamson <rjw@apple.com>
1298 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1300 No longer need to check respondsToSelector: for
1301 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1302 because these now have a default implementation on NSObject.
1306 * bindings/objc/objc_class.mm:
1307 (ObjcClass::methodsNamed):
1308 (ObjcClass::fieldNamed):
1310 2004-06-14 Darin Adler <darin@apple.com>
1314 - fixed some things for GC that Patrick missed, or that happened after the branch
1316 * bindings/objc/WebScriptObject.mm:
1317 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1318 (-[WebScriptObject finalize]): Added.
1320 - added some missing nil checks
1322 * bindings/objc/objc_instance.mm:
1323 (ObjcInstance::ObjcInstance): Check for nil.
1324 (ObjcInstance::~ObjcInstance): Check for nil.
1325 (ObjcInstance::operator=): Check for nil.
1327 2004-06-14 Darin Adler <darin@apple.com>
1329 Reviewed by me, code changes by Patrick Beard.
1331 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1333 * bindings/objc/objc_instance.mm:
1334 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1335 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1336 (ObjcInstance::operator=): More of the same.
1337 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1339 * bindings/objc/objc_runtime.mm:
1340 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1341 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1342 (ObjcArray::operator=): More of the same.
1344 * bindings/testbindings.mm: Fixed incorrect license.
1345 (main): Use [pool drain] if compiling on Tiger.
1349 2004-06-10 Kevin Decker <kdecker@apple.com>
1355 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1357 (KJS::Lexer::lineNo):
1358 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1360 === JavaScriptCore-143.2 ===
1362 2004-06-07 Darin Adler <darin@apple.com>
1364 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1366 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1367 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1369 === JavaScriptCore-143.1 ===
1371 2004-06-04 Kevin Decker <kdecker@apple.com>
1375 - fixed <rdar://problem/3680594>
1378 (KJS::Error::create):
1382 2004-06-04 Darin Adler <darin@apple.com>
1384 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1386 2004-06-04 Kevin Decker <kdecker@apple.com>
1390 - ObjC bindings do not (yet) pass along sourceurl or line numbers
1391 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1392 - changed the wording of an error message
1393 - the lexer, parser, and interpreter have been made "sourceURL aware"
1394 - stored the url into Error
1396 * bindings/NP_jsobject.cpp:
1398 * bindings/jni/jni_jsobject.cpp:
1400 * bindings/objc/WebScriptObject.mm:
1401 (-[WebScriptObject evaluateWebScript:]):
1403 (GlobalFuncImp::call):
1404 * kjs/function_object.cpp:
1405 (FunctionObjectImp::construct):
1408 (InterpreterImp::checkSyntax):
1409 (InterpreterImp::evaluate):
1411 * kjs/interpreter.cpp:
1412 (Interpreter::evaluate):
1413 * kjs/interpreter.h:
1417 (KJS::Lexer::sourceURL):
1421 (FunctionCallNode::evaluate):
1424 (KJS::Error::create):
1427 2004-06-04 Richard Williamson <rjw@apple.com>
1429 Fixed crash when attempting to access properties on nil
1434 * bindings/objc/objc_instance.mm:
1435 (ObjcInstance::getClass):
1436 * bindings/runtime_object.cpp:
1437 (RuntimeObjectImp::get):
1438 * bindings/testM.js:
1439 * bindings/testbindings.mm:
1440 (-[MyFirstInterface getString]):
1442 2004-05-27 Kevin Decker <kdecker@apple.com>
1446 -revised generated error message content
1448 * kjs/error_object.cpp:
1449 (ErrorProtoFuncImp::call):
1453 (KJS::Error::create):
1457 2004-05-27 Richard Williamson <rjw@apple.com>
1459 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1463 * bindings/objc/WebScriptObject.h:
1465 2004-05-27 Darin Adler <darin@apple.com>
1469 - moved to new symlink technique for embedding frameworks
1471 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1472 because we don't need it any more.
1474 2004-05-24 Richard Williamson <rjw@apple.com>
1476 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1477 fixed ClassInfo to correctly reflect inheritance. This is required
1478 because of the runtime checks in JSC for arrays, i.e. in
1479 the Function objects apply method.
1483 * bindings/jni/jni_runtime.cpp:
1484 (JavaArray::convertJObjectToArray):
1485 * bindings/objc/objc_utility.mm:
1486 (KJS::Bindings::convertObjcValueToValue):
1487 * bindings/runtime_array.cpp:
1488 (RuntimeArrayImp::RuntimeArrayImp):
1489 * bindings/runtime_array.h:
1490 * bindings/testM.js: Added.
1491 * bindings/testbindings.mm:
1492 (+[MyFirstInterface webScriptNameForSelector:]):
1493 (-[MyFirstInterface logMessages:]):
1494 (-[MyFirstInterface logMessage:prefix:]):
1495 (-[MyFirstInterface callJSObject::]):
1497 2004-05-22 Darin Adler <darin@apple.com>
1501 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
1503 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
1504 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
1505 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
1506 it hasn't been set explicitly.
1510 2004-05-20 Richard Williamson <rjw@apple.com>
1512 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
1513 can now be referenced like any other WebScriptObject, meaning
1514 you can do JS operations on them.
1516 All added implementation of finalizeForWebScript.
1520 * bindings/objc/WebScriptObject.h:
1521 * bindings/objc/WebScriptObject.mm:
1522 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1523 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1524 (-[WebScriptObject KJS::]):
1525 (-[WebScriptObject dealloc]):
1526 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1527 (-[WebScriptObject evaluateWebScript:]):
1528 (-[WebScriptObject setValue:forKey:]):
1529 (-[WebScriptObject valueForKey:]):
1530 (-[WebScriptObject stringRepresentation]):
1531 * bindings/objc/WebScriptObjectPrivate.h:
1532 * bindings/objc/objc_instance.mm:
1533 (ObjcInstance::~ObjcInstance):
1535 2004-05-19 Richard Williamson <rjw@apple.com>
1537 Removed extraneous tabs that were added (by XCode?).
1539 * bindings/objc/WebScriptObject.h:
1541 2004-05-19 Darin Adler <darin@apple.com>
1543 - fixed headers with licenses mangled by Xcode auto-indenting
1545 * bindings/jni/jni_jsobject.cpp:
1546 * bindings/jni/jni_jsobject.h:
1547 * bindings/runtime_array.h:
1548 * bindings/runtime_root.cpp:
1549 * bindings/runtime_root.h:
1551 2004-05-18 Richard Williamson <rjw@apple.com>
1553 Added exception logging. Also check for exception and
1554 set results as appropriate.
1556 Reviewed by Maciej (partially reviewed).
1558 * bindings/objc/WebScriptObject.mm:
1559 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1560 (-[WebScriptObject evaluateWebScript:]):
1561 (-[WebScriptObject setValue:forKey:]):
1562 (-[WebScriptObject valueForKey:]):
1564 2004-05-18 Richard Williamson <rjw@apple.com>
1566 Finsished implementing support for windowScriptObject.
1567 Had to make WebScriptObjectPrivate.h accessible from
1572 * JavaScriptCore.pbproj/project.pbxproj:
1573 * bindings/objc/WebScriptObjectPrivate.h:
1575 2004-05-18 Richard Williamson <rjw@apple.com>
1577 Use KVC to set/get values instead of directly accessing
1582 * bindings/objc/WebScriptObject.mm:
1583 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1584 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1585 * bindings/objc/objc_runtime.mm:
1586 (ObjcField::valueFromInstance):
1587 (convertValueToObjcObject):
1588 (ObjcField::setValueToInstance):
1590 2004-05-17 Richard Williamson <rjw@apple.com>
1592 Implemented new API for WebScriptObject.
1594 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
1595 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
1599 * JavaScriptCore.pbproj/project.pbxproj:
1600 * bindings/c/c_instance.cpp:
1601 (CInstance::invokeMethod):
1602 * bindings/jni/jni_instance.cpp:
1603 (JavaInstance::invokeMethod):
1604 * bindings/jni/jni_jsobject.cpp:
1605 (JSObject::convertValueToJObject):
1606 * bindings/jni/jni_utility.cpp:
1607 (KJS::Bindings::getJNIField):
1608 * bindings/objc/WebScriptObject.mm:
1610 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1611 (-[WebScriptObject KJS::]):
1612 (-[WebScriptObject dealloc]):
1613 (+[WebScriptObject throwException:]):
1615 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1616 (-[WebScriptObject evaluateWebScript:]):
1617 (-[WebScriptObject setValue:forKey:]):
1618 (-[WebScriptObject valueForKey:]):
1619 (-[WebScriptObject stringRepresentation]):
1620 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1621 (+[WebUndefined undefined]):
1622 (-[WebUndefined initWithCoder:]):
1623 (-[WebUndefined encodeWithCoder:]):
1624 (-[WebUndefined copyWithZone:]):
1625 (-[WebUndefined retain]):
1626 (-[WebUndefined release]):
1627 (-[WebUndefined retainCount]):
1628 (-[WebUndefined autorelease]):
1629 (-[WebUndefined dealloc]):
1630 (-[WebUndefined copy]):
1631 (-[WebUndefined replacementObjectForPortCoder:]):
1632 * bindings/objc/WebScriptObjectPrivate.h: Added.
1633 * bindings/objc/objc_class.mm:
1634 (ObjcClass::methodsNamed):
1635 (ObjcClass::fieldNamed):
1636 * bindings/objc/objc_instance.mm:
1637 (ObjcInstance::invokeMethod):
1638 * bindings/objc/objc_jsobject.h:
1639 * bindings/objc/objc_jsobject.mm:
1640 * bindings/objc/objc_runtime.mm:
1641 (ObjcField::valueFromInstance):
1642 * bindings/objc/objc_utility.mm:
1643 (KJS::Bindings::JSMethodNameToObjCMethodName):
1644 (KJS::Bindings::convertValueToObjcValue):
1645 (KJS::Bindings::convertObjcValueToValue):
1646 * bindings/runtime.cpp:
1647 (Instance::setDidExecuteFunction):
1648 (Instance::didExecuteFunction):
1649 (Instance::setValueOfField):
1650 * bindings/runtime.h:
1651 * bindings/testbindings.mm:
1652 (+[MyFirstInterface webScriptNameForSelector:]):
1653 (-[MyFirstInterface callJSObject::]):
1655 2004-05-14 Vicki Murley <vicki@apple.com>
1659 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
1661 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
1665 2004-05-13 Richard Williamson <rjw@apple.com>
1672 * bindings/objc/WebScriptObject.h:
1674 2004-05-13 Richard Williamson <rjw@apple.com>
1676 Approved API changes. Currently unimplemented.
1681 * JavaScriptCore.pbproj/project.pbxproj:
1682 * bindings/objc/WebScriptObject.h: Added.
1683 * bindings/objc/WebScriptObject.mm: Added.
1684 (+[WebScriptObject throwException:]):
1685 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1686 (-[WebScriptObject evaluateWebScript:]):
1687 (-[WebScriptObject stringRepresentation]):
1688 (+[WebUndefined undefined]):
1689 (-[WebUndefined initWithCoder:]):
1690 (-[WebUndefined encodeWithCoder:]):
1691 (-[WebUndefined copyWithZone:]):
1693 2004-05-07 Vicki Murley <vicki@apple.com>
1697 Turn off GC since it uses ppc only instructions (which breaks
1700 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
1704 2004-05-07 Maciej Stachowiak <mjs@apple.com>
1708 - add -funroll-loops=16 compiler option for approx .5% speedup on
1709 HTML iBench and .5-1% speedup on JS iBench.
1711 * JavaScriptCore.pbproj/project.pbxproj:
1713 2004-04-25 Maciej Stachowiak <mjs@apple.com>
1717 Enable full conservative GC mode in addition to test mode. When
1718 conservative GC is enabled, we now get an 11% speed improvement on
1719 the iBench. Also fix some spots I missed before.
1721 Specific noteworth changes:
1723 * kjs/collector.cpp:
1724 (KJS::Collector::markStackObjectsConservatively): Check possible
1725 cell pointers for 8-byte aligment and verify they are not 0.
1727 * kjs/protected_values.cpp:
1728 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
1729 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
1731 (KJS::gcProtectNullTolerant): ...to here...
1732 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
1733 tolerance, and doing the check is expensive.
1735 * kjs/protected_values.cpp:
1736 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
1737 that is still very good.
1742 (KJS::ProtectedValue::ProtectedValue):
1743 (KJS::ProtectedValue::~ProtectedValue):
1744 (KJS::ProtectedValue::operator=):
1745 (KJS::ProtectedObject::ProtectedObject):
1746 (KJS::ProtectedObject::~ProtectedObject):
1747 (KJS::ProtectedObject::operator=):
1748 (KJS::ProtectedReference::ProtectedReference):
1749 (KJS::ProtectedReference::~ProtectedReference):
1750 (KJS::ProtectedReference::operator=):
1751 * kjs/protected_values.cpp:
1752 (KJS::ProtectedValues::getProtectCount):
1753 (KJS::ProtectedValues::increaseProtectCount):
1754 (KJS::ProtectedValues::decreaseProtectCount):
1755 (KJS::ProtectedValues::computeHash):
1756 * bindings/runtime_root.cpp:
1757 (KJS::Bindings::addNativeReference):
1758 (KJS::Bindings::removeNativeReference):
1759 (RootObject::removeAllNativeReferences):
1760 * bindings/runtime_root.h:
1761 (KJS::Bindings::RootObject::~RootObject):
1762 (KJS::Bindings::RootObject::setRootObjectImp):
1763 * kjs/collector.cpp:
1764 (KJS::Collector::allocate):
1765 (KJS::Collector::collect):
1768 (NumberImp::create):
1769 (InterpreterImp::globalInit):
1770 (InterpreterImp::globalClear):
1771 (InterpreterImp::mark):
1773 (KJS::List::derefValues):
1774 (KJS::List::refValues):
1775 (KJS::List::append):
1777 (KJS::ObjectImp::setInternalValue):
1778 (KJS::ObjectImp::putDirect):
1783 (KJS::ValueImp::ValueImp):
1784 (KJS::ValueImp::~ValueImp):
1786 (KJS::Value::Value):
1787 (KJS::Value::~Value):
1788 (KJS::Value::operator=):
1790 2004-04-30 Richard Williamson <rjw@apple.com>
1792 Asking an NSInvocation for it's return value when return type
1793 is void throws an exception. Added check for void return types
1794 to avoid this exception.
1798 * bindings/objc/objc_instance.mm:
1799 (ObjcInstance::invokeMethod):
1801 2004-04-29 Richard Williamson <rjw@apple.com>
1803 Fixed several bad problems with the ObjC bindings. In particular, conversion
1804 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
1808 * bindings/objc/objc_jsobject.h:
1809 * bindings/objc/objc_jsobject.mm:
1810 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
1811 (-[JavaScriptObject KJS::]):
1812 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1813 (-[JavaScriptObject call:arguments:]):
1814 (-[JavaScriptObject evaluate:]):
1815 (-[JavaScriptObject getMember:]):
1816 (-[JavaScriptObject getSlot:]):
1817 * bindings/objc/objc_runtime.mm:
1818 (ObjcField::valueFromInstance):
1819 (ObjcField::setValueToInstance):
1820 * bindings/objc/objc_utility.mm:
1821 (KJS::Bindings::convertValueToObjcValue):
1822 (KJS::Bindings::convertObjcValueToValue):
1823 * bindings/runtime.h:
1824 * bindings/runtime_root.cpp:
1825 (KJS::Bindings::rootForInterpreter):
1826 (KJS::Bindings::addNativeReference):
1827 (KJS::Bindings::removeNativeReference):
1828 * bindings/runtime_root.h:
1829 * bindings/testbindings.mm:
1830 (-[MyFirstInterface logMessage:]):
1831 (-[MyFirstInterface setJSObject:]):
1832 (-[MyFirstInterface callJSObject::]):
1834 2004-04-24 Darin Adler <darin@apple.com>
1838 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
1841 2004-04-23 Maciej Stachowiak <mjs@apple.com>
1845 Implementation of conservative GC, based partly on code from
1846 Darin. It's turned off for now, so it shouldn't have any effect on
1849 * JavaScriptCore.pbproj/project.pbxproj:
1850 * kjs/collector.cpp:
1851 (KJS::Collector::markStackObjectsConservatively):
1852 (KJS::Collector::markProtectedObjects):
1853 (KJS::Collector::collect):
1858 * kjs/protected_values.cpp: Added.
1859 (KJS::ProtectedValues::getProtectCount):
1860 (KJS::ProtectedValues::increaseProtectCount):
1861 (KJS::ProtectedValues::insert):
1862 (KJS::ProtectedValues::decreaseProtectCount):
1863 (KJS::ProtectedValues::expand):
1864 (KJS::ProtectedValues::shrink):
1865 (KJS::ProtectedValues::rehash):
1866 (KJS::ProtectedValues::computeHash):
1867 * kjs/protected_values.h: Added.
1869 (ValueImp::useConservativeMark):
1877 2004-04-22 Richard Williamson <rjw@apple.com>
1879 Fixed build snafu (re-declaration of NPBool in npruntime.h and
1882 * bindings/npruntime.h:
1884 2004-04-22 Richard Williamson <rjw@apple.com>
1886 Updated plugin binding API to reflect latest revision from
1889 Biggest change is the introduction of NPVariant used to represent
1890 value types. NPVariant replaces the use of NPObject for the
1891 exchange of values between scripting environment and native code.
1895 * JavaScriptCore.pbproj/project.pbxproj:
1896 * bindings/NP_jsobject.cpp:
1897 (identiferFromNPIdentifier):
1903 (NPN_GetPropertyAtIndex):
1904 (NPN_SetPropertyAtIndex):
1905 * bindings/c/c_class.cpp:
1906 (CClass::methodsNamed):
1907 (CClass::fieldNamed):
1908 * bindings/c/c_instance.cpp:
1909 (CInstance::invokeMethod):
1910 (CInstance::defaultValue):
1911 * bindings/c/c_runtime.cpp:
1912 (CField::valueFromInstance):
1913 (CField::setValueToInstance):
1914 * bindings/c/c_utility.cpp:
1915 (convertNPStringToUTF16):
1916 (convertUTF8ToUTF16):
1917 (coerceValueToNPVariantStringType):
1918 (convertValueToNPVariant):
1919 (convertNPVariantToValue):
1920 * bindings/c/c_utility.h:
1921 * bindings/npruntime.cpp:
1922 (NPN_GetIdentifier):
1923 (NPN_GetIdentifiers):
1924 (NPN_UTF8FromIdentifier):
1925 (NPN_VariantIsVoid):
1926 (NPN_VariantIsNull):
1927 (NPN_VariantIsUndefined):
1928 (NPN_VariantIsBool):
1929 (NPN_VariantIsInt32):
1930 (NPN_VariantIsDouble):
1931 (NPN_VariantIsString):
1932 (NPN_VariantIsObject):
1933 (NPN_VariantToBool):
1934 (NPN_VariantToString):
1935 (NPN_VariantToInt32):
1936 (NPN_VariantToDouble):
1937 (NPN_VariantToObject):
1938 (NPN_InitializeVariantAsVoid):
1939 (NPN_InitializeVariantAsNull):
1940 (NPN_InitializeVariantAsUndefined):
1941 (NPN_InitializeVariantWithBool):
1942 (NPN_InitializeVariantWithInt32):
1943 (NPN_InitializeVariantWithDouble):
1944 (NPN_InitializeVariantWithString):
1945 (NPN_InitializeVariantWithStringCopy):
1946 (NPN_InitializeVariantWithObject):
1947 (NPN_InitializeVariantWithVariant):
1948 (NPN_ReleaseVariantValue):
1951 (NPN_ReleaseObject):
1952 (NPN_IsKindOfClass):
1953 (NPN_SetExceptionWithUTF8):
1955 * bindings/npruntime.h:
1957 (_NPString::_NPVariant::):
1958 * bindings/testbindings.cpp:
1973 2004-04-22 Darin Adler <darin@apple.com>
1977 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
1980 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
1981 Was resulting in a buffer 2x the needed size.
1982 (KJS::UString::expandPreCapacity): Ditto.
1983 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
1985 2004-04-21 Maciej Stachowiak <mjs@apple.com>
1989 Preliminary change for conservative GC. Create "protected"
1990 subclasses to GC-protect objects when on heap, since we will soon
1991 remove the built-in refcounting of the normal wrapper classes. Use
1994 * JavaScriptCore.pbproj/project.pbxproj:
1997 (KJS::InterpreterImp::globalObject):
1998 * kjs/interpreter.h:
1999 * kjs/property_map.cpp:
2001 * kjs/reference_list.cpp:
2003 2004-04-19 Maciej Stachowiak <mjs@apple.com>
2007 Optimize prepend using the shared substring optimization. Also,
2008 limit the applicability of shared append and shared prepend. If
2009 you overdo it, it does more harm than good, because you create a
2010 bunch of strings that are disqualified from future shared
2011 append/prepend, for not much immediate savings in allocate/copy
2016 (KJS::UString::Rep::create):
2017 (KJS::UString::expandedSize):
2018 (KJS::UString::usedPreCapacity):
2019 (KJS::UString::expandCapacity):
2020 (KJS::UString::expandPreCapacity):
2021 (KJS::UString::UString):
2022 (KJS::UString::append):
2023 (KJS::UString::operator=):
2025 (KJS::UString::Rep::data):
2027 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2028 Reviewed by Richard.
2030 No more need for Completion or Reference to privately inherit from
2031 Value, none of the superclass functionality is used.
2038 2004-04-16 Richard Williamson <rjw@apple.com>
2040 Added interpreter lock protection around object creation.
2044 * bindings/runtime.cpp:
2045 (Instance::createRuntimeObject):
2047 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2051 Another JavaScript speed improvement: use the mechanism from
2052 string append optimization to make taking a substring fast, again
2055 A further 22% improvement on the 24fun string speed test.
2059 (KJS::UString::Rep::create):
2060 (KJS::UString::UString):
2061 (KJS::UString::append):
2062 (KJS::UString::operator=):
2063 (KJS::UString::substr):
2065 (KJS::UString::Rep::data):
2067 2004-04-13 Maciej Stachowiak <mjs@apple.com>
2071 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
2072 - fixed <rdar://problem/3600691>: Table generation test is really slow
2073 - fixed <rdar://problem/3600661>: 24fun date test is really slow
2075 80% speedup on the string test, lesser speedups on the other two.
2077 Two different optimizations here:
2079 1) Avoid large overhead of scanning strings to see if they are all
2080 ASCII before numeric conversion.
2083 (AssignNode::evaluate): Don't convert to integer until we know for
2084 sure the operation will need it. Attempting to convert strings to
2085 numbers is a waste when they are being appended with +=.
2087 2) Avoid huge cost of appending strings.
2089 This is done by allowing multiple strings to share a buffer but
2090 actually use different ranges of it. The first time a string is
2091 appended to, we start leaving at least 10% extra space in the
2092 buffer, so doing N appends to the same string takes O(log N)
2093 mallocs instead of O(N).
2095 * kjs/identifier.cpp:
2096 (KJS::Identifier::equal):
2097 (KJS::Identifier::add):
2100 (KJS::UCharReference::operator=):
2101 (KJS::UCharReference::ref):
2102 (KJS::UString::Rep::create):
2103 (KJS::UString::Rep::destroy):
2104 (KJS::UString::expandedSize):
2105 (KJS::UString::usedCapacity):
2106 (KJS::UString::expandCapacity):
2107 (KJS::UString::UString):
2108 (KJS::UString::null):
2109 (KJS::UString::append):
2110 (KJS::UString::operator=):
2111 (KJS::UString::toStrictUInt32):
2112 (KJS::UString::detach):
2113 (KJS::KJS::operator==):
2115 (KJS::UString::Rep::data):
2116 (KJS::UString::Rep::hash):
2118 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2122 - fix deployment build by avoiding deployment-only warning.
2124 * kjs/scope_chain.cpp:
2125 (KJS::ScopeChain::bottom):
2127 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2131 Changed things so that newly created objects get a prototype based
2132 on the scope chain of the current function, rather than the
2133 interpreter that started execution. This fixes the following bugs:
2135 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
2136 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
2138 * JavaScriptCore.pbproj/project.pbxproj:
2139 * kjs/array_object.cpp:
2140 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2141 (ArrayProtoFuncImp::ArrayProtoFuncImp):
2142 (ArrayProtoFuncImp::call):
2143 (ArrayObjectImp::construct):
2144 * kjs/bool_object.cpp:
2145 (BooleanObjectImp::construct):
2146 * kjs/date_object.cpp:
2147 (DateProtoFuncImp::DateProtoFuncImp):
2148 (DateProtoFuncImp::call):
2149 (DateObjectImp::construct):
2150 * kjs/error_object.cpp:
2151 (ErrorObjectImp::construct):
2153 (FunctionImp::FunctionImp):
2154 (FunctionImp::call):
2155 (DeclaredFunctionImp::construct):
2156 (ArgumentsImp::ArgumentsImp):
2157 (GlobalFuncImp::call):
2158 * kjs/function_object.cpp:
2159 (FunctionProtoFuncImp::call):
2160 (FunctionObjectImp::construct):
2162 (BooleanImp::toObject):
2163 (StringImp::toObject):
2164 (NumberImp::toObject):
2165 (InterpreterImp::InterpreterImp):
2166 (InterpreterImp::clear):
2167 (InterpreterImp::interpreterWithGlobalObject):
2169 * kjs/interpreter.cpp:
2170 (ExecState::lexicalInterpreter):
2171 * kjs/interpreter.h:
2172 (KJS::ExecState::dynamicInterpreter):
2173 (KJS::ExecState::interpreter):
2174 * kjs/math_object.cpp:
2175 (MathFuncImp::MathFuncImp):
2177 (StatementNode::hitStatement):
2178 (StatementNode::abortStatement):
2179 (RegExpNode::evaluate):
2180 (ElementNode::evaluate):
2181 (ArrayNode::evaluate):
2182 (ObjectLiteralNode::evaluate):
2183 (PropertyValueNode::evaluate):
2184 (FunctionCallNode::evaluate):
2185 (FuncDeclNode::processFuncDecl):
2186 (FuncExprNode::evaluate):
2187 * kjs/number_object.cpp:
2188 (NumberObjectImp::construct):
2190 (KJS::ObjectImp::defaultValue):
2191 (KJS::Error::create):
2192 * kjs/object_object.cpp:
2193 (ObjectObjectImp::construct):
2194 * kjs/reference.cpp:
2195 (Reference::putValue):
2196 * kjs/regexp_object.cpp:
2197 (RegExpProtoFuncImp::call):
2198 (RegExpObjectImp::arrayOfMatches):
2199 (RegExpObjectImp::construct):
2200 * kjs/scope_chain.cpp:
2201 (KJS::ScopeChain::bottom):
2202 * kjs/scope_chain.h:
2203 * kjs/string_object.cpp:
2204 (StringProtoFuncImp::StringProtoFuncImp):
2205 (StringProtoFuncImp::call):
2206 (StringObjectImp::construct):
2212 2004-03-31 Richard Williamson <rjw@apple.com>
2214 Tedious renames based on feedback from plugin-futures list.
2215 NP_ functions are renamed with NPN_ prefix.
2216 Types prefix renamed from NP_ to NP.
2217 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
2219 No review because this was just a renaming patch.
2221 * bindings/NP_jsobject.cpp:
2224 (identiferFromNPIdentifier):
2229 (NPN_RemoveProperty):
2231 (NPN_GetPropertyAtIndex):
2232 (NPN_SetPropertyAtIndex):
2233 * bindings/NP_jsobject.h:
2234 * bindings/c/c_class.cpp:
2235 (CClass::_commonInit):
2236 (CClass::classForIsA):
2238 (CClass::methodsNamed):
2239 (CClass::fieldNamed):
2240 * bindings/c/c_class.h:
2241 * bindings/c/c_instance.cpp:
2242 (CInstance::CInstance):
2243 (CInstance::~CInstance):
2244 (CInstance::operator=):
2245 (CInstance::invokeMethod):
2246 (CInstance::defaultValue):
2247 * bindings/c/c_instance.h:
2248 (KJS::Bindings::CInstance::getObject):
2249 * bindings/c/c_runtime.cpp:
2250 (CField::valueFromInstance):
2251 (CField::setValueToInstance):
2252 * bindings/c/c_runtime.h:
2253 (KJS::Bindings::CField::CField):
2254 (KJS::Bindings::CField::name):
2255 (KJS::Bindings::CMethod::CMethod):
2256 (KJS::Bindings::CMethod::name):
2257 * bindings/c/c_utility.cpp:
2258 (coerceValueToNPString):
2259 (convertValueToNPValueType):
2260 (convertNPValueTypeToValue):
2261 * bindings/c/c_utility.h:
2262 * bindings/npruntime.cpp:
2263 (NPN_IdentifierFromUTF8):
2264 (NPN_IsValidIdentifier):
2265 (NPN_GetIdentifiers):
2266 (NPN_UTF8FromIdentifier):
2269 (NPN_ReleaseObject):
2270 (NPN_IsKindOfClass):
2271 (NPN_SetExceptionWithUTF8):
2274 (NPN_CreateNumberWithInt):
2275 (NPN_CreateNumberWithFloat):
2276 (NPN_CreateNumberWithDouble):
2277 (NPN_IntFromNumber):
2278 (NPN_FloatFromNumber):
2279 (NPN_DoubleFromNumber):
2281 (NPN_CreateStringWithUTF8):
2282 (NPN_CreateStringWithUTF16):
2283 (NPN_DeallocateUTF8):
2284 (NPN_UTF8FromString):
2285 (NPN_UTF16FromString):
2288 (NPN_CreateBoolean):
2289 (NPN_BoolFromBoolean):
2292 (undefinedAllocate):
2298 (NPN_ObjectAtIndex):
2299 * bindings/npruntime.h:
2300 * bindings/runtime.cpp:
2301 (Instance::createBindingForLanguageInstance):
2302 * bindings/testbindings.cpp:
2303 (initializeIdentifiers):
2323 2004-03-31 Richard Williamson <rjw@apple.com>
2325 Changed references to NP_runtime.h to npruntime.h
2327 * JavaScriptCore.pbproj/project.pbxproj:
2328 * bindings/NP_jsobject.h:
2329 * bindings/c/c_class.h:
2330 * bindings/c/c_instance.h:
2331 * bindings/c/c_runtime.h:
2332 * bindings/c/c_utility.h:
2333 * bindings/npruntime.cpp:
2335 2004-03-31 Richard Williamson <rjw@apple.com>
2337 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2339 * JavaScriptCore.pbproj/project.pbxproj:
2340 * bindings/NP_jsobject.h:
2341 * bindings/npruntime.cpp:
2345 2004-03-23 Richard Williamson <rjw@apple.com>
2347 Added implementation of KJS::Value <-> NP_Object conversion functions.
2348 Augmented test program for 'C' bindings.
2349 Added asserts and parameter checking to all public API.
2353 * JavaScriptCore.pbproj/project.pbxproj:
2354 * bindings/NP_jsobject.cpp:
2356 * bindings/NP_jsobject.h: Added.
2357 * bindings/NP_runtime.cpp:
2358 (NP_IdentifierFromUTF8):
2359 (NP_IsValidIdentifier):
2360 (NP_GetIdentifiers):
2365 (NP_SetExceptionWithUTF8):
2368 (NP_FloatFromNumber):
2369 (NP_DoubleFromNumber):
2370 (NP_CreateStringWithUTF8):
2371 (NP_CreateStringWithUTF16):
2372 (NP_DeallocateUTF8):
2373 (NP_UTF8FromString):
2374 (NP_UTF16FromString):
2376 (NP_BoolFromBoolean):
2377 * bindings/NP_runtime.h:
2378 * bindings/c/c_instance.cpp:
2379 (CInstance::invokeMethod):
2380 * bindings/c/c_utility.cpp:
2381 (coerceValueToNPString):
2382 (convertValueToNPValueType):
2383 (convertNPValueTypeToValue):
2384 * bindings/c/c_utility.h:
2386 * bindings/testC.js: Added.
2387 * bindings/testbindings.cpp:
2397 (myInterfaceInvoke):
2398 (myInterfaceAllocate):
2402 2004-03-19 Darin Adler <darin@apple.com>
2406 - fixed problem with methods like setUTCHour
2408 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2409 GMT vs. local time function based on the utc flag.
2411 2004-03-17 Richard Williamson <rjw@apple.com>
2413 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
2417 * bindings/NP_jsobject.cpp:
2422 (NP_GetPropertyAtIndex):
2423 * bindings/NP_runtime.h:
2425 2004-03-16 Richard Williamson <rjw@apple.com>
2427 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.
2431 * bindings/jni/jni_class.cpp:
2432 (JavaClass::methodsNamed):
2434 2004-03-15 Richard Williamson <rjw@apple.com>
2436 Fixed 3570854. Don't attempt to convert Null to strings. We
2437 were incorrectly converting to "Null".
2439 Actually fixed by Scott Kovatch.
2441 Reviewed by Richard.
2443 * bindings/jni/jni_utility.cpp:
2444 (KJS::Bindings::convertValueToJValue):
2448 2004-03-11 Richard Williamson <rjw@apple.com>
2450 Stitched together the NP stuff to our language independent
2451 JavaScript binding stuff. Very close to being done.
2453 Added program to test C bindings (and NP stuff). Just tests
2454 properties. Will add methods and JavaScript access, etc.
2456 Updated Makefile.am to account for new bindings/c directory.
2458 Change NP_UTF8 from "const char *" to "char" to allow for
2459 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
2462 Added NP_IsValidIdentifier().
2466 * JavaScriptCore.pbproj/project.pbxproj:
2468 * bindings/NP_jsobject.cpp:
2469 (identiferFromNPIdentifier):
2471 * bindings/NP_runtime.cpp:
2472 (NP_IdentifierFromUTF8):
2473 (NP_IsValidIdentifier):
2474 (NP_GetIdentifiers):
2475 (NP_UTF8FromIdentifier):
2476 (NP_SetExceptionWithUTF8):
2478 (NP_CreateStringWithUTF8):
2479 (NP_CreateStringWithUTF16):
2480 (NP_UTF8FromString):
2481 (NP_UTF16FromString):
2482 * bindings/NP_runtime.h:
2483 * bindings/c/c_class.cpp: Added.
2484 (CClass::_commonDelete):
2485 (CClass::_commonCopy):
2486 (CClass::_commonInit):
2487 (_createClassesByIsAIfNecessary):
2488 (CClass::classForIsA):
2491 (CClass::methodsNamed):
2492 (CClass::fieldNamed):
2493 * bindings/c/c_class.h: Added.
2494 (KJS::Bindings::CClass::~CClass):
2495 (KJS::Bindings::CClass::CClass):
2496 (KJS::Bindings::CClass::operator=):
2497 (KJS::Bindings::CClass::constructorAt):
2498 (KJS::Bindings::CClass::numConstructors):
2499 * bindings/c/c_instance.cpp: Added.
2500 (CInstance::CInstance):
2501 (CInstance::~CInstance):
2502 (CInstance::operator=):
2503 (CInstance::getClass):
2506 (CInstance::invokeMethod):
2507 (CInstance::defaultValue):
2508 (CInstance::stringValue):
2509 (CInstance::numberValue):
2510 (CInstance::booleanValue):
2511 (CInstance::valueOf):
2512 * bindings/c/c_instance.h: Added.
2513 (KJS::Bindings::CInstance::getObject):
2514 * bindings/c/c_runtime.cpp: Added.
2515 (CField::valueFromInstance):
2516 (CField::setValueToInstance):
2517 * bindings/c/c_runtime.h: Added.
2518 (KJS::Bindings::CField::CField):
2519 (KJS::Bindings::CField::name):
2520 (KJS::Bindings::CField::type):
2521 (KJS::Bindings::CMethod::CMethod):
2522 (KJS::Bindings::CMethod::name):
2523 (KJS::Bindings::CMethod::numParameters):
2524 * bindings/c/c_utility.cpp: Added.
2525 (coerceValueToNPValueType):
2526 (convertValueToNPValueType):
2527 (convertNPValueTypeToValue):
2528 * bindings/c/c_utility.h: Added.
2529 * bindings/make_testbindings:
2530 * bindings/runtime.cpp:
2531 (Instance::createBindingForLanguageInstance):
2532 * bindings/runtime.h:
2533 (KJS::Bindings::Instance::):
2534 * bindings/testbindings.cpp: Added.
2535 (initializeIdentifiers):
2536 (myInterfaceHasProperty):
2537 (myInterfaceHasMethod):
2538 (myInterfaceGetProperty):
2539 (myInterfaceSetProperty):
2540 (myInterfaceInvoke):
2541 (myInterfaceAllocate):
2542 (myInterfaceInvalidate):
2543 (myInterfaceDeallocate):
2544 (GlobalImp::className):
2545 (readJavaScriptFromFile):
2548 2004-03-10 Richard Williamson <rjw@apple.com>
2550 Made changes to support new asychronous approach to calls from
2551 plugin to JavaScript
2555 * bindings/NP_jsobject.cpp:
2560 (NP_GetPropertyAtIndex):
2561 * bindings/NP_runtime.h:
2562 * bindings/make_testbindings:
2563 * bindings/runtime.cpp:
2564 (Instance::createBindingForLanguageInstance):
2566 2004-03-10 Richard Williamson <rjw@apple.com>
2568 Updated header to include proposed changes from
2569 plugin-futures list. Calls from plugin to JavaScript
2570 are now asynchronous.
2574 * bindings/NP_runtime.h:
2578 2004-03-04 Richard Williamson <rjw@apple.com>
2580 Implementation of NP_JavaScriptObject. This is the 'C' class
2581 that wraps a JavaScript object.
2585 * JavaScriptCore.pbproj/project.pbxproj:
2586 * bindings/NP_jsobject.cpp: Added.
2587 (coerceValueToNPValueType):
2588 (convertValueToNPValueType):
2589 (convertNPValueTypeToValue):
2593 (identiferFromNPIdentifier):
2598 (NP_RemoveProperty):
2600 (NP_GetPropertyAtIndex):
2601 (NP_SetPropertyAtIndex):
2602 * bindings/NP_runtime.cpp:
2604 * bindings/NP_runtime.h:
2605 * bindings/runtime_object.h:
2607 2004-03-04 Richard Williamson <rjw@apple.com>
2609 Added NP_Array implementation.
2611 Changed NP_Boolean to just depend on two static instances, no
2612 space is required for values.
2616 * bindings/NP_runtime.cpp:
2618 (NP_BoolFromBoolean):
2624 * bindings/NP_runtime.h:
2626 2004-03-03 Darin Adler <darin@apple.com>
2630 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
2631 copyright string, and that's all that was in here.
2632 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
2634 2004-03-03 Richard Williamson <rjw@apple.com>
2636 More 'C' binding implementation. Fleshed out all the
2637 'primitive' data types.
2641 * bindings/NP_runtime.cpp:
2646 (NP_CreateStringWithUTF8):
2647 (NP_CreateStringWithUTF16):
2648 (NP_UTF8FromString):
2649 (NP_UTF16FromString):
2652 (booleanDeallocate):
2654 (NP_BoolFromBoolean):
2658 (undefinedAllocate):
2659 (undefinedDeallocate):
2661 * bindings/NP_runtime.h:
2663 2004-03-03 Richard Williamson <rjw@apple.com>
2665 More 'C' binding implementation.
2669 * bindings/NP_runtime.cpp:
2672 (getIdentifierDictionary):
2673 (NP_IdentifierFromUTF8):
2674 (NP_UTF8FromIdentifier):
2679 (NP_CreateNumberWithInt):
2680 (NP_CreateNumberWithFloat):
2681 (NP_CreateNumberWithDouble):
2683 (NP_FloatFromNumber):
2684 (NP_DoubleFromNumber):
2685 * bindings/NP_runtime.h:
2687 2004-03-02 Richard Williamson <rjw@apple.com>
2689 Removed retain/release from NP_Class. Classes will not be allowed to implement their
2690 own customer retain/release scheme.
2694 * bindings/NP_runtime.cpp:
2697 * bindings/NP_runtime.h:
2699 2004-03-02 Richard Williamson <rjw@apple.com>
2701 C binding API. Partial implementation.
2703 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.
2705 Factored root object reference counting scheme. It is now useful independent
2710 * JavaScriptCore.pbproj/project.pbxproj:
2711 * bindings/NP_runtime.cpp: Added.
2712 (NP_IdentifierFromUTF8):
2713 (NP_GetIdentifiers):
2714 (NP_UTF8FromIdentifier):
2724 (NP_RemoveProperty):
2726 (NP_GetPropertyAtIndex):
2727 (NP_SetPropertyAtIndex):
2728 (NP_CreateNumberWithInt):
2729 (NP_CreateNumberWithFloat):
2730 (NP_CreateNumberWithDouble):
2732 (NP_FloatFromNumber):
2733 (NP_DoubleFromNumber):
2734 (NP_CreateStringWithUTF8):
2735 (NP_CreateStringWithUTF16):
2736 (NP_UTF8FromString):
2737 (NP_UTF16FromString):
2739 (NP_BoolFromBoolean):
2745 * bindings/NP_runtime.h: Added.
2746 * bindings/jni/jni_jsobject.cpp:
2748 (JSObject::finalize):
2749 (JSObject::createNative):
2750 (JSObject::convertValueToJObject):
2751 * bindings/jni/jni_jsobject.h:
2752 * bindings/objc/objc_jsobject.h:
2753 * bindings/objc/objc_jsobject.mm:
2755 (windowJavaScriptObject):
2756 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2757 (-[JavaScriptObject dealloc]):
2758 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
2759 (-[JavaScriptObject call:arguments:]):
2760 (-[JavaScriptObject evaluate:]):
2761 (-[JavaScriptObject getMember:]):
2762 (-[JavaScriptObject setMember:value:]):
2763 (-[JavaScriptObject removeMember:]):
2764 (-[JavaScriptObject toString]):
2765 (-[JavaScriptObject getSlot:]):
2766 (-[JavaScriptObject setSlot:value:]):
2767 * bindings/objc/objc_utility.h:
2768 * bindings/objc/objc_utility.mm:
2769 (KJS::Bindings::convertValueToObjcValue):
2770 * bindings/runtime_root.cpp: Added.
2771 (getReferencesByRootDictionary):
2772 (getReferencesDictionary):
2773 (KJS::Bindings::findReferenceDictionary):
2774 (KJS::Bindings::rootForImp):
2775 (KJS::Bindings::addNativeReference):
2776 (KJS::Bindings::removeNativeReference):
2777 (completedJavaScriptAccess):
2778 (initializeJavaScriptAccessLock):
2779 (lockJavaScriptAccess):
2780 (unlockJavaScriptAccess):
2781 (RootObject::dispatchToJavaScriptThread):
2782 (performJavaScriptAccess):
2783 (RootObject::setFindRootObjectForNativeHandleFunction):
2784 (RootObject::removeAllNativeReferences):
2785 * bindings/runtime_root.h: Added.
2786 (KJS::Bindings::RootObject::RootObject):
2787 (KJS::Bindings::RootObject::~RootObject):
2788 (KJS::Bindings::RootObject::setRootObjectImp):
2789 (KJS::Bindings::RootObject::rootObjectImp):
2790 (KJS::Bindings::RootObject::setInterpreter):
2791 (KJS::Bindings::RootObject::interpreter):
2792 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
2793 (KJS::Bindings::RootObject::runLoop):
2794 (KJS::Bindings::RootObject::performJavaScriptSource):
2800 2004-02-18 Richard Williamson <rjw@apple.com>
2802 Added NSNumber/Number conversion.
2804 Removed some unnecessary KJS:: namespace specifiers.
2808 * bindings/objc/objc_utility.mm:
2809 (KJS::Bindings::convertValueToObjcValue):
2810 (KJS::Bindings::convertObjcValueToValue):
2811 * bindings/runtime_array.h:
2813 2004-02-18 Richard Williamson <rjw@apple.com>
2815 Added support for export NSArrays.
2817 Updated valueAt() to take an ExecState so we can throw
2820 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
2821 ObjectiveC classes to control the visibility of their methods in
2826 * bindings/jni/jni_runtime.cpp:
2827 (JavaField::valueFromInstance):
2828 (JavaArray::valueAt):
2829 * bindings/jni/jni_runtime.h:
2830 * bindings/objc/objc_class.mm:
2831 (ObjcClass::methodsNamed):
2832 * bindings/objc/objc_runtime.h:
2833 (KJS::Bindings::ObjcArray::getObjcArray):
2834 * bindings/objc/objc_runtime.mm:
2835 (ObjcField::valueFromInstance):
2836 (ObjcField::setValueToInstance):
2837 (ObjcArray::ObjcArray):
2838 (ObjcArray::~ObjcArray):
2839 (ObjcArray::operator=):
2840 (ObjcArray::setValueAt):
2841 (ObjcArray::valueAt):
2842 (ObjcArray::getLength):
2843 * bindings/objc/objc_utility.mm:
2844 (KJS::Bindings::convertValueToObjcValue):
2845 (KJS::Bindings::convertObjcValueToValue):
2846 * bindings/runtime.cpp:
2847 (Instance::getValueOfField):
2848 * bindings/runtime.h:
2849 * bindings/runtime_array.cpp:
2850 (RuntimeArrayImp::get):
2851 * bindings/runtime_object.cpp:
2852 (RuntimeObjectImp::get):
2854 2004-02-17 Richard Williamson <rjw@apple.com>
2856 Added String <-> NSString conversion.
2857 Added tests of String <-> NSString conversion to test program.
2861 * bindings/objc/objc_utility.mm:
2862 (KJS::Bindings::convertValueToObjcValue):
2863 (KJS::Bindings::convertObjcValueToValue):
2865 * bindings/testbindings.mm:
2866 (-[MyFirstInterface getString]):
2868 2004-02-15 Darin Adler <darin@apple.com>
2872 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
2873 and removing redundant settings of things that match defaults in other build styles.
2875 2004-02-13 Richard Williamson <rjw@apple.com>
2877 Work towards the JavaScript ObjC bindings. The bindings now work for
2878 simple scalar types. testbindings.mm is an illustration of how the
2883 * JavaScriptCore.pbproj/project.pbxproj:
2885 * bindings/jni/jni_class.cpp:
2886 (JavaClass::methodsNamed):
2887 * bindings/jni/jni_class.h:
2888 * bindings/jni/jni_instance.cpp:
2889 (JavaInstance::invokeMethod):
2890 * bindings/jni/jni_instance.h:
2891 * bindings/jni/jni_runtime.h:
2892 (KJS::Bindings::JavaMethod::returnType):
2893 * bindings/make_testbindings: Added.
2894 * bindings/objc/objc_class.h: Added.
2895 (KJS::Bindings::ObjcClass::~ObjcClass):
2896 (KJS::Bindings::ObjcClass::ObjcClass):
2897 (KJS::Bindings::ObjcClass::operator=):
2898 (KJS::Bindings::ObjcClass::constructorAt):
2899 (KJS::Bindings::ObjcClass::numConstructors):
2900 * bindings/objc/objc_class.mm: Added.
2901 (ObjcClass::_commonDelete):
2902 (ObjcClass::_commonCopy):
2903 (ObjcClass::_commonInit):
2904 (_createClassesByIsAIfNecessary):
2905 (ObjcClass::classForIsA):
2906 (ObjcClass::ObjcClass):
2908 (ObjcClass::methodsNamed):
2909 (ObjcClass::fieldNamed):
2910 * bindings/objc/objc_header.h: Added.
2911 * bindings/objc/objc_instance.h: Added.
2912 (KJS::Bindings::ObjcInstance::getObject):
2913 * bindings/objc/objc_instance.mm: Added.
2914 (ObjcInstance::ObjcInstance):
2915 (ObjcInstance::~ObjcInstance):
2916 (ObjcInstance::operator=):
2917 (ObjcInstance::begin):
2918 (ObjcInstance::end):
2919 (ObjcInstance::getClass):
2920 (ObjcInstance::invokeMethod):
2921 (ObjcInstance::defaultValue):
2922 (ObjcInstance::stringValue):
2923 (ObjcInstance::numberValue):
2924 (ObjcInstance::booleanValue):
2925 (ObjcInstance::valueOf):
2926 * bindings/objc/objc_jsobject.h: Added.
2927 * bindings/objc/objc_jsobject.mm: Added.
2928 * bindings/objc/objc_runtime.h:
2929 (KJS::Bindings::ObjcField::~ObjcField):
2930 (KJS::Bindings::ObjcField::ObjcField):
2931 (KJS::Bindings::ObjcField::operator=):
2932 (KJS::Bindings::ObjcMethod::ObjcMethod):
2933 (KJS::Bindings::ObjcMethod::~ObjcMethod):
2934 (KJS::Bindings::ObjcMethod::operator=):
2935 * bindings/objc/objc_runtime.mm: Added.
2936 (ObjcMethod::ObjcMethod):
2938 (ObjcMethod::numParameters):
2939 (ObjcMethod::getMethodSignature):
2940 (ObjcField::ObjcField):
2943 (ObjcField::valueFromInstance):
2944 (ObjcField::setValueToInstance):
2945 * bindings/objc/objc_utility.h: Added.
2947 * bindings/objc/objc_utility.mm: Added.
2948 (KJS::Bindings::JSMethodNameToObjCMethodName):
2949 (KJS::Bindings::convertValueToObjcValue):
2950 (KJS::Bindings::convertObjcValueToValue):
2951 (KJS::Bindings::objcValueTypeForType):
2952 * bindings/runtime.cpp:
2953 (MethodList::MethodList):
2954 (MethodList::operator=):
2955 (Instance::setValueOfField):
2956 (Instance::createBindingForLanguageInstance):
2957 (Instance::createRuntimeObject):
2958 * bindings/runtime.h:
2959 * bindings/runtime_method.cpp:
2960 (RuntimeMethodImp::RuntimeMethodImp):
2961 (RuntimeMethodImp::get):
2962 (RuntimeMethodImp::call):
2963 * bindings/runtime_method.h:
2964 * bindings/runtime_object.cpp:
2965 (RuntimeObjectImp::get):
2966 (RuntimeObjectImp::hasProperty):
2967 * bindings/test.js: Added.
2968 * bindings/testbindings.mm: Added.
2969 (-[MySecondInterface init]):
2970 (-[MyFirstInterface init]):
2971 (-[MyFirstInterface dealloc]):
2972 (+[MyFirstInterface JavaScriptNameForSelector:]):
2973 (-[MyFirstInterface getInt]):
2974 (-[MyFirstInterface setInt:]):
2975 (-[MyFirstInterface getMySecondInterface]):
2976 (-[MyFirstInterface logMessage:]):
2977 (GlobalImp::className):
2978 (readJavaScriptFromFile):
2983 2004-02-08 Darin Adler <darin@apple.com>
2987 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
2989 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
2990 macros from working right in C++ code that uses the <cctype> header.
2993 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
2994 (KJS::UTF8SequenceLengthNonASCII): Added.
2995 (KJS::inlineUTF8SequenceLength): Added.
2996 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
2997 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
2998 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
2999 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3000 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3002 - fixed the test program so it won't hit the interpreter lock assertion
3004 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
3008 2004-02-06 Richard Williamson <rjw@apple.com>
3010 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.
3014 * bindings/jni/jni_jsobject.cpp:
3015 (JSObject::toString):
3016 * bindings/jni/jni_utility.cpp:
3017 (KJS::Bindings::convertValueToJValue):
3019 2004-02-02 Darin Adler <darin@apple.com>
3023 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
3025 * kjs/array_object.cpp:
3026 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
3027 we start putting values in. This prevents new Array(2147483647) from causing trouble.
3028 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
3029 number is out of range. This prevents new Array(-1) from causing trouble.
3031 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
3033 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
3034 casting to int. Results now match those in other browsers.
3036 2004-02-02 Darin Adler <darin@apple.com>
3040 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
3041 - fixed other related overflow issues
3043 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
3045 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
3046 must not restrict values to the range of a particular integer type.
3047 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
3048 proper handling for negative results from fmod.
3049 (ValueImp::toUInt32): Ditto.
3050 (ValueImp::toUInt16): Ditto.
3051 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
3053 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
3054 out-of-integer-range values better in the slice function.
3055 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
3056 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
3057 out-of-integer-range values better in the toString function.
3058 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
3059 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
3060 and substr functions.
3064 2004-01-30 Richard Williamson <rjw@apple.com>
3066 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
3070 * bindings/jni/jni_instance.cpp:
3071 (JavaInstance::stringValue):
3073 2004-01-26 Darin Adler <darin@apple.com>
3075 * Makefile.am: Switch from pbxbuild to xcodebuild.
3077 2004-01-22 Richard Williamson <rjw@apple.com>
3079 Added stubs for ObjC language binding to JavaScript.
3081 * JavaScriptCore.pbproj/project.pbxproj:
3082 * bindings/jni/jni_runtime.h:
3083 * bindings/objc/objc_runtime.h: Added.
3084 (KJS::Bindings::ObjcParameter::ObjcParameter):
3085 (KJS::Bindings::ObjcParameter::~ObjcParameter):
3086 (KJS::Bindings::ObjcParameter::operator=):
3087 (KJS::Bindings::ObjcParameter::type):
3088 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
3089 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
3090 (KJS::Bindings::ObjcConstructor::_commonCopy):
3091 (KJS::Bindings::ObjcConstructor::operator=):
3092 (KJS::Bindings::ObjcConstructor::value):
3093 (KJS::Bindings::ObjcConstructor::parameterAt):
3094 (KJS::Bindings::ObjcConstructor::numParameters):
3095 (KJS::Bindings::ObjcField::ObjcField):
3096 (KJS::Bindings::ObjcField::~ObjcField):
3097 * bindings/runtime.h:
3099 2004-01-22 Richard Williamson <rjw@apple.com>
3101 Simplified JavaString by using UString as backing store. This
3102 revealed a bug in CString's assignment operator which I fixed.
3104 Removed some dead code.
3108 * bindings/jni/jni_runtime.h:
3109 (KJS::Bindings::JavaString::JavaString):
3110 (KJS::Bindings::JavaString::_commonInit):
3111 (KJS::Bindings::JavaString::UTF8String):
3112 (KJS::Bindings::JavaString::uchars):
3113 (KJS::Bindings::JavaString::length):
3114 (KJS::Bindings::JavaString::ustring):
3115 * bindings/runtime_object.cpp:
3116 (RuntimeObjectImp::RuntimeObjectImp):
3117 * bindings/runtime_object.h:
3119 (KJS::CString::CString):
3120 (KJS::CString::operator=):
3126 2004-01-16 Richard Williamson <rjw@apple.com>
3128 Fixed 3525853. We weren't handling mapping to overloaded Java
3129 methods very well. Even though this is undefined the other
3130 browsers support it. Also fixed a bug with returning arrays
3131 from Java functions.
3135 * bindings/jni/jni_class.cpp:
3136 (JavaClass::_commonInit):
3137 (JavaClass::methodsNamed):
3138 * bindings/jni/jni_class.h:
3139 * bindings/jni/jni_instance.cpp:
3140 (JavaInstance::invokeMethod):
3141 * bindings/jni/jni_instance.h:
3142 * bindings/jni/jni_runtime.cpp:
3143 (JavaArray::convertJObjectToArray):
3144 (JavaField::valueFromInstance):
3145 (JavaMethod::signature):
3146 (JavaArray::valueAt):
3147 * bindings/jni/jni_runtime.h:
3148 * bindings/jni_jsobject.cpp:
3150 (JSObject::convertJObjectToValue):
3151 * bindings/runtime.cpp:
3152 (MethodList::addMethod):
3153 (MethodList::length):
3154 (MethodList::methodAt):
3155 (MethodList::~MethodList):
3156 * bindings/runtime.h:
3157 (KJS::Bindings::MethodList::MethodList):
3158 * bindings/runtime_method.cpp:
3159 (RuntimeMethodImp::RuntimeMethodImp):
3160 (RuntimeMethodImp::get):
3161 (RuntimeMethodImp::call):
3162 * bindings/runtime_method.h:
3163 * bindings/runtime_object.cpp:
3164 (RuntimeObjectImp::get):
3165 (RuntimeObjectImp::hasProperty):
3167 2004-01-16 Richard Williamson <rjw@apple.com>
3169 Fixed 3531229. Another place that needs the Push/PopLocalFrame
3170 protection implemented for 3530401.
3174 * bindings/runtime_method.cpp:
3175 (RuntimeMethodImp::call):
3177 2004-01-15 Richard Williamson <rjw@apple.com>
3179 Fixed 3530401. JNI doesn't cleanup local refs created on the
3180 main thread. IMO this is a bad bug in our JMI implementation.
3182 To work-around the problem I explicitly delete all local refs.
3183 Further, I've added Push/PopLocalFrame calls to catch any refs
3184 that I may have missed. This will guarantee that we don't leak
3185 any Java references.
3189 * bindings/jni/jni_class.cpp:
3190 (JavaClass::_commonInit):
3191 (JavaClass::JavaClass):
3192 * bindings/jni/jni_instance.cpp:
3193 (JavaInstance::begin):
3194 (JavaInstance::end):
3195 * bindings/jni/jni_instance.h:
3196 * bindings/jni/jni_runtime.cpp:
3197 (JavaConstructor::JavaConstructor):
3198 (JavaMethod::JavaMethod):
3199 * bindings/jni_jsobject.cpp:
3200 (JSObject::listFromJArray):
3201 * bindings/runtime.h:
3202 (KJS::Bindings::Instance::begin):
3203 (KJS::Bindings::Instance::end):
3204 * bindings/runtime_object.cpp:
3205 (RuntimeObjectImp::get):
3206 (RuntimeObjectImp::put):
3207 (RuntimeObjectImp::canPut):
3208 (RuntimeObjectImp::hasProperty):
3209 (RuntimeObjectImp::defaultValue):
3211 2004-01-15 Vicki Murley <vicki@apple.com>
3215 * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
3217 2004-01-14 Richard Williamson <rjw@apple.com>
3219 Fixed 3529466. With recent changes to Java plugin we must no
3220 longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
3224 * bindings/jni/jni_instance.cpp:
3225 (JObjectWrapper::JObjectWrapper):
3229 2004-01-14 Richard Williamson <rjw@apple.com>
3233 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.
3237 * bindings/jni_jsobject.cpp:
3239 (removeJavaReference):
3240 (RootObject::removeAllJavaReferencesForRoot):
3243 2004-01-13 Richard Williamson <rjw@apple.com>
3247 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.
3251 * bindings/jni_jsobject.h:
3252 (KJS::Bindings::RootObject::~RootObject):
3258 2004-01-06 Richard Williamson <rjw@apple.com>
3260 Fixed 3521814. Finalize messages weren't being dispatched!
3264 * bindings/jni_jsobject.cpp:
3267 2004-01-05 Richard Williamson <rjw@apple.com>
3269 Added cache of JNI method IDs to minimize allocations. This mitigates the problem
3270 described by 3515579.
3272 Also cleanup up logging of Java exceptions.
3276 * bindings/jni/jni_class.cpp:
3277 (JavaClass::classForInstance):
3278 * bindings/jni/jni_instance.cpp:
3279 (JavaInstance::JavaInstance):
3280 (JavaInstance::getClass):
3281 (JavaInstance::invokeMethod):
3282 (JObjectWrapper::JObjectWrapper):
3283 (JObjectWrapper::~JObjectWrapper):
3284 * bindings/jni/jni_instance.h:
3285 (KJS::Bindings::JavaInstance::operator=):
3286 * bindings/jni/jni_runtime.cpp:
3287 (JavaMethod::JavaMethod):
3288 (JavaMethod::methodID):
3289 * bindings/jni/jni_runtime.h:
3290 (KJS::Bindings::JavaMethod::JavaMethod):
3291 * bindings/jni/jni_utility.cpp:
3295 (KJS::Bindings::getMethodID):
3296 (KJS::Bindings::callJNIVoidMethodIDA):
3297 (KJS::Bindings::callJNIObjectMethodIDA):
3298 (KJS::Bindings::callJNIByteMethodIDA):
3299 (KJS::Bindings::callJNICharMethodIDA):
3300 (KJS::Bindings::callJNIShortMethodIDA):
3301 (KJS::Bindings::callJNIIntMethodIDA):
3302 (KJS::Bindings::callJNILongMethodIDA):
3303 (KJS::Bindings::callJNIFloatMethodIDA):
3304 (KJS::Bindings::callJNIDoubleMethodIDA):
3305 (KJS::Bindings::callJNIBooleanMethodIDA):
3306 (KJS::Bindings::getCharactersFromJStringInEnv):
3307 (KJS::Bindings::getUCharactersFromJStringInEnv):
3308 (KJS::Bindings::getJNIField):
3309 * bindings/jni/jni_utility.h:
3311 l2003-12-23 John Sullivan <sullivan@apple.com>
3313 * JavaScriptCore.pbproj/project.pbxproj:
3314 Xcode version wars, harmless
3316 2003-12-23 Darin Adler <darin@apple.com>
3318 Reviewed by John (concept, not code, which is just the old code coming back).
3320 - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
3322 * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
3323 mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
3325 2003-12-19 Richard Williamson <rjw@apple.com>
3327 Fixed 3515597. When an error occurs we need
3328 to make sure result values are zeroed.
3330 Cleaned up logs by adding a newline.
3334 * bindings/jni/jni_utility.cpp:
3335 (KJS::Bindings::getJavaVM):
3336 (KJS::Bindings::getJNIEnv):
3339 (KJS::Bindings::getJNIField):
3340 * bindings/jni_jsobject.cpp:
3341 (JSObject::convertValueToJObject):
3345 2003-12-17 Richard Williamson <rjw@apple.com>
3347 Ensure that all the symbols we export are in the KJS
3348 namespace (3512245).
3350 Also renamed JavaString.characters() to JavaString.UTF8String()
3351 for enhanced clarity.
3353 Added some sanity checking to constructor of JObjectWrapper.
3358 * bindings/jni/jni_class.cpp:
3359 * bindings/jni/jni_class.h:
3360 * bindings/jni/jni_instance.cpp:
3361 (JavaInstance::invokeMethod):
3362 (JObjectWrapper::JObjectWrapper):
3363 * bindings/jni/jni_instance.h:
3364 * bindings/jni/jni_runtime.cpp:
3365 (JavaParameter::JavaParameter):
3366 (JavaField::JavaField):
3367 (JavaMethod::JavaMethod):
3368 (JavaMethod::signature):
3369 * bindings/jni/jni_runtime.h:
3370 (KJS::Bindings::JavaString::ascii):
3371 (KJS::Bindings::JavaString::UTF8String):
3372 (KJS::Bindings::JavaString::JavaString):
3373 (KJS::Bindings::JavaString::_commonInit):
3374 (KJS::Bindings::JavaString::uchars):
3375 (KJS::Bindings::JavaString::length):
3376 (KJS::Bindings::JavaString::ustring):
3377 (KJS::Bindings::JavaParameter::type):
3378 (KJS::Bindings::JavaField::name):
3379 (KJS::Bindings::JavaField::type):
3380 (KJS::Bindings::JavaMethod::name):
3381 (KJS::Bindings::JavaMethod::returnType):
3382 * bindings/jni/jni_utility.cpp:
3383 (KJS::Bindings::getJavaVM):
3384 (KJS::Bindings::getJNIEnv):
3385 (KJS::Bindings::callJNIVoidMethod):
3386 (KJS::Bindings::callJNIObjectMethod):
3387 (KJS::Bindings::callJNIBooleanMethod):
3388 (KJS::Bindings::callJNIByteMethod):
3389 (KJS::Bindings::callJNICharMethod):
3390 (KJS::Bindings::callJNIShortMethod):
3391 (KJS::Bindings::callJNIIntMethod):
3392 (KJS::Bindings::callJNILongMethod):
3393 (KJS::Bindings::callJNIFloatMethod):
3394 (KJS::Bindings::callJNIDoubleMethod):
3395 (KJS::Bindings::callJNIVoidMethodA):
3396 (KJS::Bindings::callJNIObjectMethodA):
3397 (KJS::Bindings::callJNIByteMethodA):
3398 (KJS::Bindings::callJNICharMethodA):
3399 (KJS::Bindings::callJNIShortMethodA):
3400 (KJS::Bindings::callJNIIntMethodA):
3401 (KJS::Bindings::callJNILongMethodA):
3402 (KJS::Bindings::callJNIFloatMethodA):
3403 (KJS::Bindings::callJNIDoubleMethodA):
3404 (KJS::Bindings::callJNIBooleanMethodA):
3405 (KJS::Bindings::getCharactersFromJString):
3406 (KJS::Bindings::releaseCharactersForJString):
3407 (KJS::Bindings::getCharactersFromJStringInEnv):
3408 (KJS::Bindings::releaseCharactersForJStringInEnv):
3409 (KJS::Bindings::getUCharactersFromJStringInEnv):
3410 (KJS::Bindings::releaseUCharactersForJStringInEnv):
3411 (KJS::Bindings::JNITypeFromClassName):
3412 (KJS::Bindings::signatureFromPrimitiveType):
3413 (KJS::Bindings::JNITypeFromPrimitiveType):
3414 (KJS::Bindings::getJNIField):
3415 (KJS::Bindings::convertValueToJValue):
3416 * bindings/jni/jni_utility.h:
3417 * bindings/jni_jsobject.cpp:
3418 (KJS::Bindings::JSObject::invoke):
3419 (KJS::Bindings::JSObject::JSObject):
3420 (KJS::Bindings::JSObject::call):
3421 (KJS::Bindings::JSObject::eval):
3422 (KJS::Bindings::JSObject::getMember):
3423 (KJS::Bindings::JSObject::setMember):
3424 (KJS::Bindings::JSObject::removeMember):
3425 (KJS::Bindings::JSObject::getSlot):
3426 (KJS::Bindings::JSObject::setSlot):
3427 (KJS::Bindings::JSObject::toString):
3428 (KJS::Bindings::JSObject::finalize):
3429 (KJS::Bindings::JSObject::createNative):
3430 (KJS::Bindings::JSObject::convertValueToJObject):
3431 (KJS::Bindings::JSObject::convertJObjectToValue):
3432 (KJS::Bindings::JSObject::listFromJArray):
3433 * bindings/jni_jsobject.h:
3434 * bindings/runtime.cpp:
3435 * bindings/runtime.h:
3436 * bindings/runtime_method.cpp:
3437 * bindings/runtime_method.h:
3441 2003-12-16 Richard Williamson <rjw@apple.com>
3443 Ack! More assertions. Lock ALL entry points into the interpreter!
3448 * bindings/jni_jsobject.cpp:
3449 (Bindings::JSObject::call):
3450 (Bindings::JSObject::eval):
3451 (Bindings::JSObject::getMember):
3452 (Bindings::JSObject::setMember):
3453 (Bindings::JSObject::removeMember):
3454 (Bindings::JSObject::getSlot):
3455 (Bindings::JSObject::setSlot):
3456 (Bindings::JSObject::convertJObjectToValue):
3458 2003-12-15 Richard Williamson <rjw@apple.com>
3460 Fixed a couple of snafus and removed some logging.
3464 * bindings/jni_jsobject.cpp:
3465 (Bindings::performJavaScriptAccess):
3466 (Bindings::completedJavaScriptAccess):
3467 (Bindings::dispatchToJavaScriptThread):
3468 Removed some annoying JS_LOG clutter.
3470 (Bindings::RootObject::removeAllJavaReferencesForRoot):
3471 Fixed allocation of key buffer that was called after it was needed.
3473 (Bindings::JSObject::invoke):
3474 (Bindings::JSObject::JSObject):
3475 (Bindings::JSObject::getMember):
3476 (Bindings::JSObject::getSlot):
3477 Added additional interpreter locks around getMember and getSlot.
3478 These functions may cause allocation of JS impls.
3480 2003-12-15 Richard Williamson <rjw@apple.com>
3482 args weren't passed to 'call' invocation. d'oh.
3483 lock interpreter when we create instances of JS impls.
3487 * bindings/jni_jsobject.cpp:
3488 (Bindings::JSObject::call):
3489 (Bindings::JSObject::eval):
3490 (Bindings::JSObject::getMember):
3491 (Bindings::JSObject::setMember):
3492 (Bindings::JSObject::getSlot):
3493 (Bindings::JSObject::convertValueToJObject):
3494 (Bindings::JSObject::convertJObjectToValue):
3495 (Bindings::JSObject::listFromJArray):
3496 * bindings/jni_jsobject.h:
3498 2003-12-15 Richard Williamson <rjw@apple.com>
3500 Last piece of LiveConnect! This checkin adds implementation
3501 of the Java to JavaScript object conversion functions.
3505 * bindings/jni/jni_instance.cpp:
3506 (JavaInstance::invokeMethod):
3507 * bindings/jni/jni_utility.cpp:
3508 * bindings/jni/jni_utility.h:
3509 * bindings/jni_jsobject.cpp:
3510 (Bindings::JSObject::invoke):
3511 (Bindings::JSObject::call):
3512 (Bindings::JSObject::eval):
3513 (Bindings::JSObject::getMember):
3514 (Bindings::JSObject::setMember):
3515 (Bindings::JSObject::getSlot):
3516 (Bindings::JSObject::setSlot):
3517 (Bindings::JSObject::createNative):
3518 (Bindings::JSObject::convertValueToJObject):
3519 (Bindings::JSObject::convertJObjectToValue):
3520 (Bindings::JSObject::listFromJArray):
3521 * bindings/jni_jsobject.h:
3523 * bindings/runtime_method.cpp:
3524 (RuntimeMethodImp::get):
3525 (RuntimeMethodImp::codeType):
3526 (RuntimeMethodImp::execute):
3528 2003-12-12 Richard Williamson <rjw@apple.com>
3530 Added implementation of stubs in JSObject. All that
3531 remains is a couple of simple conversion functions stubs and
3532 we're done with LiveConnect. Also, changed string passing to
3533 JS to use uchars instead of chars.
3537 * bindings/jni/jni_runtime.h:
3538 (Bindings::JavaString::JavaString):
3539 (Bindings::JavaString::_commonInit):
3540 (Bindings::JavaString::_commonCopy):
3541 (Bindings::JavaString::_commonDelete):
3542 (Bindings::JavaString::~JavaString):
3543 (Bindings::JavaString::operator=):
3544 (Bindings::JavaString::uchars):
3545 (Bindings::JavaString::length):
3546 (Bindings::JavaString::ustring):
3547 * bindings/jni/jni_utility.cpp:
3548 (getUCharactersFromJStringInEnv):
3549 (releaseUCharactersForJStringInEnv):
3550 (convertValueToJObject):
3551 (convertJObjectToValue):
3552 * bindings/jni/jni_utility.h:
3553 * bindings/jni_jsobject.cpp:
3554 (Bindings::JSObject::invoke):
3555 (Bindings::JSObject::call):
3556 (Bindings::JSObject::eval):
3557 (Bindings::JSObject::getMember):
3558 (Bindings::JSObject::setMember):
3559 (Bindings::JSObject::removeMember):
3560 (Bindings::JSObject::getSlot):
3561 (Bindings::JSObject::setSlot):
3562 * bindings/jni_jsobject.h:
3564 2003-12-12 Richard Williamson <rjw@apple.com>
3566 Ensure that all calls from Java into JavaScript are
3567 performed on a designated thread (the main thread).
3571 * bindings/jni_jsobject.cpp: