=== JavaScriptCore-146.1 === 2004-06-18 Vicki Murley - merge this fix from HEAD. Even if we can't submit this to Tiger for WWDC, we'll still need it for the Dashboard demo. No harm in merging this now. 2004-06-16 Richard Williamson Fixed Crash returning nil from bound ObjC This turned out to be a show stopper for Dashboard. Accessing a nil ObjC property from JS caused a crash. Similar to the problem 3696112 fixed below. Reviewed by Trey. * bindings/objc/objc_runtime.mm: (KJS::Bindings::ObjcField::valueFromInstance): === Safari-146 === 2004-06-16 Richard Williamson Fixed : nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print. This turned out to be a show stopper for Dashboard. We now return Undefined() when nil is returned from a ObjC method that returns an object type. Reviewed by Maciej. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue): === Safari-145 === 2004-06-15 Richard Williamson Fixed : Objective-C instances that are exported to JavaScript are too promiscuous No longer need to check respondsToSelector: for isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript: because these now have a default implementation on NSObject. Reviewed by Trey. * bindings/objc/objc_class.mm: (ObjcClass::methodsNamed): (ObjcClass::fieldNamed): 2004-06-14 Darin Adler Reviewed by Maciej. - fixed some things for GC that Patrick missed, or that happened after the branch * bindings/objc/WebScriptObject.mm: (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object. (-[WebScriptObject finalize]): Added. - added some missing nil checks * bindings/objc/objc_instance.mm: (ObjcInstance::ObjcInstance): Check for nil. (ObjcInstance::~ObjcInstance): Check for nil. (ObjcInstance::operator=): Check for nil. 2004-06-14 Darin Adler Reviewed by me, code changes by Patrick Beard. - fixed : (WebKit should adopt GC changes and compile with GC enabled) * bindings/objc/objc_instance.mm: (ObjcInstance::ObjcInstance): Use CFRetain instead of retain. (ObjcInstance::~ObjcInstance): Use CFRelease instead of release. (ObjcInstance::operator=): More of the same. (ObjcInstance::end): Use [pool drain] if compiling on Tiger. * bindings/objc/objc_runtime.mm: (ObjcArray::ObjcArray): Use CFRetain instead of retain. (ObjcArray::~ObjcArray): Use CFRelease instead of release. (ObjcArray::operator=): More of the same. * bindings/testbindings.mm: Fixed incorrect license. (main): Use [pool drain] if compiling on Tiger. === Safari-144 === 2004-06-10 Kevin Decker Reviewed by John. * kjs/lexer.cpp: (Lexer::setCode): - fixed : (error console line numbers are offset by 1) * kjs/lexer.h: (KJS::Lexer::lineNo): - fixed : (error console line numbers are offset by 1) === JavaScriptCore-143.2 === 2004-06-07 Darin Adler - fixed : (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed) * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile. * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload. === JavaScriptCore-143.1 === 2004-06-04 Kevin Decker Reviewed by Darin - fixed * kjs/object.cpp: (KJS::Error::create): === Safari-143 === 2004-06-04 Darin Adler * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters. 2004-06-04 Kevin Decker Reviewed by Dave. - ObjC bindings do not (yet) pass along sourceurl or line numbers - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript - changed the wording of an error message - the lexer, parser, and interpreter have been made "sourceURL aware" - stored the url into Error * bindings/NP_jsobject.cpp: (NPN_Evaluate): * bindings/jni/jni_jsobject.cpp: (JSObject::eval): * bindings/objc/WebScriptObject.mm: (-[WebScriptObject evaluateWebScript:]): * kjs/function.cpp: (GlobalFuncImp::call): * kjs/function_object.cpp: (FunctionObjectImp::construct): * kjs/internal.cpp: (Parser::parse): (InterpreterImp::checkSyntax): (InterpreterImp::evaluate): * kjs/internal.h: * kjs/interpreter.cpp: (Interpreter::evaluate): * kjs/interpreter.h: * kjs/lexer.cpp: (Lexer::setCode): * kjs/lexer.h: (KJS::Lexer::sourceURL): * kjs/nodes.cpp: (Node::Node): (Node::throwError): (FunctionCallNode::evaluate): * kjs/nodes.h: * kjs/object.cpp: (KJS::Error::create): * kjs/object.h: 2004-06-04 Richard Williamson Fixed crash when attempting to access properties on nil object. Reviewed by John. * bindings/objc/objc_instance.mm: (ObjcInstance::getClass): * bindings/runtime_object.cpp: (RuntimeObjectImp::get): * bindings/testM.js: * bindings/testbindings.mm: (-[MyFirstInterface getString]): 2004-05-27 Kevin Decker Reviewed by Ken. -revised generated error message content * kjs/error_object.cpp: (ErrorProtoFuncImp::call): * kjs/internal.cpp: (Parser::parse): * kjs/object.cpp: (KJS::Error::create): === Safari-142 === 2004-05-27 Richard Williamson Renamed WebScriptMethods to WebScripting based on feedback from Nancy. Reviewed by Chris. * bindings/objc/WebScriptObject.h: 2004-05-27 Darin Adler Reviewed by Maciej. - moved to new symlink technique for embedding frameworks * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step because we don't need it any more. 2004-05-24 Richard Williamson Changed RuntimeArrayImp to inherit from ArrayInstanceImp and fixed ClassInfo to correctly reflect inheritance. This is required because of the runtime checks in JSC for arrays, i.e. in the Function objects apply method. Reviewed by Ken. * bindings/jni/jni_runtime.cpp: (JavaArray::convertJObjectToArray): * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue): * bindings/runtime_array.cpp: (RuntimeArrayImp::RuntimeArrayImp): * bindings/runtime_array.h: * bindings/testM.js: Added. * bindings/testbindings.mm: (+[MyFirstInterface webScriptNameForSelector:]): (-[MyFirstInterface logMessages:]): (-[MyFirstInterface logMessage:prefix:]): (-[MyFirstInterface callJSObject::]): 2004-05-22 Darin Adler Reviewed by Maciej. - fixed : (JS needs to listen to timezone change notifications) * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as it hasn't been set explicitly. === Safari-141 === 2004-05-20 Richard Williamson Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers can now be referenced like any other WebScriptObject, meaning you can do JS operations on them. All added implementation of finalizeForWebScript. Reviewed by Ken. * bindings/objc/WebScriptObject.h: * bindings/objc/WebScriptObject.mm: (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]): (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]): (-[WebScriptObject KJS::]): (-[WebScriptObject dealloc]): (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject setValue:forKey:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject stringRepresentation]): * bindings/objc/WebScriptObjectPrivate.h: * bindings/objc/objc_instance.mm: (ObjcInstance::~ObjcInstance): 2004-05-19 Richard Williamson Removed extraneous tabs that were added (by XCode?). * bindings/objc/WebScriptObject.h: 2004-05-19 Darin Adler - fixed headers with licenses mangled by Xcode auto-indenting * bindings/jni/jni_jsobject.cpp: * bindings/jni/jni_jsobject.h: * bindings/runtime_array.h: * bindings/runtime_root.cpp: * bindings/runtime_root.h: 2004-05-18 Richard Williamson Added exception logging. Also check for exception and set results as appropriate. Reviewed by Maciej (partially reviewed). * bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject setValue:forKey:]): (-[WebScriptObject valueForKey:]): 2004-05-18 Richard Williamson Finsished implementing support for windowScriptObject. Had to make WebScriptObjectPrivate.h accessible from WebCore. Reviewed by Maciej. * JavaScriptCore.pbproj/project.pbxproj: * bindings/objc/WebScriptObjectPrivate.h: 2004-05-18 Richard Williamson Use KVC to set/get values instead of directly accessing ivars. Reviewed by Maciej. * bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]): * bindings/objc/objc_runtime.mm: (ObjcField::valueFromInstance): (convertValueToObjcObject): (ObjcField::setValueToInstance): 2004-05-17 Richard Williamson Implemented new API for WebScriptObject. Fixed : (objc to javascript method calls do not cause updates.) Fixed : (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki) Reviewed by Hyatt. * JavaScriptCore.pbproj/project.pbxproj: * bindings/c/c_instance.cpp: (CInstance::invokeMethod): * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_jsobject.cpp: (JSObject::convertValueToJObject): * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJNIField): * bindings/objc/WebScriptObject.mm: (_didExecute): (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]): (-[WebScriptObject KJS::]): (-[WebScriptObject dealloc]): (+[WebScriptObject throwException:]): (listFromNSArray): (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject setValue:forKey:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject stringRepresentation]): (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]): (+[WebUndefined undefined]): (-[WebUndefined initWithCoder:]): (-[WebUndefined encodeWithCoder:]): (-[WebUndefined copyWithZone:]): (-[WebUndefined retain]): (-[WebUndefined release]): (-[WebUndefined retainCount]): (-[WebUndefined autorelease]): (-[WebUndefined dealloc]): (-[WebUndefined copy]): (-[WebUndefined replacementObjectForPortCoder:]): * bindings/objc/WebScriptObjectPrivate.h: Added. * bindings/objc/objc_class.mm: (ObjcClass::methodsNamed): (ObjcClass::fieldNamed): * bindings/objc/objc_instance.mm: (ObjcInstance::invokeMethod): * bindings/objc/objc_jsobject.h: * bindings/objc/objc_jsobject.mm: * bindings/objc/objc_runtime.mm: (ObjcField::valueFromInstance): * bindings/objc/objc_utility.mm: (KJS::Bindings::JSMethodNameToObjCMethodName): (KJS::Bindings::convertValueToObjcValue): (KJS::Bindings::convertObjcValueToValue): * bindings/runtime.cpp: (Instance::setDidExecuteFunction): (Instance::didExecuteFunction): (Instance::setValueOfField): * bindings/runtime.h: * bindings/testbindings.mm: (+[MyFirstInterface webScriptNameForSelector:]): (-[MyFirstInterface callJSObject::]): 2004-05-14 Vicki Murley Reviewed by mjs. : framework marketing number should be 2.0 for DoubleBarrel release * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0 === Safari-140 === 2004-05-13 Richard Williamson Fixed indentation. Reviewed by Chris. * ChangeLog: * bindings/objc/WebScriptObject.h: 2004-05-13 Richard Williamson Approved API changes. Currently unimplemented. Reviewed by Chris. * ChangeLog: * JavaScriptCore.pbproj/project.pbxproj: * bindings/objc/WebScriptObject.h: Added. * bindings/objc/WebScriptObject.mm: Added. (+[WebScriptObject throwException:]): (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject stringRepresentation]): (+[WebUndefined undefined]): (-[WebUndefined initWithCoder:]): (-[WebUndefined encodeWithCoder:]): (-[WebUndefined copyWithZone:]): 2004-05-07 Vicki Murley Reviewed by darin. Turn off GC since it uses ppc only instructions (which breaks the B&I build). * kjs/value.h: set USE_CONSERVATIVE_GC to 0 === Safari-139 === 2004-05-07 Maciej Stachowiak Reviewed by Darin. - add -funroll-loops=16 compiler option for approx .5% speedup on HTML iBench and .5-1% speedup on JS iBench. * JavaScriptCore.pbproj/project.pbxproj: 2004-04-25 Maciej Stachowiak Reviewed by Darin. Enable full conservative GC mode in addition to test mode. When conservative GC is enabled, we now get an 11% speed improvement on the iBench. Also fix some spots I missed before. Specific noteworth changes: * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Check possible cell pointers for 8-byte aligment and verify they are not 0. * kjs/protected_values.cpp: (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here... (KJS::ProtectedValues::decreaseProtectCount): ...and here... * kjs/protect.h: (KJS::gcProtectNullTolerant): ...to here... (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null tolerance, and doing the check is expensive. * kjs/protected_values.cpp: (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one that is still very good. * kjs/protect.h: (KJS::gcProtect): (KJS::gcUnprotect): (KJS::ProtectedValue::ProtectedValue): (KJS::ProtectedValue::~ProtectedValue): (KJS::ProtectedValue::operator=): (KJS::ProtectedObject::ProtectedObject): (KJS::ProtectedObject::~ProtectedObject): (KJS::ProtectedObject::operator=): (KJS::ProtectedReference::ProtectedReference): (KJS::ProtectedReference::~ProtectedReference): (KJS::ProtectedReference::operator=): * kjs/protected_values.cpp: (KJS::ProtectedValues::getProtectCount): (KJS::ProtectedValues::increaseProtectCount): (KJS::ProtectedValues::decreaseProtectCount): (KJS::ProtectedValues::computeHash): * bindings/runtime_root.cpp: (KJS::Bindings::addNativeReference): (KJS::Bindings::removeNativeReference): (RootObject::removeAllNativeReferences): * bindings/runtime_root.h: (KJS::Bindings::RootObject::~RootObject): (KJS::Bindings::RootObject::setRootObjectImp): * kjs/collector.cpp: (KJS::Collector::allocate): (KJS::Collector::collect): * kjs/collector.h: * kjs/internal.cpp: (NumberImp::create): (InterpreterImp::globalInit): (InterpreterImp::globalClear): (InterpreterImp::mark): * kjs/list.cpp: (KJS::List::derefValues): (KJS::List::refValues): (KJS::List::append): * kjs/object.cpp: (KJS::ObjectImp::setInternalValue): (KJS::ObjectImp::putDirect): * kjs/value.cpp: (ValueImp::mark): (ValueImp::marked): * kjs/value.h: (KJS::ValueImp::ValueImp): (KJS::ValueImp::~ValueImp): (KJS::ValueImp::): (KJS::Value::Value): (KJS::Value::~Value): (KJS::Value::operator=): 2004-04-30 Richard Williamson Asking an NSInvocation for it's return value when return type is void throws an exception. Added check for void return types to avoid this exception. Reviewed by Ken. * bindings/objc/objc_instance.mm: (ObjcInstance::invokeMethod): 2004-04-29 Richard Williamson Fixed several bad problems with the ObjC bindings. In particular, conversion to/from JavaScriptObject (soon to be WebScriptObject) was completely broken. Reviewed by Chris. * bindings/objc/objc_jsobject.h: * bindings/objc/objc_jsobject.mm: (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]): (-[JavaScriptObject KJS::]): (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]): (-[JavaScriptObject call:arguments:]): (-[JavaScriptObject evaluate:]): (-[JavaScriptObject getMember:]): (-[JavaScriptObject getSlot:]): * bindings/objc/objc_runtime.mm: (ObjcField::valueFromInstance): (ObjcField::setValueToInstance): * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): (KJS::Bindings::convertObjcValueToValue): * bindings/runtime.h: * bindings/runtime_root.cpp: (KJS::Bindings::rootForInterpreter): (KJS::Bindings::addNativeReference): (KJS::Bindings::removeNativeReference): * bindings/runtime_root.h: * bindings/testbindings.mm: (-[MyFirstInterface logMessage:]): (-[MyFirstInterface setJSObject:]): (-[MyFirstInterface callJSObject::]): 2004-04-24 Darin Adler Reviewed by Dave. * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer that is 2x too big. 2004-04-23 Maciej Stachowiak Reviewed by Darin. Implementation of conservative GC, based partly on code from Darin. It's turned off for now, so it shouldn't have any effect on the normal build. * JavaScriptCore.pbproj/project.pbxproj: * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): (KJS::Collector::markProtectedObjects): (KJS::Collector::collect): * kjs/collector.h: * kjs/protect.h: (KJS::gcProtect): (KJS::gcUnprotect): * kjs/protected_values.cpp: Added. (KJS::ProtectedValues::getProtectCount): (KJS::ProtectedValues::increaseProtectCount): (KJS::ProtectedValues::insert): (KJS::ProtectedValues::decreaseProtectCount): (KJS::ProtectedValues::expand): (KJS::ProtectedValues::shrink): (KJS::ProtectedValues::rehash): (KJS::ProtectedValues::computeHash): * kjs/protected_values.h: Added. * kjs/value.cpp: (ValueImp::useConservativeMark): (ValueImp::mark): (ValueImp::marked): * kjs/value.h: (KJS::ValueImp::): === Safari-138 === 2004-04-22 Richard Williamson Fixed build snafu (re-declaration of NPBool in npruntime.h and npapi.h). * bindings/npruntime.h: 2004-04-22 Richard Williamson Updated plugin binding API to reflect latest revision from working group. Biggest change is the introduction of NPVariant used to represent value types. NPVariant replaces the use of NPObject for the exchange of values between scripting environment and native code. Reviewed by John. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): (NPN_Call): (NPN_Evaluate): (NPN_GetProperty): (NPN_SetProperty): (NPN_ToString): (NPN_GetPropertyAtIndex): (NPN_SetPropertyAtIndex): * bindings/c/c_class.cpp: (CClass::methodsNamed): (CClass::fieldNamed): * bindings/c/c_instance.cpp: (CInstance::invokeMethod): (CInstance::defaultValue): * bindings/c/c_runtime.cpp: (CField::valueFromInstance): (CField::setValueToInstance): * bindings/c/c_utility.cpp: (convertNPStringToUTF16): (convertUTF8ToUTF16): (coerceValueToNPVariantStringType): (convertValueToNPVariant): (convertNPVariantToValue): * bindings/c/c_utility.h: * bindings/npruntime.cpp: (NPN_GetIdentifier): (NPN_GetIdentifiers): (NPN_UTF8FromIdentifier): (NPN_VariantIsVoid): (NPN_VariantIsNull): (NPN_VariantIsUndefined): (NPN_VariantIsBool): (NPN_VariantIsInt32): (NPN_VariantIsDouble): (NPN_VariantIsString): (NPN_VariantIsObject): (NPN_VariantToBool): (NPN_VariantToString): (NPN_VariantToInt32): (NPN_VariantToDouble): (NPN_VariantToObject): (NPN_InitializeVariantAsVoid): (NPN_InitializeVariantAsNull): (NPN_InitializeVariantAsUndefined): (NPN_InitializeVariantWithBool): (NPN_InitializeVariantWithInt32): (NPN_InitializeVariantWithDouble): (NPN_InitializeVariantWithString): (NPN_InitializeVariantWithStringCopy): (NPN_InitializeVariantWithObject): (NPN_InitializeVariantWithVariant): (NPN_ReleaseVariantValue): (NPN_CreateObject): (NPN_RetainObject): (NPN_ReleaseObject): (NPN_IsKindOfClass): (NPN_SetExceptionWithUTF8): (NPN_SetException): * bindings/npruntime.h: (_NPString::): (_NPString::_NPVariant::): * bindings/testbindings.cpp: (logMessage): (setDoubleValue): (setIntValue): (setStringValue): (setBooleanValue): (getDoubleValue): (getIntValue): (getStringValue): (getBooleanValue): (myGetProperty): (mySetProperty): (myInvoke): (myAllocate): 2004-04-22 Darin Adler Reviewed by Maciej. - fixed : "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes" * kjs/ustring.cpp: (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar). Was resulting in a buffer 2x the needed size. (KJS::UString::expandPreCapacity): Ditto. (KJS::UString::append): Fix malloc that is missing a sizeof(UChar). 2004-04-21 Maciej Stachowiak Reviewed by Darin. Preliminary change for conservative GC. Create "protected" subclasses to GC-protect objects when on heap, since we will soon remove the built-in refcounting of the normal wrapper classes. Use them where needed. * JavaScriptCore.pbproj/project.pbxproj: * kjs/context.h: * kjs/internal.h: (KJS::InterpreterImp::globalObject): * kjs/interpreter.h: * kjs/property_map.cpp: * kjs/reference.h: * kjs/reference_list.cpp: 2004-04-19 Maciej Stachowiak Reviewed by Dave. Optimize prepend using the shared substring optimization. Also, limit the applicability of shared append and shared prepend. If you overdo it, it does more harm than good, because you create a bunch of strings that are disqualified from future shared append/prepend, for not much immediate savings in allocate/copy expense. * kjs/ustring.cpp: (KJS::): (KJS::UString::Rep::create): (KJS::UString::expandedSize): (KJS::UString::usedPreCapacity): (KJS::UString::expandCapacity): (KJS::UString::expandPreCapacity): (KJS::UString::UString): (KJS::UString::append): (KJS::UString::operator=): * kjs/ustring.h: (KJS::UString::Rep::data): 2004-04-16 Maciej Stachowiak Reviewed by Richard. No more need for Completion or Reference to privately inherit from Value, none of the superclass functionality is used. * kjs/completion.h: * kjs/reference.h: === Safari-137 === 2004-04-16 Richard Williamson Added interpreter lock protection around object creation. Reviewed by Chris. * bindings/runtime.cpp: (Instance::createRuntimeObject): 2004-04-16 Maciej Stachowiak Reviewed by Ken. Another JavaScript speed improvement: use the mechanism from string append optimization to make taking a substring fast, again sharing the buffer. A further 22% improvement on the 24fun string speed test. * kjs/ustring.cpp: (KJS::): (KJS::UString::Rep::create): (KJS::UString::UString): (KJS::UString::append): (KJS::UString::operator=): (KJS::UString::substr): * kjs/ustring.h: (KJS::UString::Rep::data): 2004-04-13 Maciej Stachowiak Reviewed by Darin. - fixed : String manipulation in JavaScript 24fun test is very slow (slow) - fixed : Table generation test is really slow - fixed : 24fun date test is really slow 80% speedup on the string test, lesser speedups on the other two. Two different optimizations here: 1) Avoid large overhead of scanning strings to see if they are all ASCII before numeric conversion. * kjs/nodes.cpp: (AssignNode::evaluate): Don't convert to integer until we know for sure the operation will need it. Attempting to convert strings to numbers is a waste when they are being appended with +=. 2) Avoid huge cost of appending strings. This is done by allowing multiple strings to share a buffer but actually use different ranges of it. The first time a string is appended to, we start leaving at least 10% extra space in the buffer, so doing N appends to the same string takes O(log N) mallocs instead of O(N). * kjs/identifier.cpp: (KJS::Identifier::equal): (KJS::Identifier::add): * kjs/ustring.cpp: (KJS::): (KJS::UCharReference::operator=): (KJS::UCharReference::ref): (KJS::UString::Rep::create): (KJS::UString::Rep::destroy): (KJS::UString::expandedSize): (KJS::UString::usedCapacity): (KJS::UString::expandCapacity): (KJS::UString::UString): (KJS::UString::null): (KJS::UString::append): (KJS::UString::operator=): (KJS::UString::toStrictUInt32): (KJS::UString::detach): (KJS::KJS::operator==): * kjs/ustring.h: (KJS::UString::Rep::data): (KJS::UString::Rep::hash): 2004-04-09 Maciej Stachowiak Reviewed by John. - fix deployment build by avoiding deployment-only warning. * kjs/scope_chain.cpp: (KJS::ScopeChain::bottom): 2004-04-09 Maciej Stachowiak Reviewed by John. Changed things so that newly created objects get a prototype based on the scope chain of the current function, rather than the interpreter that started execution. This fixes the following bugs: : ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com) : ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly) * JavaScriptCore.pbproj/project.pbxproj: * kjs/array_object.cpp: (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments): (ArrayProtoFuncImp::ArrayProtoFuncImp): (ArrayProtoFuncImp::call): (ArrayObjectImp::construct): * kjs/bool_object.cpp: (BooleanObjectImp::construct): * kjs/date_object.cpp: (DateProtoFuncImp::DateProtoFuncImp): (DateProtoFuncImp::call): (DateObjectImp::construct): * kjs/error_object.cpp: (ErrorObjectImp::construct): * kjs/function.cpp: (FunctionImp::FunctionImp): (FunctionImp::call): (DeclaredFunctionImp::construct): (ArgumentsImp::ArgumentsImp): (GlobalFuncImp::call): * kjs/function_object.cpp: (FunctionProtoFuncImp::call): (FunctionObjectImp::construct): * kjs/internal.cpp: (BooleanImp::toObject): (StringImp::toObject): (NumberImp::toObject): (InterpreterImp::InterpreterImp): (InterpreterImp::clear): (InterpreterImp::interpreterWithGlobalObject): * kjs/internal.h: * kjs/interpreter.cpp: (ExecState::lexicalInterpreter): * kjs/interpreter.h: (KJS::ExecState::dynamicInterpreter): (KJS::ExecState::interpreter): * kjs/math_object.cpp: (MathFuncImp::MathFuncImp): * kjs/nodes.cpp: (StatementNode::hitStatement): (StatementNode::abortStatement): (RegExpNode::evaluate): (ElementNode::evaluate): (ArrayNode::evaluate): (ObjectLiteralNode::evaluate): (PropertyValueNode::evaluate): (FunctionCallNode::evaluate): (FuncDeclNode::processFuncDecl): (FuncExprNode::evaluate): * kjs/number_object.cpp: (NumberObjectImp::construct): * kjs/object.cpp: (KJS::ObjectImp::defaultValue): (KJS::Error::create): * kjs/object_object.cpp: (ObjectObjectImp::construct): * kjs/reference.cpp: (Reference::putValue): * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): (RegExpObjectImp::arrayOfMatches): (RegExpObjectImp::construct): * kjs/scope_chain.cpp: (KJS::ScopeChain::bottom): * kjs/scope_chain.h: * kjs/string_object.cpp: (StringProtoFuncImp::StringProtoFuncImp): (StringProtoFuncImp::call): (StringObjectImp::construct): === Safari-136 === === Safari-135 === 2004-03-31 Richard Williamson Tedious renames based on feedback from plugin-futures list. NP_ functions are renamed with NPN_ prefix. Types prefix renamed from NP_ to NP. NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated. No review because this was just a renaming patch. * bindings/NP_jsobject.cpp: (listFromNPArray): (jsAllocate): (identiferFromNPIdentifier): (NPN_Call): (NPN_Evaluate): (NPN_GetProperty): (NPN_SetProperty): (NPN_RemoveProperty): (NPN_ToString): (NPN_GetPropertyAtIndex): (NPN_SetPropertyAtIndex): * bindings/NP_jsobject.h: * bindings/c/c_class.cpp: (CClass::_commonInit): (CClass::classForIsA): (CClass::CClass): (CClass::methodsNamed): (CClass::fieldNamed): * bindings/c/c_class.h: * bindings/c/c_instance.cpp: (CInstance::CInstance): (CInstance::~CInstance): (CInstance::operator=): (CInstance::invokeMethod): (CInstance::defaultValue): * bindings/c/c_instance.h: (KJS::Bindings::CInstance::getObject): * bindings/c/c_runtime.cpp: (CField::valueFromInstance): (CField::setValueToInstance): * bindings/c/c_runtime.h: (KJS::Bindings::CField::CField): (KJS::Bindings::CField::name): (KJS::Bindings::CMethod::CMethod): (KJS::Bindings::CMethod::name): * bindings/c/c_utility.cpp: (coerceValueToNPString): (convertValueToNPValueType): (convertNPValueTypeToValue): * bindings/c/c_utility.h: * bindings/npruntime.cpp: (NPN_IdentifierFromUTF8): (NPN_IsValidIdentifier): (NPN_GetIdentifiers): (NPN_UTF8FromIdentifier): (NPN_CreateObject): (NPN_RetainObject): (NPN_ReleaseObject): (NPN_IsKindOfClass): (NPN_SetExceptionWithUTF8): (NPN_SetException): (numberAllocate): (NPN_CreateNumberWithInt): (NPN_CreateNumberWithFloat): (NPN_CreateNumberWithDouble): (NPN_IntFromNumber): (NPN_FloatFromNumber): (NPN_DoubleFromNumber): (stringAllocate): (NPN_CreateStringWithUTF8): (NPN_CreateStringWithUTF16): (NPN_DeallocateUTF8): (NPN_UTF8FromString): (NPN_UTF16FromString): (NPN_StringLength): (booleanAllocate): (NPN_CreateBoolean): (NPN_BoolFromBoolean): (nullAllocate): (NPN_GetNull): (undefinedAllocate): (NPN_GetUndefined): (arrayAllocate): (arrayDeallocate): (NPN_CreateArray): (NPN_CreateArrayV): (NPN_ObjectAtIndex): * bindings/npruntime.h: * bindings/runtime.cpp: (Instance::createBindingForLanguageInstance): * bindings/testbindings.cpp: (initializeIdentifiers): (myHasProperty): (myHasMethod): (myGetProperty): (mySetProperty): (logMessage): (setDoubleValue): (setIntValue): (setStringValue): (setBooleanValue): (getDoubleValue): (getIntValue): (getStringValue): (getBooleanValue): (myInvoke): (myAllocate): (myInvalidate): (myDeallocate): (main): 2004-03-31 Richard Williamson Changed references to NP_runtime.h to npruntime.h * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.h: * bindings/c/c_class.h: * bindings/c/c_instance.h: * bindings/c/c_runtime.h: * bindings/c/c_utility.h: * bindings/npruntime.cpp: 2004-03-31 Richard Williamson Renamed NP_runtime.h to npruntime.h to match Netscape SDK. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.h: * bindings/npruntime.cpp: === Safari-134 === 2004-03-23 Richard Williamson Added implementation of KJS::Value <-> NP_Object conversion functions. Augmented test program for 'C' bindings. Added asserts and parameter checking to all public API. Reviewed by Ken. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.cpp: (NP_ToString): * bindings/NP_jsobject.h: Added. * bindings/NP_runtime.cpp: (NP_IdentifierFromUTF8): (NP_IsValidIdentifier): (NP_GetIdentifiers): (NP_CreateObject): (NP_RetainObject): (NP_ReleaseObject): (NP_IsKindOfClass): (NP_SetExceptionWithUTF8): (NP_SetException): (NP_IntFromNumber): (NP_FloatFromNumber): (NP_DoubleFromNumber): (NP_CreateStringWithUTF8): (NP_CreateStringWithUTF16): (NP_DeallocateUTF8): (NP_UTF8FromString): (NP_UTF16FromString): (NP_StringLength): (NP_BoolFromBoolean): * bindings/NP_runtime.h: * bindings/c/c_instance.cpp: (CInstance::invokeMethod): * bindings/c/c_utility.cpp: (coerceValueToNPString): (convertValueToNPValueType): (convertNPValueTypeToValue): * bindings/c/c_utility.h: * bindings/test.js: * bindings/testC.js: Added. * bindings/testbindings.cpp: (logMessage): (setDoubleValue): (setIntValue): (setStringValue): (setBooleanValue): (getDoubleValue): (getIntValue): (getStringValue): (getBooleanValue): (myInterfaceInvoke): (myInterfaceAllocate): === Safari-133 === 2004-03-19 Darin Adler Reviewed by Ken. - fixed problem with methods like setUTCHour * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate GMT vs. local time function based on the utc flag. 2004-03-17 Richard Williamson Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team. Reviewed by Ken. * bindings/NP_jsobject.cpp: (NP_Call): (NP_Evaluate): (NP_GetProperty): (NP_ToString): (NP_GetPropertyAtIndex): * bindings/NP_runtime.h: 2004-03-16 Richard Williamson 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. Reviewed by John. * bindings/jni/jni_class.cpp: (JavaClass::methodsNamed): 2004-03-15 Richard Williamson Fixed 3570854. Don't attempt to convert Null to strings. We were incorrectly converting to "Null". Actually fixed by Scott Kovatch. Reviewed by Richard. * bindings/jni/jni_utility.cpp: (KJS::Bindings::convertValueToJValue): === Safari-132 === 2004-03-11 Richard Williamson Stitched together the NP stuff to our language independent JavaScript binding stuff. Very close to being done. Added program to test C bindings (and NP stuff). Just tests properties. Will add methods and JavaScript access, etc. Updated Makefile.am to account for new bindings/c directory. Change NP_UTF8 from "const char *" to "char" to allow for declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto for NP_UTF16. Added NP_IsValidIdentifier(). Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * Makefile.am: * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): (NP_Evaluate): * bindings/NP_runtime.cpp: (NP_IdentifierFromUTF8): (NP_IsValidIdentifier): (NP_GetIdentifiers): (NP_UTF8FromIdentifier): (NP_SetExceptionWithUTF8): (NP_SetException): (NP_CreateStringWithUTF8): (NP_CreateStringWithUTF16): (NP_UTF8FromString): (NP_UTF16FromString): * bindings/NP_runtime.h: * bindings/c/c_class.cpp: Added. (CClass::_commonDelete): (CClass::_commonCopy): (CClass::_commonInit): (_createClassesByIsAIfNecessary): (CClass::classForIsA): (CClass::CClass): (CClass::name): (CClass::methodsNamed): (CClass::fieldNamed): * bindings/c/c_class.h: Added. (KJS::Bindings::CClass::~CClass): (KJS::Bindings::CClass::CClass): (KJS::Bindings::CClass::operator=): (KJS::Bindings::CClass::constructorAt): (KJS::Bindings::CClass::numConstructors): * bindings/c/c_instance.cpp: Added. (CInstance::CInstance): (CInstance::~CInstance): (CInstance::operator=): (CInstance::getClass): (CInstance::begin): (CInstance::end): (CInstance::invokeMethod): (CInstance::defaultValue): (CInstance::stringValue): (CInstance::numberValue): (CInstance::booleanValue): (CInstance::valueOf): * bindings/c/c_instance.h: Added. (KJS::Bindings::CInstance::getObject): * bindings/c/c_runtime.cpp: Added. (CField::valueFromInstance): (CField::setValueToInstance): * bindings/c/c_runtime.h: Added. (KJS::Bindings::CField::CField): (KJS::Bindings::CField::name): (KJS::Bindings::CField::type): (KJS::Bindings::CMethod::CMethod): (KJS::Bindings::CMethod::name): (KJS::Bindings::CMethod::numParameters): * bindings/c/c_utility.cpp: Added. (coerceValueToNPValueType): (convertValueToNPValueType): (convertNPValueTypeToValue): * bindings/c/c_utility.h: Added. * bindings/make_testbindings: * bindings/runtime.cpp: (Instance::createBindingForLanguageInstance): * bindings/runtime.h: (KJS::Bindings::Instance::): * bindings/testbindings.cpp: Added. (initializeIdentifiers): (myInterfaceHasProperty): (myInterfaceHasMethod): (myInterfaceGetProperty): (myInterfaceSetProperty): (myInterfaceInvoke): (myInterfaceAllocate): (myInterfaceInvalidate): (myInterfaceDeallocate): (GlobalImp::className): (readJavaScriptFromFile): (main): 2004-03-10 Richard Williamson Made changes to support new asychronous approach to calls from plugin to JavaScript Reviewed by Chris. * bindings/NP_jsobject.cpp: (NP_Call): (NP_Evaluate): (NP_GetProperty): (NP_ToString): (NP_GetPropertyAtIndex): * bindings/NP_runtime.h: * bindings/make_testbindings: * bindings/runtime.cpp: (Instance::createBindingForLanguageInstance): 2004-03-10 Richard Williamson Updated header to include proposed changes from plugin-futures list. Calls from plugin to JavaScript are now asynchronous. Reviewed by Chris. * bindings/NP_runtime.h: === Safari-131 === 2004-03-04 Richard Williamson Implementation of NP_JavaScriptObject. This is the 'C' class that wraps a JavaScript object. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.cpp: Added. (coerceValueToNPValueType): (convertValueToNPValueType): (convertNPValueTypeToValue): (listFromNPArray): (jsAllocate): (jsDeallocate): (identiferFromNPIdentifier): (NP_Call): (NP_Evaluate): (NP_GetProperty): (NP_SetProperty): (NP_RemoveProperty): (NP_ToString): (NP_GetPropertyAtIndex): (NP_SetPropertyAtIndex): * bindings/NP_runtime.cpp: (NP_ObjectAtIndex): * bindings/NP_runtime.h: * bindings/runtime_object.h: 2004-03-04 Richard Williamson Added NP_Array implementation. Changed NP_Boolean to just depend on two static instances, no space is required for values. Reviewed by Chris. * bindings/NP_runtime.cpp: (NP_CreateBoolean): (NP_BoolFromBoolean): (arrayAllocate): (arrayDeallocate): (NP_CreateArray): (NP_CreateArrayV): (NP_ObjectAtIndex): * bindings/NP_runtime.h: 2004-03-03 Darin Adler Reviewed by Vicki. * English.lproj/InfoPlist.strings: Removed. No need to localize the version and copyright string, and that's all that was in here. * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build. 2004-03-03 Richard Williamson More 'C' binding implementation. Fleshed out all the 'primitive' data types. Reviewed by Chris. * bindings/NP_runtime.cpp: (NP_ReleaseObject): (numberAllocate): (stringAllocate): (stringDeallocate): (NP_CreateStringWithUTF8): (NP_CreateStringWithUTF16): (NP_UTF8FromString): (NP_UTF16FromString): (NP_StringLength): (booleanAllocate): (booleanDeallocate): (NP_CreateBoolean): (NP_BoolFromBoolean): (nullAllocate): (nullDeallocate): (NP_GetNull): (undefinedAllocate): (undefinedDeallocate): (NP_GetUndefined): * bindings/NP_runtime.h: 2004-03-03 Richard Williamson More 'C' binding implementation. Reviewed by Chris. * bindings/NP_runtime.cpp: (identifierEqual): (identifierHash): (getIdentifierDictionary): (NP_IdentifierFromUTF8): (NP_UTF8FromIdentifier): (NP_CreateObject): (NP_ReleaseObject): (NP_IsKindOfClass): (numberCreate): (NP_CreateNumberWithInt): (NP_CreateNumberWithFloat): (NP_CreateNumberWithDouble): (NP_IntFromNumber): (NP_FloatFromNumber): (NP_DoubleFromNumber): * bindings/NP_runtime.h: 2004-03-02 Richard Williamson Removed retain/release from NP_Class. Classes will not be allowed to implement their own customer retain/release scheme. Reviewed by Chris. * bindings/NP_runtime.cpp: (NP_RetainObject): (NP_ReleaseObject): * bindings/NP_runtime.h: 2004-03-02 Richard Williamson C binding API. Partial implementation. 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. Factored root object reference counting scheme. It is now useful independent of LiveConnect. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_runtime.cpp: Added. (NP_IdentifierFromUTF8): (NP_GetIdentifiers): (NP_UTF8FromIdentifier): (NP_CreateObject): (NP_RetainObject): (NP_ReleaseObject): (NP_IsKindOfClass): (NP_SetException): (NP_Call): (NP_Evaluate): (NP_GetProperty): (NP_SetProperty): (NP_RemoveProperty): (NP_ToString): (NP_GetPropertyAtIndex): (NP_SetPropertyAtIndex): (NP_CreateNumberWithInt): (NP_CreateNumberWithFloat): (NP_CreateNumberWithDouble): (NP_IntFromNumber): (NP_FloatFromNumber): (NP_DoubleFromNumber): (NP_CreateStringWithUTF8): (NP_CreateStringWithUTF16): (NP_UTF8FromString): (NP_UTF16FromString): (NP_CreateBoolean): (NP_BoolFromBoolean): (NP_GetNull): (NP_GetUndefined): (NP_CreateArray): (NP_CreateArrayV): (NP_ObjectAtIndex): * bindings/NP_runtime.h: Added. * bindings/jni/jni_jsobject.cpp: (JSObject::invoke): (JSObject::finalize): (JSObject::createNative): (JSObject::convertValueToJObject): * bindings/jni/jni_jsobject.h: * bindings/objc/objc_jsobject.h: * bindings/objc/objc_jsobject.mm: (rootForView): (windowJavaScriptObject): (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]): (-[JavaScriptObject dealloc]): (-[JavaScriptObject _convertValueToObjcValue:KJS::]): (-[JavaScriptObject call:arguments:]): (-[JavaScriptObject evaluate:]): (-[JavaScriptObject getMember:]): (-[JavaScriptObject setMember:value:]): (-[JavaScriptObject removeMember:]): (-[JavaScriptObject toString]): (-[JavaScriptObject getSlot:]): (-[JavaScriptObject setSlot:value:]): * bindings/objc/objc_utility.h: * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): * bindings/runtime_root.cpp: Added. (getReferencesByRootDictionary): (getReferencesDictionary): (KJS::Bindings::findReferenceDictionary): (KJS::Bindings::rootForImp): (KJS::Bindings::addNativeReference): (KJS::Bindings::removeNativeReference): (completedJavaScriptAccess): (initializeJavaScriptAccessLock): (lockJavaScriptAccess): (unlockJavaScriptAccess): (RootObject::dispatchToJavaScriptThread): (performJavaScriptAccess): (RootObject::setFindRootObjectForNativeHandleFunction): (RootObject::removeAllNativeReferences): * bindings/runtime_root.h: Added. (KJS::Bindings::RootObject::RootObject): (KJS::Bindings::RootObject::~RootObject): (KJS::Bindings::RootObject::setRootObjectImp): (KJS::Bindings::RootObject::rootObjectImp): (KJS::Bindings::RootObject::setInterpreter): (KJS::Bindings::RootObject::interpreter): (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction): (KJS::Bindings::RootObject::runLoop): (KJS::Bindings::RootObject::performJavaScriptSource): === Safari-130 === === Safari-129 === 2004-02-18 Richard Williamson Added NSNumber/Number conversion. Removed some unnecessary KJS:: namespace specifiers. Reviewed by Ken. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): (KJS::Bindings::convertObjcValueToValue): * bindings/runtime_array.h: 2004-02-18 Richard Williamson Added support for export NSArrays. Updated valueAt() to take an ExecState so we can throw JS exceptions. Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows ObjectiveC classes to control the visibility of their methods in JavaScript. Reviewed by Ken. * bindings/jni/jni_runtime.cpp: (JavaField::valueFromInstance): (JavaArray::valueAt): * bindings/jni/jni_runtime.h: * bindings/objc/objc_class.mm: (ObjcClass::methodsNamed): * bindings/objc/objc_runtime.h: (KJS::Bindings::ObjcArray::getObjcArray): * bindings/objc/objc_runtime.mm: (ObjcField::valueFromInstance): (ObjcField::setValueToInstance): (ObjcArray::ObjcArray): (ObjcArray::~ObjcArray): (ObjcArray::operator=): (ObjcArray::setValueAt): (ObjcArray::valueAt): (ObjcArray::getLength): * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): (KJS::Bindings::convertObjcValueToValue): * bindings/runtime.cpp: (Instance::getValueOfField): * bindings/runtime.h: * bindings/runtime_array.cpp: (RuntimeArrayImp::get): * bindings/runtime_object.cpp: (RuntimeObjectImp::get): 2004-02-17 Richard Williamson Added String <-> NSString conversion. Added tests of String <-> NSString conversion to test program. Reviewed by Chris. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): (KJS::Bindings::convertObjcValueToValue): * bindings/test.js: * bindings/testbindings.mm: (-[MyFirstInterface getString]): 2004-02-15 Darin Adler Reviewed by Dave. * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols, and removing redundant settings of things that match defaults in other build styles. 2004-02-13 Richard Williamson Work towards the JavaScript ObjC bindings. The bindings now work for simple scalar types. testbindings.mm is an illustration of how the bindings work. Reviewed by Ken. * JavaScriptCore.pbproj/project.pbxproj: * Makefile.am: * bindings/jni/jni_class.cpp: (JavaClass::methodsNamed): * bindings/jni/jni_class.h: * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.h: (KJS::Bindings::JavaMethod::returnType): * bindings/make_testbindings: Added. * bindings/objc/objc_class.h: Added. (KJS::Bindings::ObjcClass::~ObjcClass): (KJS::Bindings::ObjcClass::ObjcClass): (KJS::Bindings::ObjcClass::operator=): (KJS::Bindings::ObjcClass::constructorAt): (KJS::Bindings::ObjcClass::numConstructors): * bindings/objc/objc_class.mm: Added. (ObjcClass::_commonDelete): (ObjcClass::_commonCopy): (ObjcClass::_commonInit): (_createClassesByIsAIfNecessary): (ObjcClass::classForIsA): (ObjcClass::ObjcClass): (ObjcClass::name): (ObjcClass::methodsNamed): (ObjcClass::fieldNamed): * bindings/objc/objc_header.h: Added. * bindings/objc/objc_instance.h: Added. (KJS::Bindings::ObjcInstance::getObject): * bindings/objc/objc_instance.mm: Added. (ObjcInstance::ObjcInstance): (ObjcInstance::~ObjcInstance): (ObjcInstance::operator=): (ObjcInstance::begin): (ObjcInstance::end): (ObjcInstance::getClass): (ObjcInstance::invokeMethod): (ObjcInstance::defaultValue): (ObjcInstance::stringValue): (ObjcInstance::numberValue): (ObjcInstance::booleanValue): (ObjcInstance::valueOf): * bindings/objc/objc_jsobject.h: Added. * bindings/objc/objc_jsobject.mm: Added. * bindings/objc/objc_runtime.h: (KJS::Bindings::ObjcField::~ObjcField): (KJS::Bindings::ObjcField::ObjcField): (KJS::Bindings::ObjcField::operator=): (KJS::Bindings::ObjcMethod::ObjcMethod): (KJS::Bindings::ObjcMethod::~ObjcMethod): (KJS::Bindings::ObjcMethod::operator=): * bindings/objc/objc_runtime.mm: Added. (ObjcMethod::ObjcMethod): (ObjcMethod::name): (ObjcMethod::numParameters): (ObjcMethod::getMethodSignature): (ObjcField::ObjcField): (ObjcField::name): (ObjcField::type): (ObjcField::valueFromInstance): (ObjcField::setValueToInstance): * bindings/objc/objc_utility.h: Added. (KJS::Bindings::): * bindings/objc/objc_utility.mm: Added. (KJS::Bindings::JSMethodNameToObjCMethodName): (KJS::Bindings::convertValueToObjcValue): (KJS::Bindings::convertObjcValueToValue): (KJS::Bindings::objcValueTypeForType): * bindings/runtime.cpp: (MethodList::MethodList): (MethodList::operator=): (Instance::setValueOfField): (Instance::createBindingForLanguageInstance): (Instance::createRuntimeObject): * bindings/runtime.h: * bindings/runtime_method.cpp: (RuntimeMethodImp::RuntimeMethodImp): (RuntimeMethodImp::get): (RuntimeMethodImp::call): * bindings/runtime_method.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::hasProperty): * bindings/test.js: Added. * bindings/testbindings.mm: Added. (-[MySecondInterface init]): (-[MyFirstInterface init]): (-[MyFirstInterface dealloc]): (+[MyFirstInterface JavaScriptNameForSelector:]): (-[MyFirstInterface getInt]): (-[MyFirstInterface setInt:]): (-[MyFirstInterface getMySecondInterface]): (-[MyFirstInterface logMessage:]): (GlobalImp::className): (readJavaScriptFromFile): (main): === Safari-128 === 2004-02-08 Darin Adler Reviewed by Dave. - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects) * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the macros from working right in C++ code that uses the header. * kjs/ustring.cpp: (KJS::inlineUTF8SequenceLengthNonASCII): Added. (KJS::UTF8SequenceLengthNonASCII): Added. (KJS::inlineUTF8SequenceLength): Added. (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now. (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII. (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those. (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII. (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII. - fixed the test program so it won't hit the interpreter lock assertion * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded. === Safari-127 === 2004-02-06 Richard Williamson 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. Reviewed by John. * bindings/jni/jni_jsobject.cpp: (JSObject::toString): * bindings/jni/jni_utility.cpp: (KJS::Bindings::convertValueToJValue): 2004-02-02 Darin Adler Reviewed by Maciej. - fixed : array of negative size leads to crash (test page at oscar.the-rileys.net) * kjs/array_object.cpp: (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until we start putting values in. This prevents new Array(2147483647) from causing trouble. (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the number is out of range. This prevents new Array(-1) from causing trouble. - fixed : Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page) * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve casting to int. Results now match those in other browsers. 2004-02-02 Darin Adler Reviewed by Maciej. - fixed : integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt") - fixed other related overflow issues * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16. * kjs/value.cpp: (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification, must not restrict values to the range of a particular integer type. (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added proper handling for negative results from fmod. (ValueImp::toUInt32): Ditto. (ValueImp::toUInt16): Ditto. (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t. * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle out-of-integer-range values better in the slice function. * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly. * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle out-of-integer-range values better in the toString function. * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice, and substr functions. === Safari-126 === 2004-01-30 Richard Williamson Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor. Reviewed by Darin. * bindings/jni/jni_instance.cpp: (JavaInstance::stringValue): 2004-01-26 Darin Adler * Makefile.am: Switch from pbxbuild to xcodebuild. 2004-01-22 Richard Williamson Added stubs for ObjC language binding to JavaScript. * JavaScriptCore.pbproj/project.pbxproj: * bindings/jni/jni_runtime.h: * bindings/objc/objc_runtime.h: Added. (KJS::Bindings::ObjcParameter::ObjcParameter): (KJS::Bindings::ObjcParameter::~ObjcParameter): (KJS::Bindings::ObjcParameter::operator=): (KJS::Bindings::ObjcParameter::type): (KJS::Bindings::ObjcConstructor::ObjcConstructor): (KJS::Bindings::ObjcConstructor::~ObjcConstructor): (KJS::Bindings::ObjcConstructor::_commonCopy): (KJS::Bindings::ObjcConstructor::operator=): (KJS::Bindings::ObjcConstructor::value): (KJS::Bindings::ObjcConstructor::parameterAt): (KJS::Bindings::ObjcConstructor::numParameters): (KJS::Bindings::ObjcField::ObjcField): (KJS::Bindings::ObjcField::~ObjcField): * bindings/runtime.h: 2004-01-22 Richard Williamson Simplified JavaString by using UString as backing store. This revealed a bug in CString's assignment operator which I fixed. Removed some dead code. Reviewed by John. * bindings/jni/jni_runtime.h: (KJS::Bindings::JavaString::JavaString): (KJS::Bindings::JavaString::_commonInit): (KJS::Bindings::JavaString::UTF8String): (KJS::Bindings::JavaString::uchars): (KJS::Bindings::JavaString::length): (KJS::Bindings::JavaString::ustring): * bindings/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): * bindings/runtime_object.h: * kjs/ustring.cpp: (KJS::CString::CString): (KJS::CString::operator=): === Safari-125 === === Safari-124 === 2004-01-16 Richard Williamson Fixed 3525853. We weren't handling mapping to overloaded Java methods very well. Even though this is undefined the other browsers support it. Also fixed a bug with returning arrays from Java functions. Reviewed by John. * bindings/jni/jni_class.cpp: (JavaClass::_commonInit): (JavaClass::methodsNamed): * bindings/jni/jni_class.h: * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.cpp: (JavaArray::convertJObjectToArray): (JavaField::valueFromInstance): (JavaMethod::signature): (JavaArray::valueAt): * bindings/jni/jni_runtime.h: * bindings/jni_jsobject.cpp: (JSObject::call): (JSObject::convertJObjectToValue): * bindings/runtime.cpp: (MethodList::addMethod): (MethodList::length): (MethodList::methodAt): (MethodList::~MethodList): * bindings/runtime.h: (KJS::Bindings::MethodList::MethodList): * bindings/runtime_method.cpp: (RuntimeMethodImp::RuntimeMethodImp): (RuntimeMethodImp::get): (RuntimeMethodImp::call): * bindings/runtime_method.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::hasProperty): 2004-01-16 Richard Williamson Fixed 3531229. Another place that needs the Push/PopLocalFrame protection implemented for 3530401. Reviewed by John. * bindings/runtime_method.cpp: (RuntimeMethodImp::call): 2004-01-15 Richard Williamson Fixed 3530401. JNI doesn't cleanup local refs created on the main thread. IMO this is a bad bug in our JMI implementation. To work-around the problem I explicitly delete all local refs. Further, I've added Push/PopLocalFrame calls to catch any refs that I may have missed. This will guarantee that we don't leak any Java references. Reviewed by John. * bindings/jni/jni_class.cpp: (JavaClass::_commonInit): (JavaClass::JavaClass): * bindings/jni/jni_instance.cpp: (JavaInstance::begin): (JavaInstance::end): * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.cpp: (JavaConstructor::JavaConstructor): (JavaMethod::JavaMethod): * bindings/jni_jsobject.cpp: (JSObject::listFromJArray): * bindings/runtime.h: (KJS::Bindings::Instance::begin): (KJS::Bindings::Instance::end): * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::put): (RuntimeObjectImp::canPut): (RuntimeObjectImp::hasProperty): (RuntimeObjectImp::defaultValue): 2004-01-15 Vicki Murley Reviewed by Darin. * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004. 2004-01-14 Richard Williamson Fixed 3529466. With recent changes to Java plugin we must no longer call DeleteLocalRef(). Not a problem, it was an optimization anyway. Reviewed by John. * bindings/jni/jni_instance.cpp: (JObjectWrapper::JObjectWrapper): === Safari-122 === 2004-01-14 Richard Williamson Fixed 3529010. 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. Reviewed by John. * bindings/jni_jsobject.cpp: (addJavaReference): (removeJavaReference): (RootObject::removeAllJavaReferencesForRoot): (JSObject::invoke): 2004-01-13 Richard Williamson Fixed 3528324. 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. Reviewed by Hyatt. * bindings/jni_jsobject.h: (KJS::Bindings::RootObject::~RootObject): === Safari-121 === === Safari-120 === 2004-01-06 Richard Williamson Fixed 3521814. Finalize messages weren't being dispatched! Reviewed by John. * bindings/jni_jsobject.cpp: (JSObject::invoke): 2004-01-05 Richard Williamson Added cache of JNI method IDs to minimize allocations. This mitigates the problem described by 3515579. Also cleanup up logging of Java exceptions. Reviewed by John. * bindings/jni/jni_class.cpp: (JavaClass::classForInstance): * bindings/jni/jni_instance.cpp: (JavaInstance::JavaInstance): (JavaInstance::getClass): (JavaInstance::invokeMethod): (JObjectWrapper::JObjectWrapper): (JObjectWrapper::~JObjectWrapper): * bindings/jni/jni_instance.h: (KJS::Bindings::JavaInstance::operator=): * bindings/jni/jni_runtime.cpp: (JavaMethod::JavaMethod): (JavaMethod::methodID): * bindings/jni/jni_runtime.h: (KJS::Bindings::JavaMethod::JavaMethod): * bindings/jni/jni_utility.cpp: (callJNIMethod): (callJNIMethodIDA): (callJNIMethodA): (KJS::Bindings::getMethodID): (KJS::Bindings::callJNIVoidMethodIDA): (KJS::Bindings::callJNIObjectMethodIDA): (KJS::Bindings::callJNIByteMethodIDA): (KJS::Bindings::callJNICharMethodIDA): (KJS::Bindings::callJNIShortMethodIDA): (KJS::Bindings::callJNIIntMethodIDA): (KJS::Bindings::callJNILongMethodIDA): (KJS::Bindings::callJNIFloatMethodIDA): (KJS::Bindings::callJNIDoubleMethodIDA): (KJS::Bindings::callJNIBooleanMethodIDA): (KJS::Bindings::getCharactersFromJStringInEnv): (KJS::Bindings::getUCharactersFromJStringInEnv): (KJS::Bindings::getJNIField): * bindings/jni/jni_utility.h: l2003-12-23 John Sullivan * JavaScriptCore.pbproj/project.pbxproj: Xcode version wars, harmless 2003-12-23 Darin Adler Reviewed by John (concept, not code, which is just the old code coming back). - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime, mktime, timegm, and time, because mktime, at least, won't handle a year of 0. 2003-12-19 Richard Williamson Fixed 3515597. When an error occurs we need to make sure result values are zeroed. Cleaned up logs by adding a newline. Reviewed by John. * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): (KJS::Bindings::getJNIEnv): (callJNIMethod): (callJNIMethodA): (KJS::Bindings::getJNIField): * bindings/jni_jsobject.cpp: (JSObject::convertValueToJObject): === Safari-119 === 2003-12-17 Richard Williamson Ensure that all the symbols we export are in the KJS namespace (3512245). Also renamed JavaString.characters() to JavaString.UTF8String() for enhanced clarity. Added some sanity checking to constructor of JObjectWrapper. Reviewed by Dave. * ChangeLog: * bindings/jni/jni_class.cpp: * bindings/jni/jni_class.h: * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): (JObjectWrapper::JObjectWrapper): * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.cpp: (JavaParameter::JavaParameter): (JavaField::JavaField): (JavaMethod::JavaMethod): (JavaMethod::signature): * bindings/jni/jni_runtime.h: (KJS::Bindings::JavaString::ascii): (KJS::Bindings::JavaString::UTF8String): (KJS::Bindings::JavaString::JavaString): (KJS::Bindings::JavaString::_commonInit): (KJS::Bindings::JavaString::uchars): (KJS::Bindings::JavaString::length): (KJS::Bindings::JavaString::ustring): (KJS::Bindings::JavaParameter::type): (KJS::Bindings::JavaField::name): (KJS::Bindings::JavaField::type): (KJS::Bindings::JavaMethod::name): (KJS::Bindings::JavaMethod::returnType): * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): (KJS::Bindings::getJNIEnv): (KJS::Bindings::callJNIVoidMethod): (KJS::Bindings::callJNIObjectMethod): (KJS::Bindings::callJNIBooleanMethod): (KJS::Bindings::callJNIByteMethod): (KJS::Bindings::callJNICharMethod): (KJS::Bindings::callJNIShortMethod): (KJS::Bindings::callJNIIntMethod): (KJS::Bindings::callJNILongMethod): (KJS::Bindings::callJNIFloatMethod): (KJS::Bindings::callJNIDoubleMethod): (KJS::Bindings::callJNIVoidMethodA): (KJS::Bindings::callJNIObjectMethodA): (KJS::Bindings::callJNIByteMethodA): (KJS::Bindings::callJNICharMethodA): (KJS::Bindings::callJNIShortMethodA): (KJS::Bindings::callJNIIntMethodA): (KJS::Bindings::callJNILongMethodA): (KJS::Bindings::callJNIFloatMethodA): (KJS::Bindings::callJNIDoubleMethodA): (KJS::Bindings::callJNIBooleanMethodA): (KJS::Bindings::getCharactersFromJString): (KJS::Bindings::releaseCharactersForJString): (KJS::Bindings::getCharactersFromJStringInEnv): (KJS::Bindings::releaseCharactersForJStringInEnv): (KJS::Bindings::getUCharactersFromJStringInEnv): (KJS::Bindings::releaseUCharactersForJStringInEnv): (KJS::Bindings::JNITypeFromClassName): (KJS::Bindings::signatureFromPrimitiveType): (KJS::Bindings::JNITypeFromPrimitiveType): (KJS::Bindings::getJNIField): (KJS::Bindings::convertValueToJValue): * bindings/jni/jni_utility.h: * bindings/jni_jsobject.cpp: (KJS::Bindings::JSObject::invoke): (KJS::Bindings::JSObject::JSObject): (KJS::Bindings::JSObject::call): (KJS::Bindings::JSObject::eval): (KJS::Bindings::JSObject::getMember): (KJS::Bindings::JSObject::setMember): (KJS::Bindings::JSObject::removeMember): (KJS::Bindings::JSObject::getSlot): (KJS::Bindings::JSObject::setSlot): (KJS::Bindings::JSObject::toString): (KJS::Bindings::JSObject::finalize): (KJS::Bindings::JSObject::createNative): (KJS::Bindings::JSObject::convertValueToJObject): (KJS::Bindings::JSObject::convertJObjectToValue): (KJS::Bindings::JSObject::listFromJArray): * bindings/jni_jsobject.h: * bindings/runtime.cpp: * bindings/runtime.h: * bindings/runtime_method.cpp: * bindings/runtime_method.h: === Safari-118 === 2003-12-16 Richard Williamson Ack! More assertions. Lock ALL entry points into the interpreter! (3511733). Reviewed by Ken. * bindings/jni_jsobject.cpp: (Bindings::JSObject::call): (Bindings::JSObject::eval): (Bindings::JSObject::getMember): (Bindings::JSObject::setMember): (Bindings::JSObject::removeMember): (Bindings::JSObject::getSlot): (Bindings::JSObject::setSlot): (Bindings::JSObject::convertJObjectToValue): 2003-12-15 Richard Williamson Fixed a couple of snafus and removed some logging. Reviewed by Maciej. * bindings/jni_jsobject.cpp: (Bindings::performJavaScriptAccess): (Bindings::completedJavaScriptAccess): (Bindings::dispatchToJavaScriptThread): Removed some annoying JS_LOG clutter. (Bindings::RootObject::removeAllJavaReferencesForRoot): Fixed allocation of key buffer that was called after it was needed. (Bindings::JSObject::invoke): (Bindings::JSObject::JSObject): (Bindings::JSObject::getMember): (Bindings::JSObject::getSlot): Added additional interpreter locks around getMember and getSlot. These functions may cause allocation of JS impls. 2003-12-15 Richard Williamson args weren't passed to 'call' invocation. d'oh. lock interpreter when we create instances of JS impls. Reviewed by Maciej. * bindings/jni_jsobject.cpp: (Bindings::JSObject::call): (Bindings::JSObject::eval): (Bindings::JSObject::getMember): (Bindings::JSObject::setMember): (Bindings::JSObject::getSlot): (Bindings::JSObject::convertValueToJObject): (Bindings::JSObject::convertJObjectToValue): (Bindings::JSObject::listFromJArray): * bindings/jni_jsobject.h: 2003-12-15 Richard Williamson Last piece of LiveConnect! This checkin adds implementation of the Java to JavaScript object conversion functions. Reviewed by John. * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_utility.cpp: * bindings/jni/jni_utility.h: * bindings/jni_jsobject.cpp: (Bindings::JSObject::invoke): (Bindings::JSObject::call): (Bindings::JSObject::eval): (Bindings::JSObject::getMember): (Bindings::JSObject::setMember): (Bindings::JSObject::getSlot): (Bindings::JSObject::setSlot): (Bindings::JSObject::createNative): (Bindings::JSObject::convertValueToJObject): (Bindings::JSObject::convertJObjectToValue): (Bindings::JSObject::listFromJArray): * bindings/jni_jsobject.h: (Bindings::): * bindings/runtime_method.cpp: (RuntimeMethodImp::get): (RuntimeMethodImp::codeType): (RuntimeMethodImp::execute): 2003-12-12 Richard Williamson Added implementation of stubs in JSObject. All that remains is a couple of simple conversion functions stubs and we're done with LiveConnect. Also, changed string passing to JS to use uchars instead of chars. Reviewed by Maciej. * bindings/jni/jni_runtime.h: (Bindings::JavaString::JavaString): (Bindings::JavaString::_commonInit): (Bindings::JavaString::_commonCopy): (Bindings::JavaString::_commonDelete): (Bindings::JavaString::~JavaString): (Bindings::JavaString::operator=): (Bindings::JavaString::uchars): (Bindings::JavaString::length): (Bindings::JavaString::ustring): * bindings/jni/jni_utility.cpp: (getUCharactersFromJStringInEnv): (releaseUCharactersForJStringInEnv): (convertValueToJObject): (convertJObjectToValue): * bindings/jni/jni_utility.h: * bindings/jni_jsobject.cpp: (Bindings::JSObject::invoke): (Bindings::JSObject::call): (Bindings::JSObject::eval): (Bindings::JSObject::getMember): (Bindings::JSObject::setMember): (Bindings::JSObject::removeMember): (Bindings::JSObject::getSlot): (Bindings::JSObject::setSlot): * bindings/jni_jsobject.h: 2003-12-12 Richard Williamson Ensure that all calls from Java into JavaScript are performed on a designated thread (the main thread). Reviewed by Ken. * bindings/jni_jsobject.cpp: (isJavaScriptThread): (rootForImp): (Bindings::performJavaScriptAccess): (Bindings::completedJavaScriptAccess): (Bindings::initializeJavaScriptAccessLock): (Bindings::lockJavaScriptAccess): (Bindings::unlockJavaScriptAccess): (Bindings::dispatchToJavaScriptThread): (Bindings::RootObject::setFindRootObjectForNativeHandleFunction): (Bindings::RootObject::removeAllJavaReferencesForRoot): (Bindings::JSObject::invoke): (Bindings::JSObject::JSObject): (Bindings::JSObject::call): (Bindings::JSObject::eval): (Bindings::JSObject::getMember): (Bindings::JSObject::setMember): (Bindings::JSObject::removeMember): (Bindings::JSObject::getSlot): (Bindings::JSObject::setSlot): (Bindings::JSObject::toString): (Bindings::JSObject::finalize): (Bindings::JSObject::getWindow): * bindings/jni_jsobject.h: (Bindings::RootObject::~RootObject): (Bindings::RootObject::findRootObjectForNativeHandleFunction): (Bindings::RootObject::runLoop): (Bindings::RootObject::performJavaScriptSource): (Bindings::): 2003-12-11 Richard Williamson Added support for calling a JavaScript function from Java. Right now this only works for void func(void) functions, but the conversion of args and return values will come shortly. Cleaned up and verified reference counting scheme, and dereferencing of vended JavaScript objects when applet is destroyed (actually when part is destroyed). Removed link hack for testkjs now that the Java folks think they have a solution for the 1.4.2 JavaVM link problem. Although Greg B. thinks his solution may cause problems for the 1.3.1 version of the VM!?! Reviewed by Ken. * Makefile.am: * bindings/jni/jni_runtime.h: (Bindings::JavaString::JavaString): * bindings/jni/jni_utility.cpp: (convertValueToJValue): (convertValueToJObject): (listFromJArray): * bindings/jni/jni_utility.h: * bindings/jni_jsobject.cpp: (KJS_setFindRootObjectForNativeHandleFunction): (KJS_findRootObjectForNativeHandleFunction): (getReferencesByRootDictionary): (getReferencesDictionary): (findReferenceDictionary): (rootForImp): (addJavaReference): (removeJavaReference): * bindings/jni_jsobject.h: (Bindings::RootObject::RootObject): (Bindings::RootObject::~RootObject): (Bindings::RootObject::setRootObjectImp): (Bindings::RootObject::rootObjectImp): (Bindings::RootObject::setInterpreter): (Bindings::RootObject::interpreter): === Safari-117 === 2003-12-10 Darin Adler Reviewed by Maciej. - fixed regression in JavaScript tests reported by the KDE guys - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong. * kjs/ustring.cpp: (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones: tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size and binary compatibility than default parameter values. (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload. * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new "tolerate empty string" parameter. 2003-12-10 Richard Williamson Added code to manage reference counting of JavaScript objects passed to Java. Also added implementation of KJS_JSCreateNativeJSObject. This is the function that provides the root object to Java (KJS::Window). Reviewed by Hyatt. * JavaScriptCore.pbproj/project.pbxproj: * bindings/jni_jsobject.cpp: (KJS_setFindObjectForNativeHandleFunction): (KJS_findObjectForNativeHandleFunction): (getReferencesByOwnerDictionary): (getReferencesDictionary): (findReferenceDictionary): (addJavaReference): (removeJavaReference): (removeAllJavaReferencesForOwner): * bindings/jni_jsobject.h: 2003-12-09 Richard Williamson LiveConnect stubs that correspond to the native methods on JSObject. These will be called from the new Java plugin when an instance of JSObject is instantiated and messaged. When these are implemented the Java will be able to originate calls into JavaScript. Also a temporary work-around added to Makefile.am to solve a link problem. The 1.4.2 JavaVM accidentally links against libobjc. This call a failure linking testkjs. Mike Hay is working with someone to fix the problem (3505587). Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * Makefile.am: * bindings/jni_jsobject.cpp: Added. (KJS_JSCreateNativeJSObject): (KJS_JSObject_JSFinalize): (KJS_JSObject_JSObjectCall): (KJS_JSObject_JSObjectEval): (KJS_JSObject_JSObjectGetMember): (KJS_JSObject_JSObjectSetMember): (KJS_JSObject_JSObjectRemoveMember): (KJS_JSObject_JSObjectGetSlot): (KJS_JSObject_JSObjectSetSlot): (KJS_JSObject_JSObjectToString): * bindings/jni_jsobject.h: Added. 2003-12-09 Maciej Stachowiak Reviewed by John. : JavaScriptCore should assert that interpreter is locked in collector * kjs/collector.cpp: (KJS::Collector::allocate): Assert that interpreter lock count is not 0. (KJS::Collector::collect): likewise 2003-12-08 Richard Williamson LiveConnect: The last piece of the JavaScript side of the LiveConnect implementation. This change adds support for setting/getting values from Java arrays in JavaScript. Reviewed by John. * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.cpp: (JavaField::JavaField): (convertJObjectToArray): (JavaArray::JavaArray): (JavaArray::~JavaArray): (JavaArray::setValueAt): (JavaArray::valueAt): (JavaArray::getLength): * bindings/jni/jni_runtime.h: (Bindings::JavaArray::operator=): (Bindings::JavaArray::javaArray): * bindings/jni/jni_utility.cpp: (JNITypeFromPrimitiveType): (convertValueToJValue): * bindings/jni/jni_utility.h: * bindings/runtime.h: * bindings/runtime_array.cpp: (RuntimeArrayImp::RuntimeArrayImp): (RuntimeArrayImp::~RuntimeArrayImp): (RuntimeArrayImp::get): (RuntimeArrayImp::put): (RuntimeArrayImp::hasProperty): * bindings/runtime_array.h: (KJS::RuntimeArrayImp::getLength): (KJS::RuntimeArrayImp::getConcreteArray): * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::canPut): (RuntimeObjectImp::hasProperty): 2003-12-05 Richard Williamson LiveConnect: Part 1 of supporting JS bindings to native language arrays. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * bindings/jni/jni_runtime.cpp: (JavaField::JavaField): (convertJObjectToArray): (JavaField::valueFromInstance): (JavaField::setValueToInstance): * bindings/jni/jni_runtime.h: * bindings/runtime.cpp: (Instance::setValueOfField): * bindings/runtime.h: (Bindings::Array::~Array): 2003-12-04 Richard Williamson LiveConnect: Moved defaultValue into concrete implementation because more intelligent conversion can be perform with knowledge of the class of the original instance. Reviewed by Chris. * bindings/jni/jni_class.cpp: (JavaClass::isNumberClass): (JavaClass::isBooleanClass): (JavaClass::isStringClass): * bindings/jni/jni_class.h: * bindings/jni/jni_instance.cpp: (JavaInstance::defaultValue): (JavaInstance::valueOf): * bindings/jni/jni_instance.h: (Bindings::JavaInstance::javaInstance): * bindings/runtime.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::defaultValue): 2003-12-04 Richard Williamson LiveConnect: Added support for setting the value of Java fields. Reviewed by Chris. * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_runtime.cpp: (JavaParameter::JavaParameter): (JavaField::JavaField): (JavaField::valueFromInstance): (JavaField::setValueToInstance): (JavaMethod::JavaMethod): * bindings/jni/jni_runtime.h: (Bindings::JavaField::getJNIType): * bindings/jni/jni_utility.cpp: (JNITypeFromClassName): (convertValueToJValue): * bindings/jni/jni_utility.h: * bindings/runtime.cpp: (Instance::setValueOfField): * bindings/runtime.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::put): (RuntimeObjectImp::defaultValue): 2003-12-04 Richard Williamson Added support for string conversions. Changed various JavaString member variables to be inline. Implemented defaultValue for context relevant type coercion. Reviewed by Chris. * bindings/jni/jni_class.cpp: (JavaClass::JavaClass): (JavaClass::setClassName): (JavaClass::classForInstance): * bindings/jni/jni_class.h: * bindings/jni/jni_instance.cpp: (JavaInstance::stringValue): (JavaInstance::numberValue): (JavaInstance::booleanValue): (JavaInstance::invokeMethod): * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.cpp: (JavaParameter::JavaParameter): (JavaField::JavaField): (JavaMethod::JavaMethod): (appendClassName): (JavaMethod::signature): * bindings/jni/jni_runtime.h: (Bindings::JavaString::JavaString): (Bindings::JavaString::~JavaString): (Bindings::JavaString::operator=): (Bindings::JavaString::characters): (Bindings::JavaParameter::JavaParameter): (Bindings::JavaParameter::~JavaParameter): (Bindings::JavaParameter::operator=): (Bindings::JavaParameter::type): (Bindings::JavaField::JavaField): (Bindings::JavaField::~JavaField): (Bindings::JavaField::operator=): (Bindings::JavaField::name): (Bindings::JavaField::type): (Bindings::JavaMethod::JavaMethod): (Bindings::JavaMethod::_commonDelete): (Bindings::JavaMethod::name): (Bindings::JavaMethod::returnType): * bindings/jni/jni_utility.cpp: (convertValueToJValue): * bindings/runtime.h: (Bindings::Instance::valueOf): * bindings/runtime_method.cpp: (RuntimeMethodImp::call): * bindings/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::get): (RuntimeObjectImp::defaultValue): * bindings/runtime_object.h: (KJS::RuntimeObjectImp::classInfo): === Safari-116 === 2003-12-03 Richard Williamson LiveConnect: Added support for parameter passing to Java and conversion of return values. Reviewed by Chris. * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.cpp: (JavaParameter::JavaParameter): (JavaMethod::JavaMethod): (JavaMethod::signature): * bindings/jni/jni_runtime.h: (Bindings::JavaParameter::JavaParameter): (Bindings::JavaParameter::operator=): (Bindings::JavaParameter::getJNIType): * bindings/jni/jni_utility.cpp: (callJNIBooleanMethodA): (convertValueToJValue): * bindings/jni/jni_utility.h: * bindings/runtime.h: * bindings/runtime_method.cpp: (RuntimeMethodImp::call): * bindings/runtime_object.cpp: (RuntimeObjectImp::get): 2003-12-02 Richard Williamson Added support for calling simple methods in Java from JavaScript. (void return and no parameters). Yay, LiveConnect lives. Still need write argument and return value conversion code. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * bindings/jni/jni_instance.cpp: (JavaInstance::getClass): (JavaInstance::invokeMethod): * bindings/jni/jni_instance.h: * bindings/jni/jni_runtime.cpp: (JavaMethod::JavaMethod): (JavaMethod::signature): (JavaMethod::JNIReturnType): * bindings/jni/jni_runtime.h: (Bindings::JavaMethod::_commonDelete): (Bindings::JavaMethod::_commonCopy): (Bindings::JavaMethod::name): * bindings/jni/jni_utility.cpp: (signatureFromPrimitiveType): * bindings/jni/jni_utility.h: * bindings/runtime.h: * bindings/runtime_method.cpp: Added. (RuntimeMethodImp::RuntimeMethodImp): (RuntimeMethodImp::~RuntimeMethodImp): (RuntimeMethodImp::get): (RuntimeMethodImp::implementsCall): (RuntimeMethodImp::call): (RuntimeMethodImp::codeType): (RuntimeMethodImp::execute): * bindings/runtime_method.h: Added. * bindings/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::get): * bindings/runtime_object.h: * kjs/function.cpp: (FunctionImp::FunctionImp): * kjs/interpreter.h: 2003-12-01 Darin Adler Reviewed by Maciej. - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean. This indirectly caused the string.replace bug. 2003-12-02 Maciej Stachowiak Merged patches from Harri Porten and David Faure to fix: : reproducible crash printing self-referential array * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown. * kjs/nodes.cpp: (FunctionCallNode::evaluate): Move function call depth check from here... * kjs/object.cpp: (KJS::Object::call): ...to here. * kjs/object.h: Un-inline Object::call now that it does more. 2003-12-01 Richard Williamson Fixed mistake in method signatures used to get boolean and integer fields. Reviewed by Chris. * bindings/jni/jni_runtime.cpp: (JavaField::valueFromInstance): 2003-12-01 Richard Williamson 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. 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. Added support for getting at Java object fields. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * Makefile.am: * bindings/jni/jni_instance.cpp: (JObjectWrapper::JObjectWrapper): * bindings/jni/jni_instance.h: (Bindings::JObjectWrapper::~JObjectWrapper): * bindings/jni/jni_runtime.cpp: (JavaField::valueFromInstance): * bindings/runtime_object.cpp: (RuntimeObjectImp::~RuntimeObjectImp): (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::get): (RuntimeObjectImp::deleteProperty): * bindings/runtime_object.h: === Safari-115 === 2003-11-21 Maciej Stachowiak Patch from Harri Porten, reviewed by me. - fixed 3491712 - String slice with negative arguments does not offset from end of string * kjs/string_object.cpp: (StringProtoFuncImp::call): Handle negative arguments as offsets from end by adding length and clamping to [0,length-1]. 2003-11-21 Maciej Stachowiak Patch from Harri Porten, reviewed by me. - fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Nest parentheses properly. 2003-11-20 Richard Williamson More LiveConnect stuff. Primitive Java fields are now accessible from JavaScript! Yay! Reviewed by Maciej. * bindings/jni/jni_class.cpp: (JavaClass::methodNamed): (JavaClass::fieldNamed): * bindings/jni/jni_class.h: (Bindings::JavaClass::_commonDelete): * bindings/jni/jni_instance.cpp: (JavaInstance::JavaInstance): (JavaInstance::~JavaInstance): (JavaInstance::getClass): * bindings/jni/jni_instance.h: (Bindings::JavaInstance::javaInstance): * bindings/jni/jni_runtime.cpp: (JavaField::JavaField): (JavaField::valueFromInstance): * bindings/jni/jni_runtime.h: (Bindings::JavaField::JavaField): (Bindings::JavaField::~JavaField): (Bindings::JavaField::operator=): * bindings/jni/jni_utility.cpp: (callJNIMethod): (callJNIMethodA): (callJNIVoidMethod): (callJNIObjectMethod): (callJNIBooleanMethod): (callJNIByteMethod): (callJNICharMethod): (callJNIShortMethod): (callJNIIntMethod): (callJNILongMethod): (callJNIFloatMethod): (callJNIDoubleMethod): (callJNIVoidMethodA): (callJNIObjectMethodA): (callJNIByteMethodA): (callJNICharMethodA): (callJNIShortMethodA): (callJNIIntMethodA): (callJNILongMethodA): (callJNIFloatMethodA): (callJNIDoubleMethodA): (releaseCharactersForJStringInEnv): (primitiveTypeFromClassName): (getJNIField): * bindings/jni/jni_utility.h: * bindings/runtime.cpp: (Instance::createBindingForLanguageInstance): (Instance::getValueOfField): * bindings/runtime.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::get): 2003-11-20 Richard Williamson More LiveConnect stuff. Reviewed by Chris. * bindings/jni/jni_class.cpp: (JavaClass::classForName): (JavaClass::classForInstance): * bindings/jni/jni_instance.cpp: (JavaInstance::getValueOfField): * bindings/jni/jni_instance.h: (Bindings::JObjectWrapper::JObjectWrapper): * bindings/jni/jni_runtime.h: (Bindings::JavaConstructor::~JavaConstructor): (Bindings::JavaConstructor::operator=): (Bindings::JavaMethod::JavaMethod): (Bindings::JavaMethod::_commonDelete): (Bindings::JavaMethod::signature): * bindings/jni/jni_utility.cpp: (getJNIEnv): (attachToJavaVM): * bindings/jni/jni_utility.h: * bindings/runtime.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::~RuntimeObjectImp): (RuntimeObjectImp::get): * bindings/runtime_object.h: 2003-11-19 Richard Williamson More LiveConnect stuff. Reviewed by Ken. * JavaScriptCore.pbproj/project.pbxproj: * bindings/jni/jni_class.cpp: Added. (JavaClass::_commonInit): (JavaClass::JavaClass): (_createClassesByNameIfNecessary): (JavaClass::classForName): (JavaClass::classForInstance): (JavaClass::methodNamed): (JavaClass::fieldNamed): * bindings/jni/jni_class.h: Added. (Bindings::JavaClass::_commonDelete): (Bindings::JavaClass::~JavaClass): (Bindings::JavaClass::_commonCopy): (Bindings::JavaClass::JavaClass): (Bindings::JavaClass::operator=): (Bindings::JavaClass::name): (Bindings::JavaClass::constructorAt): (Bindings::JavaClass::numConstructors): * bindings/jni/jni_instance.cpp: Added. (JavaInstance::JavaInstance): (JavaInstance::~JavaInstance): * bindings/jni/jni_instance.h: Added. (Bindings::JObjectWrapper::JObjectWrapper): (Bindings::JObjectWrapper::~JObjectWrapper): (Bindings::JObjectWrapper::ref): (Bindings::JObjectWrapper::deref): (Bindings::JavaInstance::getClass): (Bindings::JavaInstance::operator=): * bindings/jni/jni_runtime.cpp: (JavaMethod::JavaMethod): * bindings/jni/jni_runtime.h: (Bindings::JavaString::JavaString): (Bindings::JavaString::~JavaString): (Bindings::JavaString::operator=): * bindings/jni/jni_utility.cpp: (getJavaVM): (getJNIEnv): (getCharactersFromJString): (releaseCharactersForJString): (getCharactersFromJStringInEnv): (releaseCharactersForJStringInEnv): * bindings/jni/jni_utility.h: * bindings/runtime.cpp: (Instance::createBindingForLanguageInstance): * bindings/runtime.h: (Bindings::Instance::): 2003-11-18 Richard Williamson More live connect stubs. We're getting close. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * bindings/jni/jni_runtime.cpp: (JavaClass::JavaClass): (JavaInstance::JavaInstance): (JavaInstance::~JavaInstance): * bindings/jni/jni_runtime.h: (Bindings::JavaConstructor::value): (Bindings::JavaField::value): (Bindings::JavaMethod::value): (Bindings::JavaClass::_commonDelete): (Bindings::JavaClass::_commonCopy): (Bindings::JavaClass::methodNamed): (Bindings::JavaClass::fieldNamed): (Bindings::JavaInstance::getClass): * bindings/runtime.cpp: Added. * bindings/runtime.h: (Bindings::Instance::~Instance): * bindings/runtime_object.cpp: Added. (RuntimeObjectImp::classInfo): (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::get): (RuntimeObjectImp::put): (RuntimeObjectImp::canPut): (RuntimeObjectImp::hasProperty): (RuntimeObjectImp::deleteProperty): (RuntimeObjectImp::defaultValue): (RuntimeObjectImp::_initializeClassInfoFromInstance): * bindings/runtime_object.h: Added. (KJS::RuntimeObjectImp::setInternalInstance): (KJS::RuntimeObjectImp::getInternalInstance): * kjs/object.cpp: (KJS::ObjectImp::get): (KJS::ObjectImp::hasProperty): * kjs/value.h: (KJS::): 2003-11-17 Maciej Stachowiak Patch from Harri, reviewed by me. - fixed 3487375 - backwards array slice causes infinite loop * kjs/array_object.cpp: (ArrayProtoFuncImp::call): 2003-11-17 Maciej Stachowiak Patch from Harri Porten reviewed by me. - fixed 3487371 - operator precedence for bitwise or, xor and and is wrong * kjs/grammar.y: Correct the precedence. 2003-11-16 Maciej Stachowiak Reviewed by John. - fixed 3483829 - JavaScriptCore needs workaround to compile on Merlot * JavaScriptCore.pbproj/project.pbxproj: Add -Wno-long-double to warning flags. === Safari-114 === 2003-11-13 Richard Williamson Factored common code between copy constructor and assignment operator. Reviewed by Chris. * ChangeLog: * bindings/jni/jni_runtime.h: (Bindings::JavaConstructor::_commonCopy): (Bindings::JavaConstructor::JavaConstructor): (Bindings::JavaConstructor::operator=): (Bindings::JavaField::type): * bindings/runtime.h: 2003-11-13 Richard Williamson More LiveConnect stuff. This checkin adds abstract classes to model language runtimes and a JNI based set of concrete implementations for Java. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * Makefile.am: * bindings/Makefile.am: Removed. * bindings/jni/Makefile.am: Removed. * bindings/jni/jni_runtime.cpp: Added. (JavaField::JavaField): (JavaConstructor::JavaConstructor): (JavaMethod::JavaMethod): (JavaClass::JavaClass): * bindings/jni/jni_runtime.h: Added. (Bindings::JavaString::JavaString): (Bindings::JavaString::~JavaString): (Bindings::JavaString::operator=): (Bindings::JavaString::characters): (Bindings::JavaParameter::JavaParameter): (Bindings::JavaParameter::~JavaParameter): (Bindings::JavaParameter::operator=): (Bindings::JavaParameter::type): (Bindings::JavaConstructor::JavaConstructor): (Bindings::JavaConstructor::~JavaConstructor): (Bindings::JavaConstructor::operator=): (Bindings::JavaConstructor::parameterAt): (Bindings::JavaConstructor::numParameters): (Bindings::JavaField::JavaField): (Bindings::JavaField::~JavaField): (Bindings::JavaField::operator=): (Bindings::JavaField::name): (Bindings::JavaField::type): (Bindings::JavaMethod::JavaMethod): (Bindings::JavaMethod::_commonDelete): (Bindings::JavaMethod::~JavaMethod): (Bindings::JavaMethod::_commonCopy): (Bindings::JavaMethod::operator=): (Bindings::JavaMethod::name): (Bindings::JavaMethod::returnType): (Bindings::JavaMethod::parameterAt): (Bindings::JavaMethod::numParameters): (Bindings::JavaClass::_commonDelete): (Bindings::JavaClass::~JavaClass): (Bindings::JavaClass::_commonCopy): (Bindings::JavaClass::JavaClass): (Bindings::JavaClass::operator=): (Bindings::JavaClass::name): (Bindings::JavaClass::methodAt): (Bindings::JavaClass::numMethods): (Bindings::JavaClass::constructorAt): (Bindings::JavaClass::numConstructors): (Bindings::JavaClass::fieldAt): (Bindings::JavaClass::numFields): * bindings/jni/jni_utility.cpp: (callJNIMethod): (callJNIMethodA): (callJNIObjectMethod): (callJNIByteMethod): (callJNICharMethod): (callJNIShortMethod): (callJNIIntMethod): (callJNILongMethod): (callJNIFloatMethod): (callJNIDoubleMethod): (callJNIVoidMethodA): (callJNIObjectMethodA): (callJNIByteMethodA): (callJNICharMethodA): (callJNIShortMethodA): (callJNIIntMethodA): (callJNILongMethodA): (callJNIFloatMethodA): (callJNIDoubleMethodA): (getCharactersFromJString): (releaseCharactersForJString): * bindings/jni/jni_utility.h: * bindings/objc/Makefile.am: Removed. * bindings/runtime.h: Added. (Bindings::Parameter::~Parameter): (Bindings::Constructor::~Constructor): (Bindings::Field::~Field): (Bindings::Method::~Method): (Bindings::Class::~Class): 2003-11-13 Maciej Stachowiak Reviewed by John. - fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions * kjs/nodes.cpp: (ForInNode::execute): If the in value is null or undefined, bail out early, since attempting to iterate its properties will throw an exception. 2003-11-12 Darin Adler - fixed the build * Makefile.am: Fix the build by removing the bindings directory from SUBDIRS. Later, we can either add this back and add the Makefile.am files to the top level configure.in or leave it out and remove the Makefile.am files. 2003-11-12 Richard Williamson Added utility functions for calling JNI methods. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * Makefile.am: * bindings/Makefile.am: Added. * bindings/jni/Makefile.am: Added. * bindings/jni/jni_utility.cpp: Added. (attachToJavaVM): (callJNIMethod): (callJNIVoidMethod): (callJNIObjectMethod): (callJNIByteMethod): (callJNICharMethod): (callJNIShortMethod): (callJNIIntMethod): (callJNILongMethod): (callJNIFloatMethod): (callJNIDoubleMethod): * bindings/jni/jni_utility.h: Added. * bindings/objc/Makefile.am: Added. 2003-11-08 Darin Adler Reviewed by John. - fixed 3477528 -- array.sort(function) fails if the function returns a non-zero value that rounds to zero * kjs/array_object.cpp: (compareByStringForQSort): Added checks for undefined values to match what the specification calls for. (compareWithCompareFunctionForQSort): Added checks for undefined values as above, and also changed the code that looks at the compare function result to look at the number returned without rounding to an integer. (ArrayProtoFuncImp::call): Changed the code that looks at the compare function result to look at the number returned without rounding to an integer. === Safari-113 === 2003-11-03 Vicki Murley Reviewed by kocienda. - fixed : non-B&I builds should not use order files, because they cause false "regressions" in perf. * JavaScriptCore.pbproj/project.pbxproj: added empty SECTORDER_FLAGS variables to the Development and Deployment build styles 2003-11-02 Darin Adler Reviewed by Maciej. - changed list manipulation to use Harri Porten's idea of a circular linked list that is built from head to tail rather than building the list backwards and reversing the list when done * kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way. Change many places that passed 0L to pass nothing at all, or to pass 0. * kjs/nodes.h: (KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated backwards list. (KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list. (KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated backwards list. Made the case for the first node separate so we don't need a nil check. (KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of reversing the list. (KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated backwards list. Also, made the constructors inline (moved here from .cpp file). (KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of reversing the list. (KJS::NewExprNode::NewExprNode): Changed a 0L to 0. (KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into .cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated backwards list. (KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated backwards list. (KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing the list. (KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file). The one in the .cpp file breaks the list instead of reversing it. (KJS::ForNode::ForNode): Break the circular list instead of reversing the list. (KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the list. (KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated backwards list. (KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into .cpp file). The one in the .cpp file breaks the list instead of reversing it. (KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and finally nodes rather than just Node. (KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated backwards list. (KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the list. (KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the list. * kjs/nodes.cpp: (StatListNode::StatListNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. Added setLoc calls to match KJS in the KDE tree; since we don't currently use the JavaScript debugging support, it's unclear whether there's any benefit, but later we might be using it and it's good to be as close as possible. (BlockNode::BlockNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. Added setLoc calls. (CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. (SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. Added setLoc calls. * kjs/grammar.cpp: Regenerated. * kjs/grammar.cpp.h: Regenerated. * kjs/grammar.h: Regenerated. === Safari-112 === 2003-10-30 Maciej Stachowiak Reviewed by Ken. - fixed 3427069 - browsing mp3.com causes leaks (KJS) * kjs/string_object.cpp: (StringProtoFuncImp::call): Don't do an early return, since that could leak a temporary regexp. 2003-10-29 Maciej Stachowiak Reviewed by Darin. - fixed 3426076 - Leak of JS lexer data visiting http://www.ebay.com * kjs/grammar.cpp: (yyerror): Updated the commented code. * kjs/grammar.y: Don't delete string and identifier tokens when done with them any more, they'll get cleaned up by the lexer now. * kjs/internal.cpp: (Parser::parse): Tell lexer when done parsing. * kjs/lexer.cpp: (Lexer::Lexer): Initialize new data members. (Lexer::lex): Use new methods to make strings and identifiers, and save them. (Lexer::makeIdentifier): Make a new Identifier and save it in an auto-growing array. (Lexer::makeUString): Likewise for UStrings. (Lexer::doneParsing): Clean up arrays of Ifentifiers and UStrings. * kjs/lexer.h: 2003-10-28 Maciej Stachowiak Reviewed by Ken. - fixed 3413962 - malicious web pages can kill all future JavaScript execution by breaking recursion limit check * kjs/nodes.cpp: (FunctionCallNode::evaluate): If we're going to return early due to breaking the recursion limit, make sure to lower it again, or it will creep up by one each time it's exceeded. 2003-10-26 Darin Adler * JavaScriptCorePrefix.h: Added a C case to the NULL definition since we use C as well as C++ in this project. 2003-10-26 Darin Adler - rolled in some CString changes Harri Porten did on the KDE side * kjs/ustring.cpp: (KJS::CString::CString): Use memcpy instead of strcpy for speed. Fix an off by one error in the copy constructor. (KJS::CString::operator=): Use memcpy instead of strcpy for speed. * JavaScriptCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU __null feature even if the system C library doesn't. == Rolled over to ChangeLog-2003-10-25 ==