=== JavaScriptCore-417.8 === 2005-11-17 Adele Peterson Fix by Darin, reviewed by me. fix for Some values used with setAttribute() cause the attribute to be removed (null strings vs. empty strings) (4059) Changed the constructors to return the emtpy string if the string is null. * kjs/value.cpp: (Value::Value): (String::String): === JavaScriptCore-417.7 === 2005-11-16 Timothy Hatcher Fixes build failures on Glendale and Chardonnay. We now use an export file for whatever compiler is selected (since the exported symbols differ.) * JavaScriptCore.xcodeproj: use GCC_VERSION_IDENTIFIER to pick the proper export file * JavaScriptCore.exp: added the 4 type infos that GCC 4 adds. * JavaScriptCore-3.3.exp: the GCC 3.3 export file that excluded GCC 4 symbols === JavaScriptCore-417.6 === 2005-11-14 Timothy Hatcher * JavaScriptCore.exp: removed type info sysmbols that we no longer export according to B&I. === JavaScriptCore-417.5 === 2005-11-11 Timothy Hatcher Merges fixes from TOT to Safari-2-0-branch 2005-06-20 Anders Carlsson Fixed: * kjs/string_object.cpp: (replace): Handle the second argument of replace being a function. 2005-11-10 Timothy Hatcher Merges fixes from Ti-2005-009-branch to Safari-2-0-branch 2005-11-04 Geoffrey Garen Reviewed by darin. - Fixed *SecUpd: Tiger* PCRE heap overflow in Safari JavaScriptCore * pcre/pcre.c: (read_repeat_counts): We now return an error for negative repeat counts in regular expressions. This matches Firefox exactly, and Win IE by effect (Win IE doesn't return an error, but it does refuse to match anything). 2005-11-04 Geoffrey Garen Reviewed by Darin. - Fixed REGRESSION (412.2-416.12): [[xxx]] appears on page due to JS regexp with char > 255 (5597) (tiddlywiki.com) Previously, we fixed a buffer overflow by returning an error when compiling character classes with characters > 255. But that broke the internet. Plan B here is to work around such classes, skipping single characters > 255, skipping character ranges beginning > 255, and truncating character ranges at 255. I removed the early returns we added and the early returns in the original library. Now, funky expressions compile normally, tweaked by our special rules. I also merged the UTF8 and UTF16 checks for out of range characters. I remember we kept them separate before because we were purist about marking off our code changes inside UTF16 #ifdefs. Since this patch applies equally to UTF8 and UTF16, we've already lost that innocence, so why not have a little fun? * ChangeLog: * pcre/pcre.c: (compile_branch): * tests/mozilla/jsDriver.pl: Oh, by the way, I modified this to look inside of $SYMROOTS/Development. Not perfect, but certainly better than $SYMROOTS/, which is always wrong with XCode 2.1. === JavaScriptCore-417.4 === 2005-10-26 Timothy Hatcher - Fixed Mail and Safari will launch faster if JavaScriptCore has no weak exports (typeinfo for subclasses in WebCore) Reviewed by Darin. * as: Wrapper for the system assembler that supresses all type-info .weak_definition lines * gcc-path: small wrapper that sets the PATH before calling gcc, this makes gcc use our as * JavaScriptCore.xcodeproj/project.pbxproj: set CC and CPLUSPLUS to point to gcc-path only in Default configuration === JavaScriptCore-417.3 === 2005-10-17 Timothy Hatcher * JavaScriptCore.exp: Rolled out some NPN symbols from my last commit that Tim O. and I determined are not public. 2005-10-17 Timothy Hatcher - Fixed: JavaScriptCore export file needs to include symbols used by Java/liveconnect and other bindings clients Reviewed by Darin and Geoff. * JavaScriptCore.exp: adding a few sysmbols for jni bindings also add the WebUndefined ObjC class symbol, and some missing NPN symbols === JavaScriptCore-417.2 === 2005-10-05 Timothy Hatcher - Fixed JavaScriptCore needs to limit its exports Reviewed by Geoff. * JavaScriptCore.xcodeproj: Use the new export file in all configs except Development * JavaScriptCore.exp: New export file 2005-10-03 Geoffrey Garen - Fixed Denver Regression: setUTC() functions don't take into account Daylight Savings Time Reviewed by kevin. Fix was to roll in this change from TOT: 2005-08-11 Maciej Stachowiak Reviewed by Geoff. * kjs/date_object.cpp: (timetUsingCF): Fix one of the date tests my making the CF version of mktime have the same quirk about the DST field as the real mktime. * tests/mozilla/expected.html: Updated for newly fixed test. 2005-09-30 Timothy Hatcher JS exceptions don't carry file/line information (3327) Fixed by Geoffrey Garen. Reviewed by Andrew Wooster. Sends file and line numbers with JS exceptions. * kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): * kjs/nodes.h: === JavaScriptCore-417.1 === 2005-09-30 Timothy Hatcher Merges fixes from TOT to Safari-2-0-branch 2005-09-29 Geoffrey Garen - Second cut at fixing Denver Regression: Seed: Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com Reviewed by mjs. * kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified, just rely on the fallback logic, which will do it for you. Also, return invalidDate if the date includes trailing garbage. (Somewhat accidentally, the timezone logic used to catch trailing garbage.) === JavaScriptCore-417 === 2005-09-28 Timothy Hatcher Merges fixes from TOT to Safari-2-0-branch 2005-09-28 Geoffrey Garen - Fixed Denver Regression: Seed: Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com Reviewed by darin. * kjs/date_object.cpp: (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning invalidDate, substitute the local timezone. This matches the behavior of FF/IE. 2005-09-27 Timothy Hatcher Merges fixes from TOT to Safari-2-0-branch 2005-09-26 Geoffrey Garen - Fixed Denver Regression: Date.setUTCFullYear() broken Reviewed by John. * kjs/date_object.cpp: (KJS::makeTime): Changed to use localtime_r to avoid blowing away the results from a previous call to localtime farther up the stack. 2005-09-22 Timothy Hatcher - Fixed Denver 8F29 Regression: KJS::InterpreterImp::mark() crash Fix by mjs, review by Geoff. * kjs/internal.cpp: (KJS::InterpreterImp::mark): Added a null check on globExec in case a garbage collection occurs inside InterpreterImp::globalInit (called from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized. 2005-09-22 Timothy Hatcher Merges fixes from TOT to Safari-2-0-branch 2005-09-20 Geoffrey Garen - More changes needed to fix 8F29 REGRESSION(Denver/Chardonnay): kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer) Added InterpreterLocks in some places in the bindings we missed before. Reviewed by john. * bindings/runtime_root.cpp: (KJS::Bindings::addNativeReference): (KJS::Bindings::removeNativeReference): (RootObject::removeAllNativeReferences): * bindings/runtime_root.h: (KJS::Bindings::RootObject::~RootObject): (KJS::Bindings::RootObject::setRootObjectImp): 2005-09-14 Maciej Stachowiak Reviewed by Geoff. - fixed REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer) Make sure to lock using the InterpreterLock class in all places that need it (including anything that uses the collector, the parser, the protect count hash table, and anything that allocates via fast_malloc). Also added assertions to ensure that the locking rules are followed for the relevant resources. * Makefile.am: * bindings/NP_jsobject.cpp: (identifierFromNPIdentifier): (_NPN_Invoke): (_NPN_Evaluate): (_NPN_GetProperty): (_NPN_SetProperty): (_NPN_RemoveProperty): (_NPN_HasProperty): (_NPN_HasMethod): (_NPN_SetException): * bindings/jni/jni_jsobject.cpp: (JSObject::call): (JSObject::eval): (JSObject::getMember): (JSObject::setMember): (JSObject::removeMember): (JSObject::getSlot): (JSObject::setSlot): (JSObject::toString): (JSObject::convertJObjectToValue): * bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject setValue:forKey:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject removeWebScriptKey:]): (-[WebScriptObject stringRepresentation]): (-[WebScriptObject webScriptValueAtIndex:]): (-[WebScriptObject setWebScriptValueAtIndex:value:]): (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): * bindings/runtime.cpp: (Instance::createRuntimeObject): * bindings/runtime_root.h: * bindings/testbindings.cpp: (main): * bindings/testbindings.mm: (main): * kjs/fast_malloc.cpp: (KJS::kjs_fast_malloc): (KJS::kjs_fast_calloc): (KJS::kjs_fast_free): (KJS::kjs_fast_realloc): * kjs/fast_malloc.h: * kjs/identifier.h: * kjs/internal.cpp: (InterpreterImp::InterpreterImp): (InterpreterImp::clear): (InterpreterImp::mark): (InterpreterImp::checkSyntax): (InterpreterImp::evaluate): * kjs/internal.h: (KJS::InterpreterImp::globalObject): * kjs/interpreter.cpp: (Interpreter::evaluate): * kjs/interpreter.h: (KJS::InterpreterLock::InterpreterLock): (KJS::InterpreterLock::~InterpreterLock): * kjs/nodes.h: * kjs/protect.h: (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_object.h: * kjs/protected_values.cpp: (KJS::ProtectedValues::getProtectCount): (KJS::ProtectedValues::increaseProtectCount): (KJS::ProtectedValues::decreaseProtectCount): * kjs/string_object.cpp: (StringObjectImp::StringObjectImp): * kjs/testkjs.cpp: (main): === Safari-416.6 === 2005-09-02 Adele Peterson Merged fix from TOT to Safari-2-0-branch 2005-09-02 Beth Dakin Fix for Regression: Safari crash in KWQStringData::makeUnicode The other half of the fix is in WebCore. Fix written by Maciej and Darin. Reviewed by me/Maciej As Maciej said in Radar: These problems was caused by a conflict between some of our custom allocators, causing them to return null. Symptom is typically a null pointer dereference in a place where it might be expected an allocation has just occurred. * kjs/fast_malloc.cpp: Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM, and MALLOC_FAILURE_ACTION. === Safari-416.5 === 2005-08-28 Adele Peterson * JavaScriptCore.xcodeproj/project.pbxproj: Adding shared_ptr.h as private header. It didn't make it in the last merge. 2005-08-28 Maciej Stachowiak Merges fixes from HEAD to Safari-2-0-branch 2005-08-26 Maciej Stachowiak Reviewed by John. many many leaks in kjsyyparse with malformed Javascript Record all nodes that are created during parsing, and delete any that are left floating with a refcount of 0. * kjs/internal.cpp: (KJS::Parser::saveNewNode): (KJS::clearNewNodes): (KJS::Parser::parse): * kjs/internal.h: * kjs/nodes.cpp: (Node::Node): * kjs/nodes.h: (KJS::Node::refcount): 2005-08-26 Maciej Stachowiak Reviewed by John. - fixed many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests) Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and deref for all its children (and being responsible for deleting them), nodes use a smart pointer to hold their children, and smart pointers are used outside the node tree as well. This change mostly removes code. * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/function.cpp: (KJS::DeclaredFunctionImp::DeclaredFunctionImp): (KJS::GlobalFuncImp::callAsFunction): * kjs/function.h: * kjs/function_object.cpp: (FunctionObjectImp::construct): * kjs/grammar.y: * kjs/internal.cpp: (KJS::Parser::parse): (KJS::Parser::accept): (KJS::InterpreterImp::checkSyntax): (KJS::InterpreterImp::evaluate): * kjs/internal.h: * kjs/nodes.cpp: (Node::Node): (Node::~Node): (ElementNode::evaluate): (PropertyValueNode::evaluate): (ArgumentListNode::evaluateList): (NewExprNode::evaluate): (FunctionCallValueNode::evaluate): (FunctionCallBracketNode::evaluate): (FunctionCallDotNode::evaluate): (RelationalNode::evaluate): (StatListNode::execute): (StatListNode::processVarDecls): (VarDeclListNode::evaluate): (VarDeclListNode::processVarDecls): (ForInNode::ForInNode): (ClauseListNode::processVarDecls): (CaseBlockNode::evalBlock): (FuncDeclNode::processFuncDecl): (FuncExprNode::evaluate): (SourceElementsNode::execute): (SourceElementsNode::processFuncDecl): (SourceElementsNode::processVarDecls): * kjs/nodes.h: (KJS::Node::ref): (KJS::Node::deref): (KJS::NumberNode::NumberNode): (KJS::GroupNode::GroupNode): (KJS::ElementNode::ElementNode): (KJS::ArrayNode::ArrayNode): (KJS::PropertyValueNode::PropertyValueNode): (KJS::ObjectLiteralNode::ObjectLiteralNode): (KJS::BracketAccessorNode::BracketAccessorNode): (KJS::DotAccessorNode::DotAccessorNode): (KJS::ArgumentListNode::ArgumentListNode): (KJS::ArgumentsNode::ArgumentsNode): (KJS::NewExprNode::NewExprNode): (KJS::FunctionCallValueNode::FunctionCallValueNode): (KJS::FunctionCallResolveNode::FunctionCallResolveNode): (KJS::FunctionCallBracketNode::FunctionCallBracketNode): (KJS::FunctionCallDotNode::FunctionCallDotNode): (KJS::PostfixNode::PostfixNode): (KJS::DeleteNode::DeleteNode): (KJS::VoidNode::VoidNode): (KJS::TypeOfNode::TypeOfNode): (KJS::PrefixNode::PrefixNode): (KJS::UnaryPlusNode::UnaryPlusNode): (KJS::NegateNode::NegateNode): (KJS::BitwiseNotNode::BitwiseNotNode): (KJS::LogicalNotNode::LogicalNotNode): (KJS::MultNode::MultNode): (KJS::AddNode::AddNode): (KJS::ShiftNode::ShiftNode): (KJS::RelationalNode::RelationalNode): (KJS::EqualNode::EqualNode): (KJS::BitOperNode::BitOperNode): (KJS::BinaryLogicalNode::BinaryLogicalNode): (KJS::ConditionalNode::ConditionalNode): (KJS::AssignResolveNode::AssignResolveNode): (KJS::AssignBracketNode::AssignBracketNode): (KJS::AssignDotNode::AssignDotNode): (KJS::CommaNode::CommaNode): (KJS::AssignExprNode::AssignExprNode): (KJS::VarDeclListNode::VarDeclListNode): (KJS::VarStatementNode::VarStatementNode): (KJS::ExprStatementNode::ExprStatementNode): (KJS::IfNode::IfNode): (KJS::DoWhileNode::DoWhileNode): (KJS::WhileNode::WhileNode): (KJS::ForNode::ForNode): (KJS::ReturnNode::ReturnNode): (KJS::WithNode::WithNode): (KJS::CaseClauseNode::CaseClauseNode): (KJS::ClauseListNode::ClauseListNode): (KJS::ClauseListNode::clause): (KJS::ClauseListNode::next): (KJS::SwitchNode::SwitchNode): (KJS::LabelNode::LabelNode): (KJS::ThrowNode::ThrowNode): (KJS::CatchNode::CatchNode): (KJS::FinallyNode::FinallyNode): (KJS::TryNode::TryNode): (KJS::ParameterNode::ParameterNode): (KJS::ParameterNode::nextParam): (KJS::FuncDeclNode::FuncDeclNode): (KJS::FuncExprNode::FuncExprNode): * kjs/nodes2string.cpp: (KJS::SourceStream::operator<<): (ElementNode::streamTo): (PropertyValueNode::streamTo): (ArgumentListNode::streamTo): (StatListNode::streamTo): (VarDeclListNode::streamTo): (CaseBlockNode::streamTo): (ParameterNode::streamTo): (SourceElementsNode::streamTo): * kjs/shared_ptr.h: Added. (kxmlcore::SharedPtr::SharedPtr): (kxmlcore::SharedPtr::~SharedPtr): (kxmlcore::SharedPtr::isNull): (kxmlcore::SharedPtr::notNull): (kxmlcore::SharedPtr::reset): (kxmlcore::SharedPtr::get): (kxmlcore::SharedPtr::operator*): (kxmlcore::SharedPtr::operator->): (kxmlcore::SharedPtr::operator!): (kxmlcore::SharedPtr::operator bool): (kxmlcore::SharedPtr::operator==): (kxmlcore::::operator): (kxmlcore::operator!=): (kxmlcore::static_pointer_cast): (kxmlcore::const_pointer_cast): === Safari-416.3 === === Safari-416.2 === 2005-08-18 Adele Peterson Checked "Inline Functions Hidden" box. * JavaScriptCore.xcodeproj/project.pbxproj: === Safari-416.1 === 2005-08-10 Adele Peterson Merged fix from TOT to Safari-2-0-branch 2005-08-10 Geoffrey Garen -fixed REGRESSION: Some applet liveconnect calls throws privilege exception. Reviewed by richard and mjs. -I removed the global static JavaClass cache, since it violated Java security to cache classes between websites and applets. * bindings/jni/jni_class.cpp: -removed global static cache dictionary -instance constructor and destructor now do the work that used to be done by static factory methods -removed obsolete functions (JavaClass::JavaClass): (JavaClass::~JavaClass): * bindings/jni/jni_class.h: -removed obsolete function declarations -made copying private since it's unused and it's also not clear excatly how copying would work with Java security -made default construction private since it's meaningless * bindings/jni/jni_instance.cpp: -removed obsolete functions (JavaInstance::~JavaInstance): (JavaInstance::getClass): * bindings/jni/jni_instance.h: -made copying private since it's unused and it's also not clear excatly how copying would work with Java security -made default construction private since it's meaningless 2005-08-09 Geoffrey Garen -fixed crash in ObjectImp::findPropertyHashEntry at ifilm.com [due to JS infinite recursion] More changes in WebCore. Reviewed by darin. All calls to FunctionImp::call now go through ObjectImp::call to preserve stack depth checking. * bindings/NP_jsobject.cpp: (_NPN_Invoke): * bindings/jni/jni_jsobject.cpp: (JSObject::call): * bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): * kjs/function.cpp: (KJS::DeclaredFunctionImp::construct): * kjs/nodes.cpp: (FunctionCallNode::evaluate): 2005-08-09 Adele Peterson Merged fix from TOT to Safari-2-0-branch 2005-07-14 Geoffrey Garen -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3970 throw statements fail inside eval statements Reviewed by mjs. * kjs/function.cpp: (KJS::GlobalFuncImp::call): Big change since I fixed the tabbing. The important part is: if (c.complType() == Throw) exec->setException(c.value()); * kjs/nodes.cpp: (ThrowNode::execute): removed duplicate KJS_CHECKEXCEPTION (TryNode::execute): try now clears the exception state before the finally block executes, and checks the state after the block executes, so that exceptions in finally code get caught. 2005-08-08 Adele Peterson Merged fix from TOT to Safari-2-0-branch 2005-08-05 Geoffrey Garen Fix by darin, reviewed by me. - rolled in fix for: JavaScript regular expressions with certain ranges of Unicode characters cause a crash Test cases added: * layout-tests/fast/js/regexp-big-unicode-ranges-expected.txt: Added. * layout-tests/fast/js/regexp-big-unicode-ranges.html: Added. * pcre/pcre.c: (compile_branch): added checks for characters > 255 2005-08-08 Adele Peterson Merged fix from TOT to Safari-2-0-branch some US-centric date formats not parsed by JavaScript (clock at news8austin.com) (bugzilla 3477) 2005-07-01 Geoffrey Garen -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477 some US-centric date formats not parsed by JavaScript (clock at news8austin.com) -relevant tests: mozilla/ecma_3/Date/15.9.5.5.js layout-tests/fast/js/date-parse-test.html Reviewed by darin. * kjs/date_object.cpp: (day): (dayFromYear): (daysInYear): (timeFromYear): (yearFromTime): (weekDay): (timeZoneOffset): (DateProtoFuncImp::call): (DateObjectImp::construct): (KJS::parseDate): (ymdhms_to_seconds): (KJS::makeTime): (findMonth): (KJS::KRFCDate_parseDate): * kjs/date_object.h: === Safari-416 === 2005-08-05 Adele Peterson Merged fix from TOT to Safari-2-0-branch 2005-08-05 Geoffrey Garen -fixed REGRESSION (DENVER): Crash occurs after clicking on Hangman applet Reviewed by darin. * kjs/object.cpp: (KJS::ObjectImp::hasProperty): added check for null prototype. FIXME: The long-term plan is to make runtime objects use JS Null() instead of null pointers, which will allow us to eliminate null checks, improving performance. 2005-08-05 Adele Peterson Reviewed by Darin. * JavaScriptCore.xcodeproj/project.pbxproj: Unchecked 'statics are thread safe' option. === JavaScriptCore-412.7 === 2005-08-04 Adele Peterson Merged fix from TOT to Safari-2-0-branch Submitted by: rjw@apple.com Reviewed by: cblu@apple.com Fixed hard capacity limit on the method and field cache use for the ObjC bindings. Dashboard client crashes when too many ObjC methods are called * bindings/objc/objc_class.mm: (ObjcClass::_commonInit): 2005-08-02 Geoffrey Garen - minor tweak to last checkin * kjs/debugger.h: restored a comment I shouldn't have deleted 2005-08-02 Geoffrey Garen Merged from TOT to Safari-2-0-branch. 2005-07-27 Maciej Stachowiak Changes by Michael Kahl, reviewed by me. - fixed Need better debugging support in JavaScriptCore * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/debugger.cpp: (KJS::AttachedInterpreter::AttachedInterpreter): (KJS::AttachedInterpreter::~AttachedInterpreter): (Debugger::~Debugger): (Debugger::attach): (Debugger::detach): (Debugger::sourceParsed): * kjs/debugger.h: * kjs/function.cpp: (KJS::FunctionImp::call): (KJS::GlobalFuncImp::call): * kjs/function_object.cpp: (FunctionObjectImp::construct): * kjs/grammar.y: * kjs/internal.cpp: (Parser::parse): (InterpreterImp::evaluate): * kjs/internal.h: (KJS::InterpreterImp::setDebugger): * kjs/interpreter.cpp: * kjs/interpreter.h: (KJS::Interpreter::imp): * kjs/nodes.cpp: 2005-08-02 Adele Peterson Merged fix from TOT to Safari-2-0-branch 2005-06-20 Maciej Stachowiak Patch from Mark Rowe , reviewed by me. - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3293 Test cases added: * tests/mozilla/expected.html: Updated for two fixed tests. - also added a layout test * bindings/objc/objc_runtime.h: * bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::hasOwnProperty): * bindings/runtime_array.cpp: (RuntimeArrayImp::hasOwnProperty): * bindings/runtime_array.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::hasOwnProperty): * bindings/runtime_object.h: * kjs/array_instance.h: * kjs/array_object.cpp: (ArrayInstanceImp::hasOwnProperty): * kjs/function.cpp: (KJS::FunctionImp::hasOwnProperty): (KJS::ActivationImp::hasOwnProperty): * kjs/function.h: * kjs/object.cpp: (KJS::ObjectImp::hasProperty): (KJS::ObjectImp::hasOwnProperty): * kjs/object.h: (KJS::Object::hasOwnProperty): * kjs/object_object.cpp: (ObjectPrototypeImp::ObjectPrototypeImp): (ObjectProtoFuncImp::call): * kjs/object_object.h: (KJS::ObjectProtoFuncImp::): * kjs/string_object.cpp: (StringInstanceImp::hasOwnProperty): * kjs/string_object.h: 2005-08-02 Adele Peterson Merged from TOT to Safari-2-0-branch. 2005-06-30 Kevin Decker Reviewed by rjw. fixed: failed assertion in`Interpreter::lockCount() > 0 no layout test added; this is in the bindings code. * bindings/objc/WebScriptObject.mm: (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): make sure to lock and unlock the interpreter around allocations. === JavaScriptCore-412.6 === 2005-07-21 Adele Peterson Merge from TOT to Safari-2-0-branch 2005-04-26 Maciej Stachowiak Reviewed by Chris. reproducible crash in KJS::kjs_fast_realloc loading maps.google.com * kjs/string_object.cpp: (StringObjectFuncImp::call): Allocate adopted ustring buffer properly. 2005-04-22 Darin Adler Reviewed by Maciej. * kjs/ustring.cpp: (KJS::UString::UTF8String): Fix off-by-one error in surrogate pair logic. 2005-04-22 Darin Adler Reviewed by John. - fixed JavaScript throw statement causes parse error when no semicolon is present * kjs/grammar.y: Added an additional rule for throw like the ones we have for all the other semicolon rules. Not sure why we missed this one earlier. * kjs/grammar.cpp: Regenerated. 2005-04-20 Darin Adler Reviewed by Maciej. - speedups, total 12% on JavaScript iBench I ran the benchmark under Shark and followed its advice a lot, mainly. * kjs/collector.cpp: (KJS::Collector::allocate): Take out special case for 0; costing speed but unexercised. Use numLiveObjectsAtLastCollect instead of numAllocationsSinceLastCollect so we don't have to bump it each time we call allocate. Put numLiveObjects into a local variable to cut down on global variable accesses. Make "next" cell pointer be a byte offset rather than a pointer so we don't need a special case for NULL. Allow freeList to point to some bogus item when the entire block is full rather than going out of our way to make it point to NULL. (KJS::Collector::markProtectedObjects): Get table size and pointer into locals outside the loop to avoid re-loading them over and over again. (KJS::Collector::collect): Put numLiveObjects into a local variable to cut down on global variable accesses. Make "next" cell pointer be a byte offset as above. Put numLiveObjects into a local variable to cut down on global variable accesses. Set numLiveObjectsAtLastCollect rather than numAllocationsSinceLastCollect. (KJS::Collector::numReferencedObjects): Get table size and pointer into locals outside the loop to avoid re-loading them over and over again. (KJS::Collector::rootObjectClasses): Ditto. * kjs/internal.h: Make Value be a friend of NumberImp so it can construct number objects directly, avoiding the conversion from Number to Value. * kjs/internal.cpp: (StringImp::toObject): Don't use Object::dynamicCast, because we know the thing is an object and we don't want to do all the extra work; just cast directly. * kjs/list.cpp: (KJS::List::List): Construct valueRefCount in a way that avoids the need for a branch -- in the hot case this just meant avoiding checking a variable we just set to false. * kjs/lookup.cpp: (keysMatch): Marked this inline. * kjs/nodes.cpp: Disabled KJS_BREAKPOINT, to avoid calling hitStatement all the time. (BooleanNode::evaluate): Make a Value directly, rather than making a Boolean which is converted into a Value. (NumberNode::evaluate): Ditto. (StringNode::evaluate): Ditto. (ArrayNode::evaluate): Ditto. (FunctionCallNode::evaluate): Use new inline baseIfMutable to avoid unnecessary getBase function. Also just use a pointer for func, rather than an Object. (PostfixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it passes a "known to be integer" boolean in, often avoiding a conversion from floating point to integer and back. (DeleteNode::evaluate): Make a Value directly. (TypeOfNode::evaluate): Use new inline baseIfMutable and make Value directly. (PrefixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it passes a "known to be integer" boolean in, often avoiding a conversion from floating point to integer and back. (UnaryPlusNode::evaluate): Make a Value directly. (NegateNode::evaluate): Change code so that it doesn't make an excess Number, and so that it passes a "known to be integer" boolean in, often avoiding a conversion from floating point to integer and back. (BitwiseNotNode::evaluate): Make a Value directly. (LogicalNotNode::evaluate): Ditto. (ShiftNode::evaluate): Don't convert to a double before making a Value. (RelationalNode::evaluate): Make a Value directly. (EqualNode::evaluate): Ditto. (BitOperNode::evaluate): Ditto. (AssignNode::evaluate): Make a Value directly. Change code so that it passes a "known to be integer" boolean in, often avoiding a conversion from floating point to integer and back. (VarDeclNode::evaluate): Make a Value directly. (ForNode::execute): Remove unused local variable. * kjs/operations.h: (KJS::isNaN): Inlined. (KJS::isInf): Ditto. (KJS::isPosInf): Ditto. (KJS::isNegInf): Ditto. * kjs/operations.cpp: Change isNaN, isInf, isPosInf, and isNegInf to be inlines. (KJS::equal): Rewrite to avoid creating values and recursing back into the function. (KJS::relation): Rearranged code so that we don't need explicit isNaN checks. (KJS::add): Changed code to make Value directly, and so that it passes a "known to be integer" boolean in, often avoiding a conversion from floating point to integer and back. (KJS::mult): Ditto. * kjs/property_map.cpp: (KJS::PropertyMap::~PropertyMap): Get size and entries pointer outside loop to avoid re-getting them inside the loop. (KJS::PropertyMap::clear): Ditto. Clear value pointer in addition to key, so we can just look at the value pointer in the mark function. (KJS::PropertyMap::get): Get sizeMask and entries pointer outside loop to avoid re-getting them inside the loop. (KJS::PropertyMap::put): Ditto. (KJS::PropertyMap::insert): Ditto. (KJS::PropertyMap::remove): Ditto. (KJS::PropertyMap::mark): Get size and entries pointer outside loop to avoid re-getting them inside the loop. Don't bother checking key for 0, since we already have to check value for 0. (Also had to change clear() to set value to 0.) (KJS::PropertyMap::addEnumerablesToReferenceList): Get size and entries pointer outside loop to avoid re-getting them inside the loop. (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Ditto. (KJS::PropertyMap::save): Ditto. - other changes * kjs/protected_values.h: Remove unneeded class name qualifiers. * kjs/reference.h: (KJS::Reference::baseIfMutable): New inline function: replaces isMutable(). (KJS::Reference::Reference): Inlined. * kjs/reference.cpp: (KJS::Reference::getValue): Rewrite to not use getBase. (KJS::Reference::putValue): Ditto. (KJS::Reference::deleteValue): Dittol * kjs/simple_number.h: (KJS::SimpleNumber::integerFits): Added. For use when the parameter is known to be integral. * kjs/string_object.cpp: (StringProtoFuncImp::call): Create the number without first converting to double in various cases that involve integers. * kjs/ustring.h: (KJS::UString::attach): Inlined. (KJS::UString::release): Inlined. * kjs/ustring.cpp: (KJS::UString::find): Get first character outside the loop instead of re-fetching it each time. * kjs/value.cpp: (Value::Value): Added overloads for all the various specific types of values, so you don't have to convert from, say, Number to Value, just to create one. (Number::Number): Added an overload that takes a boolean to indicate the number is already known to be an integer. * kjs/value.h: Added more Value constructors, added a version of toNumber that returns a boolean to indicate if the number is known to be an integer (because it was a "simple number"). (KJS::ValueImp::marked): Inlined. (KJS::ValueImp::dispatchType): Inlined. (KJS::ValueImp::dispatchToPrimitive): Inlined. (KJS::ValueImp::dispatchToBoolean): Inlined. (KJS::ValueImp::dispatchToNumber): Inlined. (KJS::ValueImp::dispatchToString): Inlined. (KJS::ValueImp::dispatchToUInt32): Inlined. 2005-04-14 Maciej Stachowiak - make fast_malloc.h a private header, not project * JavaScriptCore.pbproj/project.pbxproj: 2005-04-12 Maciej Stachowiak Reviewed by Richard. JavaScript iBench can be sped up ~10% with custom allocator - use custom single-threaded malloc for all non-GC JavaScriptCore allocations, for a 9.1% speedup on JavaScript iBench * JavaScriptCore.pbproj/project.pbxproj: * kjs/collector.cpp: (KJS::Collector::allocate): Use dlmalloc to allocate the collector blocks. (KJS::Collector::collect): And dlfree to free it. * kjs/fast_malloc.cpp: Added, just the standard dlmalloc here. * kjs/fast_malloc.h: Added. Declarations for the functions. Also added a handy macro to give a class custom operator new/delete * kjs/identifier.cpp: (KJS::Identifier::add): Use dlmalloc/dlfree. * kjs/nodes.h: make nodes KJS_FAST_ALLOCATED. * kjs/property_map.cpp: (KJS::PropertyMap::~PropertyMap): Use dlmalloc/dlfree. (KJS::PropertyMap::rehash): ditto * kjs/scope_chain.h: * kjs/ustring.cpp: (KJS::UString::Rep::createCopying): New named constructor that copies a passed-in buffer, to hide allocation details from webcore. (KJS::UString::UString): use createCopying when appropriate. (KJS::UString::Rep::destroy): Use dlmalloc/dlfree. (KJS::UString::expandedSize): likewise (KJS::UString::expandCapacity): likewise (KJS::UString::expandPreCapacity): likewise (KJS::UString::spliceSubstringsWithSeparators): likewise (KJS::UString::append): likewise (KJS::UString::operator=): likewise (KJS::UString::detach): likewise * kjs/ustring.h: make UString and UString::Rep KJS_FAST_ALLOCATED. 2005-04-11 Maciej Stachowiak Reviewed by John. Avoid using protect count hash table so much for 5.6% JS iBench speedup - Avoid using protected values hash for the two most common cases - Bump up ListImp high water mark, new testing shows 508 ListImps are created during JS iBench. Net result is a 5.6% speedup on JavaScript iBench * kjs/collector.cpp: (KJS::Collector::collect): mark protected lists as appropriate. * kjs/context.h: * kjs/list.cpp: (KJS::ListImp::markValues): Moved implementation from List::markValues (KJS::List::markProtectedLists): Implemented - scan pool and overflow list. (KJS::allocateListImp): link lists outside the pool into a separate doubly linked list to be able to mark protected lists (KJS::deallocateListImp): do the corresponding delinking (KJS::List::derefValues): do nothing in conservative GC mode (KJS::List::refValues): do nothing in conservative GC mode (KJS::List::markValues): call ListImp version (KJS::List::append): * kjs/list.h: 2005-07-21 Adele Peterson Merge from TOT to Safari-2-0-branch to build with gcc 4.0 2005-05-16 Darin Adler Reviewed by Adele. - fixed issues preventing us from compiling with newer versions of gcc 4.0 * kjs/ustring.cpp: (KJS::operator==): Remove redundant and illegal KJS:: prefix on this function's definition. (KJS::operator<): Ditto. (KJS::compare): Ditto. 2005-05-04 Darin Adler Reviewed by Dave Hyatt. - another gcc-4.0-related fix * bindings/runtime_root.h: Take off extra namespace prefixes that apparently cause problems compiling with gcc 4.0, although I have not observed the problems. 2005-04-28 Darin Adler Reviewed by Dave Harrison. - fixed problems preventing us from compiling with gcc 4.0 * JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from WARNING_CPLUSPLUSFLAGS since it's now a C-only warning. * bindings/jni/jni_jsobject.cpp: (JSObject::getSlot): Changed some %d to %ld where the parameters where long ints. (JSObject::setSlot): Ditto. * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Ditto. (KJS::Bindings::getJNIEnv): Ditto. * bindings/objc/objc_utility.mm: Fixed include of that needed the letter "S" capitalized. * kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to avoid incorrect gcc 4.0 warning. * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment. Prevents a crash on garbage collect when compiled with gcc 4.0. * kjs/nodes.cpp: (WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning. (ForNode::execute): Ditto. (SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning. (LabelNode::execute): Ditto. * kjs/string_object.cpp: (replace): Ditto. === JavaScriptCore-412.5 === 2005-07-12 Adele Peterson Merging fix from TOT to Safari-2-0-branch String.replace() method not working when regex pattern contains {n, m} 2005-06-21 Adele Peterson Patch from Anders Carlsson , reviewed by Darin. Fixed: String.replace() method not working when regex pattern contains {n, m} * pcre/pcre.c: (pcre_compile): Remember the last char length so it can be subtracted correctly if needed. === JavaScriptCore-412.3 === 2005-05-26 Chris Petersen Merged fix for from TOT to SUTiCambridge. 2005-05-04 Maciej Stachowiak Reviewed by Darin. Crash in JavaScriptCore with RSS Visualizer * kjs/internal.cpp: (InterpreterImp::mark): mark staticNaN, it is usually protected by the Number prototype but there is a small window where it can get collected. === JavaScriptCore-412.2 === 2005-05-24 Chris Petersen Merged addition fix for from TOT to SUTiCambridge 2005-05-18 Darin Adler Reviewed by Maciej. - fix a failure seen in the Mozilla JavaScript tests where a live object was garbage-collected when the only reference to it was in an argList on the stack * kjs/list.h: Moved the operator= function into the .cpp file since it's too big to be a good choice to inline. * kjs/list.cpp: (KJS::List::operator=): Moved this formerly-inline function into a separate file and added missing code to update valueRefCount. It's the latter that fixes the bug. 2005-05-23 Chris Petersen Merging fix for from TOT to SUTiCambridge 2005-04-26 Richard Williamson Fixed Scripting API is incompatible with Mozilla We were incompatible with Mozilla's implementation of the scripting APIs in two ways: Their NPN_SetException has the following signature: void NPN_SetException(NPObject *npobj, const NPUTF8 *message); ours has: void NPN_SetException (NPObject * npobj, const NPString *message); Also, they expect the string returned from NPN_UTF8FromIdentifier() to be freed by caller. We do not. I changed both behaviors to match Mozilla. Reviewed by Chris. * bindings/NP_jsobject.cpp: (_NPN_SetException): * bindings/npruntime.cpp: (_NPN_UTF8FromIdentifier): (_NPN_IntFromIdentifier): (_NPN_SetExceptionWithUTF8): * bindings/npruntime.h: * bindings/npruntime_impl.h: === Safari-412 === === Safari-411 === === Safari-410 === === Safari-409 === === Safari-408 === === Safari-407 === 2005-03-16 Jens Alfke Reviewed by Kevin. Fix for "REGRESSION (163-164): search not performed correctly; united.com" JavaScript unescape("") was returning a messed-up String object that appeared identical to an empty string, but would in some cases act as 'null' when passed to native functions, in this case the Option() constructor. In the implementation of unescape, the UString holding the result was not initialized to "", so it started out as a null string. If nothing was appended to it, it remained null, resulting in a JavaScript String object with some bad behaviors (namely, converting it to a DOMStringImpl results in a NULL pointer.) Darin says this regression occurred when we replaced our own implementation of unescape() with code from KJS. * kjs/function.cpp: (KJS::GlobalFuncImp::call): 2005-03-15 Richard Williamson Fixed WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C Added JavaScript boolean to type that can be converted to ObjC scalar parameters. Reviewed by Ken Kocienda. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): === Safari-406 === === Safari-405 === === Safari-403 === === Safari-402 === === Safari-401 === === Safari-400 === === Safari-188 === 2005-02-21 Darin Adler * kjs/date_object.cpp: (timetUsingCF): Fixed indenting. 2005-02-17 Richard Williamson Fixed Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string Added nil check. Reviewed by John Sullivan. * bindings/jni/jni_runtime.cpp: (JavaField::valueFromInstance): === Safari-187 === 2005-02-11 Richard Williamson Fixed DOM objects not being marshaled on JS->native calls Re-factored how 'native' wrappers for JS objects are created. The interpreter now creates these wrappers. The WebCore subclass of the interpreter now overrides createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects. Reviewed by Ken. * bindings/c/c_utility.cpp: (convertValueToNPVariant): * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_objc.mm: (KJS::Bindings::dispatchJNICall): * bindings/jni/jni_runtime.cpp: (JavaField::valueFromInstance): (JavaArray::valueAt): * bindings/objc/WebScriptObject.mm: (-[WebScriptObject _setExecutionContext:KJS::Bindings::]): (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): * bindings/objc/WebScriptObjectPrivate.h: * bindings/objc/objc_utility.h: * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue): (KJS::Bindings::createObjcInstanceForValue): * bindings/runtime.cpp: (Instance::createBindingForLanguageInstance): (Instance::createRuntimeObject): (Instance::createLanguageInstanceForValue): * bindings/runtime.h: * kjs/interpreter.cpp: (Interpreter::createLanguageInstanceForValue): * kjs/interpreter.h: === Safari-186 === 2005-02-10 Darin Adler "Reviewed" by Richard (he told me the file was obsolete). - got rid of an obsolete file * bindings/npsap.h: Removed. === Safari-185 === === Safari-183 === 2005-02-03 Richard Williamson Fixed CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120 Revert to old (and correct) behavior of returning runtime object when passed as a parameter, rather than it's corresponding DOM object. Reviewed by Chris. * bindings/objc/WebScriptObject.mm: (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): === Safari-182 === 2005-01-28 Richard Williamson Fixed JavaScript bindings access incorrect runtime object Only use special 'back door' property to get the runtime object if thisObj isn't already a runtime object. Cleaned up a couple of strcmp on ClassInfo name. Used == on ClassInfo pointer instead. Reviewed by Chris. * bindings/c/c_utility.cpp: (convertValueToNPVariant): * bindings/objc/WebScriptObject.mm: (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): * bindings/runtime_method.cpp: (RuntimeMethodImp::call): === Safari-181 === 2005-01-26 Richard Williamson Fixed (179-180) 40% slowdown on iBench JavaScript test I added a member variable to ObjectImp. This changed it's size and consequently hampered the optimizations built into the garbage collector. Objects no longer fit within the allocators cell size, and thus allocation fell back to a slower allocator. As a result of this fix I also dramatically cleaned up how runtime objects are accessed. The path mostly *removes* code. Reviewed by Chris. * bindings/runtime_method.cpp: (RuntimeMethodImp::call): * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::put): (RuntimeObjectImp::canPut): (RuntimeObjectImp::hasProperty): (RuntimeObjectImp::defaultValue): * bindings/runtime_object.h: * kjs/object.cpp: (KJS::ObjectImp::ObjectImp): * kjs/object.h: 2005-01-20 Darin Adler Reviewed by me, changes by Han Ming Ong. - SWB: A few files need to be updated to be compilable under GCC 4.0 * bindings/objc/WebScriptObjectPrivate.h: Make members public. * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template. 2005-01-20 Richard Williamson Fixed undefined property value from binding seems to evaluate to true in an if statement The comprehensive fix for this problem requires new API, as described in 3965326. However, given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave like and Undefined object if invokeUndefinedMethodFromWebScript:withArguments: isn't implemented on the bound object. Reviewed by Chris. * bindings/objc/objc_runtime.h: * bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::type): (ObjcFallbackObjectImp::implementsCall): (ObjcFallbackObjectImp::toBoolean): * bindings/testbindings.mm: (+[MyFirstInterface isSelectorExcludedFromWebScript:]): (+[MyFirstInterface isKeyExcludedFromWebScript:]): === Safari-180 === 2005-01-19 Richard Williamson Fixed Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue Fixed the following problems with LiveConnect that are demonstrated by the application described in 3853676. 1. If a nil object is passed in an array from Java to JavaScript we will crash. 2. We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper. 3. We will sometimes fail to find the correct static method ID. Reviewed by Maciej. * bindings/jni/jni_jsobject.cpp: (JSObject::convertJObjectToValue): (JSObject::listFromJArray): * bindings/jni/jni_runtime.cpp: (JavaField::valueFromInstance): (JavaField::setValueToInstance): * bindings/jni/jni_utility.cpp: (KJS::Bindings::getMethodID): (KJS::Bindings::convertValueToJValue): * bindings/runtime_array.h: 2005-01-18 Richard Williamson Fixed several issues all arising from analysis of plugin detection code at ifilm.com: Fixed can't script plug-ins if plug-in is invoked with element instead of Fixed elements with IDs do not show up as named properties of the document Fixed DOM objects for plugin elements are not accessible Fixed need an additional class ID in WebCore for the Real plug-in We now support accessing scriptable plugin objects that are specified with , , or tags. Also, if any of these elements are named they can be accessed from the document or window objects. Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object. Reviewed by Chris. * bindings/objc/objc_instance.h: * bindings/objc/objc_instance.mm: (ObjcInstance::supportsSetValueOfUndefinedField): * bindings/runtime.h: (KJS::Bindings::Instance::supportsSetValueOfUndefinedField): * bindings/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::get): (RuntimeObjectImp::put): (RuntimeObjectImp::canPut): (RuntimeObjectImp::hasProperty): (RuntimeObjectImp::defaultValue): * bindings/runtime_object.h: (KJS::RuntimeObjectImp::fallbackObject): * kjs/object.cpp: (KJS::ObjectImp::ObjectImp): * kjs/object.h: (KJS::ObjectImp::forwardingScriptMessage): (KJS::ObjectImp::setForwardingScriptMessage): 2005-01-18 Richard Williamson Back out a change that was incorrectly committed yesterday. Reviewed by Chris. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): 2005-01-17 Richard Williamson Fixed Need to ensure same origin for plugin binding invocations (origin security rules) Keep track of originating execution context and target execution context for native JS object wrappers, and perform appropriate security checks. Reviewed by David Harrison. * bindings/NP_jsobject.cpp: (_isSafeScript): (_NPN_CreateScriptObject): (_NPN_Invoke): (_NPN_Evaluate): (_NPN_GetProperty): (_NPN_SetProperty): (_NPN_RemoveProperty): (_NPN_HasProperty): (_NPN_HasMethod): (_NPN_SetException): * bindings/NP_jsobject.h: * bindings/c/c_instance.cpp: (CInstance::CInstance): (CInstance::stringValue): * bindings/c/c_instance.h: * bindings/c/c_utility.cpp: (convertValueToNPVariant): * bindings/jni/jni_instance.cpp: (JavaInstance::JavaInstance): (JavaInstance::valueOf): * bindings/jni/jni_instance.h: * bindings/objc/WebScriptObject.mm: (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): (-[WebScriptObject KJS::Bindings::]): (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]): (-[WebScriptObject _isSafeScript]): (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject setValue:forKey:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject removeWebScriptKey:]): (-[WebScriptObject stringRepresentation]): (-[WebScriptObject webScriptValueAtIndex:]): (-[WebScriptObject setWebScriptValueAtIndex:value:]): (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): * bindings/objc/WebScriptObjectPrivate.h: * bindings/objc/objc_instance.h: * bindings/objc/objc_runtime.mm: (convertValueToObjcObject): * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): * bindings/runtime.cpp: (Instance::Instance): (Instance::operator=): * bindings/runtime.h: (KJS::Bindings::Instance::Instance): (KJS::Bindings::Instance::setExecutionContext): (KJS::Bindings::Instance::executionContext): * bindings/runtime_root.cpp: (RootObject::setInterpreter): * bindings/runtime_root.h: * kjs/interpreter.h: (KJS::Interpreter::isGlobalObject): (KJS::Interpreter::interpreterForGlobalObject): (KJS::Interpreter::isSafeScript): === Safari-179 === 2005-01-13 Vicki Murley Reviewed by Adele. - fix Safari about box lists 2004 instead of 2005 * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005" 2005-01-12 Richard Williamson Avoid additional work on dealloc by adding early out to removeNativeReference(). (This will save time on dealloc for all ObjC DOM objects.) Reviewed by Darin. * bindings/runtime_root.cpp: (KJS::Bindings::removeNativeReference): 2005-01-12 Richard Williamson Fixed REGRESSION: Java/JavaScript security checks working incorrectly We were always returning the first "root" object for all runtime objects. Changed 0 in loop to i, the index. Reviewed by David Harrison. * bindings/runtime_root.cpp: (KJS::Bindings::rootForImp): 2005-01-11 Richard Williamson Fixed Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes) Use the new dispatching API to invoke JNI, rather than calling JNI directly. Reviewed by David Harrison. * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_runtime.cpp: (JavaField::dispatchValueFromInstance): (JavaField::valueFromInstance): (JavaField::dispatchSetValueToInstance): (JavaField::setValueToInstance): * bindings/jni/jni_runtime.h: * bindings/jni/jni_utility.cpp: (KJS::Bindings::convertValueToJValue): === Safari-178 === === Safari-177 === === Safari-176 === 2004-12-17 Maciej Stachowiak Reviewed by Kevin. Opening caches window after running PLT causes crash * kjs/protected_values.cpp: (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in the protected value table. (KJS::ProtectedValues::increaseProtectCount): Ditto. (KJS::ProtectedValues::decreaseProtectCount): Ditto. 2004-12-16 Darin Adler Reviewed by Maciej. - fixed Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase. * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the non-locale-specific versions. * kjs/string_object.lut.h: Regenerated. 2004-12-14 Richard Williamson Pass URL of plugin view when call into JNI. Reviewed by Chris. * bindings/jni/jni_objc.mm: (KJS::Bindings::dispatchJNICall): 2004-12-13 Richard Williamson Fixed repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related) Add support for calling static Java methods from JavaScript. Reviewed by Maciej. * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_runtime.cpp: (JavaMethod::JavaMethod): * bindings/jni/jni_runtime.h: (KJS::Bindings::JavaMethod::isStatic): * bindings/jni/jni_utility.cpp: (callJNIStaticMethod): (KJS::Bindings::callJNIBooleanMethod): (KJS::Bindings::callJNIStaticBooleanMethod): * bindings/jni/jni_utility.h: 2004-12-13 Richard Williamson Fixed LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running) Reviewed by John. * bindings/jni/jni_instance.cpp: (JavaInstance::invokeMethod): * bindings/jni/jni_objc.mm: (KJS::Bindings::dispatchJNICall): * bindings/jni/jni_runtime.h: * bindings/jni/jni_utility.h: === Safari-175 === 2004-12-07 Maciej Stachowiak Reviewed by Darin. REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com) The fix was to implement copy constructor and assignment operator, the ones that worked on the base class did not replace the defaults apparently! * kjs/protect.h: (KJS::ProtectedValue::ProtectedValue): (KJS::ProtectedValue::operator=): (KJS::ProtectedObject::ProtectedObject): (KJS::ProtectedObject::operator=): Also fixed a bug in the GC test mode that compares the results of the old collector and the new collector. * kjs/value.cpp: (ValueImp::mark): === Safari-173 === 2004-11-23 Richard Williamson Fixed field and method cache incorrectly capped (c bindings) Reviewed by Ken. * bindings/c/c_class.cpp: (CClass::_commonInit): 2004-11-21 Maciej Stachowiak Reviewed by Ken. Enable conservative garbage collection for JavaScript * kjs/collector.cpp: (KJS::Collector::Thread::Thread): (KJS::destroyRegisteredThread): (KJS::initializeRegisteredThreadKey): (KJS::Collector::registerThread): (KJS::Collector::markStackObjectsConservatively): (KJS::Collector::markCurrentThreadConservatively): (KJS::Collector::markOtherThreadConservatively): * kjs/collector.h: * kjs/internal.cpp: (lockInterpreter): * kjs/value.h: === Safari-172 === 2004-11-15 Richard Williamson Fixed Default string value of ObjC object in JS should be [obj description]. Reviewed by Hyatt. * bindings/objc/objc_instance.mm: (ObjcInstance::stringValue): * bindings/objc/objc_utility.h: * bindings/objc/objc_utility.mm: (KJS::Bindings::convertNSStringToString): (KJS::Bindings::convertObjcValueToValue): === Safari-171 === 2004-11-09 Chris Blumenberg Fixed: soft link against JavaVM to save ~2MB RSHRD Reviewed by rjw. * ChangeLog: * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM * bindings/softlinking.c: Added. (loadFramework): new (getFunctionPointer): new (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs === Safari-170 === 2004-11-04 Darin Adler Reviewed by Ken. - fixed since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather than allocating a new one * bindings/objc/WebScriptObject.mm: Removed some stray semicolons. (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance of WebUndefined, since it's the single method that normally allocates new instances. Calls super to actually allocate only the very first time it's called. (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single shared instance since there can be only one). (-[WebUndefined copyWithZone:]): Ditto. (-[WebUndefined retain]): Ditto. (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count of class). (-[WebUndefined autorelease]): Simplified to just return self (see above). (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:. (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the bug mentioned above). (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance. No need to call init, since that's a no-op for this class. 2004-11-03 David Harrison Reviewed by Darin. Eliminate the use of a marker file to determine how to build. * .cvsignore: * Makefile.am: 2004-11-01 Richard Williamson Fixed Latest Real player crashes Safari on some sites. Reviewed by Ken. * bindings/c/c_instance.cpp: (CInstance::invokeMethod): (CInstance::invokeDefaultMethod): Initialize out parameters to void type. * bindings/c/c_runtime.cpp: (CField::valueFromInstance): (CField::setValueToInstance): Initialize out parameters to void type. Also added additional checks to protect against classes that don't implement all functions. 2004-11-01 Richard Williamson Fixed WebUndefined should be returned for undefined values Reviewed by John. * ChangeLog: * bindings/objc/WebScriptObject.mm: (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]): Added additional conversion Undefined -> WebUndefined. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue): Added additional conversion WebUndefined -> Undefined. 2004-11-01 Darin Adler - fixed Remove reference to "WebScriptMethods" from WebScriptObject.h comments * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug report to match the contents of the file. === Safari-169 === === Safari-168 === 2004-10-22 Ken Kocienda Reviewed by me * JavaScriptCore.pbproj/project.pbxproj: Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags. === Safari-167 === 2004-10-13 Richard Williamson Moved boolean checks prior to NSNumber checks. booleans are NSNumbers. Follow on to binding layer needs to convert NSNumber-bools to js type boolean not number. Reviewed by John. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue): 2004-10-12 Richard Williamson Fixed access to DOM object via WebScriptObject API. The execution context for DOM objects wasn't being found. The valueForKey method for @"offsetLeft" on a paragraph element causes a crash. Reviewed by Chris. * bindings/objc/WebScriptObject.mm: (_didExecute): (-[WebScriptObject KJS::Bindings::]): (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject setValue:forKey:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject stringRepresentation]): * bindings/objc/WebScriptObjectPrivate.h: 2004-10-09 Darin Adler Reviewed by Kevin. - fixed REGRESSION: JavaScriptCore framework now has two init routines * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was creating an init routine. * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not require a global constructor that creates an init routine. 2004-10-09 Darin Adler Reviewed by Kevin. - fixed REGRESSION (164-165): expedia.com's popup help doesn't work * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object work with the window object of the page the function is in, not the page of the caller. This is what all other browsers do. This code was hidden before by the "everything is defined on window object" hack in WebCore. 2004-10-07 Richard Williamson Added simple JavaScript call tracing. Very useful for debugging complex pages. Tracing is only available in development builds and is enabled by: (gdb) set traceJavaScript = 1 or programatically setTraceJavaScript(true) Function, args, and return values are printed to console. Very verbose. Reviewed by Ken. * kjs/function_object.cpp: (FunctionProtoFuncImp::call): * kjs/object.cpp: (KJS::Object::call): === Safari-166 === 2004-10-05 Richard Williamson Fixed NPN_SetException (and throwException:) isn't implemented Reviewed by Chris. * bindings/NP_jsobject.cpp: (_NPN_SetException): * bindings/npruntime.cpp: (_NPN_SetExceptionWithUTF8): * bindings/objc/WebScriptObject.mm: (+[WebScriptObject throwException:]): * kjs/internal.h: (KJS::InterpreterImp::context): 2004-10-05 Richard Williamson Fixed binding layer needs to convert NSNumber-bools to js type boolean not number Reviewed by Ken. * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue): 2004-10-04 Darin Adler Reviewed by Ken. - rolled in a fix the KDE folks did for the operations that generate HTML fragments * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML. - rolled out an old workaround we don't need any more * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the issue that required it is no longer there. 2004-09-30 Richard Williamson Fixed NPN hasMethod and hasProperty functions should take NPObjects, not NPClass Reviewed by Chris. * bindings/NP_jsobject.cpp: (_NPN_GetProperty): (_NPN_HasProperty): (_NPN_HasMethod): * bindings/c/c_class.cpp: (CClass::methodsNamed): (CClass::fieldNamed): * bindings/c/c_class.h: * bindings/c/c_instance.cpp: (CInstance::invokeMethod): * bindings/jni/jni_class.cpp: (JavaClass::methodsNamed): * bindings/jni/jni_class.h: * bindings/npruntime.h: * bindings/objc/objc_class.h: * bindings/objc/objc_class.mm: (ObjcClass::methodsNamed): * bindings/runtime.h: * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::hasProperty): 2004-09-29 Chris Blumenberg Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line. Reviewed by rjw. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.cpp: (_NPN_CreateScriptObject): (_NPN_InvokeDefault): (_NPN_Invoke): (_NPN_Evaluate): (_NPN_GetProperty): (_NPN_SetProperty): (_NPN_RemoveProperty): (_NPN_HasProperty): (_NPN_HasMethod): * bindings/c/c_class.cpp: (CClass::methodsNamed): (CClass::fieldNamed): * bindings/c/c_instance.cpp: (CInstance::CInstance): (CInstance::~CInstance): (CInstance::operator=): (CInstance::invokeMethod): (CInstance::invokeDefaultMethod): * bindings/c/c_runtime.cpp: * bindings/c/c_runtime.h: (KJS::Bindings::CField::name): (KJS::Bindings::CMethod::name): * bindings/npruntime.cpp: (_NPN_GetStringIdentifier): (_NPN_GetStringIdentifiers): (_NPN_GetIntIdentifier): (_NPN_IdentifierIsString): (_NPN_UTF8FromIdentifier): (_NPN_IntFromIdentifier): (NPN_InitializeVariantWithObject): (_NPN_ReleaseVariantValue): (_NPN_CreateObject): (_NPN_RetainObject): (_NPN_ReleaseObject): (_NPN_SetExceptionWithUTF8): (_NPN_SetException): 2004-09-26 Darin Adler * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and low() to get Unicode value of character, and just use unicode(). 2004-09-26 Darin Adler - refine charAt/charCodeAt fix slightly * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an omitted parameter, as we do everywhere else, and as other browsers do here. 2004-09-26 Darin Adler Reviewed by Kevin. - fixed REGRESSION: mailblocks, and presumably many other pages, failing because variable not found * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing the program. We were doing this properly for functions, but not entire programs. - fixed REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt() * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index. * tests/mozilla/expected.html: Update for two tests that now pass with these changes. === Safari-165 === === Safari-164 === 2004-09-14 Richard Williamson 1. Add class parameter to object allocation function. This is somewhat redundant, given that the allocation function is in the class function vector, but people wanted to use the same allocation function for different classes. 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector. 3. Add support for a default function on an object. This is a feature that ActiveX supports, and will allow JavaScript code to be written that will look exactly the same for both ActiveX plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and 'Objective-C' bindings. There bugs are covered by Support for default functions in the JavaScript bindings NPN_Call needs to be renamed to NPN_Invoke Need to implement latest npruntime.h Reviewed by John. * bindings/NP_jsobject.cpp: (jsAllocate): (NPN_InvokeDefault): (NPN_Invoke): * bindings/c/c_class.cpp: * bindings/c/c_instance.cpp: (CInstance::CInstance): (CInstance::operator=): (CInstance::invokeMethod): (CInstance::invokeDefaultMethod): * bindings/c/c_instance.h: * bindings/c/c_runtime.cpp: * bindings/c/c_runtime.h: * bindings/jni/jni_instance.cpp: (JavaInstance::invokeDefaultMethod): * bindings/jni/jni_instance.h: * bindings/npruntime.cpp: (NPN_CreateObject): * bindings/npruntime.h: * bindings/objc/WebScriptObject.h: * bindings/objc/objc_class.mm: (ObjcClass::fallbackObject): * bindings/objc/objc_instance.h: * bindings/objc/objc_instance.mm: (ObjcInstance::invokeDefaultMethod): * bindings/objc/objc_runtime.h: * bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::ObjcFallbackObjectImp): (ObjcFallbackObjectImp::get): (ObjcFallbackObjectImp::put): (ObjcFallbackObjectImp::canPut): (ObjcFallbackObjectImp::implementsCall): (ObjcFallbackObjectImp::call): (ObjcFallbackObjectImp::hasProperty): (ObjcFallbackObjectImp::deleteProperty): (ObjcFallbackObjectImp::defaultValue): * bindings/runtime.h: (KJS::Bindings::Class::fallbackObject): (KJS::Bindings::Instance::getValueOfUndefinedField): (KJS::Bindings::Instance::setValueOfUndefinedField): (KJS::Bindings::Instance::valueOf): * bindings/runtime_object.cpp: (RuntimeObjectImp::implementsCall): (RuntimeObjectImp::call): * bindings/runtime_object.h: 2004-09-13 Maciej Stachowiak Reviewed by Darin. Gmail- sending a very long message with Safari is so slow it seems like a hang * kjs/string_object.cpp: (StringProtoFuncImp::call): Replaced implementation of replace() method with function below... (replace): In order to avoid excessive allocation and copying, figure out the ranges of the original string and replacement strings to be assembled, instead of constantly creating new strings at each substitution. The old behavior is basically O(N^2) for a global replace on a pattern that matches many places in the string. (regExpIsGlobal): Helper function for the above. (expandSourceRanges): ditto (pushSourceRange): ditto (expandReplacements): ditto (pushReplacement): ditto * kjs/ustring.cpp: (KJS::UString::spliceSubstringsWithSeparators): New method that pieces together substring ranges of this string together with specified separators, all at one go. * kjs/ustring.h: (KJS::UString::Range::Range): Added new helper class to represent substring choices. 2004-09-14 Maciej Stachowiak Reviewed by Darin. - fixed encode-URI-test layout test is failing * kjs/function.cpp: (KJS::GlobalFuncImp::call): Make sure to escape null characters. This is a bug in the new code that made part of the test fail. 2004-09-13 Darin Adler Reviewed by Kevin and Maciej. - new function to support fix for DIG bug in WebCore * kjs/scope_chain.h: Added new push function that pushes another entire scope chain. * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto. 2004-09-12 Darin Adler * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version of escape and unescape. 2004-09-12 Darin Adler Reviewed by Maciej. - fixed any non-ASCII characters are garbled in the result of toLocaleString * kjs/date_object.cpp: (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that uses CFDateFormatter. (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime. 2004-09-09 Maciej Stachowiak Reviewed by Richard. REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com * kjs/function.cpp: (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with ones from KDE KJS, which have the proper latin-1 behavior to match Win IE. * kjs/lexer.cpp: (Lexer::isHexDigit): Made static and non-const. * kjs/lexer.h: === Safari-163 === 2004-09-06 Darin Adler * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3. === Safari-162 === 2004-09-01 Richard Williamson Add pid to exception messages (to help debug dashboard clients). Reviewed by Chris. * kjs/interpreter.cpp: (Interpreter::evaluate): === Safari-161 === 2004-08-20 Richard Williamson Implemented new JNI abstraction. We no longer invoke Java methods directly with JNI, rather we call into the plugin. This allows the plugin to dispatch the call to the appropriate VM thread. This change should (will?) fix a whole class of threading related problems with the Java VM. Reviewed by Hyatt. * JavaScriptCore.pbproj/project.pbxproj: * bindings/c/c_instance.h: (KJS::Bindings::CInstance::setExecutionContext): (KJS::Bindings::CInstance::executionContext): * bindings/jni/jni_instance.cpp: (JavaInstance::JavaInstance): (JavaInstance::invokeMethod): (JavaInstance::setExecutionContext): (JavaInstance::executionContext): * bindings/jni/jni_instance.h: * bindings/jni/jni_jsobject.cpp: (JSObject::convertJObjectToValue): * bindings/jni/jni_runtime.cpp: (JavaField::JavaField): (JavaArray::convertJObjectToArray): (JavaField::valueFromInstance): (JavaArray::JavaArray): (JavaArray::valueAt): * bindings/jni/jni_runtime.h: (KJS::Bindings::JavaArray::operator=): (KJS::Bindings::JavaArray::executionContext): * bindings/jni/jni_utility.h: * bindings/objc/objc_instance.h: (KJS::Bindings::ObjcInstance::setExecutionContext): (KJS::Bindings::ObjcInstance::executionContext): * bindings/runtime.cpp: (Instance::createBindingForLanguageInstance): * bindings/runtime.h: * bindings/runtime_root.h: (KJS::Bindings::RootObject::nativeHandle): === Safari-158 === 2004-08-19 Vicki Murley Reviewed by John. * kjs/property_map.cpp: (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy 2004-08-17 Darin Adler Reviewed by Adele. - fixed SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem) * kjs/property_map.h: Added some private functions. * kjs/property_map.cpp: (KJS::PropertyMap::clear): Set sentinelCount to 0. (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel. Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element. (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16. (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function. (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are deleted-element sentinels. (KJS::PropertyMap::checkConsistency): Check the sentinelCount. 2004-08-16 Maciej Stachowiak Code change by Eric Albert, reviewd by me. washingtonpost.com claims I don't have cookies enabled and won't let me read articles * kjs/date_object.cpp: (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t entirely would be even better, but is not required to fix this bug. === Safari-157 === 2004-08-16 Richard Williamson Fixed cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC). Reviewed by Chris. * bindings/NP_jsobject.cpp: (NPN_Evaluate): * bindings/jni/jni_jsobject.cpp: (JSObject::eval): * bindings/objc/WebScriptObject.mm: (-[WebScriptObject evaluateWebScript:]): 2004-08-15 Richard Williamson More updates to np headers. Implemented new NPN functions. Reviewed by Darin. * bindings/NP_jsobject.cpp: (NPN_HasProperty): (NPN_HasMethod): * bindings/npapi.h: * bindings/npruntime.h: 2004-08-13 Darin Adler - fix build so we can compile again * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here is good enough so that we can compile, but it's only a stopgap measure, because I think Richard has a newer one he wants to check in. 2004-08-12 Richard Williamson Bring npruntime.h and friends closer to compliance with latest spec. Reviewed by Maciej. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.cpp: (jsAllocate): (_NPN_CreateScriptObject): (NPN_Call): (NPN_Evaluate): (NPN_GetProperty): (NPN_SetProperty): (NPN_RemoveProperty): * bindings/NP_jsobject.h: * bindings/c/c_instance.cpp: (CInstance::invokeMethod): * bindings/c/c_utility.cpp: (convertNPVariantToValue): * bindings/npruntime.cpp: (NPN_IdentifierIsString): (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): * bindings/npruntime.h: (_NPString::): (_NPString::_NPVariant::): * bindings/npruntime_priv.h: Added. 2004-08-12 Darin Adler Reviewed by Adele. - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests * kjs/function.cpp: (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working. (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not. (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code to skip leading "+" or "-". === Safari-156 === 2004-08-12 Darin Adler Reviewed by Ken. - fixed 43 Mozilla JavaScript tests * kjs/date_object.h: Change parseDate and timeClip to take and return doubles. * kjs/date_object.cpp: (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather than constructing a number object to pass to it. (DateObjectFuncImp::call): Change to use a parseDate function that returns a double. (KJS::parseDate): Change to return a double instead of creating the Number object here. (KJS::timeClip): Implement this as specified in the language standard. * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum flags on the prototype property. * kjs/function.cpp: (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not currently in scope. (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility file later. (KJS::parseDigit): Added. Helper function for parseInt. (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what strtoll can handle. Also matches standard more closely. (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN instead of 0. (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat. * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property. * kjs/lexer.h: Added error flag and sawError() function for detecting errors. * kjs/lexer.cpp: (Lexer::setCode): Clear error state. (Lexer::lex): Set error state if the lexer encounters an error * kjs/internal.cpp: (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly. (Parser::parse): Use new lexer error method so those errors are treated like parser errors. * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0. Change round to round values between -0.5 and -0 to -0 instead of +0. * kjs/nodes.h: Add evaluateReference function to GroupNode. * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses would change x.y into a value that can't be deleted as a side effect. * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match the specification. * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and get rid of the fixed size limit for code. * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just returns the string without creating a new Rep, since I'm using substr in a place where it will often be passed a 0. * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to the other day that was making a couple tests fail. * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto. * kjs/string_object.lut.h: Regenerated. 2004-08-11 Darin Adler - fixed a tiny problem with the UTF-16 PCRE check-in * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused the ctype_meta flag to get set in items that should not have it. * pcre/chartables.c: Regenerated. 2004-08-10 Richard Williamson Fixed Need to implement invokeUndefinedMethodFromWebScript:withArguments: The following WebScripting methods are now supported on bound objects: - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args; - (void)setValue:(id)value forUndefinedKey:(NSString *)key - (id)valueForUndefinedKey:(NSString *)key Reviewed by Chris. * bindings/c/c_class.cpp: (CClass::fieldNamed): * bindings/c/c_class.h: * bindings/jni/jni_class.cpp: (JavaClass::fieldNamed): * bindings/jni/jni_class.h: * bindings/objc/objc_class.h: (KJS::Bindings::ObjcClass::isa): * bindings/objc/objc_class.mm: (ObjcClass::methodsNamed): (ObjcClass::fieldNamed): (ObjcClass::fallbackObject): * bindings/objc/objc_instance.h: * bindings/objc/objc_instance.mm: (ObjcInstance::invokeMethod): (ObjcInstance::setValueOfField): (ObjcInstance::setValueOfUndefinedField): (ObjcInstance::getValueOfField): (ObjcInstance::getValueOfUndefinedField): * bindings/objc/objc_runtime.h: (KJS::Bindings::ObjcField::~ObjcField): (KJS::Bindings::ObjcField::ObjcField): (KJS::Bindings::ObjcField::operator=): (KJS::Bindings::FallbackObjectImp::classInfo): * bindings/objc/objc_runtime.mm: (ObjcField::ObjcField): (ObjcField::name): (ObjcField::type): (ObjcField::valueFromInstance): (ObjcField::setValueToInstance): (FallbackObjectImp::FallbackObjectImp): (FallbackObjectImp::get): (FallbackObjectImp::put): (FallbackObjectImp::canPut): (FallbackObjectImp::implementsCall): (FallbackObjectImp::call): (FallbackObjectImp::hasProperty): (FallbackObjectImp::deleteProperty): (FallbackObjectImp::defaultValue): * bindings/runtime.h: (KJS::Bindings::Class::fallbackObject): (KJS::Bindings::Instance::getValueOfUndefinedField): (KJS::Bindings::Instance::setValueOfUndefinedField): * bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::put): (RuntimeObjectImp::canPut): (RuntimeObjectImp::hasProperty): * bindings/testbindings.mm: (-[MyFirstInterface valueForUndefinedKey:]): (-[MyFirstInterface setValue:forUndefinedKey:]): 2004-08-10 Darin Adler Reviewed by Dave. - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char or uint16_t depending on the mode, and used appropriate in the 7 public functions that need to use it. * pcre/pcre.c: Add UTF-16 support to all functions. * pcre/study.c: Ditto. * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on the mode. Changed declarations to use symbolic constants and typedefs so we size things to ichar when needed. * pcre/maketables.c: (pcre_maketables): Change code to make tables that are sized to 16-bit characters instead of 8-bit. * pcre/get.c: (pcre_copy_substring): Use pcre_char instead of char. (pcre_get_substring_list): Ditto. (pcre_free_substring_list): Ditto. (pcre_get_substring): Ditto. (pcre_free_substring): Ditto. * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead of hard-coding 8-bit table sizes. * pcre/chartables.c: Regenerated. * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets. * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that is not null. The null string still has a null pointer. This prevents us from passing a null through to the regular expression engine (which results in a null error even when the string length is 0). * kjs/regexp.cpp: (KJS::RegExp::RegExp): Null-terminate the pattern and pass it. (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8. 2004-08-09 Darin Adler Reviewed by Maciej. - fixed 28 Mozilla JavaScript tests * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than checking the number of arguments for the join method. * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather than integers, so we aren't limited to 32 bits. * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in the implementation of the pow operation. Also simplied a case that was handling positive and negative infinity separately. * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of putting them in a long, so that unsigned shift will work properly. * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants. * kjs/operations.cpp: (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the sign of isinf; our isinf function returns +1 even for negative infinity. (KJS::isNegInf): And again. (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES. Our floating point already handles the various infinity cases correctly. * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method. (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the array in cases where we did not match. (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for "global", "ignoreCase", "multiline", and "source". * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null string into undefined rather than an empty string. For the slice method, handle an undefined parameter for the limit properly as decribed in the specification, and add the limit to one case that didn't have the limit at all. For the methods that generate HTML strings, use lowercase tags instead of uppercase. * kjs/ustring.cpp: (KJS::UChar::toLower): Use u_tolower from the ICU library. (KJS::UChar::toUpper): Use u_toupper from the ICU library. (KJS::UString::append): Fix some math that caused a buffer overflow. (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special flag) rather than converting them all to 0. (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto. * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files. * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match the Unicode specification in a few cases where it was wrong before. * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto. * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto. * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto. * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto. * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto. * JavaScriptCore.pbproj/project.pbxproj: Link to libicu. * kjs/number_object.lut.h: Regenerated. 2004-08-09 Darin Adler Reviewed by Maciej. - fixed REGRESSION (137-138): reproducible buffer overrun in UString manipulation code * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it we get a buffer overflow. === Safari-155 === 2004-08-05 Richard Williamson Fixed part of 3674747. The QT guys need this for feature freeze. This patch implements support for the - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args method of objects bound to JavaScript. Reviewed by John. * ChangeLog: * bindings/objc/objc_class.mm: (ObjcClass::methodsNamed): (ObjcClass::fieldNamed): * bindings/objc/objc_instance.mm: (ObjcInstance::invokeMethod): * bindings/objc/objc_runtime.h: (KJS::Bindings::ObjcMethod::~ObjcMethod): (KJS::Bindings::ObjcMethod::isFallbackMethod): (KJS::Bindings::ObjcMethod::javaScriptName): * bindings/objc/objc_runtime.mm: (ObjcMethod::ObjcMethod): (ObjcMethod::getMethodSignature): (ObjcMethod::setJavaScriptName): * bindings/testbindings.mm: 2004-08-04 Vicki Murley Reviewed by mjs. - fix SAP WebGUI has problems loading first page because of parse error * kjs/lexer.cpp: (Lexer::lex): if the current character is a '\' and the next character is a line terminator, go to the next line and continue parsing the string (instead of failing). This matches behavior in Mac IE and Mozilla. 2004-08-03 Kevin Decker Reviewed by Darin. Rolled in changes from the latest KJS sources that support additional Number.prototype functions. Specifically this patch covers the follow parts of the ECMA 3 spec: 15.7.4.5, 15.7.4.6, and 15.7.4.7 Fixes: missing Number.toFixed (and toPrecision, toExponential) missing Number.toPrecision prototype implementation missing Number.toExponential prototype implementation * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the list of supported identifiers (a macro). * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(), and toExponential(). (NumberPrototypeImp::NumberPrototypeImp): (NumberProtoFuncImp::call): * kjs/number_object.h: Added property names for toFixed, toPrecision, and toExponential. (KJS::NumberProtoFuncImp::): * tests/mozilla/expected.html: Update results. 2004-08-03 Darin Adler Reviewed by Ken. - added support for copying RegExp objects so 7 more Mozilla regexp tests pass * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where we are supposed to just copy the regular expression object, and do so. Also tighten up arguments check to handle case where an actual "undefined" is passed rather than just omitting an argument. * tests/mozilla/expected.html: Update results. 2004-08-02 Darin Adler * tests/mozilla/.cvsignore: Added. * tests/mozilla/expected.html: Update results. 2004-08-02 Darin Adler Reviewed by Ken. - fixed RegExp.toString so 3 more Mozilla regexp tests pass * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Append the flags here so more tests paseed. 2004-08-02 Darin Adler Reviewed by Ken. - fixed a couple things making 5 Mozilla regexp tests pass * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString for the prototype. (RegExpObjectImp::construct): Fix bug where the string "undefined" would be used as the flags string when no parameter was passed. * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo): Added a class info object for RegExp prototype so it can return a string instead of raising an exception when converting to a string. * tests/mozilla/expected.html: Update results. 2004-08-02 Darin Adler Reviewed by Kevin. - fix crashes in mozilla tests due to mishandling NaN * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after calls to toInteger so that NaN will get turned into something that fits in an integer. These were the ones John already fixed, but his fix used isnan and the new fix is more efficient. * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks after a call to toInteger to handle NaN properly. Also removed separate check for undefined that's not needed. * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes as in the above two files, but for a lot more functions. Also changed one place with an explicit check for undefined to instead just check isNaN. * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people like me who don't keep $SYMROOTS in their $PATH. === Safari-154 === === Safari-153 === 2004-07-26 Kevin Decker Changes done by Darin, reviewed by Kevin. - changed testkjs to build in Xcode rather than from Makefile * .cvsignore: Removed obsolete files from this list. * Makefile.am: Removed code to build testkjs; we do this in Xcode now. Changed to build target "All" rather than default target. This makes us build the testkjs test tool. * dummy.cpp: Removed. * kjs/.cvsignore: Removed obsolete files from this list, including the testkjs tool, which is now built in the symroots directory. * kjs/testkjs.cpp: Added copyright notice that was missing, since we have changed this file. Also this has the nice side effect of causing the tool to be rebuilt in the new location even if there are no other changes in your tree when you check this out. * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works without setting the execute bit on jsDriver.pl. 2004-07-22 Kevin Decker Reviewed by Darin Fixed (error console does not include source urls or line numbers of event exceptions). * kjs/function_object.cpp: (FunctionObjectImp::construct): * kjs/function_object.h: * kjs/object.cpp: (KJS::ObjectImp::construct): * kjs/object.h: (KJS::Object::construct): 2004-07-21 Darin Adler * bindings/npruntime.h: Fixed typo. 2004-07-19 John Sullivan Reviewed by Maciej. - bulletproofed array.slice() against NAN arguments. Harri noticed this vulnerability in my patch for 3714644 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): handle NAN parameters passed to slice() by clamping to 0 and length. 2004-07-19 Richard Williamson Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet has been destroyed. Reviewed by John. * bindings/jni/jni_jsobject.cpp: (JSObject::invoke): (JSObject::JSObject): 2004-07-16 John Sullivan Reviewed by Maciej. - fixed REGRESSION (125.8-146): bugzilla submit link hangs browser with javascript * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined type for args[0] the same way we were already checking for args[1]. In this case, args was zero-length, but we were treating args[0] like an integer anyway. Resulted in some code looping from a NAN value to 4, taking approximately forever. * JavaScriptCore.pbproj/project.pbxproj: version wars === Safari-152 === 2004-07-14 Maciej Stachowiak Reviewed by John. : (REGRESSION (125-146): JavaScript 'toString(16)' is broken) : (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com) * kjs/number_object.cpp: (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself! 2004-07-13 Kevin Decker Reviewed by kocienda. - made testkjs and JavaScriptCore a subtarget of 'All' - testkjs now builds in $SYMROOTS * JavaScriptCore.pbproj/project.pbxproj: === Safari-151 === 2004-06-24 Chris Blumenberg Ignore .mode1 files in JavaScriptCore.pbproj Reviewed by kocienda. * JavaScriptCore.pbproj/.cvsignore: 2004-06-23 Richard Williamson Implemented changes for latest npruntime.h. Reviewed by Chris. * JavaScriptCore.pbproj/project.pbxproj: * bindings/NP_jsobject.cpp: (listFromVariantArgs): (identiferFromNPIdentifier): (_NPN_CreateScriptObject): (NPN_Call): (NPN_Evaluate): (NPN_GetProperty): (NPN_SetProperty): (NPN_RemoveProperty): * bindings/NP_jsobject.h: * bindings/c/c_class.cpp: (CClass::methodsNamed): (CClass::fieldNamed): * bindings/c/c_instance.cpp: (CInstance::invokeMethod): * bindings/c/c_utility.cpp: (convertNPVariantToValue): * bindings/c/c_utility.h: * bindings/npruntime.cpp: (stringIdentifierEqual): (stringIdentifierHash): (getStringIdentifierDictionary): (intIdentifierEqual): (intIdentifierHash): (getIntIdentifierDictionary): (NPN_GetStringIdentifier): (NPN_GetStringIdentifiers): (NPN_GetIntIdentifier): (NPN_IdentifierIsString): (NPN_UTF8FromIdentifier): (NPN_VariantToInt32): (NPN_VariantToDouble): (NPN_SetException): * bindings/npruntime.h: * bindings/objc/WebScriptObject.mm: (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]): * bindings/runtime_object.cpp: (RuntimeObjectImp::~RuntimeObjectImp): * bindings/runtime_root.cpp: (KJS::Bindings::rootForInterpreter): * bindings/testbindings.cpp: (initializeIdentifiers): (logMessage): (setDoubleValue): (setIntValue): (setBooleanValue): === JavaScriptCore-146.1 === 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): (InterpreterI