3 2004-06-04 Darin Adler <darin@apple.com>
5 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
7 2004-06-04 Kevin Decker <kdecker@apple.com>
11 - ObjC bindings do not (yet) pass along sourceurl or line numbers
12 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
13 - changed the wording of an error message
14 - the lexer, parser, and interpreter have been made "sourceURL aware"
15 - stored the url into Error
17 * bindings/NP_jsobject.cpp:
19 * bindings/jni/jni_jsobject.cpp:
21 * bindings/objc/WebScriptObject.mm:
22 (-[WebScriptObject evaluateWebScript:]):
24 (GlobalFuncImp::call):
25 * kjs/function_object.cpp:
26 (FunctionObjectImp::construct):
29 (InterpreterImp::checkSyntax):
30 (InterpreterImp::evaluate):
32 * kjs/interpreter.cpp:
33 (Interpreter::evaluate):
38 (KJS::Lexer::sourceURL):
42 (FunctionCallNode::evaluate):
48 2004-06-04 Richard Williamson <rjw@apple.com>
50 Fixed crash when attempting to access properties on nil
55 * bindings/objc/objc_instance.mm:
56 (ObjcInstance::getClass):
57 * bindings/runtime_object.cpp:
58 (RuntimeObjectImp::get):
60 * bindings/testbindings.mm:
61 (-[MyFirstInterface getString]):
63 2004-05-27 Kevin Decker <kdecker@apple.com>
67 -revised generated error message content
69 * kjs/error_object.cpp:
70 (ErrorProtoFuncImp::call):
78 2004-05-27 Richard Williamson <rjw@apple.com>
80 Renamed WebScriptMethods to WebScripting based on feedback
85 * bindings/objc/WebScriptObject.h:
87 2004-05-27 Darin Adler <darin@apple.com>
91 - moved to new symlink technique for embedding frameworks
93 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
94 because we don't need it any more.
96 2004-05-24 Richard Williamson <rjw@apple.com>
98 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
99 fixed ClassInfo to correctly reflect inheritance. This is required
100 because of the runtime checks in JSC for arrays, i.e. in
101 the Function objects apply method.
105 * bindings/jni/jni_runtime.cpp:
106 (JavaArray::convertJObjectToArray):
107 * bindings/objc/objc_utility.mm:
108 (KJS::Bindings::convertObjcValueToValue):
109 * bindings/runtime_array.cpp:
110 (RuntimeArrayImp::RuntimeArrayImp):
111 * bindings/runtime_array.h:
112 * bindings/testM.js: Added.
113 * bindings/testbindings.mm:
114 (+[MyFirstInterface webScriptNameForSelector:]):
115 (-[MyFirstInterface logMessages:]):
116 (-[MyFirstInterface logMessage:prefix:]):
117 (-[MyFirstInterface callJSObject::]):
119 2004-05-22 Darin Adler <darin@apple.com>
123 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
125 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
126 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
127 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
128 it hasn't been set explicitly.
132 2004-05-20 Richard Williamson <rjw@apple.com>
134 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
135 can now be referenced like any other WebScriptObject, meaning
136 you can do JS operations on them.
138 All added implementation of finalizeForWebScript.
142 * bindings/objc/WebScriptObject.h:
143 * bindings/objc/WebScriptObject.mm:
144 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
145 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
146 (-[WebScriptObject KJS::]):
147 (-[WebScriptObject dealloc]):
148 (-[WebScriptObject callWebScriptMethod:withArguments:]):
149 (-[WebScriptObject evaluateWebScript:]):
150 (-[WebScriptObject setValue:forKey:]):
151 (-[WebScriptObject valueForKey:]):
152 (-[WebScriptObject stringRepresentation]):
153 * bindings/objc/WebScriptObjectPrivate.h:
154 * bindings/objc/objc_instance.mm:
155 (ObjcInstance::~ObjcInstance):
157 2004-05-19 Richard Williamson <rjw@apple.com>
159 Removed extraneous tabs that were added (by XCode?).
161 * bindings/objc/WebScriptObject.h:
163 2004-05-19 Darin Adler <darin@apple.com>
165 - fixed headers with licenses mangled by Xcode auto-indenting
167 * bindings/jni/jni_jsobject.cpp:
168 * bindings/jni/jni_jsobject.h:
169 * bindings/runtime_array.h:
170 * bindings/runtime_root.cpp:
171 * bindings/runtime_root.h:
173 2004-05-18 Richard Williamson <rjw@apple.com>
175 Added exception logging. Also check for exception and
176 set results as appropriate.
178 Reviewed by Maciej (partially reviewed).
180 * bindings/objc/WebScriptObject.mm:
181 (-[WebScriptObject callWebScriptMethod:withArguments:]):
182 (-[WebScriptObject evaluateWebScript:]):
183 (-[WebScriptObject setValue:forKey:]):
184 (-[WebScriptObject valueForKey:]):
186 2004-05-18 Richard Williamson <rjw@apple.com>
188 Finsished implementing support for windowScriptObject.
189 Had to make WebScriptObjectPrivate.h accessible from
194 * JavaScriptCore.pbproj/project.pbxproj:
195 * bindings/objc/WebScriptObjectPrivate.h:
197 2004-05-18 Richard Williamson <rjw@apple.com>
199 Use KVC to set/get values instead of directly accessing
204 * bindings/objc/WebScriptObject.mm:
205 (-[WebScriptObject callWebScriptMethod:withArguments:]):
206 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
207 * bindings/objc/objc_runtime.mm:
208 (ObjcField::valueFromInstance):
209 (convertValueToObjcObject):
210 (ObjcField::setValueToInstance):
212 2004-05-17 Richard Williamson <rjw@apple.com>
214 Implemented new API for WebScriptObject.
216 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
217 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
221 * JavaScriptCore.pbproj/project.pbxproj:
222 * bindings/c/c_instance.cpp:
223 (CInstance::invokeMethod):
224 * bindings/jni/jni_instance.cpp:
225 (JavaInstance::invokeMethod):
226 * bindings/jni/jni_jsobject.cpp:
227 (JSObject::convertValueToJObject):
228 * bindings/jni/jni_utility.cpp:
229 (KJS::Bindings::getJNIField):
230 * bindings/objc/WebScriptObject.mm:
232 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
233 (-[WebScriptObject KJS::]):
234 (-[WebScriptObject dealloc]):
235 (+[WebScriptObject throwException:]):
237 (-[WebScriptObject callWebScriptMethod:withArguments:]):
238 (-[WebScriptObject evaluateWebScript:]):
239 (-[WebScriptObject setValue:forKey:]):
240 (-[WebScriptObject valueForKey:]):
241 (-[WebScriptObject stringRepresentation]):
242 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
243 (+[WebUndefined undefined]):
244 (-[WebUndefined initWithCoder:]):
245 (-[WebUndefined encodeWithCoder:]):
246 (-[WebUndefined copyWithZone:]):
247 (-[WebUndefined retain]):
248 (-[WebUndefined release]):
249 (-[WebUndefined retainCount]):
250 (-[WebUndefined autorelease]):
251 (-[WebUndefined dealloc]):
252 (-[WebUndefined copy]):
253 (-[WebUndefined replacementObjectForPortCoder:]):
254 * bindings/objc/WebScriptObjectPrivate.h: Added.
255 * bindings/objc/objc_class.mm:
256 (ObjcClass::methodsNamed):
257 (ObjcClass::fieldNamed):
258 * bindings/objc/objc_instance.mm:
259 (ObjcInstance::invokeMethod):
260 * bindings/objc/objc_jsobject.h:
261 * bindings/objc/objc_jsobject.mm:
262 * bindings/objc/objc_runtime.mm:
263 (ObjcField::valueFromInstance):
264 * bindings/objc/objc_utility.mm:
265 (KJS::Bindings::JSMethodNameToObjCMethodName):
266 (KJS::Bindings::convertValueToObjcValue):
267 (KJS::Bindings::convertObjcValueToValue):
268 * bindings/runtime.cpp:
269 (Instance::setDidExecuteFunction):
270 (Instance::didExecuteFunction):
271 (Instance::setValueOfField):
272 * bindings/runtime.h:
273 * bindings/testbindings.mm:
274 (+[MyFirstInterface webScriptNameForSelector:]):
275 (-[MyFirstInterface callJSObject::]):
277 2004-05-14 Vicki Murley <vicki@apple.com>
281 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
283 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
287 2004-05-13 Richard Williamson <rjw@apple.com>
294 * bindings/objc/WebScriptObject.h:
296 2004-05-13 Richard Williamson <rjw@apple.com>
298 Approved API changes. Currently unimplemented.
303 * JavaScriptCore.pbproj/project.pbxproj:
304 * bindings/objc/WebScriptObject.h: Added.
305 * bindings/objc/WebScriptObject.mm: Added.
306 (+[WebScriptObject throwException:]):
307 (-[WebScriptObject callWebScriptMethod:withArguments:]):
308 (-[WebScriptObject evaluateWebScript:]):
309 (-[WebScriptObject stringRepresentation]):
310 (+[WebUndefined undefined]):
311 (-[WebUndefined initWithCoder:]):
312 (-[WebUndefined encodeWithCoder:]):
313 (-[WebUndefined copyWithZone:]):
315 2004-05-07 Vicki Murley <vicki@apple.com>
319 Turn off GC since it uses ppc only instructions (which breaks
322 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
326 2004-05-07 Maciej Stachowiak <mjs@apple.com>
330 - add -funroll-loops=16 compiler option for approx .5% speedup on
331 HTML iBench and .5-1% speedup on JS iBench.
333 * JavaScriptCore.pbproj/project.pbxproj:
335 2004-04-25 Maciej Stachowiak <mjs@apple.com>
339 Enable full conservative GC mode in addition to test mode. When
340 conservative GC is enabled, we now get an 11% speed improvement on
341 the iBench. Also fix some spots I missed before.
343 Specific noteworth changes:
346 (KJS::Collector::markStackObjectsConservatively): Check possible
347 cell pointers for 8-byte aligment and verify they are not 0.
349 * kjs/protected_values.cpp:
350 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
351 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
353 (KJS::gcProtectNullTolerant): ...to here...
354 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
355 tolerance, and doing the check is expensive.
357 * kjs/protected_values.cpp:
358 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
359 that is still very good.
364 (KJS::ProtectedValue::ProtectedValue):
365 (KJS::ProtectedValue::~ProtectedValue):
366 (KJS::ProtectedValue::operator=):
367 (KJS::ProtectedObject::ProtectedObject):
368 (KJS::ProtectedObject::~ProtectedObject):
369 (KJS::ProtectedObject::operator=):
370 (KJS::ProtectedReference::ProtectedReference):
371 (KJS::ProtectedReference::~ProtectedReference):
372 (KJS::ProtectedReference::operator=):
373 * kjs/protected_values.cpp:
374 (KJS::ProtectedValues::getProtectCount):
375 (KJS::ProtectedValues::increaseProtectCount):
376 (KJS::ProtectedValues::decreaseProtectCount):
377 (KJS::ProtectedValues::computeHash):
378 * bindings/runtime_root.cpp:
379 (KJS::Bindings::addNativeReference):
380 (KJS::Bindings::removeNativeReference):
381 (RootObject::removeAllNativeReferences):
382 * bindings/runtime_root.h:
383 (KJS::Bindings::RootObject::~RootObject):
384 (KJS::Bindings::RootObject::setRootObjectImp):
386 (KJS::Collector::allocate):
387 (KJS::Collector::collect):
391 (InterpreterImp::globalInit):
392 (InterpreterImp::globalClear):
393 (InterpreterImp::mark):
395 (KJS::List::derefValues):
396 (KJS::List::refValues):
399 (KJS::ObjectImp::setInternalValue):
400 (KJS::ObjectImp::putDirect):
405 (KJS::ValueImp::ValueImp):
406 (KJS::ValueImp::~ValueImp):
409 (KJS::Value::~Value):
410 (KJS::Value::operator=):
412 2004-04-30 Richard Williamson <rjw@apple.com>
414 Asking an NSInvocation for it's return value when return type
415 is void throws an exception. Added check for void return types
416 to avoid this exception.
420 * bindings/objc/objc_instance.mm:
421 (ObjcInstance::invokeMethod):
423 2004-04-29 Richard Williamson <rjw@apple.com>
425 Fixed several bad problems with the ObjC bindings. In particular, conversion
426 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
430 * bindings/objc/objc_jsobject.h:
431 * bindings/objc/objc_jsobject.mm:
432 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
433 (-[JavaScriptObject KJS::]):
434 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
435 (-[JavaScriptObject call:arguments:]):
436 (-[JavaScriptObject evaluate:]):
437 (-[JavaScriptObject getMember:]):
438 (-[JavaScriptObject getSlot:]):
439 * bindings/objc/objc_runtime.mm:
440 (ObjcField::valueFromInstance):
441 (ObjcField::setValueToInstance):
442 * bindings/objc/objc_utility.mm:
443 (KJS::Bindings::convertValueToObjcValue):
444 (KJS::Bindings::convertObjcValueToValue):
445 * bindings/runtime.h:
446 * bindings/runtime_root.cpp:
447 (KJS::Bindings::rootForInterpreter):
448 (KJS::Bindings::addNativeReference):
449 (KJS::Bindings::removeNativeReference):
450 * bindings/runtime_root.h:
451 * bindings/testbindings.mm:
452 (-[MyFirstInterface logMessage:]):
453 (-[MyFirstInterface setJSObject:]):
454 (-[MyFirstInterface callJSObject::]):
456 2004-04-24 Darin Adler <darin@apple.com>
460 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
463 2004-04-23 Maciej Stachowiak <mjs@apple.com>
467 Implementation of conservative GC, based partly on code from
468 Darin. It's turned off for now, so it shouldn't have any effect on
471 * JavaScriptCore.pbproj/project.pbxproj:
473 (KJS::Collector::markStackObjectsConservatively):
474 (KJS::Collector::markProtectedObjects):
475 (KJS::Collector::collect):
480 * kjs/protected_values.cpp: Added.
481 (KJS::ProtectedValues::getProtectCount):
482 (KJS::ProtectedValues::increaseProtectCount):
483 (KJS::ProtectedValues::insert):
484 (KJS::ProtectedValues::decreaseProtectCount):
485 (KJS::ProtectedValues::expand):
486 (KJS::ProtectedValues::shrink):
487 (KJS::ProtectedValues::rehash):
488 (KJS::ProtectedValues::computeHash):
489 * kjs/protected_values.h: Added.
491 (ValueImp::useConservativeMark):
499 2004-04-22 Richard Williamson <rjw@apple.com>
501 Fixed build snafu (re-declaration of NPBool in npruntime.h and
504 * bindings/npruntime.h:
506 2004-04-22 Richard Williamson <rjw@apple.com>
508 Updated plugin binding API to reflect latest revision from
511 Biggest change is the introduction of NPVariant used to represent
512 value types. NPVariant replaces the use of NPObject for the
513 exchange of values between scripting environment and native code.
517 * JavaScriptCore.pbproj/project.pbxproj:
518 * bindings/NP_jsobject.cpp:
519 (identiferFromNPIdentifier):
525 (NPN_GetPropertyAtIndex):
526 (NPN_SetPropertyAtIndex):
527 * bindings/c/c_class.cpp:
528 (CClass::methodsNamed):
529 (CClass::fieldNamed):
530 * bindings/c/c_instance.cpp:
531 (CInstance::invokeMethod):
532 (CInstance::defaultValue):
533 * bindings/c/c_runtime.cpp:
534 (CField::valueFromInstance):
535 (CField::setValueToInstance):
536 * bindings/c/c_utility.cpp:
537 (convertNPStringToUTF16):
538 (convertUTF8ToUTF16):
539 (coerceValueToNPVariantStringType):
540 (convertValueToNPVariant):
541 (convertNPVariantToValue):
542 * bindings/c/c_utility.h:
543 * bindings/npruntime.cpp:
545 (NPN_GetIdentifiers):
546 (NPN_UTF8FromIdentifier):
549 (NPN_VariantIsUndefined):
551 (NPN_VariantIsInt32):
552 (NPN_VariantIsDouble):
553 (NPN_VariantIsString):
554 (NPN_VariantIsObject):
556 (NPN_VariantToString):
557 (NPN_VariantToInt32):
558 (NPN_VariantToDouble):
559 (NPN_VariantToObject):
560 (NPN_InitializeVariantAsVoid):
561 (NPN_InitializeVariantAsNull):
562 (NPN_InitializeVariantAsUndefined):
563 (NPN_InitializeVariantWithBool):
564 (NPN_InitializeVariantWithInt32):
565 (NPN_InitializeVariantWithDouble):
566 (NPN_InitializeVariantWithString):
567 (NPN_InitializeVariantWithStringCopy):
568 (NPN_InitializeVariantWithObject):
569 (NPN_InitializeVariantWithVariant):
570 (NPN_ReleaseVariantValue):
575 (NPN_SetExceptionWithUTF8):
577 * bindings/npruntime.h:
579 (_NPString::_NPVariant::):
580 * bindings/testbindings.cpp:
595 2004-04-22 Darin Adler <darin@apple.com>
599 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
602 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
603 Was resulting in a buffer 2x the needed size.
604 (KJS::UString::expandPreCapacity): Ditto.
605 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
607 2004-04-21 Maciej Stachowiak <mjs@apple.com>
611 Preliminary change for conservative GC. Create "protected"
612 subclasses to GC-protect objects when on heap, since we will soon
613 remove the built-in refcounting of the normal wrapper classes. Use
616 * JavaScriptCore.pbproj/project.pbxproj:
619 (KJS::InterpreterImp::globalObject):
621 * kjs/property_map.cpp:
623 * kjs/reference_list.cpp:
625 2004-04-19 Maciej Stachowiak <mjs@apple.com>
629 Optimize prepend using the shared substring optimization. Also,
630 limit the applicability of shared append and shared prepend. If
631 you overdo it, it does more harm than good, because you create a
632 bunch of strings that are disqualified from future shared
633 append/prepend, for not much immediate savings in allocate/copy
638 (KJS::UString::Rep::create):
639 (KJS::UString::expandedSize):
640 (KJS::UString::usedPreCapacity):
641 (KJS::UString::expandCapacity):
642 (KJS::UString::expandPreCapacity):
643 (KJS::UString::UString):
644 (KJS::UString::append):
645 (KJS::UString::operator=):
647 (KJS::UString::Rep::data):
649 2004-04-16 Maciej Stachowiak <mjs@apple.com>
652 No more need for Completion or Reference to privately inherit from
653 Value, none of the superclass functionality is used.
660 2004-04-16 Richard Williamson <rjw@apple.com>
662 Added interpreter lock protection around object creation.
666 * bindings/runtime.cpp:
667 (Instance::createRuntimeObject):
669 2004-04-16 Maciej Stachowiak <mjs@apple.com>
673 Another JavaScript speed improvement: use the mechanism from
674 string append optimization to make taking a substring fast, again
677 A further 22% improvement on the 24fun string speed test.
681 (KJS::UString::Rep::create):
682 (KJS::UString::UString):
683 (KJS::UString::append):
684 (KJS::UString::operator=):
685 (KJS::UString::substr):
687 (KJS::UString::Rep::data):
689 2004-04-13 Maciej Stachowiak <mjs@apple.com>
693 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
694 - fixed <rdar://problem/3600691>: Table generation test is really slow
695 - fixed <rdar://problem/3600661>: 24fun date test is really slow
697 80% speedup on the string test, lesser speedups on the other two.
699 Two different optimizations here:
701 1) Avoid large overhead of scanning strings to see if they are all
702 ASCII before numeric conversion.
705 (AssignNode::evaluate): Don't convert to integer until we know for
706 sure the operation will need it. Attempting to convert strings to
707 numbers is a waste when they are being appended with +=.
709 2) Avoid huge cost of appending strings.
711 This is done by allowing multiple strings to share a buffer but
712 actually use different ranges of it. The first time a string is
713 appended to, we start leaving at least 10% extra space in the
714 buffer, so doing N appends to the same string takes O(log N)
715 mallocs instead of O(N).
717 * kjs/identifier.cpp:
718 (KJS::Identifier::equal):
719 (KJS::Identifier::add):
722 (KJS::UCharReference::operator=):
723 (KJS::UCharReference::ref):
724 (KJS::UString::Rep::create):
725 (KJS::UString::Rep::destroy):
726 (KJS::UString::expandedSize):
727 (KJS::UString::usedCapacity):
728 (KJS::UString::expandCapacity):
729 (KJS::UString::UString):
730 (KJS::UString::null):
731 (KJS::UString::append):
732 (KJS::UString::operator=):
733 (KJS::UString::toStrictUInt32):
734 (KJS::UString::detach):
735 (KJS::KJS::operator==):
737 (KJS::UString::Rep::data):
738 (KJS::UString::Rep::hash):
740 2004-04-09 Maciej Stachowiak <mjs@apple.com>
744 - fix deployment build by avoiding deployment-only warning.
746 * kjs/scope_chain.cpp:
747 (KJS::ScopeChain::bottom):
749 2004-04-09 Maciej Stachowiak <mjs@apple.com>
753 Changed things so that newly created objects get a prototype based
754 on the scope chain of the current function, rather than the
755 interpreter that started execution. This fixes the following bugs:
757 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
758 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
760 * JavaScriptCore.pbproj/project.pbxproj:
761 * kjs/array_object.cpp:
762 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
763 (ArrayProtoFuncImp::ArrayProtoFuncImp):
764 (ArrayProtoFuncImp::call):
765 (ArrayObjectImp::construct):
766 * kjs/bool_object.cpp:
767 (BooleanObjectImp::construct):
768 * kjs/date_object.cpp:
769 (DateProtoFuncImp::DateProtoFuncImp):
770 (DateProtoFuncImp::call):
771 (DateObjectImp::construct):
772 * kjs/error_object.cpp:
773 (ErrorObjectImp::construct):
775 (FunctionImp::FunctionImp):
777 (DeclaredFunctionImp::construct):
778 (ArgumentsImp::ArgumentsImp):
779 (GlobalFuncImp::call):
780 * kjs/function_object.cpp:
781 (FunctionProtoFuncImp::call):
782 (FunctionObjectImp::construct):
784 (BooleanImp::toObject):
785 (StringImp::toObject):
786 (NumberImp::toObject):
787 (InterpreterImp::InterpreterImp):
788 (InterpreterImp::clear):
789 (InterpreterImp::interpreterWithGlobalObject):
791 * kjs/interpreter.cpp:
792 (ExecState::lexicalInterpreter):
794 (KJS::ExecState::dynamicInterpreter):
795 (KJS::ExecState::interpreter):
796 * kjs/math_object.cpp:
797 (MathFuncImp::MathFuncImp):
799 (StatementNode::hitStatement):
800 (StatementNode::abortStatement):
801 (RegExpNode::evaluate):
802 (ElementNode::evaluate):
803 (ArrayNode::evaluate):
804 (ObjectLiteralNode::evaluate):
805 (PropertyValueNode::evaluate):
806 (FunctionCallNode::evaluate):
807 (FuncDeclNode::processFuncDecl):
808 (FuncExprNode::evaluate):
809 * kjs/number_object.cpp:
810 (NumberObjectImp::construct):
812 (KJS::ObjectImp::defaultValue):
813 (KJS::Error::create):
814 * kjs/object_object.cpp:
815 (ObjectObjectImp::construct):
817 (Reference::putValue):
818 * kjs/regexp_object.cpp:
819 (RegExpProtoFuncImp::call):
820 (RegExpObjectImp::arrayOfMatches):
821 (RegExpObjectImp::construct):
822 * kjs/scope_chain.cpp:
823 (KJS::ScopeChain::bottom):
825 * kjs/string_object.cpp:
826 (StringProtoFuncImp::StringProtoFuncImp):
827 (StringProtoFuncImp::call):
828 (StringObjectImp::construct):
834 2004-03-31 Richard Williamson <rjw@apple.com>
836 Tedious renames based on feedback from plugin-futures list.
837 NP_ functions are renamed with NPN_ prefix.
838 Types prefix renamed from NP_ to NP.
839 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
841 No review because this was just a renaming patch.
843 * bindings/NP_jsobject.cpp:
846 (identiferFromNPIdentifier):
851 (NPN_RemoveProperty):
853 (NPN_GetPropertyAtIndex):
854 (NPN_SetPropertyAtIndex):
855 * bindings/NP_jsobject.h:
856 * bindings/c/c_class.cpp:
857 (CClass::_commonInit):
858 (CClass::classForIsA):
860 (CClass::methodsNamed):
861 (CClass::fieldNamed):
862 * bindings/c/c_class.h:
863 * bindings/c/c_instance.cpp:
864 (CInstance::CInstance):
865 (CInstance::~CInstance):
866 (CInstance::operator=):
867 (CInstance::invokeMethod):
868 (CInstance::defaultValue):
869 * bindings/c/c_instance.h:
870 (KJS::Bindings::CInstance::getObject):
871 * bindings/c/c_runtime.cpp:
872 (CField::valueFromInstance):
873 (CField::setValueToInstance):
874 * bindings/c/c_runtime.h:
875 (KJS::Bindings::CField::CField):
876 (KJS::Bindings::CField::name):
877 (KJS::Bindings::CMethod::CMethod):
878 (KJS::Bindings::CMethod::name):
879 * bindings/c/c_utility.cpp:
880 (coerceValueToNPString):
881 (convertValueToNPValueType):
882 (convertNPValueTypeToValue):
883 * bindings/c/c_utility.h:
884 * bindings/npruntime.cpp:
885 (NPN_IdentifierFromUTF8):
886 (NPN_IsValidIdentifier):
887 (NPN_GetIdentifiers):
888 (NPN_UTF8FromIdentifier):
893 (NPN_SetExceptionWithUTF8):
896 (NPN_CreateNumberWithInt):
897 (NPN_CreateNumberWithFloat):
898 (NPN_CreateNumberWithDouble):
900 (NPN_FloatFromNumber):
901 (NPN_DoubleFromNumber):
903 (NPN_CreateStringWithUTF8):
904 (NPN_CreateStringWithUTF16):
905 (NPN_DeallocateUTF8):
906 (NPN_UTF8FromString):
907 (NPN_UTF16FromString):
911 (NPN_BoolFromBoolean):
921 * bindings/npruntime.h:
922 * bindings/runtime.cpp:
923 (Instance::createBindingForLanguageInstance):
924 * bindings/testbindings.cpp:
925 (initializeIdentifiers):
945 2004-03-31 Richard Williamson <rjw@apple.com>
947 Changed references to NP_runtime.h to npruntime.h
949 * JavaScriptCore.pbproj/project.pbxproj:
950 * bindings/NP_jsobject.h:
951 * bindings/c/c_class.h:
952 * bindings/c/c_instance.h:
953 * bindings/c/c_runtime.h:
954 * bindings/c/c_utility.h:
955 * bindings/npruntime.cpp:
957 2004-03-31 Richard Williamson <rjw@apple.com>
959 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
961 * JavaScriptCore.pbproj/project.pbxproj:
962 * bindings/NP_jsobject.h:
963 * bindings/npruntime.cpp:
967 2004-03-23 Richard Williamson <rjw@apple.com>
969 Added implementation of KJS::Value <-> NP_Object conversion functions.
970 Augmented test program for 'C' bindings.
971 Added asserts and parameter checking to all public API.
975 * JavaScriptCore.pbproj/project.pbxproj:
976 * bindings/NP_jsobject.cpp:
978 * bindings/NP_jsobject.h: Added.
979 * bindings/NP_runtime.cpp:
980 (NP_IdentifierFromUTF8):
981 (NP_IsValidIdentifier):
987 (NP_SetExceptionWithUTF8):
990 (NP_FloatFromNumber):
991 (NP_DoubleFromNumber):
992 (NP_CreateStringWithUTF8):
993 (NP_CreateStringWithUTF16):
996 (NP_UTF16FromString):
998 (NP_BoolFromBoolean):
999 * bindings/NP_runtime.h:
1000 * bindings/c/c_instance.cpp:
1001 (CInstance::invokeMethod):
1002 * bindings/c/c_utility.cpp:
1003 (coerceValueToNPString):
1004 (convertValueToNPValueType):
1005 (convertNPValueTypeToValue):
1006 * bindings/c/c_utility.h:
1008 * bindings/testC.js: Added.
1009 * bindings/testbindings.cpp:
1019 (myInterfaceInvoke):
1020 (myInterfaceAllocate):
1024 2004-03-19 Darin Adler <darin@apple.com>
1028 - fixed problem with methods like setUTCHour
1030 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
1031 GMT vs. local time function based on the utc flag.
1033 2004-03-17 Richard Williamson <rjw@apple.com>
1035 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
1039 * bindings/NP_jsobject.cpp:
1044 (NP_GetPropertyAtIndex):
1045 * bindings/NP_runtime.h:
1047 2004-03-16 Richard Williamson <rjw@apple.com>
1049 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.
1053 * bindings/jni/jni_class.cpp:
1054 (JavaClass::methodsNamed):
1056 2004-03-15 Richard Williamson <rjw@apple.com>
1058 Fixed 3570854. Don't attempt to convert Null to strings. We
1059 were incorrectly converting to "Null".
1061 Actually fixed by Scott Kovatch.
1063 Reviewed by Richard.
1065 * bindings/jni/jni_utility.cpp:
1066 (KJS::Bindings::convertValueToJValue):
1070 2004-03-11 Richard Williamson <rjw@apple.com>
1072 Stitched together the NP stuff to our language independent
1073 JavaScript binding stuff. Very close to being done.
1075 Added program to test C bindings (and NP stuff). Just tests
1076 properties. Will add methods and JavaScript access, etc.
1078 Updated Makefile.am to account for new bindings/c directory.
1080 Change NP_UTF8 from "const char *" to "char" to allow for
1081 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
1084 Added NP_IsValidIdentifier().
1088 * JavaScriptCore.pbproj/project.pbxproj:
1090 * bindings/NP_jsobject.cpp:
1091 (identiferFromNPIdentifier):
1093 * bindings/NP_runtime.cpp:
1094 (NP_IdentifierFromUTF8):
1095 (NP_IsValidIdentifier):
1096 (NP_GetIdentifiers):
1097 (NP_UTF8FromIdentifier):
1098 (NP_SetExceptionWithUTF8):
1100 (NP_CreateStringWithUTF8):
1101 (NP_CreateStringWithUTF16):
1102 (NP_UTF8FromString):
1103 (NP_UTF16FromString):
1104 * bindings/NP_runtime.h:
1105 * bindings/c/c_class.cpp: Added.
1106 (CClass::_commonDelete):
1107 (CClass::_commonCopy):
1108 (CClass::_commonInit):
1109 (_createClassesByIsAIfNecessary):
1110 (CClass::classForIsA):
1113 (CClass::methodsNamed):
1114 (CClass::fieldNamed):
1115 * bindings/c/c_class.h: Added.
1116 (KJS::Bindings::CClass::~CClass):
1117 (KJS::Bindings::CClass::CClass):
1118 (KJS::Bindings::CClass::operator=):
1119 (KJS::Bindings::CClass::constructorAt):
1120 (KJS::Bindings::CClass::numConstructors):
1121 * bindings/c/c_instance.cpp: Added.
1122 (CInstance::CInstance):
1123 (CInstance::~CInstance):
1124 (CInstance::operator=):
1125 (CInstance::getClass):
1128 (CInstance::invokeMethod):
1129 (CInstance::defaultValue):
1130 (CInstance::stringValue):
1131 (CInstance::numberValue):
1132 (CInstance::booleanValue):
1133 (CInstance::valueOf):
1134 * bindings/c/c_instance.h: Added.
1135 (KJS::Bindings::CInstance::getObject):
1136 * bindings/c/c_runtime.cpp: Added.
1137 (CField::valueFromInstance):
1138 (CField::setValueToInstance):
1139 * bindings/c/c_runtime.h: Added.
1140 (KJS::Bindings::CField::CField):
1141 (KJS::Bindings::CField::name):
1142 (KJS::Bindings::CField::type):
1143 (KJS::Bindings::CMethod::CMethod):
1144 (KJS::Bindings::CMethod::name):
1145 (KJS::Bindings::CMethod::numParameters):
1146 * bindings/c/c_utility.cpp: Added.
1147 (coerceValueToNPValueType):
1148 (convertValueToNPValueType):
1149 (convertNPValueTypeToValue):
1150 * bindings/c/c_utility.h: Added.
1151 * bindings/make_testbindings:
1152 * bindings/runtime.cpp:
1153 (Instance::createBindingForLanguageInstance):
1154 * bindings/runtime.h:
1155 (KJS::Bindings::Instance::):
1156 * bindings/testbindings.cpp: Added.
1157 (initializeIdentifiers):
1158 (myInterfaceHasProperty):
1159 (myInterfaceHasMethod):
1160 (myInterfaceGetProperty):
1161 (myInterfaceSetProperty):
1162 (myInterfaceInvoke):
1163 (myInterfaceAllocate):
1164 (myInterfaceInvalidate):
1165 (myInterfaceDeallocate):
1166 (GlobalImp::className):
1167 (readJavaScriptFromFile):
1170 2004-03-10 Richard Williamson <rjw@apple.com>
1172 Made changes to support new asychronous approach to calls from
1173 plugin to JavaScript
1177 * bindings/NP_jsobject.cpp:
1182 (NP_GetPropertyAtIndex):
1183 * bindings/NP_runtime.h:
1184 * bindings/make_testbindings:
1185 * bindings/runtime.cpp:
1186 (Instance::createBindingForLanguageInstance):
1188 2004-03-10 Richard Williamson <rjw@apple.com>
1190 Updated header to include proposed changes from
1191 plugin-futures list. Calls from plugin to JavaScript
1192 are now asynchronous.
1196 * bindings/NP_runtime.h:
1200 2004-03-04 Richard Williamson <rjw@apple.com>
1202 Implementation of NP_JavaScriptObject. This is the 'C' class
1203 that wraps a JavaScript object.
1207 * JavaScriptCore.pbproj/project.pbxproj:
1208 * bindings/NP_jsobject.cpp: Added.
1209 (coerceValueToNPValueType):
1210 (convertValueToNPValueType):
1211 (convertNPValueTypeToValue):
1215 (identiferFromNPIdentifier):
1220 (NP_RemoveProperty):
1222 (NP_GetPropertyAtIndex):
1223 (NP_SetPropertyAtIndex):
1224 * bindings/NP_runtime.cpp:
1226 * bindings/NP_runtime.h:
1227 * bindings/runtime_object.h:
1229 2004-03-04 Richard Williamson <rjw@apple.com>
1231 Added NP_Array implementation.
1233 Changed NP_Boolean to just depend on two static instances, no
1234 space is required for values.
1238 * bindings/NP_runtime.cpp:
1240 (NP_BoolFromBoolean):
1246 * bindings/NP_runtime.h:
1248 2004-03-03 Darin Adler <darin@apple.com>
1252 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
1253 copyright string, and that's all that was in here.
1254 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
1256 2004-03-03 Richard Williamson <rjw@apple.com>
1258 More 'C' binding implementation. Fleshed out all the
1259 'primitive' data types.
1263 * bindings/NP_runtime.cpp:
1268 (NP_CreateStringWithUTF8):
1269 (NP_CreateStringWithUTF16):
1270 (NP_UTF8FromString):
1271 (NP_UTF16FromString):
1274 (booleanDeallocate):
1276 (NP_BoolFromBoolean):
1280 (undefinedAllocate):
1281 (undefinedDeallocate):
1283 * bindings/NP_runtime.h:
1285 2004-03-03 Richard Williamson <rjw@apple.com>
1287 More 'C' binding implementation.
1291 * bindings/NP_runtime.cpp:
1294 (getIdentifierDictionary):
1295 (NP_IdentifierFromUTF8):
1296 (NP_UTF8FromIdentifier):
1301 (NP_CreateNumberWithInt):
1302 (NP_CreateNumberWithFloat):
1303 (NP_CreateNumberWithDouble):
1305 (NP_FloatFromNumber):
1306 (NP_DoubleFromNumber):
1307 * bindings/NP_runtime.h:
1309 2004-03-02 Richard Williamson <rjw@apple.com>
1311 Removed retain/release from NP_Class. Classes will not be allowed to implement their
1312 own customer retain/release scheme.
1316 * bindings/NP_runtime.cpp:
1319 * bindings/NP_runtime.h:
1321 2004-03-02 Richard Williamson <rjw@apple.com>
1323 C binding API. Partial implementation.
1325 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.
1327 Factored root object reference counting scheme. It is now useful independent
1332 * JavaScriptCore.pbproj/project.pbxproj:
1333 * bindings/NP_runtime.cpp: Added.
1334 (NP_IdentifierFromUTF8):
1335 (NP_GetIdentifiers):
1336 (NP_UTF8FromIdentifier):
1346 (NP_RemoveProperty):
1348 (NP_GetPropertyAtIndex):
1349 (NP_SetPropertyAtIndex):
1350 (NP_CreateNumberWithInt):
1351 (NP_CreateNumberWithFloat):
1352 (NP_CreateNumberWithDouble):
1354 (NP_FloatFromNumber):
1355 (NP_DoubleFromNumber):
1356 (NP_CreateStringWithUTF8):
1357 (NP_CreateStringWithUTF16):
1358 (NP_UTF8FromString):
1359 (NP_UTF16FromString):
1361 (NP_BoolFromBoolean):
1367 * bindings/NP_runtime.h: Added.
1368 * bindings/jni/jni_jsobject.cpp:
1370 (JSObject::finalize):
1371 (JSObject::createNative):
1372 (JSObject::convertValueToJObject):
1373 * bindings/jni/jni_jsobject.h:
1374 * bindings/objc/objc_jsobject.h:
1375 * bindings/objc/objc_jsobject.mm:
1377 (windowJavaScriptObject):
1378 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
1379 (-[JavaScriptObject dealloc]):
1380 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
1381 (-[JavaScriptObject call:arguments:]):
1382 (-[JavaScriptObject evaluate:]):
1383 (-[JavaScriptObject getMember:]):
1384 (-[JavaScriptObject setMember:value:]):
1385 (-[JavaScriptObject removeMember:]):
1386 (-[JavaScriptObject toString]):
1387 (-[JavaScriptObject getSlot:]):
1388 (-[JavaScriptObject setSlot:value:]):
1389 * bindings/objc/objc_utility.h:
1390 * bindings/objc/objc_utility.mm:
1391 (KJS::Bindings::convertValueToObjcValue):
1392 * bindings/runtime_root.cpp: Added.
1393 (getReferencesByRootDictionary):
1394 (getReferencesDictionary):
1395 (KJS::Bindings::findReferenceDictionary):
1396 (KJS::Bindings::rootForImp):
1397 (KJS::Bindings::addNativeReference):
1398 (KJS::Bindings::removeNativeReference):
1399 (completedJavaScriptAccess):
1400 (initializeJavaScriptAccessLock):
1401 (lockJavaScriptAccess):
1402 (unlockJavaScriptAccess):
1403 (RootObject::dispatchToJavaScriptThread):
1404 (performJavaScriptAccess):
1405 (RootObject::setFindRootObjectForNativeHandleFunction):
1406 (RootObject::removeAllNativeReferences):
1407 * bindings/runtime_root.h: Added.
1408 (KJS::Bindings::RootObject::RootObject):
1409 (KJS::Bindings::RootObject::~RootObject):
1410 (KJS::Bindings::RootObject::setRootObjectImp):
1411 (KJS::Bindings::RootObject::rootObjectImp):
1412 (KJS::Bindings::RootObject::setInterpreter):
1413 (KJS::Bindings::RootObject::interpreter):
1414 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
1415 (KJS::Bindings::RootObject::runLoop):
1416 (KJS::Bindings::RootObject::performJavaScriptSource):
1422 2004-02-18 Richard Williamson <rjw@apple.com>
1424 Added NSNumber/Number conversion.
1426 Removed some unnecessary KJS:: namespace specifiers.
1430 * bindings/objc/objc_utility.mm:
1431 (KJS::Bindings::convertValueToObjcValue):
1432 (KJS::Bindings::convertObjcValueToValue):
1433 * bindings/runtime_array.h:
1435 2004-02-18 Richard Williamson <rjw@apple.com>
1437 Added support for export NSArrays.
1439 Updated valueAt() to take an ExecState so we can throw
1442 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
1443 ObjectiveC classes to control the visibility of their methods in
1448 * bindings/jni/jni_runtime.cpp:
1449 (JavaField::valueFromInstance):
1450 (JavaArray::valueAt):
1451 * bindings/jni/jni_runtime.h:
1452 * bindings/objc/objc_class.mm:
1453 (ObjcClass::methodsNamed):
1454 * bindings/objc/objc_runtime.h:
1455 (KJS::Bindings::ObjcArray::getObjcArray):
1456 * bindings/objc/objc_runtime.mm:
1457 (ObjcField::valueFromInstance):
1458 (ObjcField::setValueToInstance):
1459 (ObjcArray::ObjcArray):
1460 (ObjcArray::~ObjcArray):
1461 (ObjcArray::operator=):
1462 (ObjcArray::setValueAt):
1463 (ObjcArray::valueAt):
1464 (ObjcArray::getLength):
1465 * bindings/objc/objc_utility.mm:
1466 (KJS::Bindings::convertValueToObjcValue):
1467 (KJS::Bindings::convertObjcValueToValue):
1468 * bindings/runtime.cpp:
1469 (Instance::getValueOfField):
1470 * bindings/runtime.h:
1471 * bindings/runtime_array.cpp:
1472 (RuntimeArrayImp::get):
1473 * bindings/runtime_object.cpp:
1474 (RuntimeObjectImp::get):
1476 2004-02-17 Richard Williamson <rjw@apple.com>
1478 Added String <-> NSString conversion.
1479 Added tests of String <-> NSString conversion to test program.
1483 * bindings/objc/objc_utility.mm:
1484 (KJS::Bindings::convertValueToObjcValue):
1485 (KJS::Bindings::convertObjcValueToValue):
1487 * bindings/testbindings.mm:
1488 (-[MyFirstInterface getString]):
1490 2004-02-15 Darin Adler <darin@apple.com>
1494 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
1495 and removing redundant settings of things that match defaults in other build styles.
1497 2004-02-13 Richard Williamson <rjw@apple.com>
1499 Work towards the JavaScript ObjC bindings. The bindings now work for
1500 simple scalar types. testbindings.mm is an illustration of how the
1505 * JavaScriptCore.pbproj/project.pbxproj:
1507 * bindings/jni/jni_class.cpp:
1508 (JavaClass::methodsNamed):
1509 * bindings/jni/jni_class.h:
1510 * bindings/jni/jni_instance.cpp:
1511 (JavaInstance::invokeMethod):
1512 * bindings/jni/jni_instance.h:
1513 * bindings/jni/jni_runtime.h:
1514 (KJS::Bindings::JavaMethod::returnType):
1515 * bindings/make_testbindings: Added.
1516 * bindings/objc/objc_class.h: Added.
1517 (KJS::Bindings::ObjcClass::~ObjcClass):
1518 (KJS::Bindings::ObjcClass::ObjcClass):
1519 (KJS::Bindings::ObjcClass::operator=):
1520 (KJS::Bindings::ObjcClass::constructorAt):
1521 (KJS::Bindings::ObjcClass::numConstructors):
1522 * bindings/objc/objc_class.mm: Added.
1523 (ObjcClass::_commonDelete):
1524 (ObjcClass::_commonCopy):
1525 (ObjcClass::_commonInit):
1526 (_createClassesByIsAIfNecessary):
1527 (ObjcClass::classForIsA):
1528 (ObjcClass::ObjcClass):
1530 (ObjcClass::methodsNamed):
1531 (ObjcClass::fieldNamed):
1532 * bindings/objc/objc_header.h: Added.
1533 * bindings/objc/objc_instance.h: Added.
1534 (KJS::Bindings::ObjcInstance::getObject):
1535 * bindings/objc/objc_instance.mm: Added.
1536 (ObjcInstance::ObjcInstance):
1537 (ObjcInstance::~ObjcInstance):
1538 (ObjcInstance::operator=):
1539 (ObjcInstance::begin):
1540 (ObjcInstance::end):
1541 (ObjcInstance::getClass):
1542 (ObjcInstance::invokeMethod):
1543 (ObjcInstance::defaultValue):
1544 (ObjcInstance::stringValue):
1545 (ObjcInstance::numberValue):
1546 (ObjcInstance::booleanValue):
1547 (ObjcInstance::valueOf):
1548 * bindings/objc/objc_jsobject.h: Added.
1549 * bindings/objc/objc_jsobject.mm: Added.
1550 * bindings/objc/objc_runtime.h:
1551 (KJS::Bindings::ObjcField::~ObjcField):
1552 (KJS::Bindings::ObjcField::ObjcField):
1553 (KJS::Bindings::ObjcField::operator=):
1554 (KJS::Bindings::ObjcMethod::ObjcMethod):
1555 (KJS::Bindings::ObjcMethod::~ObjcMethod):
1556 (KJS::Bindings::ObjcMethod::operator=):
1557 * bindings/objc/objc_runtime.mm: Added.
1558 (ObjcMethod::ObjcMethod):
1560 (ObjcMethod::numParameters):
1561 (ObjcMethod::getMethodSignature):
1562 (ObjcField::ObjcField):
1565 (ObjcField::valueFromInstance):
1566 (ObjcField::setValueToInstance):
1567 * bindings/objc/objc_utility.h: Added.
1569 * bindings/objc/objc_utility.mm: Added.
1570 (KJS::Bindings::JSMethodNameToObjCMethodName):
1571 (KJS::Bindings::convertValueToObjcValue):
1572 (KJS::Bindings::convertObjcValueToValue):
1573 (KJS::Bindings::objcValueTypeForType):
1574 * bindings/runtime.cpp:
1575 (MethodList::MethodList):
1576 (MethodList::operator=):
1577 (Instance::setValueOfField):
1578 (Instance::createBindingForLanguageInstance):
1579 (Instance::createRuntimeObject):
1580 * bindings/runtime.h:
1581 * bindings/runtime_method.cpp:
1582 (RuntimeMethodImp::RuntimeMethodImp):
1583 (RuntimeMethodImp::get):
1584 (RuntimeMethodImp::call):
1585 * bindings/runtime_method.h:
1586 * bindings/runtime_object.cpp:
1587 (RuntimeObjectImp::get):
1588 (RuntimeObjectImp::hasProperty):
1589 * bindings/test.js: Added.
1590 * bindings/testbindings.mm: Added.
1591 (-[MySecondInterface init]):
1592 (-[MyFirstInterface init]):
1593 (-[MyFirstInterface dealloc]):
1594 (+[MyFirstInterface JavaScriptNameForSelector:]):
1595 (-[MyFirstInterface getInt]):
1596 (-[MyFirstInterface setInt:]):
1597 (-[MyFirstInterface getMySecondInterface]):
1598 (-[MyFirstInterface logMessage:]):
1599 (GlobalImp::className):
1600 (readJavaScriptFromFile):
1605 2004-02-08 Darin Adler <darin@apple.com>
1609 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
1611 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
1612 macros from working right in C++ code that uses the <cctype> header.
1615 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
1616 (KJS::UTF8SequenceLengthNonASCII): Added.
1617 (KJS::inlineUTF8SequenceLength): Added.
1618 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
1619 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
1620 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
1621 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
1622 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
1624 - fixed the test program so it won't hit the interpreter lock assertion
1626 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
1630 2004-02-06 Richard Williamson <rjw@apple.com>
1632 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.
1636 * bindings/jni/jni_jsobject.cpp:
1637 (JSObject::toString):
1638 * bindings/jni/jni_utility.cpp:
1639 (KJS::Bindings::convertValueToJValue):
1641 2004-02-02 Darin Adler <darin@apple.com>
1645 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
1647 * kjs/array_object.cpp:
1648 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
1649 we start putting values in. This prevents new Array(2147483647) from causing trouble.
1650 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
1651 number is out of range. This prevents new Array(-1) from causing trouble.
1653 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
1655 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
1656 casting to int. Results now match those in other browsers.
1658 2004-02-02 Darin Adler <darin@apple.com>
1662 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
1663 - fixed other related overflow issues
1665 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
1667 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
1668 must not restrict values to the range of a particular integer type.
1669 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
1670 proper handling for negative results from fmod.
1671 (ValueImp::toUInt32): Ditto.
1672 (ValueImp::toUInt16): Ditto.
1673 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
1675 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
1676 out-of-integer-range values better in the slice function.
1677 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
1678 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
1679 out-of-integer-range values better in the toString function.
1680 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
1681 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
1682 and substr functions.
1686 2004-01-30 Richard Williamson <rjw@apple.com>
1688 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
1692 * bindings/jni/jni_instance.cpp:
1693 (JavaInstance::stringValue):
1695 2004-01-26 Darin Adler <darin@apple.com>
1697 * Makefile.am: Switch from pbxbuild to xcodebuild.
1699 2004-01-22 Richard Williamson <rjw@apple.com>
1701 Added stubs for ObjC language binding to JavaScript.
1703 * JavaScriptCore.pbproj/project.pbxproj:
1704 * bindings/jni/jni_runtime.h:
1705 * bindings/objc/objc_runtime.h: Added.
1706 (KJS::Bindings::ObjcParameter::ObjcParameter):
1707 (KJS::Bindings::ObjcParameter::~ObjcParameter):
1708 (KJS::Bindings::ObjcParameter::operator=):
1709 (KJS::Bindings::ObjcParameter::type):
1710 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
1711 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
1712 (KJS::Bindings::ObjcConstructor::_commonCopy):
1713 (KJS::Bindings::ObjcConstructor::operator=):
1714 (KJS::Bindings::ObjcConstructor::value):
1715 (KJS::Bindings::ObjcConstructor::parameterAt):
1716 (KJS::Bindings::ObjcConstructor::numParameters):
1717 (KJS::Bindings::ObjcField::ObjcField):
1718 (KJS::Bindings::ObjcField::~ObjcField):
1719 * bindings/runtime.h:
1721 2004-01-22 Richard Williamson <rjw@apple.com>
1723 Simplified JavaString by using UString as backing store. This
1724 revealed a bug in CString's assignment operator which I fixed.
1726 Removed some dead code.
1730 * bindings/jni/jni_runtime.h:
1731 (KJS::Bindings::JavaString::JavaString):
1732 (KJS::Bindings::JavaString::_commonInit):
1733 (KJS::Bindings::JavaString::UTF8String):
1734 (KJS::Bindings::JavaString::uchars):
1735 (KJS::Bindings::JavaString::length):
1736 (KJS::Bindings::JavaString::ustring):
1737 * bindings/runtime_object.cpp:
1738 (RuntimeObjectImp::RuntimeObjectImp):
1739 * bindings/runtime_object.h:
1741 (KJS::CString::CString):
1742 (KJS::CString::operator=):
1748 2004-01-16 Richard Williamson <rjw@apple.com>
1750 Fixed 3525853. We weren't handling mapping to overloaded Java
1751 methods very well. Even though this is undefined the other
1752 browsers support it. Also fixed a bug with returning arrays
1753 from Java functions.
1757 * bindings/jni/jni_class.cpp:
1758 (JavaClass::_commonInit):
1759 (JavaClass::methodsNamed):
1760 * bindings/jni/jni_class.h:
1761 * bindings/jni/jni_instance.cpp:
1762 (JavaInstance::invokeMethod):
1763 * bindings/jni/jni_instance.h:
1764 * bindings/jni/jni_runtime.cpp:
1765 (JavaArray::convertJObjectToArray):
1766 (JavaField::valueFromInstance):
1767 (JavaMethod::signature):
1768 (JavaArray::valueAt):
1769 * bindings/jni/jni_runtime.h:
1770 * bindings/jni_jsobject.cpp:
1772 (JSObject::convertJObjectToValue):
1773 * bindings/runtime.cpp:
1774 (MethodList::addMethod):
1775 (MethodList::length):
1776 (MethodList::methodAt):
1777 (MethodList::~MethodList):
1778 * bindings/runtime.h:
1779 (KJS::Bindings::MethodList::MethodList):
1780 * bindings/runtime_method.cpp:
1781 (RuntimeMethodImp::RuntimeMethodImp):
1782 (RuntimeMethodImp::get):
1783 (RuntimeMethodImp::call):
1784 * bindings/runtime_method.h:
1785 * bindings/runtime_object.cpp:
1786 (RuntimeObjectImp::get):
1787 (RuntimeObjectImp::hasProperty):
1789 2004-01-16 Richard Williamson <rjw@apple.com>
1791 Fixed 3531229. Another place that needs the Push/PopLocalFrame
1792 protection implemented for 3530401.
1796 * bindings/runtime_method.cpp:
1797 (RuntimeMethodImp::call):
1799 2004-01-15 Richard Williamson <rjw@apple.com>
1801 Fixed 3530401. JNI doesn't cleanup local refs created on the
1802 main thread. IMO this is a bad bug in our JMI implementation.
1804 To work-around the problem I explicitly delete all local refs.
1805 Further, I've added Push/PopLocalFrame calls to catch any refs
1806 that I may have missed. This will guarantee that we don't leak
1807 any Java references.
1811 * bindings/jni/jni_class.cpp:
1812 (JavaClass::_commonInit):
1813 (JavaClass::JavaClass):
1814 * bindings/jni/jni_instance.cpp:
1815 (JavaInstance::begin):
1816 (JavaInstance::end):
1817 * bindings/jni/jni_instance.h:
1818 * bindings/jni/jni_runtime.cpp:
1819 (JavaConstructor::JavaConstructor):
1820 (JavaMethod::JavaMethod):
1821 * bindings/jni_jsobject.cpp:
1822 (JSObject::listFromJArray):
1823 * bindings/runtime.h:
1824 (KJS::Bindings::Instance::begin):
1825 (KJS::Bindings::Instance::end):
1826 * bindings/runtime_object.cpp:
1827 (RuntimeObjectImp::get):
1828 (RuntimeObjectImp::put):
1829 (RuntimeObjectImp::canPut):
1830 (RuntimeObjectImp::hasProperty):
1831 (RuntimeObjectImp::defaultValue):
1833 2004-01-15 Vicki Murley <vicki@apple.com>
1837 * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
1839 2004-01-14 Richard Williamson <rjw@apple.com>
1841 Fixed 3529466. With recent changes to Java plugin we must no
1842 longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
1846 * bindings/jni/jni_instance.cpp:
1847 (JObjectWrapper::JObjectWrapper):
1851 2004-01-14 Richard Williamson <rjw@apple.com>
1855 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.
1859 * bindings/jni_jsobject.cpp:
1861 (removeJavaReference):
1862 (RootObject::removeAllJavaReferencesForRoot):
1865 2004-01-13 Richard Williamson <rjw@apple.com>
1869 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.
1873 * bindings/jni_jsobject.h:
1874 (KJS::Bindings::RootObject::~RootObject):
1880 2004-01-06 Richard Williamson <rjw@apple.com>
1882 Fixed 3521814. Finalize messages weren't being dispatched!
1886 * bindings/jni_jsobject.cpp:
1889 2004-01-05 Richard Williamson <rjw@apple.com>
1891 Added cache of JNI method IDs to minimize allocations. This mitigates the problem
1892 described by 3515579.
1894 Also cleanup up logging of Java exceptions.
1898 * bindings/jni/jni_class.cpp:
1899 (JavaClass::classForInstance):
1900 * bindings/jni/jni_instance.cpp:
1901 (JavaInstance::JavaInstance):
1902 (JavaInstance::getClass):
1903 (JavaInstance::invokeMethod):
1904 (JObjectWrapper::JObjectWrapper):
1905 (JObjectWrapper::~JObjectWrapper):
1906 * bindings/jni/jni_instance.h:
1907 (KJS::Bindings::JavaInstance::operator=):
1908 * bindings/jni/jni_runtime.cpp:
1909 (JavaMethod::JavaMethod):
1910 (JavaMethod::methodID):
1911 * bindings/jni/jni_runtime.h:
1912 (KJS::Bindings::JavaMethod::JavaMethod):
1913 * bindings/jni/jni_utility.cpp:
1917 (KJS::Bindings::getMethodID):
1918 (KJS::Bindings::callJNIVoidMethodIDA):
1919 (KJS::Bindings::callJNIObjectMethodIDA):
1920 (KJS::Bindings::callJNIByteMethodIDA):
1921 (KJS::Bindings::callJNICharMethodIDA):
1922 (KJS::Bindings::callJNIShortMethodIDA):
1923 (KJS::Bindings::callJNIIntMethodIDA):
1924 (KJS::Bindings::callJNILongMethodIDA):
1925 (KJS::Bindings::callJNIFloatMethodIDA):
1926 (KJS::Bindings::callJNIDoubleMethodIDA):
1927 (KJS::Bindings::callJNIBooleanMethodIDA):
1928 (KJS::Bindings::getCharactersFromJStringInEnv):
1929 (KJS::Bindings::getUCharactersFromJStringInEnv):
1930 (KJS::Bindings::getJNIField):
1931 * bindings/jni/jni_utility.h:
1933 l2003-12-23 John Sullivan <sullivan@apple.com>
1935 * JavaScriptCore.pbproj/project.pbxproj:
1936 Xcode version wars, harmless
1938 2003-12-23 Darin Adler <darin@apple.com>
1940 Reviewed by John (concept, not code, which is just the old code coming back).
1942 - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
1944 * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
1945 mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
1947 2003-12-19 Richard Williamson <rjw@apple.com>
1949 Fixed 3515597. When an error occurs we need
1950 to make sure result values are zeroed.
1952 Cleaned up logs by adding a newline.
1956 * bindings/jni/jni_utility.cpp:
1957 (KJS::Bindings::getJavaVM):
1958 (KJS::Bindings::getJNIEnv):
1961 (KJS::Bindings::getJNIField):
1962 * bindings/jni_jsobject.cpp:
1963 (JSObject::convertValueToJObject):
1967 2003-12-17 Richard Williamson <rjw@apple.com>
1969 Ensure that all the symbols we export are in the KJS
1970 namespace (3512245).
1972 Also renamed JavaString.characters() to JavaString.UTF8String()
1973 for enhanced clarity.
1975 Added some sanity checking to constructor of JObjectWrapper.
1980 * bindings/jni/jni_class.cpp:
1981 * bindings/jni/jni_class.h:
1982 * bindings/jni/jni_instance.cpp:
1983 (JavaInstance::invokeMethod):
1984 (JObjectWrapper::JObjectWrapper):
1985 * bindings/jni/jni_instance.h:
1986 * bindings/jni/jni_runtime.cpp:
1987 (JavaParameter::JavaParameter):
1988 (JavaField::JavaField):
1989 (JavaMethod::JavaMethod):
1990 (JavaMethod::signature):
1991 * bindings/jni/jni_runtime.h:
1992 (KJS::Bindings::JavaString::ascii):
1993 (KJS::Bindings::JavaString::UTF8String):
1994 (KJS::Bindings::JavaString::JavaString):
1995 (KJS::Bindings::JavaString::_commonInit):
1996 (KJS::Bindings::JavaString::uchars):
1997 (KJS::Bindings::JavaString::length):
1998 (KJS::Bindings::JavaString::ustring):
1999 (KJS::Bindings::JavaParameter::type):
2000 (KJS::Bindings::JavaField::name):
2001 (KJS::Bindings::JavaField::type):
2002 (KJS::Bindings::JavaMethod::name):
2003 (KJS::Bindings::JavaMethod::returnType):
2004 * bindings/jni/jni_utility.cpp:
2005 (KJS::Bindings::getJavaVM):
2006 (KJS::Bindings::getJNIEnv):
2007 (KJS::Bindings::callJNIVoidMethod):
2008 (KJS::Bindings::callJNIObjectMethod):
2009 (KJS::Bindings::callJNIBooleanMethod):
2010 (KJS::Bindings::callJNIByteMethod):
2011 (KJS::Bindings::callJNICharMethod):
2012 (KJS::Bindings::callJNIShortMethod):
2013 (KJS::Bindings::callJNIIntMethod):
2014 (KJS::Bindings::callJNILongMethod):
2015 (KJS::Bindings::callJNIFloatMethod):
2016 (KJS::Bindings::callJNIDoubleMethod):
2017 (KJS::Bindings::callJNIVoidMethodA):
2018 (KJS::Bindings::callJNIObjectMethodA):
2019 (KJS::Bindings::callJNIByteMethodA):
2020 (KJS::Bindings::callJNICharMethodA):
2021 (KJS::Bindings::callJNIShortMethodA):
2022 (KJS::Bindings::callJNIIntMethodA):
2023 (KJS::Bindings::callJNILongMethodA):
2024 (KJS::Bindings::callJNIFloatMethodA):
2025 (KJS::Bindings::callJNIDoubleMethodA):
2026 (KJS::Bindings::callJNIBooleanMethodA):
2027 (KJS::Bindings::getCharactersFromJString):
2028 (KJS::Bindings::releaseCharactersForJString):
2029 (KJS::Bindings::getCharactersFromJStringInEnv):
2030 (KJS::Bindings::releaseCharactersForJStringInEnv):
2031 (KJS::Bindings::getUCharactersFromJStringInEnv):
2032 (KJS::Bindings::releaseUCharactersForJStringInEnv):
2033 (KJS::Bindings::JNITypeFromClassName):
2034 (KJS::Bindings::signatureFromPrimitiveType):
2035 (KJS::Bindings::JNITypeFromPrimitiveType):
2036 (KJS::Bindings::getJNIField):
2037 (KJS::Bindings::convertValueToJValue):
2038 * bindings/jni/jni_utility.h:
2039 * bindings/jni_jsobject.cpp:
2040 (KJS::Bindings::JSObject::invoke):
2041 (KJS::Bindings::JSObject::JSObject):
2042 (KJS::Bindings::JSObject::call):
2043 (KJS::Bindings::JSObject::eval):
2044 (KJS::Bindings::JSObject::getMember):
2045 (KJS::Bindings::JSObject::setMember):
2046 (KJS::Bindings::JSObject::removeMember):
2047 (KJS::Bindings::JSObject::getSlot):
2048 (KJS::Bindings::JSObject::setSlot):
2049 (KJS::Bindings::JSObject::toString):
2050 (KJS::Bindings::JSObject::finalize):
2051 (KJS::Bindings::JSObject::createNative):
2052 (KJS::Bindings::JSObject::convertValueToJObject):
2053 (KJS::Bindings::JSObject::convertJObjectToValue):
2054 (KJS::Bindings::JSObject::listFromJArray):
2055 * bindings/jni_jsobject.h:
2056 * bindings/runtime.cpp:
2057 * bindings/runtime.h:
2058 * bindings/runtime_method.cpp:
2059 * bindings/runtime_method.h:
2063 2003-12-16 Richard Williamson <rjw@apple.com>
2065 Ack! More assertions. Lock ALL entry points into the interpreter!
2070 * bindings/jni_jsobject.cpp:
2071 (Bindings::JSObject::call):
2072 (Bindings::JSObject::eval):
2073 (Bindings::JSObject::getMember):
2074 (Bindings::JSObject::setMember):
2075 (Bindings::JSObject::removeMember):
2076 (Bindings::JSObject::getSlot):
2077 (Bindings::JSObject::setSlot):
2078 (Bindings::JSObject::convertJObjectToValue):
2080 2003-12-15 Richard Williamson <rjw@apple.com>
2082 Fixed a couple of snafus and removed some logging.
2086 * bindings/jni_jsobject.cpp:
2087 (Bindings::performJavaScriptAccess):
2088 (Bindings::completedJavaScriptAccess):
2089 (Bindings::dispatchToJavaScriptThread):
2090 Removed some annoying JS_LOG clutter.
2092 (Bindings::RootObject::removeAllJavaReferencesForRoot):
2093 Fixed allocation of key buffer that was called after it was needed.
2095 (Bindings::JSObject::invoke):
2096 (Bindings::JSObject::JSObject):
2097 (Bindings::JSObject::getMember):
2098 (Bindings::JSObject::getSlot):
2099 Added additional interpreter locks around getMember and getSlot.
2100 These functions may cause allocation of JS impls.
2102 2003-12-15 Richard Williamson <rjw@apple.com>
2104 args weren't passed to 'call' invocation. d'oh.
2105 lock interpreter when we create instances of JS impls.
2109 * bindings/jni_jsobject.cpp:
2110 (Bindings::JSObject::call):
2111 (Bindings::JSObject::eval):
2112 (Bindings::JSObject::getMember):
2113 (Bindings::JSObject::setMember):
2114 (Bindings::JSObject::getSlot):
2115 (Bindings::JSObject::convertValueToJObject):
2116 (Bindings::JSObject::convertJObjectToValue):
2117 (Bindings::JSObject::listFromJArray):
2118 * bindings/jni_jsobject.h:
2120 2003-12-15 Richard Williamson <rjw@apple.com>
2122 Last piece of LiveConnect! This checkin adds implementation
2123 of the Java to JavaScript object conversion functions.
2127 * bindings/jni/jni_instance.cpp:
2128 (JavaInstance::invokeMethod):
2129 * bindings/jni/jni_utility.cpp:
2130 * bindings/jni/jni_utility.h:
2131 * bindings/jni_jsobject.cpp:
2132 (Bindings::JSObject::invoke):
2133 (Bindings::JSObject::call):
2134 (Bindings::JSObject::eval):
2135 (Bindings::JSObject::getMember):
2136 (Bindings::JSObject::setMember):
2137 (Bindings::JSObject::getSlot):
2138 (Bindings::JSObject::setSlot):
2139 (Bindings::JSObject::createNative):
2140 (Bindings::JSObject::convertValueToJObject):
2141 (Bindings::JSObject::convertJObjectToValue):
2142 (Bindings::JSObject::listFromJArray):
2143 * bindings/jni_jsobject.h:
2145 * bindings/runtime_method.cpp:
2146 (RuntimeMethodImp::get):
2147 (RuntimeMethodImp::codeType):
2148 (RuntimeMethodImp::execute):
2150 2003-12-12 Richard Williamson <rjw@apple.com>
2152 Added implementation of stubs in JSObject. All that
2153 remains is a couple of simple conversion functions stubs and
2154 we're done with LiveConnect. Also, changed string passing to
2155 JS to use uchars instead of chars.
2159 * bindings/jni/jni_runtime.h:
2160 (Bindings::JavaString::JavaString):
2161 (Bindings::JavaString::_commonInit):
2162 (Bindings::JavaString::_commonCopy):
2163 (Bindings::JavaString::_commonDelete):
2164 (Bindings::JavaString::~JavaString):
2165 (Bindings::JavaString::operator=):
2166 (Bindings::JavaString::uchars):
2167 (Bindings::JavaString::length):
2168 (Bindings::JavaString::ustring):
2169 * bindings/jni/jni_utility.cpp:
2170 (getUCharactersFromJStringInEnv):
2171 (releaseUCharactersForJStringInEnv):
2172 (convertValueToJObject):
2173 (convertJObjectToValue):
2174 * bindings/jni/jni_utility.h:
2175 * bindings/jni_jsobject.cpp:
2176 (Bindings::JSObject::invoke):
2177 (Bindings::JSObject::call):
2178 (Bindings::JSObject::eval):
2179 (Bindings::JSObject::getMember):
2180 (Bindings::JSObject::setMember):
2181 (Bindings::JSObject::removeMember):
2182 (Bindings::JSObject::getSlot):
2183 (Bindings::JSObject::setSlot):
2184 * bindings/jni_jsobject.h:
2186 2003-12-12 Richard Williamson <rjw@apple.com>
2188 Ensure that all calls from Java into JavaScript are
2189 performed on a designated thread (the main thread).
2193 * bindings/jni_jsobject.cpp:
2194 (isJavaScriptThread):
2196 (Bindings::performJavaScriptAccess):
2197 (Bindings::completedJavaScriptAccess):
2198 (Bindings::initializeJavaScriptAccessLock):
2199 (Bindings::lockJavaScriptAccess):
2200 (Bindings::unlockJavaScriptAccess):
2201 (Bindings::dispatchToJavaScriptThread):
2202 (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
2203 (Bindings::RootObject::removeAllJavaReferencesForRoot):
2204 (Bindings::JSObject::invoke):
2205 (Bindings::JSObject::JSObject):
2206 (Bindings::JSObject::call):
2207 (Bindings::JSObject::eval):
2208 (Bindings::JSObject::getMember):
2209 (Bindings::JSObject::setMember):
2210 (Bindings::JSObject::removeMember):
2211 (Bindings::JSObject::getSlot):
2212 (Bindings::JSObject::setSlot):
2213 (Bindings::JSObject::toString):
2214 (Bindings::JSObject::finalize):
2215 (Bindings::JSObject::getWindow):
2216 * bindings/jni_jsobject.h:
2217 (Bindings::RootObject::~RootObject):
2218 (Bindings::RootObject::findRootObjectForNativeHandleFunction):
2219 (Bindings::RootObject::runLoop):
2220 (Bindings::RootObject::performJavaScriptSource):
2223 2003-12-11 Richard Williamson <rjw@apple.com>
2225 Added support for calling a JavaScript function from
2226 Java. Right now this only works for void func(void)
2227 functions, but the conversion of args and return values
2230 Cleaned up and verified reference counting scheme, and
2231 dereferencing of vended JavaScript objects when applet is
2232 destroyed (actually when part is destroyed).
2234 Removed link hack for testkjs now that the Java folks think
2235 they have a solution for the 1.4.2 JavaVM link problem. Although
2236 Greg B. thinks his solution may cause problems for the 1.3.1
2237 version of the VM!?!
2242 * bindings/jni/jni_runtime.h:
2243 (Bindings::JavaString::JavaString):
2244 * bindings/jni/jni_utility.cpp:
2245 (convertValueToJValue):
2246 (convertValueToJObject):
2248 * bindings/jni/jni_utility.h:
2249 * bindings/jni_jsobject.cpp:
2250 (KJS_setFindRootObjectForNativeHandleFunction):
2251 (KJS_findRootObjectForNativeHandleFunction):
2252 (getReferencesByRootDictionary):
2253 (getReferencesDictionary):
2254 (findReferenceDictionary):
2257 (removeJavaReference):
2258 * bindings/jni_jsobject.h:
2259 (Bindings::RootObject::RootObject):
2260 (Bindings::RootObject::~RootObject):
2261 (Bindings::RootObject::setRootObjectImp):
2262 (Bindings::RootObject::rootObjectImp):
2263 (Bindings::RootObject::setInterpreter):
2264 (Bindings::RootObject::interpreter):
2268 2003-12-10 Darin Adler <darin@apple.com>
2272 - fixed regression in JavaScript tests reported by the KDE guys
2273 - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
2275 * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
2277 (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
2278 tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
2279 and binary compatibility than default parameter values.
2280 (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
2282 * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
2283 "tolerate empty string" parameter.
2285 2003-12-10 Richard Williamson <rjw@apple.com>
2287 Added code to manage reference counting of JavaScript
2288 objects passed to Java. Also added implementation of
2289 KJS_JSCreateNativeJSObject. This is the function that
2290 provides the root object to Java (KJS::Window).
2294 * JavaScriptCore.pbproj/project.pbxproj:
2295 * bindings/jni_jsobject.cpp:
2296 (KJS_setFindObjectForNativeHandleFunction):
2297 (KJS_findObjectForNativeHandleFunction):
2298 (getReferencesByOwnerDictionary):
2299 (getReferencesDictionary):
2300 (findReferenceDictionary):
2302 (removeJavaReference):
2303 (removeAllJavaReferencesForOwner):
2304 * bindings/jni_jsobject.h:
2306 2003-12-09 Richard Williamson <rjw@apple.com>
2308 LiveConnect stubs that correspond to the native methods
2309 on JSObject. These will be called from the new Java plugin
2310 when an instance of JSObject is instantiated and messaged.
2311 When these are implemented the Java will be able to originate
2312 calls into JavaScript.
2314 Also a temporary work-around added to Makefile.am to solve
2315 a link problem. The 1.4.2 JavaVM accidentally links against
2316 libobjc. This call a failure linking testkjs. Mike Hay is
2317 working with someone to fix the problem (3505587).
2321 * JavaScriptCore.pbproj/project.pbxproj:
2323 * bindings/jni_jsobject.cpp: Added.
2324 (KJS_JSCreateNativeJSObject):
2325 (KJS_JSObject_JSFinalize):
2326 (KJS_JSObject_JSObjectCall):
2327 (KJS_JSObject_JSObjectEval):
2328 (KJS_JSObject_JSObjectGetMember):
2329 (KJS_JSObject_JSObjectSetMember):
2330 (KJS_JSObject_JSObjectRemoveMember):
2331 (KJS_JSObject_JSObjectGetSlot):
2332 (KJS_JSObject_JSObjectSetSlot):
2333 (KJS_JSObject_JSObjectToString):
2334 * bindings/jni_jsobject.h: Added.
2336 2003-12-09 Maciej Stachowiak <mjs@apple.com>
2340 <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
2342 * kjs/collector.cpp:
2343 (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
2344 (KJS::Collector::collect): likewise
2346 2003-12-08 Richard Williamson <rjw@apple.com>
2348 LiveConnect: The last piece of the JavaScript side of the
2349 LiveConnect implementation. This change adds support for
2350 setting/getting values from Java arrays in JavaScript.
2354 * bindings/jni/jni_instance.h:
2355 * bindings/jni/jni_runtime.cpp:
2356 (JavaField::JavaField):
2357 (convertJObjectToArray):
2358 (JavaArray::JavaArray):
2359 (JavaArray::~JavaArray):
2360 (JavaArray::setValueAt):
2361 (JavaArray::valueAt):
2362 (JavaArray::getLength):
2363 * bindings/jni/jni_runtime.h:
2364 (Bindings::JavaArray::operator=):
2365 (Bindings::JavaArray::javaArray):
2366 * bindings/jni/jni_utility.cpp:
2367 (JNITypeFromPrimitiveType):
2368 (convertValueToJValue):
2369 * bindings/jni/jni_utility.h:
2370 * bindings/runtime.h:
2371 * bindings/runtime_array.cpp:
2372 (RuntimeArrayImp::RuntimeArrayImp):
2373 (RuntimeArrayImp::~RuntimeArrayImp):
2374 (RuntimeArrayImp::get):
2375 (RuntimeArrayImp::put):
2376 (RuntimeArrayImp::hasProperty):
2377 * bindings/runtime_array.h:
2378 (KJS::RuntimeArrayImp::getLength):
2379 (KJS::RuntimeArrayImp::getConcreteArray):
2380 * bindings/runtime_object.cpp:
2381 (RuntimeObjectImp::get):
2382 (RuntimeObjectImp::canPut):
2383 (RuntimeObjectImp::hasProperty):
2385 2003-12-05 Richard Williamson <rjw@apple.com>
2387 LiveConnect: Part 1 of supporting JS bindings to
2388 native language arrays.
2392 * JavaScriptCore.pbproj/project.pbxproj:
2393 * bindings/jni/jni_runtime.cpp:
2394 (JavaField::JavaField):
2395 (convertJObjectToArray):
2396 (JavaField::valueFromInstance):
2397 (JavaField::setValueToInstance):
2398 * bindings/jni/jni_runtime.h:
2399 * bindings/runtime.cpp:
2400 (Instance::setValueOfField):
2401 * bindings/runtime.h:
2402 (Bindings::Array::~Array):
2404 2003-12-04 Richard Williamson <rjw@apple.com>
2406 LiveConnect: Moved defaultValue into concrete implementation because
2407 more intelligent conversion can be perform with knowledge
2408 of the class of the original instance.
2412 * bindings/jni/jni_class.cpp:
2413 (JavaClass::isNumberClass):
2414 (JavaClass::isBooleanClass):
2415 (JavaClass::isStringClass):
2416 * bindings/jni/jni_class.h:
2417 * bindings/jni/jni_instance.cpp:
2418 (JavaInstance::defaultValue):
2419 (JavaInstance::valueOf):
2420 * bindings/jni/jni_instance.h:
2421 (Bindings::JavaInstance::javaInstance):
2422 * bindings/runtime.h:
2423 * bindings/runtime_object.cpp:
2424 (RuntimeObjectImp::defaultValue):
2426 2003-12-04 Richard Williamson <rjw@apple.com>
2428 LiveConnect: Added support for setting the value of Java
2433 * bindings/jni/jni_instance.cpp:
2434 (JavaInstance::invokeMethod):
2435 * bindings/jni/jni_runtime.cpp:
2436 (JavaParameter::JavaParameter):
2437 (JavaField::JavaField):
2438 (JavaField::valueFromInstance):
2439 (JavaField::setValueToInstance):
2440 (JavaMethod::JavaMethod):
2441 * bindings/jni/jni_runtime.h:
2442 (Bindings::JavaField::getJNIType):
2443 * bindings/jni/jni_utility.cpp:
2444 (JNITypeFromClassName):
2445 (convertValueToJValue):
2446 * bindings/jni/jni_utility.h:
2447 * bindings/runtime.cpp:
2448 (Instance::setValueOfField):
2449 * bindings/runtime.h:
2450 * bindings/runtime_object.cpp:
2451 (RuntimeObjectImp::get):
2452 (RuntimeObjectImp::put):
2453 (RuntimeObjectImp::defaultValue):
2455 2003-12-04 Richard Williamson <rjw@apple.com>
2457 Added support for string conversions.
2458 Changed various JavaString member variables to be inline.
2459 Implemented defaultValue for context relevant type coercion.
2463 * bindings/jni/jni_class.cpp:
2464 (JavaClass::JavaClass):
2465 (JavaClass::setClassName):
2466 (JavaClass::classForInstance):
2467 * bindings/jni/jni_class.h:
2468 * bindings/jni/jni_instance.cpp:
2469 (JavaInstance::stringValue):
2470 (JavaInstance::numberValue):
2471 (JavaInstance::booleanValue):
2472 (JavaInstance::invokeMethod):
2473 * bindings/jni/jni_instance.h:
2474 * bindings/jni/jni_runtime.cpp:
2475 (JavaParameter::JavaParameter):
2476 (JavaField::JavaField):
2477 (JavaMethod::JavaMethod):
2479 (JavaMethod::signature):
2480 * bindings/jni/jni_runtime.h:
2481 (Bindings::JavaString::JavaString):
2482 (Bindings::JavaString::~JavaString):
2483 (Bindings::JavaString::operator=):
2484 (Bindings::JavaString::characters):
2485 (Bindings::JavaParameter::JavaParameter):
2486 (Bindings::JavaParameter::~JavaParameter):
2487 (Bindings::JavaParameter::operator=):
2488 (Bindings::JavaParameter::type):
2489 (Bindings::JavaField::JavaField):
2490 (Bindings::JavaField::~JavaField):
2491 (Bindings::JavaField::operator=):
2492 (Bindings::JavaField::name):
2493 (Bindings::JavaField::type):
2494 (Bindings::JavaMethod::JavaMethod):
2495 (Bindings::JavaMethod::_commonDelete):
2496 (Bindings::JavaMethod::name):
2497 (Bindings::JavaMethod::returnType):
2498 * bindings/jni/jni_utility.cpp:
2499 (convertValueToJValue):
2500 * bindings/runtime.h:
2501 (Bindings::Instance::valueOf):
2502 * bindings/runtime_method.cpp:
2503 (RuntimeMethodImp::call):
2504 * bindings/runtime_object.cpp:
2505 (RuntimeObjectImp::RuntimeObjectImp):
2506 (RuntimeObjectImp::get):
2507 (RuntimeObjectImp::defaultValue):
2508 * bindings/runtime_object.h:
2509 (KJS::RuntimeObjectImp::classInfo):
2513 2003-12-03 Richard Williamson <rjw@apple.com>
2515 LiveConnect: Added support for parameter passing to Java and conversion
2520 * bindings/jni/jni_instance.cpp:
2521 (JavaInstance::invokeMethod):
2522 * bindings/jni/jni_instance.h:
2523 * bindings/jni/jni_runtime.cpp:
2524 (JavaParameter::JavaParameter):
2525 (JavaMethod::JavaMethod):
2526 (JavaMethod::signature):
2527 * bindings/jni/jni_runtime.h:
2528 (Bindings::JavaParameter::JavaParameter):
2529 (Bindings::JavaParameter::operator=):
2530 (Bindings::JavaParameter::getJNIType):
2531 * bindings/jni/jni_utility.cpp:
2532 (callJNIBooleanMethodA):
2533 (convertValueToJValue):
2534 * bindings/jni/jni_utility.h:
2535 * bindings/runtime.h:
2536 * bindings/runtime_method.cpp:
2537 (RuntimeMethodImp::call):
2538 * bindings/runtime_object.cpp:
2539 (RuntimeObjectImp::get):
2541 2003-12-02 Richard Williamson <rjw@apple.com>
2543 Added support for calling simple methods in Java from JavaScript.
2544 (void return and no parameters). Yay, LiveConnect lives.
2546 Still need write argument and return value conversion code.
2550 * JavaScriptCore.pbproj/project.pbxproj:
2551 * bindings/jni/jni_instance.cpp:
2552 (JavaInstance::getClass):
2553 (JavaInstance::invokeMethod):
2554 * bindings/jni/jni_instance.h:
2555 * bindings/jni/jni_runtime.cpp:
2556 (JavaMethod::JavaMethod):
2557 (JavaMethod::signature):
2558 (JavaMethod::JNIReturnType):
2559 * bindings/jni/jni_runtime.h:
2560 (Bindings::JavaMethod::_commonDelete):
2561 (Bindings::JavaMethod::_commonCopy):
2562 (Bindings::JavaMethod::name):
2563 * bindings/jni/jni_utility.cpp:
2564 (signatureFromPrimitiveType):
2565 * bindings/jni/jni_utility.h:
2566 * bindings/runtime.h:
2567 * bindings/runtime_method.cpp: Added.
2568 (RuntimeMethodImp::RuntimeMethodImp):
2569 (RuntimeMethodImp::~RuntimeMethodImp):
2570 (RuntimeMethodImp::get):
2571 (RuntimeMethodImp::implementsCall):
2572 (RuntimeMethodImp::call):
2573 (RuntimeMethodImp::codeType):
2574 (RuntimeMethodImp::execute):
2575 * bindings/runtime_method.h: Added.
2576 * bindings/runtime_object.cpp:
2577 (RuntimeObjectImp::RuntimeObjectImp):
2578 (RuntimeObjectImp::get):
2579 * bindings/runtime_object.h:
2581 (FunctionImp::FunctionImp):
2582 * kjs/interpreter.h:
2584 2003-12-01 Darin Adler <darin@apple.com>
2588 - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
2590 * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
2591 This indirectly caused the string.replace bug.
2593 2003-12-02 Maciej Stachowiak <mjs@apple.com>
2595 Merged patches from Harri Porten and David Faure to fix:
2597 <rdar://problem/3497643>: reproducible crash printing self-referential array
2599 * kjs/array_object.cpp:
2600 (ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown.
2602 (FunctionCallNode::evaluate): Move function call depth check from here...
2604 (KJS::Object::call): ...to here.
2605 * kjs/object.h: Un-inline Object::call now that it does more.
2607 2003-12-01 Richard Williamson <rjw@apple.com>
2609 Fixed mistake in method signatures used to get boolean and integer fields.
2613 * bindings/jni/jni_runtime.cpp:
2614 (JavaField::valueFromInstance):
2616 2003-12-01 Richard Williamson <rjw@apple.com>
2618 Fixed parameter passing to applet. Child elements are NOT valid in setStyle(). So we now create the widget before needed with createWidgetIfNecessary. This either happens when doing the first layout, or when JavaScript first references the applet element.
2620 Fixed early delete of the the main applet instance. When the JS collector cleaned up the last JS object referring to the applet instance we were deleting the java instance. This caused the applet instance cached on the applet element to be invalid. The applet instance is the only Java object not to be cleaned up by the JS collector.
2622 Added support for getting at Java object fields.
2626 * JavaScriptCore.pbproj/project.pbxproj:
2628 * bindings/jni/jni_instance.cpp:
2629 (JObjectWrapper::JObjectWrapper):
2630 * bindings/jni/jni_instance.h:
2631 (Bindings::JObjectWrapper::~JObjectWrapper):
2632 * bindings/jni/jni_runtime.cpp:
2633 (JavaField::valueFromInstance):
2634 * bindings/runtime_object.cpp:
2635 (RuntimeObjectImp::~RuntimeObjectImp):
2636 (RuntimeObjectImp::RuntimeObjectImp):
2637 (RuntimeObjectImp::get):
2638 (RuntimeObjectImp::deleteProperty):
2639 * bindings/runtime_object.h:
2643 2003-11-21 Maciej Stachowiak <mjs@apple.com>
2645 Patch from Harri Porten, reviewed by me.
2647 - fixed 3491712 - String slice with negative arguments does not offset from end of string
2649 * kjs/string_object.cpp:
2650 (StringProtoFuncImp::call): Handle negative arguments as offsets from end by
2651 adding length and clamping to [0,length-1].
2653 2003-11-21 Maciej Stachowiak <mjs@apple.com>
2655 Patch from Harri Porten, reviewed by me.
2657 - fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash
2659 * kjs/function_object.cpp:
2660 (FunctionProtoFuncImp::call): Nest parentheses properly.
2662 2003-11-20 Richard Williamson <rjw@apple.com>
2664 More LiveConnect stuff. Primitive Java fields are now
2665 accessible from JavaScript! Yay!
2669 * bindings/jni/jni_class.cpp:
2670 (JavaClass::methodNamed):
2671 (JavaClass::fieldNamed):
2672 * bindings/jni/jni_class.h:
2673 (Bindings::JavaClass::_commonDelete):
2674 * bindings/jni/jni_instance.cpp:
2675 (JavaInstance::JavaInstance):
2676 (JavaInstance::~JavaInstance):
2677 (JavaInstance::getClass):
2678 * bindings/jni/jni_instance.h:
2679 (Bindings::JavaInstance::javaInstance):
2680 * bindings/jni/jni_runtime.cpp:
2681 (JavaField::JavaField):
2682 (JavaField::valueFromInstance):
2683 * bindings/jni/jni_runtime.h:
2684 (Bindings::JavaField::JavaField):
2685 (Bindings::JavaField::~JavaField):
2686 (Bindings::JavaField::operator=):
2687 * bindings/jni/jni_utility.cpp:
2690 (callJNIVoidMethod):
2691 (callJNIObjectMethod):
2692 (callJNIBooleanMethod):
2693 (callJNIByteMethod):
2694 (callJNICharMethod):
2695 (callJNIShortMethod):
2697 (callJNILongMethod):
2698 (callJNIFloatMethod):
2699 (callJNIDoubleMethod):
2700 (callJNIVoidMethodA):
2701 (callJNIObjectMethodA):
2702 (callJNIByteMethodA):
2703 (callJNICharMethodA):
2704 (callJNIShortMethodA):
2705 (callJNIIntMethodA):
2706 (callJNILongMethodA):
2707 (callJNIFloatMethodA):
2708 (callJNIDoubleMethodA):
2709 (releaseCharactersForJStringInEnv):
2710 (primitiveTypeFromClassName):
2712 * bindings/jni/jni_utility.h:
2713 * bindings/runtime.cpp:
2714 (Instance::createBindingForLanguageInstance):
2715 (Instance::getValueOfField):
2716 * bindings/runtime.h:
2717 * bindings/runtime_object.cpp:
2718 (RuntimeObjectImp::get):
2720 2003-11-20 Richard Williamson <rjw@apple.com>
2722 More LiveConnect stuff.
2726 * bindings/jni/jni_class.cpp:
2727 (JavaClass::classForName):
2728 (JavaClass::classForInstance):
2729 * bindings/jni/jni_instance.cpp:
2730 (JavaInstance::getValueOfField):
2731 * bindings/jni/jni_instance.h:
2732 (Bindings::JObjectWrapper::JObjectWrapper):
2733 * bindings/jni/jni_runtime.h:
2734 (Bindings::JavaConstructor::~JavaConstructor):
2735 (Bindings::JavaConstructor::operator=):
2736 (Bindings::JavaMethod::JavaMethod):
2737 (Bindings::JavaMethod::_commonDelete):
2738 (Bindings::JavaMethod::signature):
2739 * bindings/jni/jni_utility.cpp:
2742 * bindings/jni/jni_utility.h:
2743 * bindings/runtime.h:
2744 * bindings/runtime_object.cpp:
2745 (RuntimeObjectImp::~RuntimeObjectImp):
2746 (RuntimeObjectImp::get):
2747 * bindings/runtime_object.h:
2749 2003-11-19 Richard Williamson <rjw@apple.com>
2751 More LiveConnect stuff.
2755 * JavaScriptCore.pbproj/project.pbxproj:
2756 * bindings/jni/jni_class.cpp: Added.
2757 (JavaClass::_commonInit):
2758 (JavaClass::JavaClass):
2759 (_createClassesByNameIfNecessary):
2760 (JavaClass::classForName):
2761 (JavaClass::classForInstance):
2762 (JavaClass::methodNamed):
2763 (JavaClass::fieldNamed):
2764 * bindings/jni/jni_class.h: Added.
2765 (Bindings::JavaClass::_commonDelete):
2766 (Bindings::JavaClass::~JavaClass):
2767 (Bindings::JavaClass::_commonCopy):
2768 (Bindings::JavaClass::JavaClass):
2769 (Bindings::JavaClass::operator=):
2770 (Bindings::JavaClass::name):
2771 (Bindings::JavaClass::constructorAt):
2772 (Bindings::JavaClass::numConstructors):
2773 * bindings/jni/jni_instance.cpp: Added.
2774 (JavaInstance::JavaInstance):
2775 (JavaInstance::~JavaInstance):
2776 * bindings/jni/jni_instance.h: Added.
2777 (Bindings::JObjectWrapper::JObjectWrapper):
2778 (Bindings::JObjectWrapper::~JObjectWrapper):
2779 (Bindings::JObjectWrapper::ref):
2780 (Bindings::JObjectWrapper::deref):
2781 (Bindings::JavaInstance::getClass):
2782 (Bindings::JavaInstance::operator=):
2783 * bindings/jni/jni_runtime.cpp:
2784 (JavaMethod::JavaMethod):
2785 * bindings/jni/jni_runtime.h:
2786 (Bindings::JavaString::JavaString):
2787 (Bindings::JavaString::~JavaString):
2788 (Bindings::JavaString::operator=):
2789 * bindings/jni/jni_utility.cpp:
2792 (getCharactersFromJString):
2793 (releaseCharactersForJString):
2794 (getCharactersFromJStringInEnv):
2795 (releaseCharactersForJStringInEnv):
2796 * bindings/jni/jni_utility.h:
2797 * bindings/runtime.cpp:
2798 (Instance::createBindingForLanguageInstance):
2799 * bindings/runtime.h:
2800 (Bindings::Instance::):
2802 2003-11-18 Richard Williamson <rjw@apple.com>
2804 More live connect stubs. We're getting close.
2808 * JavaScriptCore.pbproj/project.pbxproj:
2809 * bindings/jni/jni_runtime.cpp:
2810 (JavaClass::JavaClass):
2811 (JavaInstance::JavaInstance):
2812 (JavaInstance::~JavaInstance):
2813 * bindings/jni/jni_runtime.h:
2814 (Bindings::JavaConstructor::value):
2815 (Bindings::JavaField::value):
2816 (Bindings::JavaMethod::value):
2817 (Bindings::JavaClass::_commonDelete):
2818 (Bindings::JavaClass::_commonCopy):
2819 (Bindings::JavaClass::methodNamed):
2820 (Bindings::JavaClass::fieldNamed):
2821 (Bindings::JavaInstance::getClass):
2822 * bindings/runtime.cpp: Added.
2823 * bindings/runtime.h:
2824 (Bindings::Instance::~Instance):
2825 * bindings/runtime_object.cpp: Added.
2826 (RuntimeObjectImp::classInfo):
2827 (RuntimeObjectImp::RuntimeObjectImp):
2828 (RuntimeObjectImp::get):
2829 (RuntimeObjectImp::put):
2830 (RuntimeObjectImp::canPut):
2831 (RuntimeObjectImp::hasProperty):
2832 (RuntimeObjectImp::deleteProperty):
2833 (RuntimeObjectImp::defaultValue):
2834 (RuntimeObjectImp::_initializeClassInfoFromInstance):
2835 * bindings/runtime_object.h: Added.
2836 (KJS::RuntimeObjectImp::setInternalInstance):
2837 (KJS::RuntimeObjectImp::getInternalInstance):
2839 (KJS::ObjectImp::get):
2840 (KJS::ObjectImp::hasProperty):
2844 2003-11-17 Maciej Stachowiak <mjs@apple.com>
2846 Patch from Harri, reviewed by me.
2848 - fixed 3487375 - backwards array slice causes infinite loop
2850 * kjs/array_object.cpp:
2851 (ArrayProtoFuncImp::call):
2853 2003-11-17 Maciej Stachowiak <mjs@apple.com>
2855 Patch from Harri Porten reviewed by me.
2857 - fixed 3487371 - operator precedence for bitwise or, xor and and is wrong
2859 * kjs/grammar.y: Correct the precedence.
2861 2003-11-16 Maciej Stachowiak <mjs@apple.com>
2865 - fixed 3483829 - JavaScriptCore needs workaround to compile on Merlot
2867 * JavaScriptCore.pbproj/project.pbxproj: Add -Wno-long-double to
2872 2003-11-13 Richard Williamson <rjw@apple.com>
2874 Factored common code between copy constructor and assignment operator.
2879 * bindings/jni/jni_runtime.h:
2880 (Bindings::JavaConstructor::_commonCopy):
2881 (Bindings::JavaConstructor::JavaConstructor):
2882 (Bindings::JavaConstructor::operator=):
2883 (Bindings::JavaField::type):
2884 * bindings/runtime.h:
2886 2003-11-13 Richard Williamson <rjw@apple.com>
2888 More LiveConnect stuff. This checkin adds abstract classes to model
2889 language runtimes and a JNI based set of concrete implementations for
2894 * JavaScriptCore.pbproj/project.pbxproj:
2896 * bindings/Makefile.am: Removed.
2897 * bindings/jni/Makefile.am: Removed.
2898 * bindings/jni/jni_runtime.cpp: Added.
2899 (JavaField::JavaField):
2900 (JavaConstructor::JavaConstructor):
2901 (JavaMethod::JavaMethod):
2902 (JavaClass::JavaClass):
2903 * bindings/jni/jni_runtime.h: Added.
2904 (Bindings::JavaString::JavaString):
2905 (Bindings::JavaString::~JavaString):
2906 (Bindings::JavaString::operator=):
2907 (Bindings::JavaString::characters):
2908 (Bindings::JavaParameter::JavaParameter):
2909 (Bindings::JavaParameter::~JavaParameter):
2910 (Bindings::JavaParameter::operator=):
2911 (Bindings::JavaParameter::type):
2912 (Bindings::JavaConstructor::JavaConstructor):
2913 (Bindings::JavaConstructor::~JavaConstructor):
2914 (Bindings::JavaConstructor::operator=):
2915 (Bindings::JavaConstructor::parameterAt):
2916 (Bindings::JavaConstructor::numParameters):
2917 (Bindings::JavaField::JavaField):
2918 (Bindings::JavaField::~JavaField):
2919 (Bindings::JavaField::operator=):
2920 (Bindings::JavaField::name):
2921 (Bindings::JavaField::type):
2922 (Bindings::JavaMethod::JavaMethod):
2923 (Bindings::JavaMethod::_commonDelete):
2924 (Bindings::JavaMethod::~JavaMethod):
2925 (Bindings::JavaMethod::_commonCopy):
2926 (Bindings::JavaMethod::operator=):
2927 (Bindings::JavaMethod::name):
2928 (Bindings::JavaMethod::returnType):
2929 (Bindings::JavaMethod::parameterAt):
2930 (Bindings::JavaMethod::numParameters):
2931 (Bindings::JavaClass::_commonDelete):
2932 (Bindings::JavaClass::~JavaClass):
2933 (Bindings::JavaClass::_commonCopy):
2934 (Bindings::JavaClass::JavaClass):
2935 (Bindings::JavaClass::operator=):
2936 (Bindings::JavaClass::name):
2937 (Bindings::JavaClass::methodAt):
2938 (Bindings::JavaClass::numMethods):
2939 (Bindings::JavaClass::constructorAt):
2940 (Bindings::JavaClass::numConstructors):
2941 (Bindings::JavaClass::fieldAt):
2942 (Bindings::JavaClass::numFields):
2943 * bindings/jni/jni_utility.cpp:
2946 (callJNIObjectMethod):
2947 (callJNIByteMethod):
2948 (callJNICharMethod):
2949 (callJNIShortMethod):
2951 (callJNILongMethod):
2952 (callJNIFloatMethod):
2953 (callJNIDoubleMethod):
2954 (callJNIVoidMethodA):
2955 (callJNIObjectMethodA):
2956 (callJNIByteMethodA):
2957 (callJNICharMethodA):
2958 (callJNIShortMethodA):
2959 (callJNIIntMethodA):
2960 (callJNILongMethodA):
2961 (callJNIFloatMethodA):
2962 (callJNIDoubleMethodA):
2963 (getCharactersFromJString):
2964 (releaseCharactersForJString):
2965 * bindings/jni/jni_utility.h:
2966 * bindings/objc/Makefile.am: Removed.
2967 * bindings/runtime.h: Added.
2968 (Bindings::Parameter::~Parameter):
2969 (Bindings::Constructor::~Constructor):
2970 (Bindings::Field::~Field):
2971 (Bindings::Method::~Method):
2972 (Bindings::Class::~Class):
2974 2003-11-13 Maciej Stachowiak <mjs@apple.com>
2978 - fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions
2981 (ForInNode::execute): If the in value is null or undefined, bail
2982 out early, since attempting to iterate its properties will throw
2985 2003-11-12 Darin Adler <darin@apple.com>
2989 * Makefile.am: Fix the build by removing the bindings directory from SUBDIRS.
2990 Later, we can either add this back and add the Makefile.am files to the top
2991 level configure.in or leave it out and remove the Makefile.am files.
2993 2003-11-12 Richard Williamson <rjw@apple.com>
2995 Added utility functions for calling JNI methods.
2999 * JavaScriptCore.pbproj/project.pbxproj:
3001 * bindings/Makefile.am: Added.
3002 * bindings/jni/Makefile.am: Added.
3003 * bindings/jni/jni_utility.cpp: Added.
3006 (callJNIVoidMethod):
3007 (callJNIObjectMethod):
3008 (callJNIByteMethod):
3009 (callJNICharMethod):
3010 (callJNIShortMethod):
3012 (callJNILongMethod):
3013 (callJNIFloatMethod):
3014 (callJNIDoubleMethod):
3015 * bindings/jni/jni_utility.h: Added.
3016 * bindings/objc/Makefile.am: Added.
3018 2003-11-08 Darin Adler <darin@apple.com>
3022 - fixed 3477528 -- array.sort(function) fails if the function returns a non-zero value that rounds to zero
3024 * kjs/array_object.cpp:
3025 (compareByStringForQSort): Added checks for undefined values to match what the specification calls for.
3026 (compareWithCompareFunctionForQSort): Added checks for undefined values as above, and also changed the
3027 code that looks at the compare function result to look at the number returned without rounding to an integer.
3028 (ArrayProtoFuncImp::call): Changed the code that looks at the compare function result to look at the number
3029 returned without rounding to an integer.
3033 2003-11-03 Vicki Murley <vicki@apple.com>
3035 Reviewed by kocienda.
3037 - fixed <rdar://problem/3471096>: non-B&I builds should not use order files, because they cause false "regressions" in perf.
3039 * JavaScriptCore.pbproj/project.pbxproj: added empty SECTORDER_FLAGS variables to the Development and Deployment build styles
3041 2003-11-02 Darin Adler <darin@apple.com>
3045 - changed list manipulation to use Harri Porten's idea of a circular
3046 linked list that is built from head to tail rather than building the
3047 list backwards and reversing the list when done
3049 * kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way.
3050 Change many places that passed 0L to pass nothing at all, or to pass 0.
3053 (KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated
3055 (KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list.
3056 (KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the
3057 inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated
3058 backwards list. Made the case for the first node separate so we don't need a nil check.
3059 (KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of
3061 (KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated
3062 backwards list. Also, made the constructors inline (moved here from .cpp file).
3063 (KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of
3065 (KJS::NewExprNode::NewExprNode): Changed a 0L to 0.
3066 (KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into
3067 .cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated
3069 (KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated
3071 (KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing
3073 (KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file).
3074 The one in the .cpp file breaks the list instead of reversing it.
3075 (KJS::ForNode::ForNode): Break the circular list instead of reversing the list.
3076 (KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the
3078 (KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated
3080 (KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into
3081 .cpp file). The one in the .cpp file breaks the list instead of reversing it.
3082 (KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and
3083 finally nodes rather than just Node.
3084 (KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated
3086 (KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the
3088 (KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the
3092 (StatListNode::StatListNode): Moved this constructor here, no longer inline.
3093 Did the "break circular list" thing instead of the "reverse list" thing.
3094 Added setLoc calls to match KJS in the KDE tree; since we don't currently
3095 use the JavaScript debugging support, it's unclear whether there's any benefit, but
3096 later we might be using it and it's good to be as close as possible.
3097 (BlockNode::BlockNode): Moved this constructor here, no longer inline.
3098 Did the "break circular list" thing instead of the "reverse list" thing.
3100 (CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline.
3101 Did the "break circular list" thing instead of the "reverse list" thing.
3102 (SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline.
3103 Did the "break circular list" thing instead of the "reverse list" thing.
3106 * kjs/grammar.cpp: Regenerated.
3107 * kjs/grammar.cpp.h: Regenerated.
3108 * kjs/grammar.h: Regenerated.
3112 2003-10-30 Maciej Stachowiak <mjs@apple.com>
3116 - fixed 3427069 - browsing mp3.com causes leaks (KJS)
3118 * kjs/string_object.cpp:
3119 (StringProtoFuncImp::call): Don't do an early return, since that
3120 could leak a temporary regexp.
3122 2003-10-29 Maciej Stachowiak <mjs@apple.com>
3126 - fixed 3426076 - Leak of JS lexer data visiting http://www.ebay.com
3129 (yyerror): Updated the commented code.
3130 * kjs/grammar.y: Don't delete string and identifier tokens when done
3131 with them any more, they'll get cleaned up by the lexer now.
3133 (Parser::parse): Tell lexer when done parsing.
3135 (Lexer::Lexer): Initialize new data members.
3136 (Lexer::lex): Use new methods to make strings and identifiers, and
3138 (Lexer::makeIdentifier): Make a new Identifier and save it in an
3140 (Lexer::makeUString): Likewise for UStrings.
3141 (Lexer::doneParsing): Clean up arrays of Ifentifiers and UStrings.
3144 2003-10-28 Maciej Stachowiak <mjs@apple.com>
3148 - fixed 3413962 - malicious web pages can kill all future JavaScript execution by breaking recursion limit check
3151 (FunctionCallNode::evaluate): If we're going to return early due
3152 to breaking the recursion limit, make sure to lower it again, or
3153 it will creep up by one each time it's exceeded.
3155 2003-10-26 Darin Adler <darin@apple.com>
3157 * JavaScriptCorePrefix.h: Added a C case to the NULL definition since we use C as well
3158 as C++ in this project.
3160 2003-10-26 Darin Adler <darin@apple.com>
3162 - rolled in some CString changes Harri Porten did on the KDE side
3165 (KJS::CString::CString): Use memcpy instead of strcpy for speed. Fix an off by one error
3166 in the copy constructor.
3167 (KJS::CString::operator=): Use memcpy instead of strcpy for speed.
3169 * JavaScriptCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
3170 __null feature even if the system C library doesn't.
3172 == Rolled over to ChangeLog-2003-10-25 ==