9 2005-03-16 Jens Alfke <jens@apple.com>
13 Fix for <rdar://problem/4025212> "REGRESSION (163-164): search not performed correctly; united.com"
14 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.
15 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.)
16 Darin says this regression occurred when we replaced our own implementation of unescape() with code from KJS.
19 (KJS::GlobalFuncImp::call):
21 2005-03-15 Richard Williamson <rjw@apple.com>
23 Fixed <rdar://problem/4053276> WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C
25 Added JavaScript boolean to type that can be converted to
26 ObjC scalar parameters.
28 Reviewed by Ken Kocienda.
30 * bindings/objc/objc_utility.mm:
31 (KJS::Bindings::convertValueToObjcValue):
47 2005-02-21 Darin Adler <darin@apple.com>
49 * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
51 2005-02-17 Richard Williamson <rjw@apple.com>
53 Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
57 Reviewed by John Sullivan.
59 * bindings/jni/jni_runtime.cpp:
60 (JavaField::valueFromInstance):
64 2005-02-11 Richard Williamson <rjw@apple.com>
66 Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
68 Re-factored how 'native' wrappers for JS objects are created. The interpreter now
69 creates these wrappers. The WebCore subclass of the interpreter now overrides
70 createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
74 * bindings/c/c_utility.cpp:
75 (convertValueToNPVariant):
76 * bindings/jni/jni_instance.cpp:
77 (JavaInstance::invokeMethod):
78 * bindings/jni/jni_objc.mm:
79 (KJS::Bindings::dispatchJNICall):
80 * bindings/jni/jni_runtime.cpp:
81 (JavaField::valueFromInstance):
83 * bindings/objc/WebScriptObject.mm:
84 (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
85 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
86 * bindings/objc/WebScriptObjectPrivate.h:
87 * bindings/objc/objc_utility.h:
88 * bindings/objc/objc_utility.mm:
89 (KJS::Bindings::convertObjcValueToValue):
90 (KJS::Bindings::createObjcInstanceForValue):
91 * bindings/runtime.cpp:
92 (Instance::createBindingForLanguageInstance):
93 (Instance::createRuntimeObject):
94 (Instance::createLanguageInstanceForValue):
96 * kjs/interpreter.cpp:
97 (Interpreter::createLanguageInstanceForValue):
102 2005-02-10 Darin Adler <darin@apple.com>
104 "Reviewed" by Richard (he told me the file was obsolete).
106 - got rid of an obsolete file
108 * bindings/npsap.h: Removed.
114 2005-02-03 Richard Williamson <rjw@apple.com>
116 Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
118 Revert to old (and correct) behavior of returning runtime object
119 when passed as a parameter, rather than it's corresponding DOM
124 * bindings/objc/WebScriptObject.mm:
125 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
129 2005-01-28 Richard Williamson <rjw@apple.com>
131 Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
133 Only use special 'back door' property to get the runtime object if thisObj isn't
134 already a runtime object.
136 <gratuitous> Cleaned up a couple of strcmp on ClassInfo name. Used == on
137 ClassInfo pointer instead.
141 * bindings/c/c_utility.cpp:
142 (convertValueToNPVariant):
143 * bindings/objc/WebScriptObject.mm:
144 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
145 * bindings/runtime_method.cpp:
146 (RuntimeMethodImp::call):
150 2005-01-26 Richard Williamson <rjw@apple.com>
152 Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
154 I added a member variable to ObjectImp. This changed it's size and consequently
155 hampered the optimizations built into the garbage collector. Objects no longer
156 fit within the allocators cell size, and thus allocation fell back to a slower
159 As a result of this fix I also dramatically cleaned up how runtime objects are
160 accessed. The path mostly *removes* code.
164 * bindings/runtime_method.cpp:
165 (RuntimeMethodImp::call):
166 * bindings/runtime_object.cpp:
167 (RuntimeObjectImp::get):
168 (RuntimeObjectImp::put):
169 (RuntimeObjectImp::canPut):
170 (RuntimeObjectImp::hasProperty):
171 (RuntimeObjectImp::defaultValue):
172 * bindings/runtime_object.h:
174 (KJS::ObjectImp::ObjectImp):
177 2005-01-20 Darin Adler <darin@apple.com>
179 Reviewed by me, changes by Han Ming Ong.
181 - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
183 * bindings/objc/WebScriptObjectPrivate.h: Make members public.
184 * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
186 2005-01-20 Richard Williamson <rjw@apple.com>
188 Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
190 The comprehensive fix for this problem requires new API, as described in 3965326. However,
191 given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
192 like and Undefined object if invokeUndefinedMethodFromWebScript:withArguments: isn't
193 implemented on the bound object.
197 * bindings/objc/objc_runtime.h:
198 * bindings/objc/objc_runtime.mm:
199 (ObjcFallbackObjectImp::type):
200 (ObjcFallbackObjectImp::implementsCall):
201 (ObjcFallbackObjectImp::toBoolean):
202 * bindings/testbindings.mm:
203 (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
204 (+[MyFirstInterface isKeyExcludedFromWebScript:]):
208 2005-01-19 Richard Williamson <rjw@apple.com>
210 Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
212 Fixed the following problems with LiveConnect that are demonstrated by the application
213 described in 3853676.
215 1. If a nil object is passed in an array from Java to JavaScript we will crash.
216 2. We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
217 3. We will sometimes fail to find the correct static method ID.
221 * bindings/jni/jni_jsobject.cpp:
222 (JSObject::convertJObjectToValue):
223 (JSObject::listFromJArray):
224 * bindings/jni/jni_runtime.cpp:
225 (JavaField::valueFromInstance):
226 (JavaField::setValueToInstance):
227 * bindings/jni/jni_utility.cpp:
228 (KJS::Bindings::getMethodID):
229 (KJS::Bindings::convertValueToJValue):
230 * bindings/runtime_array.h:
232 2005-01-18 Richard Williamson <rjw@apple.com>
234 Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
236 Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
237 Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
238 Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
239 Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
241 We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
242 tags. Also, if any of these elements are named they can be accessed from the document or window objects.
243 Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
247 * bindings/objc/objc_instance.h:
248 * bindings/objc/objc_instance.mm:
249 (ObjcInstance::supportsSetValueOfUndefinedField):
250 * bindings/runtime.h:
251 (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
252 * bindings/runtime_object.cpp:
253 (RuntimeObjectImp::RuntimeObjectImp):
254 (RuntimeObjectImp::get):
255 (RuntimeObjectImp::put):
256 (RuntimeObjectImp::canPut):
257 (RuntimeObjectImp::hasProperty):
258 (RuntimeObjectImp::defaultValue):
259 * bindings/runtime_object.h:
260 (KJS::RuntimeObjectImp::fallbackObject):
262 (KJS::ObjectImp::ObjectImp):
264 (KJS::ObjectImp::forwardingScriptMessage):
265 (KJS::ObjectImp::setForwardingScriptMessage):
267 2005-01-18 Richard Williamson <rjw@apple.com>
269 Back out a change that was incorrectly committed yesterday.
273 * bindings/objc/objc_utility.mm:
274 (KJS::Bindings::convertValueToObjcValue):
276 2005-01-17 Richard Williamson <rjw@apple.com>
278 Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
280 Keep track of originating execution context and target execution
281 context for native JS object wrappers, and perform appropriate
284 Reviewed by David Harrison.
286 * bindings/NP_jsobject.cpp:
288 (_NPN_CreateScriptObject):
293 (_NPN_RemoveProperty):
297 * bindings/NP_jsobject.h:
298 * bindings/c/c_instance.cpp:
299 (CInstance::CInstance):
300 (CInstance::stringValue):
301 * bindings/c/c_instance.h:
302 * bindings/c/c_utility.cpp:
303 (convertValueToNPVariant):
304 * bindings/jni/jni_instance.cpp:
305 (JavaInstance::JavaInstance):
306 (JavaInstance::valueOf):
307 * bindings/jni/jni_instance.h:
308 * bindings/objc/WebScriptObject.mm:
309 (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
310 (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
311 (-[WebScriptObject KJS::Bindings::]):
312 (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
313 (-[WebScriptObject _isSafeScript]):
314 (-[WebScriptObject callWebScriptMethod:withArguments:]):
315 (-[WebScriptObject evaluateWebScript:]):
316 (-[WebScriptObject setValue:forKey:]):
317 (-[WebScriptObject valueForKey:]):
318 (-[WebScriptObject removeWebScriptKey:]):
319 (-[WebScriptObject stringRepresentation]):
320 (-[WebScriptObject webScriptValueAtIndex:]):
321 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
322 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
323 * bindings/objc/WebScriptObjectPrivate.h:
324 * bindings/objc/objc_instance.h:
325 * bindings/objc/objc_runtime.mm:
326 (convertValueToObjcObject):
327 * bindings/objc/objc_utility.mm:
328 (KJS::Bindings::convertValueToObjcValue):
329 * bindings/runtime.cpp:
330 (Instance::Instance):
331 (Instance::operator=):
332 * bindings/runtime.h:
333 (KJS::Bindings::Instance::Instance):
334 (KJS::Bindings::Instance::setExecutionContext):
335 (KJS::Bindings::Instance::executionContext):
336 * bindings/runtime_root.cpp:
337 (RootObject::setInterpreter):
338 * bindings/runtime_root.h:
340 (KJS::Interpreter::isGlobalObject):
341 (KJS::Interpreter::interpreterForGlobalObject):
342 (KJS::Interpreter::isSafeScript):
346 2005-01-13 Vicki Murley <vicki@apple.com>
350 - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
352 * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
354 2005-01-12 Richard Williamson <rjw@apple.com>
356 Avoid additional work on dealloc by adding early out to
357 removeNativeReference(). (This will save time on dealloc
358 for all ObjC DOM objects.)
362 * bindings/runtime_root.cpp:
363 (KJS::Bindings::removeNativeReference):
365 2005-01-12 Richard Williamson <rjw@apple.com>
367 Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
369 We were always returning the first "root" object for all runtime
370 objects. Changed 0 in loop to i, the index.
372 Reviewed by David Harrison.
374 * bindings/runtime_root.cpp:
375 (KJS::Bindings::rootForImp):
377 2005-01-11 Richard Williamson <rjw@apple.com>
379 Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
381 Use the new dispatching API to invoke JNI, rather than calling JNI
384 Reviewed by David Harrison.
386 * bindings/jni/jni_instance.cpp:
387 (JavaInstance::invokeMethod):
388 * bindings/jni/jni_runtime.cpp:
389 (JavaField::dispatchValueFromInstance):
390 (JavaField::valueFromInstance):
391 (JavaField::dispatchSetValueToInstance):
392 (JavaField::setValueToInstance):
393 * bindings/jni/jni_runtime.h:
394 * bindings/jni/jni_utility.cpp:
395 (KJS::Bindings::convertValueToJValue):
403 2004-12-17 Maciej Stachowiak <mjs@apple.com>
407 <rdar://problem/3926869> Opening caches window after running PLT causes crash
409 * kjs/protected_values.cpp:
410 (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
411 the protected value table.
412 (KJS::ProtectedValues::increaseProtectCount): Ditto.
413 (KJS::ProtectedValues::decreaseProtectCount): Ditto.
415 2004-12-16 Darin Adler <darin@apple.com>
419 - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
421 * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
422 * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
423 non-locale-specific versions.
424 * kjs/string_object.lut.h: Regenerated.
426 2004-12-14 Richard Williamson <rjw@apple.com>
428 Pass URL of plugin view when call into JNI.
432 * bindings/jni/jni_objc.mm:
433 (KJS::Bindings::dispatchJNICall):
435 2004-12-13 Richard Williamson <rjw@apple.com>
437 Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
439 Add support for calling static Java methods from JavaScript.
443 * bindings/jni/jni_instance.cpp:
444 (JavaInstance::invokeMethod):
445 * bindings/jni/jni_runtime.cpp:
446 (JavaMethod::JavaMethod):
447 * bindings/jni/jni_runtime.h:
448 (KJS::Bindings::JavaMethod::isStatic):
449 * bindings/jni/jni_utility.cpp:
450 (callJNIStaticMethod):
451 (KJS::Bindings::callJNIBooleanMethod):
452 (KJS::Bindings::callJNIStaticBooleanMethod):
453 * bindings/jni/jni_utility.h:
455 2004-12-13 Richard Williamson <rjw@apple.com>
457 Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
461 * bindings/jni/jni_instance.cpp:
462 (JavaInstance::invokeMethod):
463 * bindings/jni/jni_objc.mm:
464 (KJS::Bindings::dispatchJNICall):
465 * bindings/jni/jni_runtime.h:
466 * bindings/jni/jni_utility.h:
470 2004-12-07 Maciej Stachowiak <mjs@apple.com>
474 <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
476 The fix was to implement copy constructor and assignment operator,
477 the ones that worked on the base class did not replace the
481 (KJS::ProtectedValue::ProtectedValue):
482 (KJS::ProtectedValue::operator=):
483 (KJS::ProtectedObject::ProtectedObject):
484 (KJS::ProtectedObject::operator=):
486 Also fixed a bug in the GC test mode that compares the results of
487 the old collector and the new collector.
494 2004-11-23 Richard Williamson <rjw@apple.com>
496 Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
500 * bindings/c/c_class.cpp:
501 (CClass::_commonInit):
503 2004-11-21 Maciej Stachowiak <mjs@apple.com>
507 <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
510 (KJS::Collector::Thread::Thread):
511 (KJS::destroyRegisteredThread):
512 (KJS::initializeRegisteredThreadKey):
513 (KJS::Collector::registerThread):
514 (KJS::Collector::markStackObjectsConservatively):
515 (KJS::Collector::markCurrentThreadConservatively):
516 (KJS::Collector::markOtherThreadConservatively):
524 2004-11-15 Richard Williamson <rjw@apple.com>
526 Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
530 * bindings/objc/objc_instance.mm:
531 (ObjcInstance::stringValue):
532 * bindings/objc/objc_utility.h:
533 * bindings/objc/objc_utility.mm:
534 (KJS::Bindings::convertNSStringToString):
535 (KJS::Bindings::convertObjcValueToValue):
539 2004-11-09 Chris Blumenberg <cblu@apple.com>
541 Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
546 * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
547 * bindings/softlinking.c: Added.
549 (getFunctionPointer): new
550 (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
554 2004-11-04 Darin Adler <darin@apple.com>
558 - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
559 - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
560 and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
561 than allocating a new one
563 * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
564 (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
565 of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
566 actually allocate only the very first time it's called.
567 (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
568 shared instance since there can be only one).
569 (-[WebUndefined copyWithZone:]): Ditto.
570 (-[WebUndefined retain]): Ditto.
571 (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
573 (-[WebUndefined autorelease]): Simplified to just return self (see above).
574 (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
575 (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
576 a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
577 bug mentioned above).
578 (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
579 No need to call init, since that's a no-op for this class.
581 2004-11-03 David Harrison <harrison@apple.com>
585 Eliminate the use of a marker file to determine how to build.
590 2004-11-01 Richard Williamson <rjw@apple.com>
592 Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
596 * bindings/c/c_instance.cpp:
597 (CInstance::invokeMethod):
598 (CInstance::invokeDefaultMethod):
599 Initialize out parameters to void type.
601 * bindings/c/c_runtime.cpp:
602 (CField::valueFromInstance):
603 (CField::setValueToInstance):
604 Initialize out parameters to void type.
605 Also added additional checks to protect against classes that
606 don't implement all functions.
608 2004-11-01 Richard Williamson <rjw@apple.com>
610 Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
615 * bindings/objc/WebScriptObject.mm:
616 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
617 Added additional conversion Undefined -> WebUndefined.
618 * bindings/objc/objc_utility.mm:
619 (KJS::Bindings::convertObjcValueToValue):
620 Added additional conversion WebUndefined -> Undefined.
622 2004-11-01 Darin Adler <darin@apple.com>
624 - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
626 * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
627 this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
628 report to match the contents of the file.
634 2004-10-22 Ken Kocienda <kocienda@apple.com>
638 * JavaScriptCore.pbproj/project.pbxproj:
639 Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
643 2004-10-13 Richard Williamson <rjw@apple.com>
645 Moved boolean checks prior to NSNumber checks. booleans are
648 Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
652 * bindings/objc/objc_utility.mm:
653 (KJS::Bindings::convertObjcValueToValue):
655 2004-10-12 Richard Williamson <rjw@apple.com>
657 Fixed access to DOM object via WebScriptObject API.
658 The execution context for DOM objects wasn't being found.
659 <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
663 * bindings/objc/WebScriptObject.mm:
665 (-[WebScriptObject KJS::Bindings::]):
666 (-[WebScriptObject callWebScriptMethod:withArguments:]):
667 (-[WebScriptObject evaluateWebScript:]):
668 (-[WebScriptObject setValue:forKey:]):
669 (-[WebScriptObject valueForKey:]):
670 (-[WebScriptObject stringRepresentation]):
671 * bindings/objc/WebScriptObjectPrivate.h:
673 2004-10-09 Darin Adler <darin@apple.com>
677 - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
679 * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
680 creating an init routine.
682 * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
683 require a global constructor that creates an init routine.
685 2004-10-09 Darin Adler <darin@apple.com>
689 - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
691 * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
692 work with the window object of the page the function is in, not the page of the caller. This
693 is what all other browsers do. This code was hidden before by the "everything is defined on
694 window object" hack in WebCore.
696 2004-10-07 Richard Williamson <rjw@apple.com>
698 Added simple JavaScript call tracing. Very useful for
699 debugging complex pages.
701 Tracing is only available in development builds and is
704 (gdb) set traceJavaScript = 1
708 setTraceJavaScript(true)
710 Function, args, and return values are printed to console. Very
715 * kjs/function_object.cpp:
716 (FunctionProtoFuncImp::call):
722 2004-10-05 Richard Williamson <rjw@apple.com>
724 Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
728 * bindings/NP_jsobject.cpp:
730 * bindings/npruntime.cpp:
731 (_NPN_SetExceptionWithUTF8):
732 * bindings/objc/WebScriptObject.mm:
733 (+[WebScriptObject throwException:]):
735 (KJS::InterpreterImp::context):
737 2004-10-05 Richard Williamson <rjw@apple.com>
739 Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
743 * bindings/objc/objc_utility.mm:
744 (KJS::Bindings::convertObjcValueToValue):
746 2004-10-04 Darin Adler <darin@apple.com>
750 - rolled in a fix the KDE folks did for the operations that generate HTML fragments
752 * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
754 - rolled out an old workaround we don't need any more
756 * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
757 required it is no longer there.
759 2004-09-30 Richard Williamson <rjw@apple.com>
761 Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
765 * bindings/NP_jsobject.cpp:
769 * bindings/c/c_class.cpp:
770 (CClass::methodsNamed):
771 (CClass::fieldNamed):
772 * bindings/c/c_class.h:
773 * bindings/c/c_instance.cpp:
774 (CInstance::invokeMethod):
775 * bindings/jni/jni_class.cpp:
776 (JavaClass::methodsNamed):
777 * bindings/jni/jni_class.h:
778 * bindings/npruntime.h:
779 * bindings/objc/objc_class.h:
780 * bindings/objc/objc_class.mm:
781 (ObjcClass::methodsNamed):
782 * bindings/runtime.h:
783 * bindings/runtime_object.cpp:
784 (RuntimeObjectImp::get):
785 (RuntimeObjectImp::hasProperty):
787 2004-09-29 Chris Blumenberg <cblu@apple.com>
789 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.
793 * JavaScriptCore.pbproj/project.pbxproj:
794 * bindings/NP_jsobject.cpp:
795 (_NPN_CreateScriptObject):
796 (_NPN_InvokeDefault):
801 (_NPN_RemoveProperty):
804 * bindings/c/c_class.cpp:
805 (CClass::methodsNamed):
806 (CClass::fieldNamed):
807 * bindings/c/c_instance.cpp:
808 (CInstance::CInstance):
809 (CInstance::~CInstance):
810 (CInstance::operator=):
811 (CInstance::invokeMethod):
812 (CInstance::invokeDefaultMethod):
813 * bindings/c/c_runtime.cpp:
814 * bindings/c/c_runtime.h:
815 (KJS::Bindings::CField::name):
816 (KJS::Bindings::CMethod::name):
817 * bindings/npruntime.cpp:
818 (_NPN_GetStringIdentifier):
819 (_NPN_GetStringIdentifiers):
820 (_NPN_GetIntIdentifier):
821 (_NPN_IdentifierIsString):
822 (_NPN_UTF8FromIdentifier):
823 (_NPN_IntFromIdentifier):
824 (NPN_InitializeVariantWithObject):
825 (_NPN_ReleaseVariantValue):
828 (_NPN_ReleaseObject):
829 (_NPN_SetExceptionWithUTF8):
832 2004-09-26 Darin Adler <darin@apple.com>
834 * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
835 low() to get Unicode value of character, and just use unicode().
837 2004-09-26 Darin Adler <darin@apple.com>
839 - refine charAt/charCodeAt fix slightly
841 * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
842 omitted parameter, as we do everywhere else, and as other browsers do here.
844 2004-09-26 Darin Adler <darin@apple.com>
848 - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
850 * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
851 the program. We were doing this properly for functions, but not entire programs.
853 - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
855 * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
856 and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
858 * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
864 2004-09-14 Richard Williamson <rjw@apple.com>
866 1. Add class parameter to object allocation function. This is somewhat redundant, given that
867 the allocation function is in the class function vector, but people wanted to use the same
868 allocation function for different classes.
870 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
872 3. Add support for a default function on an object. This is a feature that ActiveX supports,
873 and will allow JavaScript code to be written that will look exactly the same for both ActiveX
874 plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
875 'Objective-C' bindings.
877 There bugs are covered by
879 <rdar://problem/3776343> Support for default functions in the JavaScript bindings
880 <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
881 <rdar://problem/3674754> Need to implement latest npruntime.h
885 * bindings/NP_jsobject.cpp:
889 * bindings/c/c_class.cpp:
890 * bindings/c/c_instance.cpp:
891 (CInstance::CInstance):
892 (CInstance::operator=):
893 (CInstance::invokeMethod):
894 (CInstance::invokeDefaultMethod):
895 * bindings/c/c_instance.h:
896 * bindings/c/c_runtime.cpp:
897 * bindings/c/c_runtime.h:
898 * bindings/jni/jni_instance.cpp:
899 (JavaInstance::invokeDefaultMethod):
900 * bindings/jni/jni_instance.h:
901 * bindings/npruntime.cpp:
903 * bindings/npruntime.h:
904 * bindings/objc/WebScriptObject.h:
905 * bindings/objc/objc_class.mm:
906 (ObjcClass::fallbackObject):
907 * bindings/objc/objc_instance.h:
908 * bindings/objc/objc_instance.mm:
909 (ObjcInstance::invokeDefaultMethod):
910 * bindings/objc/objc_runtime.h:
911 * bindings/objc/objc_runtime.mm:
912 (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
913 (ObjcFallbackObjectImp::get):
914 (ObjcFallbackObjectImp::put):
915 (ObjcFallbackObjectImp::canPut):
916 (ObjcFallbackObjectImp::implementsCall):
917 (ObjcFallbackObjectImp::call):
918 (ObjcFallbackObjectImp::hasProperty):
919 (ObjcFallbackObjectImp::deleteProperty):
920 (ObjcFallbackObjectImp::defaultValue):
921 * bindings/runtime.h:
922 (KJS::Bindings::Class::fallbackObject):
923 (KJS::Bindings::Instance::getValueOfUndefinedField):
924 (KJS::Bindings::Instance::setValueOfUndefinedField):
925 (KJS::Bindings::Instance::valueOf):
926 * bindings/runtime_object.cpp:
927 (RuntimeObjectImp::implementsCall):
928 (RuntimeObjectImp::call):
929 * bindings/runtime_object.h:
931 2004-09-13 Maciej Stachowiak <mjs@apple.com>
935 <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
937 * kjs/string_object.cpp:
938 (StringProtoFuncImp::call): Replaced implementation of replace()
939 method with function below...
940 (replace): In order to avoid excessive allocation and copying,
941 figure out the ranges of the original string and replacement
942 strings to be assembled, instead of constantly creating new
943 strings at each substitution. The old behavior is basically O(N^2)
944 for a global replace on a pattern that matches many places in the
946 (regExpIsGlobal): Helper function for the above.
947 (expandSourceRanges): ditto
948 (pushSourceRange): ditto
949 (expandReplacements): ditto
950 (pushReplacement): ditto
952 (KJS::UString::spliceSubstringsWithSeparators): New method that
953 pieces together substring ranges of this string together with
954 specified separators, all at one go.
956 (KJS::UString::Range::Range): Added new helper class to represent
959 2004-09-14 Maciej Stachowiak <mjs@apple.com>
963 - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
966 (KJS::GlobalFuncImp::call): Make sure to escape null
967 characters. This is a bug in the new code that made part of the
970 2004-09-13 Darin Adler <darin@apple.com>
972 Reviewed by Kevin and Maciej.
974 - new function to support fix for DIG bug in WebCore
976 * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
977 * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
979 2004-09-12 Darin Adler <darin@apple.com>
981 * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
982 of escape and unescape.
984 2004-09-12 Darin Adler <darin@apple.com>
988 - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
990 * kjs/date_object.cpp:
991 (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
992 uses CFDateFormatter.
993 (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
995 2004-09-09 Maciej Stachowiak <mjs@apple.com>
999 <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
1002 (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
1003 ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
1005 (Lexer::isHexDigit): Made static and non-const.
1010 2004-09-06 Darin Adler <darin@apple.com>
1012 * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
1016 2004-09-01 Richard Williamson <rjw@apple.com>
1018 Add pid to exception messages (to help debug dashboard clients).
1022 * kjs/interpreter.cpp:
1023 (Interpreter::evaluate):
1027 2004-08-20 Richard Williamson <rjw@apple.com>
1029 Implemented new JNI abstraction. We no longer invoke Java methods
1030 directly with JNI, rather we call into the plugin. This allows the
1031 plugin to dispatch the call to the appropriate VM thread. This
1032 change should (will?) fix a whole class of threading related problems with
1037 * JavaScriptCore.pbproj/project.pbxproj:
1038 * bindings/c/c_instance.h:
1039 (KJS::Bindings::CInstance::setExecutionContext):
1040 (KJS::Bindings::CInstance::executionContext):
1041 * bindings/jni/jni_instance.cpp:
1042 (JavaInstance::JavaInstance):
1043 (JavaInstance::invokeMethod):
1044 (JavaInstance::setExecutionContext):
1045 (JavaInstance::executionContext):
1046 * bindings/jni/jni_instance.h:
1047 * bindings/jni/jni_jsobject.cpp:
1048 (JSObject::convertJObjectToValue):
1049 * bindings/jni/jni_runtime.cpp:
1050 (JavaField::JavaField):
1051 (JavaArray::convertJObjectToArray):
1052 (JavaField::valueFromInstance):
1053 (JavaArray::JavaArray):
1054 (JavaArray::valueAt):
1055 * bindings/jni/jni_runtime.h:
1056 (KJS::Bindings::JavaArray::operator=):
1057 (KJS::Bindings::JavaArray::executionContext):
1058 * bindings/jni/jni_utility.h:
1059 * bindings/objc/objc_instance.h:
1060 (KJS::Bindings::ObjcInstance::setExecutionContext):
1061 (KJS::Bindings::ObjcInstance::executionContext):
1062 * bindings/runtime.cpp:
1063 (Instance::createBindingForLanguageInstance):
1064 * bindings/runtime.h:
1065 * bindings/runtime_root.h:
1066 (KJS::Bindings::RootObject::nativeHandle):
1070 2004-08-19 Vicki Murley <vicki@apple.com>
1074 * kjs/property_map.cpp:
1075 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
1077 2004-08-17 Darin Adler <darin@apple.com>
1081 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
1083 * kjs/property_map.h: Added some private functions.
1084 * kjs/property_map.cpp:
1085 (KJS::PropertyMap::clear): Set sentinelCount to 0.
1086 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
1087 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
1088 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
1089 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
1090 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
1091 deleted-element sentinels.
1092 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
1094 2004-08-16 Maciej Stachowiak <mjs@apple.com>
1096 Code change by Eric Albert, reviewd by me.
1098 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
1100 * kjs/date_object.cpp:
1101 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
1102 entirely would be even better, but is not required to fix this bug.
1106 2004-08-16 Richard Williamson <rjw@apple.com>
1108 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
1110 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
1114 * bindings/NP_jsobject.cpp:
1116 * bindings/jni/jni_jsobject.cpp:
1118 * bindings/objc/WebScriptObject.mm:
1119 (-[WebScriptObject evaluateWebScript:]):
1121 2004-08-15 Richard Williamson <rjw@apple.com>
1123 More updates to np headers. Implemented new NPN functions.
1127 * bindings/NP_jsobject.cpp:
1131 * bindings/npruntime.h:
1133 2004-08-13 Darin Adler <darin@apple.com>
1135 - fix build so we can compile again
1137 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
1138 is good enough so that we can compile, but it's only a stopgap measure, because I think
1139 Richard has a newer one he wants to check in.
1141 2004-08-12 Richard Williamson <rjw@apple.com>
1143 Bring npruntime.h and friends closer to compliance with
1148 * JavaScriptCore.pbproj/project.pbxproj:
1149 * bindings/NP_jsobject.cpp:
1151 (_NPN_CreateScriptObject):
1156 (NPN_RemoveProperty):
1157 * bindings/NP_jsobject.h:
1158 * bindings/c/c_instance.cpp:
1159 (CInstance::invokeMethod):
1160 * bindings/c/c_utility.cpp:
1161 (convertNPVariantToValue):
1162 * bindings/npruntime.cpp:
1163 (NPN_IdentifierIsString):
1164 (NPN_VariantIsVoid):
1165 (NPN_VariantIsNull):
1166 (NPN_VariantIsUndefined):
1167 (NPN_VariantIsBool):
1168 (NPN_VariantIsInt32):
1169 (NPN_VariantIsDouble):
1170 (NPN_VariantIsString):
1171 (NPN_VariantIsObject):
1172 (NPN_VariantToBool):
1173 (NPN_VariantToString):
1174 (NPN_VariantToInt32):
1175 (NPN_VariantToDouble):
1176 (NPN_VariantToObject):
1177 (NPN_InitializeVariantAsVoid):
1178 (NPN_InitializeVariantAsNull):
1179 (NPN_InitializeVariantAsUndefined):
1180 (NPN_InitializeVariantWithBool):
1181 (NPN_InitializeVariantWithInt32):
1182 (NPN_InitializeVariantWithDouble):
1183 (NPN_InitializeVariantWithString):
1184 (NPN_InitializeVariantWithStringCopy):
1185 (NPN_InitializeVariantWithObject):
1186 (NPN_InitializeVariantWithVariant):
1187 (NPN_ReleaseVariantValue):
1189 * bindings/npruntime.h:
1191 (_NPString::_NPVariant::):
1192 * bindings/npruntime_priv.h: Added.
1194 2004-08-12 Darin Adler <darin@apple.com>
1198 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
1201 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
1202 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
1203 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
1204 to skip leading "+" or "-".
1208 2004-08-12 Darin Adler <darin@apple.com>
1212 - fixed 43 Mozilla JavaScript tests
1214 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
1215 * kjs/date_object.cpp:
1216 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
1217 than constructing a number object to pass to it.
1218 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
1219 (KJS::parseDate): Change to return a double instead of creating the Number object here.
1220 (KJS::timeClip): Implement this as specified in the language standard.
1222 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
1223 flags on the prototype property.
1226 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
1228 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
1230 (KJS::parseDigit): Added. Helper function for parseInt.
1231 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
1232 strtoll can handle. Also matches standard more closely.
1233 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
1235 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
1237 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
1239 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
1241 (Lexer::setCode): Clear error state.
1242 (Lexer::lex): Set error state if the lexer encounters an error
1245 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
1246 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
1248 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
1249 Change round to round values between -0.5 and -0 to -0 instead of +0.
1251 * kjs/nodes.h: Add evaluateReference function to GroupNode.
1252 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
1253 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
1254 would change x.y into a value that can't be deleted as a side effect.
1256 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
1259 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
1260 get rid of the fixed size limit for code.
1262 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
1263 returns the string without creating a new Rep, since I'm using substr in a place where it will
1264 often be passed a 0.
1266 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
1267 the other day that was making a couple tests fail.
1268 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1269 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1270 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1271 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1272 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1274 * kjs/string_object.lut.h: Regenerated.
1276 2004-08-11 Darin Adler <darin@apple.com>
1278 - fixed a tiny problem with the UTF-16 PCRE check-in
1280 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
1281 the ctype_meta flag to get set in items that should not have it.
1283 * pcre/chartables.c: Regenerated.
1285 2004-08-10 Richard Williamson <rjw@apple.com>
1287 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
1289 The following WebScripting methods are now supported on bound
1292 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
1293 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
1294 - (id)valueForUndefinedKey:(NSString *)key
1298 * bindings/c/c_class.cpp:
1299 (CClass::fieldNamed):
1300 * bindings/c/c_class.h:
1301 * bindings/jni/jni_class.cpp:
1302 (JavaClass::fieldNamed):
1303 * bindings/jni/jni_class.h:
1304 * bindings/objc/objc_class.h:
1305 (KJS::Bindings::ObjcClass::isa):
1306 * bindings/objc/objc_class.mm:
1307 (ObjcClass::methodsNamed):
1308 (ObjcClass::fieldNamed):
1309 (ObjcClass::fallbackObject):
1310 * bindings/objc/objc_instance.h:
1311 * bindings/objc/objc_instance.mm:
1312 (ObjcInstance::invokeMethod):
1313 (ObjcInstance::setValueOfField):
1314 (ObjcInstance::setValueOfUndefinedField):
1315 (ObjcInstance::getValueOfField):
1316 (ObjcInstance::getValueOfUndefinedField):
1317 * bindings/objc/objc_runtime.h:
1318 (KJS::Bindings::ObjcField::~ObjcField):
1319 (KJS::Bindings::ObjcField::ObjcField):
1320 (KJS::Bindings::ObjcField::operator=):
1321 (KJS::Bindings::FallbackObjectImp::classInfo):
1322 * bindings/objc/objc_runtime.mm:
1323 (ObjcField::ObjcField):
1326 (ObjcField::valueFromInstance):
1327 (ObjcField::setValueToInstance):
1328 (FallbackObjectImp::FallbackObjectImp):
1329 (FallbackObjectImp::get):
1330 (FallbackObjectImp::put):
1331 (FallbackObjectImp::canPut):
1332 (FallbackObjectImp::implementsCall):
1333 (FallbackObjectImp::call):
1334 (FallbackObjectImp::hasProperty):
1335 (FallbackObjectImp::deleteProperty):
1336 (FallbackObjectImp::defaultValue):
1337 * bindings/runtime.h:
1338 (KJS::Bindings::Class::fallbackObject):
1339 (KJS::Bindings::Instance::getValueOfUndefinedField):
1340 (KJS::Bindings::Instance::setValueOfUndefinedField):
1341 * bindings/runtime_object.cpp:
1342 (RuntimeObjectImp::get):
1343 (RuntimeObjectImp::put):
1344 (RuntimeObjectImp::canPut):
1345 (RuntimeObjectImp::hasProperty):
1346 * bindings/testbindings.mm:
1347 (-[MyFirstInterface valueForUndefinedKey:]):
1348 (-[MyFirstInterface setValue:forUndefinedKey:]):
1350 2004-08-10 Darin Adler <darin@apple.com>
1354 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
1356 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
1357 or uint16_t depending on the mode, and used appropriate in the 7 public functions
1358 that need to use it.
1359 * pcre/pcre.c: Add UTF-16 support to all functions.
1360 * pcre/study.c: Ditto.
1362 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
1363 the mode. Changed declarations to use symbolic constants and typedefs so we size
1364 things to ichar when needed.
1366 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
1367 sized to 16-bit characters instead of 8-bit.
1370 (pcre_copy_substring): Use pcre_char instead of char.
1371 (pcre_get_substring_list): Ditto.
1372 (pcre_free_substring_list): Ditto.
1373 (pcre_get_substring): Ditto.
1374 (pcre_free_substring): Ditto.
1376 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
1377 of hard-coding 8-bit table sizes.
1379 * pcre/chartables.c: Regenerated.
1381 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
1382 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
1383 is not null. The null string still has a null pointer. This prevents us from
1384 passing a null through to the regular expression engine (which results in a null
1385 error even when the string length is 0).
1388 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
1389 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
1391 2004-08-09 Darin Adler <darin@apple.com>
1395 - fixed 28 Mozilla JavaScript tests
1397 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
1398 checking the number of arguments for the join method.
1400 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
1401 than integers, so we aren't limited to 32 bits.
1403 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
1404 the implementation of the pow operation. Also simplied a case that was handling positive
1405 and negative infinity separately.
1407 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
1408 putting them in a long, so that unsigned shift will work properly.
1410 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
1412 * kjs/operations.cpp:
1413 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
1414 sign of isinf; our isinf function returns +1 even for negative infinity.
1415 (KJS::isNegInf): And again.
1416 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
1417 Our floating point already handles the various infinity cases correctly.
1419 * kjs/regexp_object.cpp:
1420 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
1421 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
1422 array in cases where we did not match.
1423 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
1424 "global", "ignoreCase", "multiline", and "source".
1426 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
1427 string into undefined rather than an empty string. For the slice method, handle an
1428 undefined parameter for the limit properly as decribed in the specification, and add
1429 the limit to one case that didn't have the limit at all. For the methods that generate
1430 HTML strings, use lowercase tags instead of uppercase.
1433 (KJS::UChar::toLower): Use u_tolower from the ICU library.
1434 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
1435 (KJS::UString::append): Fix some math that caused a buffer overflow.
1436 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
1437 flag) rather than converting them all to 0.
1438 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
1440 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
1442 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
1443 the Unicode specification in a few cases where it was wrong before.
1444 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
1445 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
1446 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
1447 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
1448 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1449 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1450 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1451 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1452 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1454 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
1456 * kjs/number_object.lut.h: Regenerated.
1458 2004-08-09 Darin Adler <darin@apple.com>
1462 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
1464 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
1465 we get a buffer overflow.
1469 2004-08-05 Richard Williamson <rjw@apple.com>
1471 Fixed part of 3674747. The QT guys need this for feature freeze.
1473 This patch implements support for the
1475 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
1477 method of objects bound to JavaScript.
1482 * bindings/objc/objc_class.mm:
1483 (ObjcClass::methodsNamed):
1484 (ObjcClass::fieldNamed):
1485 * bindings/objc/objc_instance.mm:
1486 (ObjcInstance::invokeMethod):
1487 * bindings/objc/objc_runtime.h:
1488 (KJS::Bindings::ObjcMethod::~ObjcMethod):
1489 (KJS::Bindings::ObjcMethod::isFallbackMethod):
1490 (KJS::Bindings::ObjcMethod::javaScriptName):
1491 * bindings/objc/objc_runtime.mm:
1492 (ObjcMethod::ObjcMethod):
1493 (ObjcMethod::getMethodSignature):
1494 (ObjcMethod::setJavaScriptName):
1495 * bindings/testbindings.mm:
1497 2004-08-04 Vicki Murley <vicki@apple.com>
1501 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
1504 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
1505 go to the next line and continue parsing the string (instead of failing). This matches
1506 behavior in Mac IE and Mozilla.
1508 2004-08-03 Kevin Decker <kdecker@apple.com>
1512 Rolled in changes from the latest KJS sources that support additional
1513 Number.prototype functions.
1515 Specifically this patch covers the follow parts of the ECMA 3 spec:
1516 15.7.4.5, 15.7.4.6, and 15.7.4.7
1519 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
1520 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
1521 <rdar://problem/3749591> missing Number.toExponential prototype implementation
1523 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
1524 list of supported identifiers (a macro).
1525 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
1526 and toExponential().
1527 (NumberPrototypeImp::NumberPrototypeImp):
1528 (NumberProtoFuncImp::call):
1529 * kjs/number_object.h: Added property names for toFixed, toPrecision,
1531 (KJS::NumberProtoFuncImp::):
1532 * tests/mozilla/expected.html: Update results.
1534 2004-08-03 Darin Adler <darin@apple.com>
1538 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
1540 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
1541 we are supposed to just copy the regular expression object, and do so.
1542 Also tighten up arguments check to handle case where an actual "undefined"
1543 is passed rather than just omitting an argument.
1545 * tests/mozilla/expected.html: Update results.
1547 2004-08-02 Darin Adler <darin@apple.com>
1549 * tests/mozilla/.cvsignore: Added.
1550 * tests/mozilla/expected.html: Update results.
1552 2004-08-02 Darin Adler <darin@apple.com>
1556 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
1558 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
1559 Append the flags here so more tests paseed.
1561 2004-08-02 Darin Adler <darin@apple.com>
1565 - fixed a couple things making 5 Mozilla regexp tests pass
1567 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
1569 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
1570 be used as the flags string when no parameter was passed.
1572 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
1573 Added a class info object for RegExp prototype so it can return
1574 a string instead of raising an exception when converting to a string.
1576 * tests/mozilla/expected.html: Update results.
1578 2004-08-02 Darin Adler <darin@apple.com>
1582 - fix crashes in mozilla tests due to mishandling NaN
1584 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
1585 calls to toInteger so that NaN will get turned into something that fits in an integer.
1586 These were the ones John already fixed, but his fix used isnan and the new fix is
1589 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
1590 after a call to toInteger to handle NaN properly. Also removed separate check
1591 for undefined that's not needed.
1593 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
1594 as in the above two files, but for a lot more functions. Also changed one place with
1595 an explicit check for undefined to instead just check isNaN.
1597 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
1598 like me who don't keep $SYMROOTS in their $PATH.
1604 2004-07-26 Kevin Decker <kdecker@apple.com>
1606 Changes done by Darin, reviewed by Kevin.
1608 - changed testkjs to build in Xcode rather than from Makefile
1610 * .cvsignore: Removed obsolete files from this list.
1611 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
1612 Changed to build target "All" rather than default target. This makes us
1613 build the testkjs test tool.
1614 * dummy.cpp: Removed.
1615 * kjs/.cvsignore: Removed obsolete files from this list, including
1616 the testkjs tool, which is now built in the symroots directory.
1617 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
1618 changed this file. Also this has the nice side effect of causing the tool
1619 to be rebuilt in the new location even if there are no other changes in
1620 your tree when you check this out.
1621 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
1622 without setting the execute bit on jsDriver.pl.
1624 2004-07-22 Kevin Decker <kdecker@apple.com>
1628 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
1630 * kjs/function_object.cpp:
1631 (FunctionObjectImp::construct):
1632 * kjs/function_object.h:
1634 (KJS::ObjectImp::construct):
1636 (KJS::Object::construct):
1638 2004-07-21 Darin Adler <darin@apple.com>
1640 * bindings/npruntime.h: Fixed typo.
1642 2004-07-19 John Sullivan <sullivan@apple.com>
1646 - bulletproofed array.slice() against NAN arguments. Harri noticed this
1647 vulnerability in my patch for 3714644
1649 * kjs/array_object.cpp:
1650 (ArrayProtoFuncImp::call):
1651 handle NAN parameters passed to slice() by clamping to 0 and length.
1653 2004-07-19 Richard Williamson <rjw@apple.com>
1655 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
1660 * bindings/jni/jni_jsobject.cpp:
1662 (JSObject::JSObject):
1664 2004-07-16 John Sullivan <sullivan@apple.com>
1668 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
1669 hangs browser with javascript
1671 * kjs/array_object.cpp:
1672 (ArrayProtoFuncImp::call):
1673 Check for undefined type for args[0] the same way we were already checking
1674 for args[1]. In this case, args was zero-length, but we were treating
1675 args[0] like an integer anyway. Resulted in some code looping from a NAN
1676 value to 4, taking approximately forever.
1678 * JavaScriptCore.pbproj/project.pbxproj:
1683 2004-07-14 Maciej Stachowiak <mjs@apple.com>
1687 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
1688 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
1690 * kjs/number_object.cpp:
1691 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
1693 2004-07-13 Kevin Decker <kdecker@apple.com>
1695 Reviewed by kocienda.
1697 - made testkjs and JavaScriptCore a subtarget of 'All'
1698 - testkjs now builds in $SYMROOTS
1700 * JavaScriptCore.pbproj/project.pbxproj:
1704 2004-06-24 Chris Blumenberg <cblu@apple.com>
1706 Ignore .mode1 files in JavaScriptCore.pbproj
1708 Reviewed by kocienda.
1710 * JavaScriptCore.pbproj/.cvsignore:
1712 2004-06-23 Richard Williamson <rjw@apple.com>
1714 Implemented changes for latest npruntime.h.
1718 * JavaScriptCore.pbproj/project.pbxproj:
1719 * bindings/NP_jsobject.cpp:
1720 (listFromVariantArgs):
1721 (identiferFromNPIdentifier):
1722 (_NPN_CreateScriptObject):
1727 (NPN_RemoveProperty):
1728 * bindings/NP_jsobject.h:
1729 * bindings/c/c_class.cpp:
1730 (CClass::methodsNamed):
1731 (CClass::fieldNamed):
1732 * bindings/c/c_instance.cpp:
1733 (CInstance::invokeMethod):
1734 * bindings/c/c_utility.cpp:
1735 (convertNPVariantToValue):
1736 * bindings/c/c_utility.h:
1737 * bindings/npruntime.cpp:
1738 (stringIdentifierEqual):
1739 (stringIdentifierHash):
1740 (getStringIdentifierDictionary):
1741 (intIdentifierEqual):
1742 (intIdentifierHash):
1743 (getIntIdentifierDictionary):
1744 (NPN_GetStringIdentifier):
1745 (NPN_GetStringIdentifiers):
1746 (NPN_GetIntIdentifier):
1747 (NPN_IdentifierIsString):
1748 (NPN_UTF8FromIdentifier):
1749 (NPN_VariantToInt32):
1750 (NPN_VariantToDouble):
1752 * bindings/npruntime.h:
1753 * bindings/objc/WebScriptObject.mm:
1754 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1755 * bindings/runtime_object.cpp:
1756 (RuntimeObjectImp::~RuntimeObjectImp):
1757 * bindings/runtime_root.cpp:
1758 (KJS::Bindings::rootForInterpreter):
1759 * bindings/testbindings.cpp:
1760 (initializeIdentifiers):
1766 === JavaScriptCore-146.1 ===
1768 2004-06-16 Richard Williamson <rjw@apple.com>
1770 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1772 This turned out to be a show stopper for Dashboard. Accessing a nil
1773 ObjC property from JS caused a crash. Similar to the problem
1774 3696112 fixed below.
1778 * bindings/objc/objc_runtime.mm:
1779 (KJS::Bindings::ObjcField::valueFromInstance):
1783 2004-06-16 Richard Williamson <rjw@apple.com>
1785 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1787 This turned out to be a show stopper for Dashboard. We now
1788 return Undefined() when nil is returned from a ObjC method
1789 that returns an object type.
1793 * bindings/objc/objc_utility.mm:
1794 (KJS::Bindings::convertObjcValueToValue):
1798 2004-06-15 Richard Williamson <rjw@apple.com>
1800 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1802 No longer need to check respondsToSelector: for
1803 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1804 because these now have a default implementation on NSObject.
1808 * bindings/objc/objc_class.mm:
1809 (ObjcClass::methodsNamed):
1810 (ObjcClass::fieldNamed):
1812 2004-06-14 Darin Adler <darin@apple.com>
1816 - fixed some things for GC that Patrick missed, or that happened after the branch
1818 * bindings/objc/WebScriptObject.mm:
1819 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1820 (-[WebScriptObject finalize]): Added.
1822 - added some missing nil checks
1824 * bindings/objc/objc_instance.mm:
1825 (ObjcInstance::ObjcInstance): Check for nil.
1826 (ObjcInstance::~ObjcInstance): Check for nil.
1827 (ObjcInstance::operator=): Check for nil.
1829 2004-06-14 Darin Adler <darin@apple.com>
1831 Reviewed by me, code changes by Patrick Beard.
1833 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1835 * bindings/objc/objc_instance.mm:
1836 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1837 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1838 (ObjcInstance::operator=): More of the same.
1839 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1841 * bindings/objc/objc_runtime.mm:
1842 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1843 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1844 (ObjcArray::operator=): More of the same.
1846 * bindings/testbindings.mm: Fixed incorrect license.
1847 (main): Use [pool drain] if compiling on Tiger.
1851 2004-06-10 Kevin Decker <kdecker@apple.com>
1857 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1859 (KJS::Lexer::lineNo):
1860 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1862 === JavaScriptCore-143.2 ===
1864 2004-06-07 Darin Adler <darin@apple.com>
1866 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1868 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1869 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1871 === JavaScriptCore-143.1 ===
1873 2004-06-04 Kevin Decker <kdecker@apple.com>
1877 - fixed <rdar://problem/3680594>
1880 (KJS::Error::create):
1884 2004-06-04 Darin Adler <darin@apple.com>
1886 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1888 2004-06-04 Kevin Decker <kdecker@apple.com>
1892 - ObjC bindings do not (yet) pass along sourceurl or line numbers
1893 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1894 - changed the wording of an error message
1895 - the lexer, parser, and interpreter have been made "sourceURL aware"
1896 - stored the url into Error
1898 * bindings/NP_jsobject.cpp:
1900 * bindings/jni/jni_jsobject.cpp:
1902 * bindings/objc/WebScriptObject.mm:
1903 (-[WebScriptObject evaluateWebScript:]):
1905 (GlobalFuncImp::call):
1906 * kjs/function_object.cpp:
1907 (FunctionObjectImp::construct):
1910 (InterpreterImp::checkSyntax):
1911 (InterpreterImp::evaluate):
1913 * kjs/interpreter.cpp:
1914 (Interpreter::evaluate):
1915 * kjs/interpreter.h:
1919 (KJS::Lexer::sourceURL):
1923 (FunctionCallNode::evaluate):
1926 (KJS::Error::create):
1929 2004-06-04 Richard Williamson <rjw@apple.com>
1931 Fixed crash when attempting to access properties on nil
1936 * bindings/objc/objc_instance.mm:
1937 (ObjcInstance::getClass):
1938 * bindings/runtime_object.cpp:
1939 (RuntimeObjectImp::get):
1940 * bindings/testM.js:
1941 * bindings/testbindings.mm:
1942 (-[MyFirstInterface getString]):
1944 2004-05-27 Kevin Decker <kdecker@apple.com>
1948 -revised generated error message content
1950 * kjs/error_object.cpp:
1951 (ErrorProtoFuncImp::call):
1955 (KJS::Error::create):
1959 2004-05-27 Richard Williamson <rjw@apple.com>
1961 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1965 * bindings/objc/WebScriptObject.h:
1967 2004-05-27 Darin Adler <darin@apple.com>
1971 - moved to new symlink technique for embedding frameworks
1973 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1974 because we don't need it any more.
1976 2004-05-24 Richard Williamson <rjw@apple.com>
1978 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1979 fixed ClassInfo to correctly reflect inheritance. This is required
1980 because of the runtime checks in JSC for arrays, i.e. in
1981 the Function objects apply method.
1985 * bindings/jni/jni_runtime.cpp:
1986 (JavaArray::convertJObjectToArray):
1987 * bindings/objc/objc_utility.mm:
1988 (KJS::Bindings::convertObjcValueToValue):
1989 * bindings/runtime_array.cpp:
1990 (RuntimeArrayImp::RuntimeArrayImp):
1991 * bindings/runtime_array.h:
1992 * bindings/testM.js: Added.
1993 * bindings/testbindings.mm:
1994 (+[MyFirstInterface webScriptNameForSelector:]):
1995 (-[MyFirstInterface logMessages:]):
1996 (-[MyFirstInterface logMessage:prefix:]):
1997 (-[MyFirstInterface callJSObject::]):
1999 2004-05-22 Darin Adler <darin@apple.com>
2003 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
2005 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
2006 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
2007 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
2008 it hasn't been set explicitly.
2012 2004-05-20 Richard Williamson <rjw@apple.com>
2014 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
2015 can now be referenced like any other WebScriptObject, meaning
2016 you can do JS operations on them.
2018 All added implementation of finalizeForWebScript.
2022 * bindings/objc/WebScriptObject.h:
2023 * bindings/objc/WebScriptObject.mm:
2024 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
2025 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2026 (-[WebScriptObject KJS::]):
2027 (-[WebScriptObject dealloc]):
2028 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2029 (-[WebScriptObject evaluateWebScript:]):
2030 (-[WebScriptObject setValue:forKey:]):
2031 (-[WebScriptObject valueForKey:]):
2032 (-[WebScriptObject stringRepresentation]):
2033 * bindings/objc/WebScriptObjectPrivate.h:
2034 * bindings/objc/objc_instance.mm:
2035 (ObjcInstance::~ObjcInstance):
2037 2004-05-19 Richard Williamson <rjw@apple.com>
2039 Removed extraneous tabs that were added (by XCode?).
2041 * bindings/objc/WebScriptObject.h:
2043 2004-05-19 Darin Adler <darin@apple.com>
2045 - fixed headers with licenses mangled by Xcode auto-indenting
2047 * bindings/jni/jni_jsobject.cpp:
2048 * bindings/jni/jni_jsobject.h:
2049 * bindings/runtime_array.h:
2050 * bindings/runtime_root.cpp:
2051 * bindings/runtime_root.h:
2053 2004-05-18 Richard Williamson <rjw@apple.com>
2055 Added exception logging. Also check for exception and
2056 set results as appropriate.
2058 Reviewed by Maciej (partially reviewed).
2060 * bindings/objc/WebScriptObject.mm:
2061 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2062 (-[WebScriptObject evaluateWebScript:]):
2063 (-[WebScriptObject setValue:forKey:]):
2064 (-[WebScriptObject valueForKey:]):
2066 2004-05-18 Richard Williamson <rjw@apple.com>
2068 Finsished implementing support for windowScriptObject.
2069 Had to make WebScriptObjectPrivate.h accessible from
2074 * JavaScriptCore.pbproj/project.pbxproj:
2075 * bindings/objc/WebScriptObjectPrivate.h:
2077 2004-05-18 Richard Williamson <rjw@apple.com>
2079 Use KVC to set/get values instead of directly accessing
2084 * bindings/objc/WebScriptObject.mm:
2085 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2086 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2087 * bindings/objc/objc_runtime.mm:
2088 (ObjcField::valueFromInstance):
2089 (convertValueToObjcObject):
2090 (ObjcField::setValueToInstance):
2092 2004-05-17 Richard Williamson <rjw@apple.com>
2094 Implemented new API for WebScriptObject.
2096 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
2097 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
2101 * JavaScriptCore.pbproj/project.pbxproj:
2102 * bindings/c/c_instance.cpp:
2103 (CInstance::invokeMethod):
2104 * bindings/jni/jni_instance.cpp:
2105 (JavaInstance::invokeMethod):
2106 * bindings/jni/jni_jsobject.cpp:
2107 (JSObject::convertValueToJObject):
2108 * bindings/jni/jni_utility.cpp:
2109 (KJS::Bindings::getJNIField):
2110 * bindings/objc/WebScriptObject.mm:
2112 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2113 (-[WebScriptObject KJS::]):
2114 (-[WebScriptObject dealloc]):
2115 (+[WebScriptObject throwException:]):
2117 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2118 (-[WebScriptObject evaluateWebScript:]):
2119 (-[WebScriptObject setValue:forKey:]):
2120 (-[WebScriptObject valueForKey:]):
2121 (-[WebScriptObject stringRepresentation]):
2122 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2123 (+[WebUndefined undefined]):
2124 (-[WebUndefined initWithCoder:]):
2125 (-[WebUndefined encodeWithCoder:]):
2126 (-[WebUndefined copyWithZone:]):
2127 (-[WebUndefined retain]):
2128 (-[WebUndefined release]):
2129 (-[WebUndefined retainCount]):
2130 (-[WebUndefined autorelease]):
2131 (-[WebUndefined dealloc]):
2132 (-[WebUndefined copy]):
2133 (-[WebUndefined replacementObjectForPortCoder:]):
2134 * bindings/objc/WebScriptObjectPrivate.h: Added.
2135 * bindings/objc/objc_class.mm:
2136 (ObjcClass::methodsNamed):
2137 (ObjcClass::fieldNamed):
2138 * bindings/objc/objc_instance.mm:
2139 (ObjcInstance::invokeMethod):
2140 * bindings/objc/objc_jsobject.h:
2141 * bindings/objc/objc_jsobject.mm:
2142 * bindings/objc/objc_runtime.mm:
2143 (ObjcField::valueFromInstance):
2144 * bindings/objc/objc_utility.mm:
2145 (KJS::Bindings::JSMethodNameToObjCMethodName):
2146 (KJS::Bindings::convertValueToObjcValue):
2147 (KJS::Bindings::convertObjcValueToValue):
2148 * bindings/runtime.cpp:
2149 (Instance::setDidExecuteFunction):
2150 (Instance::didExecuteFunction):
2151 (Instance::setValueOfField):
2152 * bindings/runtime.h:
2153 * bindings/testbindings.mm:
2154 (+[MyFirstInterface webScriptNameForSelector:]):
2155 (-[MyFirstInterface callJSObject::]):
2157 2004-05-14 Vicki Murley <vicki@apple.com>
2161 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
2163 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
2167 2004-05-13 Richard Williamson <rjw@apple.com>
2174 * bindings/objc/WebScriptObject.h:
2176 2004-05-13 Richard Williamson <rjw@apple.com>
2178 Approved API changes. Currently unimplemented.
2183 * JavaScriptCore.pbproj/project.pbxproj:
2184 * bindings/objc/WebScriptObject.h: Added.
2185 * bindings/objc/WebScriptObject.mm: Added.
2186 (+[WebScriptObject throwException:]):
2187 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2188 (-[WebScriptObject evaluateWebScript:]):
2189 (-[WebScriptObject stringRepresentation]):
2190 (+[WebUndefined undefined]):
2191 (-[WebUndefined initWithCoder:]):
2192 (-[WebUndefined encodeWithCoder:]):
2193 (-[WebUndefined copyWithZone:]):
2195 2004-05-07 Vicki Murley <vicki@apple.com>
2199 Turn off GC since it uses ppc only instructions (which breaks
2202 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
2206 2004-05-07 Maciej Stachowiak <mjs@apple.com>
2210 - add -funroll-loops=16 compiler option for approx .5% speedup on
2211 HTML iBench and .5-1% speedup on JS iBench.
2213 * JavaScriptCore.pbproj/project.pbxproj:
2215 2004-04-25 Maciej Stachowiak <mjs@apple.com>
2219 Enable full conservative GC mode in addition to test mode. When
2220 conservative GC is enabled, we now get an 11% speed improvement on
2221 the iBench. Also fix some spots I missed before.
2223 Specific noteworth changes:
2225 * kjs/collector.cpp:
2226 (KJS::Collector::markStackObjectsConservatively): Check possible
2227 cell pointers for 8-byte aligment and verify they are not 0.
2229 * kjs/protected_values.cpp:
2230 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
2231 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
2233 (KJS::gcProtectNullTolerant): ...to here...
2234 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
2235 tolerance, and doing the check is expensive.
2237 * kjs/protected_values.cpp:
2238 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
2239 that is still very good.
2244 (KJS::ProtectedValue::ProtectedValue):
2245 (KJS::ProtectedValue::~ProtectedValue):
2246 (KJS::ProtectedValue::operator=):
2247 (KJS::ProtectedObject::ProtectedObject):
2248 (KJS::ProtectedObject::~ProtectedObject):
2249 (KJS::ProtectedObject::operator=):
2250 (KJS::ProtectedReference::ProtectedReference):
2251 (KJS::ProtectedReference::~ProtectedReference):
2252 (KJS::ProtectedReference::operator=):
2253 * kjs/protected_values.cpp:
2254 (KJS::ProtectedValues::getProtectCount):
2255 (KJS::ProtectedValues::increaseProtectCount):
2256 (KJS::ProtectedValues::decreaseProtectCount):
2257 (KJS::ProtectedValues::computeHash):
2258 * bindings/runtime_root.cpp:
2259 (KJS::Bindings::addNativeReference):
2260 (KJS::Bindings::removeNativeReference):
2261 (RootObject::removeAllNativeReferences):
2262 * bindings/runtime_root.h:
2263 (KJS::Bindings::RootObject::~RootObject):
2264 (KJS::Bindings::RootObject::setRootObjectImp):
2265 * kjs/collector.cpp:
2266 (KJS::Collector::allocate):
2267 (KJS::Collector::collect):
2270 (NumberImp::create):
2271 (InterpreterImp::globalInit):
2272 (InterpreterImp::globalClear):
2273 (InterpreterImp::mark):
2275 (KJS::List::derefValues):
2276 (KJS::List::refValues):
2277 (KJS::List::append):
2279 (KJS::ObjectImp::setInternalValue):
2280 (KJS::ObjectImp::putDirect):
2285 (KJS::ValueImp::ValueImp):
2286 (KJS::ValueImp::~ValueImp):
2288 (KJS::Value::Value):
2289 (KJS::Value::~Value):
2290 (KJS::Value::operator=):
2292 2004-04-30 Richard Williamson <rjw@apple.com>
2294 Asking an NSInvocation for it's return value when return type
2295 is void throws an exception. Added check for void return types
2296 to avoid this exception.
2300 * bindings/objc/objc_instance.mm:
2301 (ObjcInstance::invokeMethod):
2303 2004-04-29 Richard Williamson <rjw@apple.com>
2305 Fixed several bad problems with the ObjC bindings. In particular, conversion
2306 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
2310 * bindings/objc/objc_jsobject.h:
2311 * bindings/objc/objc_jsobject.mm:
2312 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2313 (-[JavaScriptObject KJS::]):
2314 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2315 (-[JavaScriptObject call:arguments:]):
2316 (-[JavaScriptObject evaluate:]):
2317 (-[JavaScriptObject getMember:]):
2318 (-[JavaScriptObject getSlot:]):
2319 * bindings/objc/objc_runtime.mm:
2320 (ObjcField::valueFromInstance):
2321 (ObjcField::setValueToInstance):
2322 * bindings/objc/objc_utility.mm:
2323 (KJS::Bindings::convertValueToObjcValue):
2324 (KJS::Bindings::convertObjcValueToValue):
2325 * bindings/runtime.h:
2326 * bindings/runtime_root.cpp:
2327 (KJS::Bindings::rootForInterpreter):
2328 (KJS::Bindings::addNativeReference):
2329 (KJS::Bindings::removeNativeReference):
2330 * bindings/runtime_root.h:
2331 * bindings/testbindings.mm:
2332 (-[MyFirstInterface logMessage:]):
2333 (-[MyFirstInterface setJSObject:]):
2334 (-[MyFirstInterface callJSObject::]):
2336 2004-04-24 Darin Adler <darin@apple.com>
2340 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
2343 2004-04-23 Maciej Stachowiak <mjs@apple.com>
2347 Implementation of conservative GC, based partly on code from
2348 Darin. It's turned off for now, so it shouldn't have any effect on
2351 * JavaScriptCore.pbproj/project.pbxproj:
2352 * kjs/collector.cpp:
2353 (KJS::Collector::markStackObjectsConservatively):
2354 (KJS::Collector::markProtectedObjects):
2355 (KJS::Collector::collect):
2360 * kjs/protected_values.cpp: Added.
2361 (KJS::ProtectedValues::getProtectCount):
2362 (KJS::ProtectedValues::increaseProtectCount):
2363 (KJS::ProtectedValues::insert):
2364 (KJS::ProtectedValues::decreaseProtectCount):
2365 (KJS::ProtectedValues::expand):
2366 (KJS::ProtectedValues::shrink):
2367 (KJS::ProtectedValues::rehash):
2368 (KJS::ProtectedValues::computeHash):
2369 * kjs/protected_values.h: Added.
2371 (ValueImp::useConservativeMark):
2379 2004-04-22 Richard Williamson <rjw@apple.com>
2381 Fixed build snafu (re-declaration of NPBool in npruntime.h and
2384 * bindings/npruntime.h:
2386 2004-04-22 Richard Williamson <rjw@apple.com>
2388 Updated plugin binding API to reflect latest revision from
2391 Biggest change is the introduction of NPVariant used to represent
2392 value types. NPVariant replaces the use of NPObject for the
2393 exchange of values between scripting environment and native code.
2397 * JavaScriptCore.pbproj/project.pbxproj:
2398 * bindings/NP_jsobject.cpp:
2399 (identiferFromNPIdentifier):
2405 (NPN_GetPropertyAtIndex):
2406 (NPN_SetPropertyAtIndex):
2407 * bindings/c/c_class.cpp:
2408 (CClass::methodsNamed):
2409 (CClass::fieldNamed):
2410 * bindings/c/c_instance.cpp:
2411 (CInstance::invokeMethod):
2412 (CInstance::defaultValue):
2413 * bindings/c/c_runtime.cpp:
2414 (CField::valueFromInstance):
2415 (CField::setValueToInstance):
2416 * bindings/c/c_utility.cpp:
2417 (convertNPStringToUTF16):
2418 (convertUTF8ToUTF16):
2419 (coerceValueToNPVariantStringType):
2420 (convertValueToNPVariant):
2421 (convertNPVariantToValue):
2422 * bindings/c/c_utility.h:
2423 * bindings/npruntime.cpp:
2424 (NPN_GetIdentifier):
2425 (NPN_GetIdentifiers):
2426 (NPN_UTF8FromIdentifier):
2427 (NPN_VariantIsVoid):
2428 (NPN_VariantIsNull):
2429 (NPN_VariantIsUndefined):
2430 (NPN_VariantIsBool):
2431 (NPN_VariantIsInt32):
2432 (NPN_VariantIsDouble):
2433 (NPN_VariantIsString):
2434 (NPN_VariantIsObject):
2435 (NPN_VariantToBool):
2436 (NPN_VariantToString):
2437 (NPN_VariantToInt32):
2438 (NPN_VariantToDouble):
2439 (NPN_VariantToObject):
2440 (NPN_InitializeVariantAsVoid):
2441 (NPN_InitializeVariantAsNull):
2442 (NPN_InitializeVariantAsUndefined):
2443 (NPN_InitializeVariantWithBool):
2444 (NPN_InitializeVariantWithInt32):
2445 (NPN_InitializeVariantWithDouble):
2446 (NPN_InitializeVariantWithString):
2447 (NPN_InitializeVariantWithStringCopy):
2448 (NPN_InitializeVariantWithObject):
2449 (NPN_InitializeVariantWithVariant):
2450 (NPN_ReleaseVariantValue):
2453 (NPN_ReleaseObject):
2454 (NPN_IsKindOfClass):
2455 (NPN_SetExceptionWithUTF8):
2457 * bindings/npruntime.h:
2459 (_NPString::_NPVariant::):
2460 * bindings/testbindings.cpp:
2475 2004-04-22 Darin Adler <darin@apple.com>
2479 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
2482 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
2483 Was resulting in a buffer 2x the needed size.
2484 (KJS::UString::expandPreCapacity): Ditto.
2485 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
2487 2004-04-21 Maciej Stachowiak <mjs@apple.com>
2491 Preliminary change for conservative GC. Create "protected"
2492 subclasses to GC-protect objects when on heap, since we will soon
2493 remove the built-in refcounting of the normal wrapper classes. Use
2496 * JavaScriptCore.pbproj/project.pbxproj:
2499 (KJS::InterpreterImp::globalObject):
2500 * kjs/interpreter.h:
2501 * kjs/property_map.cpp:
2503 * kjs/reference_list.cpp:
2505 2004-04-19 Maciej Stachowiak <mjs@apple.com>
2509 Optimize prepend using the shared substring optimization. Also,
2510 limit the applicability of shared append and shared prepend. If
2511 you overdo it, it does more harm than good, because you create a
2512 bunch of strings that are disqualified from future shared
2513 append/prepend, for not much immediate savings in allocate/copy
2518 (KJS::UString::Rep::create):
2519 (KJS::UString::expandedSize):
2520 (KJS::UString::usedPreCapacity):
2521 (KJS::UString::expandCapacity):
2522 (KJS::UString::expandPreCapacity):
2523 (KJS::UString::UString):
2524 (KJS::UString::append):
2525 (KJS::UString::operator=):
2527 (KJS::UString::Rep::data):
2529 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2530 Reviewed by Richard.
2532 No more need for Completion or Reference to privately inherit from
2533 Value, none of the superclass functionality is used.
2540 2004-04-16 Richard Williamson <rjw@apple.com>
2542 Added interpreter lock protection around object creation.
2546 * bindings/runtime.cpp:
2547 (Instance::createRuntimeObject):
2549 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2553 Another JavaScript speed improvement: use the mechanism from
2554 string append optimization to make taking a substring fast, again
2557 A further 22% improvement on the 24fun string speed test.
2561 (KJS::UString::Rep::create):
2562 (KJS::UString::UString):
2563 (KJS::UString::append):
2564 (KJS::UString::operator=):
2565 (KJS::UString::substr):
2567 (KJS::UString::Rep::data):
2569 2004-04-13 Maciej Stachowiak <mjs@apple.com>
2573 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
2574 - fixed <rdar://problem/3600691>: Table generation test is really slow
2575 - fixed <rdar://problem/3600661>: 24fun date test is really slow
2577 80% speedup on the string test, lesser speedups on the other two.
2579 Two different optimizations here:
2581 1) Avoid large overhead of scanning strings to see if they are all
2582 ASCII before numeric conversion.
2585 (AssignNode::evaluate): Don't convert to integer until we know for
2586 sure the operation will need it. Attempting to convert strings to
2587 numbers is a waste when they are being appended with +=.
2589 2) Avoid huge cost of appending strings.
2591 This is done by allowing multiple strings to share a buffer but
2592 actually use different ranges of it. The first time a string is
2593 appended to, we start leaving at least 10% extra space in the
2594 buffer, so doing N appends to the same string takes O(log N)
2595 mallocs instead of O(N).
2597 * kjs/identifier.cpp:
2598 (KJS::Identifier::equal):
2599 (KJS::Identifier::add):
2602 (KJS::UCharReference::operator=):
2603 (KJS::UCharReference::ref):
2604 (KJS::UString::Rep::create):
2605 (KJS::UString::Rep::destroy):
2606 (KJS::UString::expandedSize):
2607 (KJS::UString::usedCapacity):
2608 (KJS::UString::expandCapacity):
2609 (KJS::UString::UString):
2610 (KJS::UString::null):
2611 (KJS::UString::append):
2612 (KJS::UString::operator=):
2613 (KJS::UString::toStrictUInt32):
2614 (KJS::UString::detach):
2615 (KJS::KJS::operator==):
2617 (KJS::UString::Rep::data):
2618 (KJS::UString::Rep::hash):
2620 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2624 - fix deployment build by avoiding deployment-only warning.
2626 * kjs/scope_chain.cpp:
2627 (KJS::ScopeChain::bottom):
2629 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2633 Changed things so that newly created objects get a prototype based
2634 on the scope chain of the current function, rather than the
2635 interpreter that started execution. This fixes the following bugs:
2637 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
2638 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
2640 * JavaScriptCore.pbproj/project.pbxproj:
2641 * kjs/array_object.cpp:
2642 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2643 (ArrayProtoFuncImp::ArrayProtoFuncImp):
2644 (ArrayProtoFuncImp::call):
2645 (ArrayObjectImp::construct):
2646 * kjs/bool_object.cpp:
2647 (BooleanObjectImp::construct):
2648 * kjs/date_object.cpp:
2649 (DateProtoFuncImp::DateProtoFuncImp):
2650 (DateProtoFuncImp::call):
2651 (DateObjectImp::construct):
2652 * kjs/error_object.cpp:
2653 (ErrorObjectImp::construct):
2655 (FunctionImp::FunctionImp):
2656 (FunctionImp::call):
2657 (DeclaredFunctionImp::construct):
2658 (ArgumentsImp::ArgumentsImp):
2659 (GlobalFuncImp::call):
2660 * kjs/function_object.cpp:
2661 (FunctionProtoFuncImp::call):
2662 (FunctionObjectImp::construct):
2664 (BooleanImp::toObject):
2665 (StringImp::toObject):
2666 (NumberImp::toObject):
2667 (InterpreterImp::InterpreterImp):
2668 (InterpreterImp::clear):
2669 (InterpreterImp::interpreterWithGlobalObject):
2671 * kjs/interpreter.cpp:
2672 (ExecState::lexicalInterpreter):
2673 * kjs/interpreter.h:
2674 (KJS::ExecState::dynamicInterpreter):
2675 (KJS::ExecState::interpreter):
2676 * kjs/math_object.cpp:
2677 (MathFuncImp::MathFuncImp):
2679 (StatementNode::hitStatement):
2680 (StatementNode::abortStatement):
2681 (RegExpNode::evaluate):
2682 (ElementNode::evaluate):
2683 (ArrayNode::evaluate):
2684 (ObjectLiteralNode::evaluate):
2685 (PropertyValueNode::evaluate):
2686 (FunctionCallNode::evaluate):
2687 (FuncDeclNode::processFuncDecl):
2688 (FuncExprNode::evaluate):
2689 * kjs/number_object.cpp:
2690 (NumberObjectImp::construct):
2692 (KJS::ObjectImp::defaultValue):
2693 (KJS::Error::create):
2694 * kjs/object_object.cpp:
2695 (ObjectObjectImp::construct):
2696 * kjs/reference.cpp:
2697 (Reference::putValue):
2698 * kjs/regexp_object.cpp:
2699 (RegExpProtoFuncImp::call):
2700 (RegExpObjectImp::arrayOfMatches):
2701 (RegExpObjectImp::construct):
2702 * kjs/scope_chain.cpp:
2703 (KJS::ScopeChain::bottom):
2704 * kjs/scope_chain.h:
2705 * kjs/string_object.cpp:
2706 (StringProtoFuncImp::StringProtoFuncImp):
2707 (StringProtoFuncImp::call):
2708 (StringObjectImp::construct):
2714 2004-03-31 Richard Williamson <rjw@apple.com>
2716 Tedious renames based on feedback from plugin-futures list.
2717 NP_ functions are renamed with NPN_ prefix.
2718 Types prefix renamed from NP_ to NP.
2719 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
2721 No review because this was just a renaming patch.
2723 * bindings/NP_jsobject.cpp:
2726 (identiferFromNPIdentifier):
2731 (NPN_RemoveProperty):
2733 (NPN_GetPropertyAtIndex):
2734 (NPN_SetPropertyAtIndex):
2735 * bindings/NP_jsobject.h:
2736 * bindings/c/c_class.cpp:
2737 (CClass::_commonInit):
2738 (CClass::classForIsA):
2740 (CClass::methodsNamed):
2741 (CClass::fieldNamed):
2742 * bindings/c/c_class.h:
2743 * bindings/c/c_instance.cpp:
2744 (CInstance::CInstance):
2745 (CInstance::~CInstance):
2746 (CInstance::operator=):
2747 (CInstance::invokeMethod):
2748 (CInstance::defaultValue):
2749 * bindings/c/c_instance.h:
2750 (KJS::Bindings::CInstance::getObject):
2751 * bindings/c/c_runtime.cpp:
2752 (CField::valueFromInstance):
2753 (CField::setValueToInstance):
2754 * bindings/c/c_runtime.h:
2755 (KJS::Bindings::CField::CField):
2756 (KJS::Bindings::CField::name):
2757 (KJS::Bindings::CMethod::CMethod):
2758 (KJS::Bindings::CMethod::name):
2759 * bindings/c/c_utility.cpp:
2760 (coerceValueToNPString):
2761 (convertValueToNPValueType):
2762 (convertNPValueTypeToValue):
2763 * bindings/c/c_utility.h:
2764 * bindings/npruntime.cpp:
2765 (NPN_IdentifierFromUTF8):
2766 (NPN_IsValidIdentifier):
2767 (NPN_GetIdentifiers):
2768 (NPN_UTF8FromIdentifier):
2771 (NPN_ReleaseObject):
2772 (NPN_IsKindOfClass):
2773 (NPN_SetExceptionWithUTF8):
2776 (NPN_CreateNumberWithInt):
2777 (NPN_CreateNumberWithFloat):
2778 (NPN_CreateNumberWithDouble):
2779 (NPN_IntFromNumber):
2780 (NPN_FloatFromNumber):
2781 (NPN_DoubleFromNumber):
2783 (NPN_CreateStringWithUTF8):
2784 (NPN_CreateStringWithUTF16):
2785 (NPN_DeallocateUTF8):
2786 (NPN_UTF8FromString):
2787 (NPN_UTF16FromString):
2790 (NPN_CreateBoolean):
2791 (NPN_BoolFromBoolean):
2794 (undefinedAllocate):
2800 (NPN_ObjectAtIndex):
2801 * bindings/npruntime.h:
2802 * bindings/runtime.cpp:
2803 (Instance::createBindingForLanguageInstance):
2804 * bindings/testbindings.cpp:
2805 (initializeIdentifiers):
2825 2004-03-31 Richard Williamson <rjw@apple.com>
2827 Changed references to NP_runtime.h to npruntime.h
2829 * JavaScriptCore.pbproj/project.pbxproj:
2830 * bindings/NP_jsobject.h:
2831 * bindings/c/c_class.h:
2832 * bindings/c/c_instance.h:
2833 * bindings/c/c_runtime.h:
2834 * bindings/c/c_utility.h:
2835 * bindings/npruntime.cpp:
2837 2004-03-31 Richard Williamson <rjw@apple.com>
2839 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2841 * JavaScriptCore.pbproj/project.pbxproj:
2842 * bindings/NP_jsobject.h:
2843 * bindings/npruntime.cpp:
2847 2004-03-23 Richard Williamson <rjw@apple.com>
2849 Added implementation of KJS::Value <-> NP_Object conversion functions.
2850 Augmented test program for 'C' bindings.
2851 Added asserts and parameter checking to all public API.
2855 * JavaScriptCore.pbproj/project.pbxproj:
2856 * bindings/NP_jsobject.cpp:
2858 * bindings/NP_jsobject.h: Added.
2859 * bindings/NP_runtime.cpp:
2860 (NP_IdentifierFromUTF8):
2861 (NP_IsValidIdentifier):
2862 (NP_GetIdentifiers):
2867 (NP_SetExceptionWithUTF8):
2870 (NP_FloatFromNumber):
2871 (NP_DoubleFromNumber):
2872 (NP_CreateStringWithUTF8):
2873 (NP_CreateStringWithUTF16):
2874 (NP_DeallocateUTF8):
2875 (NP_UTF8FromString):
2876 (NP_UTF16FromString):
2878 (NP_BoolFromBoolean):
2879 * bindings/NP_runtime.h:
2880 * bindings/c/c_instance.cpp:
2881 (CInstance::invokeMethod):
2882 * bindings/c/c_utility.cpp:
2883 (coerceValueToNPString):
2884 (convertValueToNPValueType):
2885 (convertNPValueTypeToValue):
2886 * bindings/c/c_utility.h:
2888 * bindings/testC.js: Added.
2889 * bindings/testbindings.cpp:
2899 (myInterfaceInvoke):
2900 (myInterfaceAllocate):
2904 2004-03-19 Darin Adler <darin@apple.com>
2908 - fixed problem with methods like setUTCHour
2910 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2911 GMT vs. local time function based on the utc flag.
2913 2004-03-17 Richard Williamson <rjw@apple.com>
2915 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
2919 * bindings/NP_jsobject.cpp:
2924 (NP_GetPropertyAtIndex):
2925 * bindings/NP_runtime.h:
2927 2004-03-16 Richard Williamson <rjw@apple.com>
2929 Fixed 3590169. Regression (crash) caused by the switch to MethodLists. Crash when attempting to invoke a method from JavaScript to Java that is not implemented.
2933 * bindings/jni/jni_class.cpp:
2934 (JavaClass::methodsNamed):
2936 2004-03-15 Richard Williamson <rjw@apple.com>
2938 Fixed 3570854. Don't attempt to convert Null to strings. We
2939 were incorrectly converting to "Null".
2941 Actually fixed by Scott Kovatch.
2943 Reviewed by Richard.
2945 * bindings/jni/jni_utility.cpp:
2946 (KJS::Bindings::convertValueToJValue):
2950 2004-03-11 Richard Williamson <rjw@apple.com>
2952 Stitched together the NP stuff to our language independent
2953 JavaScript binding stuff. Very close to being done.
2955 Added program to test C bindings (and NP stuff). Just tests
2956 properties. Will add methods and JavaScript access, etc.
2958 Updated Makefile.am to account for new bindings/c directory.
2960 Change NP_UTF8 from "const char *" to "char" to allow for
2961 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
2964 Added NP_IsValidIdentifier().
2968 * JavaScriptCore.pbproj/project.pbxproj:
2970 * bindings/NP_jsobject.cpp:
2971 (identiferFromNPIdentifier):
2973 * bindings/NP_runtime.cpp:
2974 (NP_IdentifierFromUTF8):
2975 (NP_IsValidIdentifier):
2976 (NP_GetIdentifiers):
2977 (NP_UTF8FromIdentifier):
2978 (NP_SetExceptionWithUTF8):
2980 (NP_CreateStringWithUTF8):
2981 (NP_CreateStringWithUTF16):
2982 (NP_UTF8FromString):
2983 (NP_UTF16FromString):
2984 * bindings/NP_runtime.h:
2985 * bindings/c/c_class.cpp: Added.
2986 (CClass::_commonDelete):
2987 (CClass::_commonCopy):
2988 (CClass::_commonInit):
2989 (_createClassesByIsAIfNecessary):
2990 (CClass::classForIsA):
2993 (CClass::methodsNamed):
2994 (CClass::fieldNamed):
2995 * bindings/c/c_class.h: Added.
2996 (KJS::Bindings::CClass::~CClass):
2997 (KJS::Bindings::CClass::CClass):
2998 (KJS::Bindings::CClass::operator=):
2999 (KJS::Bindings::CClass::constructorAt):
3000 (KJS::Bindings::CClass::numConstructors):
3001 * bindings/c/c_instance.cpp: Added.
3002 (CInstance::CInstance):
3003 (CInstance::~CInstance):
3004 (CInstance::operator=):
3005 (CInstance::getClass):
3008 (CInstance::invokeMethod):
3009 (CInstance::defaultValue):
3010 (CInstance::stringValue):
3011 (CInstance::numberValue):
3012 (CInstance::booleanValue):
3013 (CInstance::valueOf):
3014 * bindings/c/c_instance.h: Added.
3015 (KJS::Bindings::CInstance::getObject):
3016 * bindings/c/c_runtime.cpp: Added.
3017 (CField::valueFromInstance):
3018 (CField::setValueToInstance):
3019 * bindings/c/c_runtime.h: Added.
3020 (KJS::Bindings::CField::CField):
3021 (KJS::Bindings::CField::name):
3022 (KJS::Bindings::CField::type):
3023 (KJS::Bindings::CMethod::CMethod):
3024 (KJS::Bindings::CMethod::name):
3025 (KJS::Bindings::CMethod::numParameters):
3026 * bindings/c/c_utility.cpp: Added.
3027 (coerceValueToNPValueType):
3028 (convertValueToNPValueType):
3029 (convertNPValueTypeToValue):
3030 * bindings/c/c_utility.h: Added.
3031 * bindings/make_testbindings:
3032 * bindings/runtime.cpp:
3033 (Instance::createBindingForLanguageInstance):
3034 * bindings/runtime.h:
3035 (KJS::Bindings::Instance::):
3036 * bindings/testbindings.cpp: Added.
3037 (initializeIdentifiers):
3038 (myInterfaceHasProperty):
3039 (myInterfaceHasMethod):
3040 (myInterfaceGetProperty):
3041 (myInterfaceSetProperty):
3042 (myInterfaceInvoke):
3043 (myInterfaceAllocate):
3044 (myInterfaceInvalidate):
3045 (myInterfaceDeallocate):
3046 (GlobalImp::className):
3047 (readJavaScriptFromFile):
3050 2004-03-10 Richard Williamson <rjw@apple.com>
3052 Made changes to support new asychronous approach to calls from
3053 plugin to JavaScript
3057 * bindings/NP_jsobject.cpp:
3062 (NP_GetPropertyAtIndex):
3063 * bindings/NP_runtime.h:
3064 * bindings/make_testbindings:
3065 * bindings/runtime.cpp:
3066 (Instance::createBindingForLanguageInstance):
3068 2004-03-10 Richard Williamson <rjw@apple.com>
3070 Updated header to include proposed changes from
3071 plugin-futures list. Calls from plugin to JavaScript
3072 are now asynchronous.
3076 * bindings/NP_runtime.h:
3080 2004-03-04 Richard Williamson <rjw@apple.com>
3082 Implementation of NP_JavaScriptObject. This is the 'C' class
3083 that wraps a JavaScript object.
3087 * JavaScriptCore.pbproj/project.pbxproj:
3088 * bindings/NP_jsobject.cpp: Added.
3089 (coerceValueToNPValueType):
3090 (convertValueToNPValueType):
3091 (convertNPValueTypeToValue):
3095 (identiferFromNPIdentifier):
3100 (NP_RemoveProperty):
3102 (NP_GetPropertyAtIndex):
3103 (NP_SetPropertyAtIndex):
3104 * bindings/NP_runtime.cpp:
3106 * bindings/NP_runtime.h:
3107 * bindings/runtime_object.h:
3109 2004-03-04 Richard Williamson <rjw@apple.com>
3111 Added NP_Array implementation.
3113 Changed NP_Boolean to just depend on two static instances, no
3114 space is required for values.
3118 * bindings/NP_runtime.cpp:
3120 (NP_BoolFromBoolean):
3126 * bindings/NP_runtime.h:
3128 2004-03-03 Darin Adler <darin@apple.com>
3132 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
3133 copyright string, and that's all that was in here.
3134 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
3136 2004-03-03 Richard Williamson <rjw@apple.com>
3138 More 'C' binding implementation. Fleshed out all the
3139 'primitive' data types.
3143 * bindings/NP_runtime.cpp:
3148 (NP_CreateStringWithUTF8):
3149 (NP_CreateStringWithUTF16):
3150 (NP_UTF8FromString):
3151 (NP_UTF16FromString):
3154 (booleanDeallocate):
3156 (NP_BoolFromBoolean):
3160 (undefinedAllocate):
3161 (undefinedDeallocate):
3163 * bindings/NP_runtime.h:
3165 2004-03-03 Richard Williamson <rjw@apple.com>
3167 More 'C' binding implementation.
3171 * bindings/NP_runtime.cpp:
3174 (getIdentifierDictionary):
3175 (NP_IdentifierFromUTF8):
3176 (NP_UTF8FromIdentifier):
3181 (NP_CreateNumberWithInt):
3182 (NP_CreateNumberWithFloat):
3183 (NP_CreateNumberWithDouble):
3185 (NP_FloatFromNumber):
3186 (NP_DoubleFromNumber):
3187 * bindings/NP_runtime.h:
3189 2004-03-02 Richard Williamson <rjw@apple.com>
3191 Removed retain/release from NP_Class. Classes will not be allowed to implement their
3192 own customer retain/release scheme.
3196 * bindings/NP_runtime.cpp:
3199 * bindings/NP_runtime.h:
3201 2004-03-02 Richard Williamson <rjw@apple.com>
3203 C binding API. Partial implementation.
3205 Completed ObjectiveC bindings (not based on the C API). These will re-implemented over the C binding API, but I wanted to get this code in the tree.
3207 Factored root object reference counting scheme. It is now useful independent
3212 * JavaScriptCore.pbproj/project.pbxproj:
3213 * bindings/NP_runtime.cpp: Added.
3214 (NP_IdentifierFromUTF8):
3215 (NP_GetIdentifiers):
3216 (NP_UTF8FromIdentifier):
3226 (NP_RemoveProperty):
3228 (NP_GetPropertyAtIndex):
3229 (NP_SetPropertyAtIndex):
3230 (NP_CreateNumberWithInt):
3231 (NP_CreateNumberWithFloat):
3232 (NP_CreateNumberWithDouble):
3234 (NP_FloatFromNumber):
3235 (NP_DoubleFromNumber):
3236 (NP_CreateStringWithUTF8):
3237 (NP_CreateStringWithUTF16):
3238 (NP_UTF8FromString):
3239 (NP_UTF16FromString):
3241 (NP_BoolFromBoolean):
3247 * bindings/NP_runtime.h: Added.
3248 * bindings/jni/jni_jsobject.cpp:
3250 (JSObject::finalize):
3251 (JSObject::createNative):
3252 (JSObject::convertValueToJObject):
3253 * bindings/jni/jni_jsobject.h:
3254 * bindings/objc/objc_jsobject.h:
3255 * bindings/objc/objc_jsobject.mm:
3257 (windowJavaScriptObject):
3258 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
3259 (-[JavaScriptObject dealloc]):
3260 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
3261 (-[JavaScriptObject call:arguments:]):
3262 (-[JavaScriptObject evaluate:]):
3263 (-[JavaScriptObject getMember:]):
3264 (-[JavaScriptObject setMember:value:]):
3265 (-[JavaScriptObject removeMember:]):
3266 (-[JavaScriptObject toString]):
3267 (-[JavaScriptObject getSlot:]):
3268 (-[JavaScriptObject setSlot:value:]):
3269 * bindings/objc/objc_utility.h:
3270 * bindings/objc/objc_utility.mm:
3271 (KJS::Bindings::convertValueToObjcValue):
3272 * bindings/runtime_root.cpp: Added.
3273 (getReferencesByRootDictionary):
3274 (getReferencesDictionary):
3275 (KJS::Bindings::findReferenceDictionary):
3276 (KJS::Bindings::rootForImp):
3277 (KJS::Bindings::addNativeReference):
3278 (KJS::Bindings::removeNativeReference):
3279 (completedJavaScriptAccess):
3280 (initializeJavaScriptAccessLock):
3281 (lockJavaScriptAccess):
3282 (unlockJavaScriptAccess):
3283 (RootObject::dispatchToJavaScriptThread):
3284 (performJavaScriptAccess):
3285 (RootObject::setFindRootObjectForNativeHandleFunction):
3286 (RootObject::removeAllNativeReferences):
3287 * bindings/runtime_root.h: Added.
3288 (KJS::Bindings::RootObject::RootObject):
3289 (KJS::Bindings::RootObject::~RootObject):
3290 (KJS::Bindings::RootObject::setRootObjectImp):
3291 (KJS::Bindings::RootObject::rootObjectImp):
3292 (KJS::Bindings::RootObject::setInterpreter):
3293 (KJS::Bindings::RootObject::interpreter):
3294 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
3295 (KJS::Bindings::RootObject::runLoop):
3296 (KJS::Bindings::RootObject::performJavaScriptSource):
3302 2004-02-18 Richard Williamson <rjw@apple.com>
3304 Added NSNumber/Number conversion.
3306 Removed some unnecessary KJS:: namespace specifiers.
3310 * bindings/objc/objc_utility.mm:
3311 (KJS::Bindings::convertValueToObjcValue):
3312 (KJS::Bindings::convertObjcValueToValue):
3313 * bindings/runtime_array.h:
3315 2004-02-18 Richard Williamson <rjw@apple.com>
3317 Added support for export NSArrays.
3319 Updated valueAt() to take an ExecState so we can throw
3322 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
3323 ObjectiveC classes to control the visibility of their methods in
3328 * bindings/jni/jni_runtime.cpp:
3329 (JavaField::valueFromInstance):
3330 (JavaArray::valueAt):
3331 * bindings/jni/jni_runtime.h:
3332 * bindings/objc/objc_class.mm:
3333 (ObjcClass::methodsNamed):
3334 * bindings/objc/objc_runtime.h:
3335 (KJS::Bindings::ObjcArray::getObjcArray):
3336 * bindings/objc/objc_runtime.mm:
3337 (ObjcField::valueFromInstance):
3338 (ObjcField::setValueToInstance):
3339 (ObjcArray::ObjcArray):
3340 (ObjcArray::~ObjcArray):
3341 (ObjcArray::operator=):
3342 (ObjcArray::setValueAt):
3343 (ObjcArray::valueAt):
3344 (ObjcArray::getLength):
3345 * bindings/objc/objc_utility.mm:
3346 (KJS::Bindings::convertValueToObjcValue):
3347 (KJS::Bindings::convertObjcValueToValue):
3348 * bindings/runtime.cpp:
3349 (Instance::getValueOfField):
3350 * bindings/runtime.h:
3351 * bindings/runtime_array.cpp:
3352 (RuntimeArrayImp::get):
3353 * bindings/runtime_object.cpp:
3354 (RuntimeObjectImp::get):
3356 2004-02-17 Richard Williamson <rjw@apple.com>
3358 Added String <-> NSString conversion.
3359 Added tests of String <-> NSString conversion to test program.
3363 * bindings/objc/objc_utility.mm:
3364 (KJS::Bindings::convertValueToObjcValue):
3365 (KJS::Bindings::convertObjcValueToValue):
3367 * bindings/testbindings.mm:
3368 (-[MyFirstInterface getString]):
3370 2004-02-15 Darin Adler <darin@apple.com>
3374 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
3375 and removing redundant settings of things that match defaults in other build styles.
3377 2004-02-13 Richard Williamson <rjw@apple.com>
3379 Work towards the JavaScript ObjC bindings. The bindings now work for
3380 simple scalar types. testbindings.mm is an illustration of how the
3385 * JavaScriptCore.pbproj/project.pbxproj:
3387 * bindings/jni/jni_class.cpp:
3388 (JavaClass::methodsNamed):
3389 * bindings/jni/jni_class.h:
3390 * bindings/jni/jni_instance.cpp:
3391 (JavaInstance::invokeMethod):
3392 * bindings/jni/jni_instance.h:
3393 * bindings/jni/jni_runtime.h:
3394 (KJS::Bindings::JavaMethod::returnType):
3395 * bindings/make_testbindings: Added.
3396 * bindings/objc/objc_class.h: Added.
3397 (KJS::Bindings::ObjcClass::~ObjcClass):
3398 (KJS::Bindings::ObjcClass::ObjcClass):
3399 (KJS::Bindings::ObjcClass::operator=):
3400 (KJS::Bindings::ObjcClass::constructorAt):
3401 (KJS::Bindings::ObjcClass::numConstructors):
3402 * bindings/objc/objc_class.mm: Added.
3403 (ObjcClass::_commonDelete):
3404 (ObjcClass::_commonCopy):
3405 (ObjcClass::_commonInit):
3406 (_createClassesByIsAIfNecessary):
3407 (ObjcClass::classForIsA):
3408 (ObjcClass::ObjcClass):
3410 (ObjcClass::methodsNamed):
3411 (ObjcClass::fieldNamed):
3412 * bindings/objc/objc_header.h: Added.
3413 * bindings/objc/objc_instance.h: Added.
3414 (KJS::Bindings::ObjcInstance::getObject):
3415 * bindings/objc/objc_instance.mm: Added.
3416 (ObjcInstance::ObjcInstance):
3417 (ObjcInstance::~ObjcInstance):
3418 (ObjcInstance::operator=):
3419 (ObjcInstance::begin):
3420 (ObjcInstance::end):
3421 (ObjcInstance::getClass):
3422 (ObjcInstance::invokeMethod):
3423 (ObjcInstance::defaultValue):
3424 (ObjcInstance::stringValue):
3425 (ObjcInstance::numberValue):
3426 (ObjcInstance::booleanValue):
3427 (ObjcInstance::valueOf):
3428 * bindings/objc/objc_jsobject.h: Added.
3429 * bindings/objc/objc_jsobject.mm: Added.
3430 * bindings/objc/objc_runtime.h:
3431 (KJS::Bindings::ObjcField::~ObjcField):
3432 (KJS::Bindings::ObjcField::ObjcField):
3433 (KJS::Bindings::ObjcField::operator=):
3434 (KJS::Bindings::ObjcMethod::ObjcMethod):
3435 (KJS::Bindings::ObjcMethod::~ObjcMethod):
3436 (KJS::Bindings::ObjcMethod::operator=):
3437 * bindings/objc/objc_runtime.mm: Added.
3438 (ObjcMethod::ObjcMethod):
3440 (ObjcMethod::numParameters):
3441 (ObjcMethod::getMethodSignature):
3442 (ObjcField::ObjcField):
3445 (ObjcField::valueFromInstance):
3446 (ObjcField::setValueToInstance):
3447 * bindings/objc/objc_utility.h: Added.
3449 * bindings/objc/objc_utility.mm: Added.
3450 (KJS::Bindings::JSMethodNameToObjCMethodName):
3451 (KJS::Bindings::convertValueToObjcValue):
3452 (KJS::Bindings::convertObjcValueToValue):
3453 (KJS::Bindings::objcValueTypeForType):
3454 * bindings/runtime.cpp:
3455 (MethodList::MethodList):
3456 (MethodList::operator=):
3457 (Instance::setValueOfField):
3458 (Instance::createBindingForLanguageInstance):
3459 (Instance::createRuntimeObject):
3460 * bindings/runtime.h:
3461 * bindings/runtime_method.cpp:
3462 (RuntimeMethodImp::RuntimeMethodImp):
3463 (RuntimeMethodImp::get):
3464 (RuntimeMethodImp::call):
3465 * bindings/runtime_method.h:
3466 * bindings/runtime_object.cpp:
3467 (RuntimeObjectImp::get):
3468 (RuntimeObjectImp::hasProperty):
3469 * bindings/test.js: Added.
3470 * bindings/testbindings.mm: Added.
3471 (-[MySecondInterface init]):
3472 (-[MyFirstInterface init]):
3473 (-[MyFirstInterface dealloc]):
3474 (+[MyFirstInterface JavaScriptNameForSelector:]):
3475 (-[MyFirstInterface getInt]):
3476 (-[MyFirstInterface setInt:]):
3477 (-[MyFirstInterface getMySecondInterface]):
3478 (-[MyFirstInterface logMessage:]):
3479 (GlobalImp::className):
3480 (readJavaScriptFromFile):
3485 2004-02-08 Darin Adler <darin@apple.com>
3489 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
3491 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
3492 macros from working right in C++ code that uses the <cctype> header.
3495 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
3496 (KJS::UTF8SequenceLengthNonASCII): Added.
3497 (KJS::inlineUTF8SequenceLength): Added.
3498 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
3499 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3500 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
3501 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3502 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3504 - fixed the test program so it won't hit the interpreter lock assertion
3506 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
3510 2004-02-06 Richard Williamson <rjw@apple.com>
3512 Fixed 3550242 and 3546977. The first diff prevents an assert from firing. The second diff prevents a JavaScript exception, caused be an invalid conversion, which has a downstream consequence of preventing a valid conversion.
3516 * bindings/jni/jni_jsobject.cpp:
3517 (JSObject::toString):
3518 * bindings/jni/jni_utility.cpp:
3519 (KJS::Bindings::convertValueToJValue):
3521 2004-02-02 Darin Adler <darin@apple.com>
3525 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
3527 * kjs/array_object.cpp:
3528 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
3529 we start putting values in. This prevents new Array(2147483647) from causing trouble.
3530 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
3531 number is out of range. This prevents new Array(-1) from causing trouble.
3533 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
3535 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
3536 casting to int. Results now match those in other browsers.
3538 2004-02-02 Darin Adler <darin@apple.com>
3542 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
3543 - fixed other related overflow issues
3545 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
3547 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
3548 must not restrict values to the range of a particular integer type.
3549 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
3550 proper handling for negative results from fmod.
3551 (ValueImp::toUInt32): Ditto.
3552 (ValueImp::toUInt16): Ditto.
3553 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
3555 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
3556 out-of-integer-range values better in the slice function.
3557 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
3558 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
3559 out-of-integer-range values better in the toString function.
3560 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
3561 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
3562 and substr functions.
3566 2004-01-30 Richard Williamson <rjw@apple.com>
3568 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.