3 2005-02-11 Richard Williamson <rjw@apple.com>
5 Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
7 Re-factored how 'native' wrappers for JS objects are created. The interpreter now
8 creates these wrappers. The WebCore subclass of the interpreter now overrides
9 createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
13 * bindings/c/c_utility.cpp:
14 (convertValueToNPVariant):
15 * bindings/jni/jni_instance.cpp:
16 (JavaInstance::invokeMethod):
17 * bindings/jni/jni_objc.mm:
18 (KJS::Bindings::dispatchJNICall):
19 * bindings/jni/jni_runtime.cpp:
20 (JavaField::valueFromInstance):
22 * bindings/objc/WebScriptObject.mm:
23 (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
24 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
25 * bindings/objc/WebScriptObjectPrivate.h:
26 * bindings/objc/objc_utility.h:
27 * bindings/objc/objc_utility.mm:
28 (KJS::Bindings::convertObjcValueToValue):
29 (KJS::Bindings::createObjcInstanceForValue):
30 * bindings/runtime.cpp:
31 (Instance::createBindingForLanguageInstance):
32 (Instance::createRuntimeObject):
33 (Instance::createLanguageInstanceForValue):
35 * kjs/interpreter.cpp:
36 (Interpreter::createLanguageInstanceForValue):
41 2005-02-10 Darin Adler <darin@apple.com>
43 "Reviewed" by Richard (he told me the file was obsolete).
45 - got rid of an obsolete file
47 * bindings/npsap.h: Removed.
53 2005-02-03 Richard Williamson <rjw@apple.com>
55 Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
57 Revert to old (and correct) behavior of returning runtime object
58 when passed as a parameter, rather than it's corresponding DOM
63 * bindings/objc/WebScriptObject.mm:
64 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
68 2005-01-28 Richard Williamson <rjw@apple.com>
70 Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
72 Only use special 'back door' property to get the runtime object if thisObj isn't
73 already a runtime object.
75 <gratuitous> Cleaned up a couple of strcmp on ClassInfo name. Used == on
76 ClassInfo pointer instead.
80 * bindings/c/c_utility.cpp:
81 (convertValueToNPVariant):
82 * bindings/objc/WebScriptObject.mm:
83 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
84 * bindings/runtime_method.cpp:
85 (RuntimeMethodImp::call):
89 2005-01-26 Richard Williamson <rjw@apple.com>
91 Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
93 I added a member variable to ObjectImp. This changed it's size and consequently
94 hampered the optimizations built into the garbage collector. Objects no longer
95 fit within the allocators cell size, and thus allocation fell back to a slower
98 As a result of this fix I also dramatically cleaned up how runtime objects are
99 accessed. The path mostly *removes* code.
103 * bindings/runtime_method.cpp:
104 (RuntimeMethodImp::call):
105 * bindings/runtime_object.cpp:
106 (RuntimeObjectImp::get):
107 (RuntimeObjectImp::put):
108 (RuntimeObjectImp::canPut):
109 (RuntimeObjectImp::hasProperty):
110 (RuntimeObjectImp::defaultValue):
111 * bindings/runtime_object.h:
113 (KJS::ObjectImp::ObjectImp):
116 2005-01-20 Darin Adler <darin@apple.com>
118 Reviewed by me, changes by Han Ming Ong.
120 - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
122 * bindings/objc/WebScriptObjectPrivate.h: Make members public.
123 * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
125 2005-01-20 Richard Williamson <rjw@apple.com>
127 Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
129 The comprehensive fix for this problem requires new API, as described in 3965326. However,
130 given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
131 like and Undefined object if invokeUndefinedMethodFromWebScript:withArguments: isn't
132 implemented on the bound object.
136 * bindings/objc/objc_runtime.h:
137 * bindings/objc/objc_runtime.mm:
138 (ObjcFallbackObjectImp::type):
139 (ObjcFallbackObjectImp::implementsCall):
140 (ObjcFallbackObjectImp::toBoolean):
141 * bindings/testbindings.mm:
142 (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
143 (+[MyFirstInterface isKeyExcludedFromWebScript:]):
147 2005-01-19 Richard Williamson <rjw@apple.com>
149 Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
151 Fixed the following problems with LiveConnect that are demonstrated by the application
152 described in 3853676.
154 1. If a nil object is passed in an array from Java to JavaScript we will crash.
155 2. We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
156 3. We will sometimes fail to find the correct static method ID.
160 * bindings/jni/jni_jsobject.cpp:
161 (JSObject::convertJObjectToValue):
162 (JSObject::listFromJArray):
163 * bindings/jni/jni_runtime.cpp:
164 (JavaField::valueFromInstance):
165 (JavaField::setValueToInstance):
166 * bindings/jni/jni_utility.cpp:
167 (KJS::Bindings::getMethodID):
168 (KJS::Bindings::convertValueToJValue):
169 * bindings/runtime_array.h:
171 2005-01-18 Richard Williamson <rjw@apple.com>
173 Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
175 Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
176 Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
177 Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
178 Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
180 We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
181 tags. Also, if any of these elements are named they can be accessed from the document or window objects.
182 Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
186 * bindings/objc/objc_instance.h:
187 * bindings/objc/objc_instance.mm:
188 (ObjcInstance::supportsSetValueOfUndefinedField):
189 * bindings/runtime.h:
190 (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
191 * bindings/runtime_object.cpp:
192 (RuntimeObjectImp::RuntimeObjectImp):
193 (RuntimeObjectImp::get):
194 (RuntimeObjectImp::put):
195 (RuntimeObjectImp::canPut):
196 (RuntimeObjectImp::hasProperty):
197 (RuntimeObjectImp::defaultValue):
198 * bindings/runtime_object.h:
199 (KJS::RuntimeObjectImp::fallbackObject):
201 (KJS::ObjectImp::ObjectImp):
203 (KJS::ObjectImp::forwardingScriptMessage):
204 (KJS::ObjectImp::setForwardingScriptMessage):
206 2005-01-18 Richard Williamson <rjw@apple.com>
208 Back out a change that was incorrectly committed yesterday.
212 * bindings/objc/objc_utility.mm:
213 (KJS::Bindings::convertValueToObjcValue):
215 2005-01-17 Richard Williamson <rjw@apple.com>
217 Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
219 Keep track of originating execution context and target execution
220 context for native JS object wrappers, and perform appropriate
223 Reviewed by David Harrison.
225 * bindings/NP_jsobject.cpp:
227 (_NPN_CreateScriptObject):
232 (_NPN_RemoveProperty):
236 * bindings/NP_jsobject.h:
237 * bindings/c/c_instance.cpp:
238 (CInstance::CInstance):
239 (CInstance::stringValue):
240 * bindings/c/c_instance.h:
241 * bindings/c/c_utility.cpp:
242 (convertValueToNPVariant):
243 * bindings/jni/jni_instance.cpp:
244 (JavaInstance::JavaInstance):
245 (JavaInstance::valueOf):
246 * bindings/jni/jni_instance.h:
247 * bindings/objc/WebScriptObject.mm:
248 (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
249 (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
250 (-[WebScriptObject KJS::Bindings::]):
251 (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
252 (-[WebScriptObject _isSafeScript]):
253 (-[WebScriptObject callWebScriptMethod:withArguments:]):
254 (-[WebScriptObject evaluateWebScript:]):
255 (-[WebScriptObject setValue:forKey:]):
256 (-[WebScriptObject valueForKey:]):
257 (-[WebScriptObject removeWebScriptKey:]):
258 (-[WebScriptObject stringRepresentation]):
259 (-[WebScriptObject webScriptValueAtIndex:]):
260 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
261 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
262 * bindings/objc/WebScriptObjectPrivate.h:
263 * bindings/objc/objc_instance.h:
264 * bindings/objc/objc_runtime.mm:
265 (convertValueToObjcObject):
266 * bindings/objc/objc_utility.mm:
267 (KJS::Bindings::convertValueToObjcValue):
268 * bindings/runtime.cpp:
269 (Instance::Instance):
270 (Instance::operator=):
271 * bindings/runtime.h:
272 (KJS::Bindings::Instance::Instance):
273 (KJS::Bindings::Instance::setExecutionContext):
274 (KJS::Bindings::Instance::executionContext):
275 * bindings/runtime_root.cpp:
276 (RootObject::setInterpreter):
277 * bindings/runtime_root.h:
279 (KJS::Interpreter::isGlobalObject):
280 (KJS::Interpreter::interpreterForGlobalObject):
281 (KJS::Interpreter::isSafeScript):
285 2005-01-13 Vicki Murley <vicki@apple.com>
289 - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
291 * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
293 2005-01-12 Richard Williamson <rjw@apple.com>
295 Avoid additional work on dealloc by adding early out to
296 removeNativeReference(). (This will save time on dealloc
297 for all ObjC DOM objects.)
301 * bindings/runtime_root.cpp:
302 (KJS::Bindings::removeNativeReference):
304 2005-01-12 Richard Williamson <rjw@apple.com>
306 Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
308 We were always returning the first "root" object for all runtime
309 objects. Changed 0 in loop to i, the index.
311 Reviewed by David Harrison.
313 * bindings/runtime_root.cpp:
314 (KJS::Bindings::rootForImp):
316 2005-01-11 Richard Williamson <rjw@apple.com>
318 Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
320 Use the new dispatching API to invoke JNI, rather than calling JNI
323 Reviewed by David Harrison.
325 * bindings/jni/jni_instance.cpp:
326 (JavaInstance::invokeMethod):
327 * bindings/jni/jni_runtime.cpp:
328 (JavaField::dispatchValueFromInstance):
329 (JavaField::valueFromInstance):
330 (JavaField::dispatchSetValueToInstance):
331 (JavaField::setValueToInstance):
332 * bindings/jni/jni_runtime.h:
333 * bindings/jni/jni_utility.cpp:
334 (KJS::Bindings::convertValueToJValue):
342 2004-12-17 Maciej Stachowiak <mjs@apple.com>
346 <rdar://problem/3926869> Opening caches window after running PLT causes crash
348 * kjs/protected_values.cpp:
349 (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
350 the protected value table.
351 (KJS::ProtectedValues::increaseProtectCount): Ditto.
352 (KJS::ProtectedValues::decreaseProtectCount): Ditto.
354 2004-12-16 Darin Adler <darin@apple.com>
358 - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
360 * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
361 * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
362 non-locale-specific versions.
363 * kjs/string_object.lut.h: Regenerated.
365 2004-12-14 Richard Williamson <rjw@apple.com>
367 Pass URL of plugin view when call into JNI.
371 * bindings/jni/jni_objc.mm:
372 (KJS::Bindings::dispatchJNICall):
374 2004-12-13 Richard Williamson <rjw@apple.com>
376 Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
378 Add support for calling static Java methods from JavaScript.
382 * bindings/jni/jni_instance.cpp:
383 (JavaInstance::invokeMethod):
384 * bindings/jni/jni_runtime.cpp:
385 (JavaMethod::JavaMethod):
386 * bindings/jni/jni_runtime.h:
387 (KJS::Bindings::JavaMethod::isStatic):
388 * bindings/jni/jni_utility.cpp:
389 (callJNIStaticMethod):
390 (KJS::Bindings::callJNIBooleanMethod):
391 (KJS::Bindings::callJNIStaticBooleanMethod):
392 * bindings/jni/jni_utility.h:
394 2004-12-13 Richard Williamson <rjw@apple.com>
396 Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
400 * bindings/jni/jni_instance.cpp:
401 (JavaInstance::invokeMethod):
402 * bindings/jni/jni_objc.mm:
403 (KJS::Bindings::dispatchJNICall):
404 * bindings/jni/jni_runtime.h:
405 * bindings/jni/jni_utility.h:
409 2004-12-07 Maciej Stachowiak <mjs@apple.com>
413 <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
415 The fix was to implement copy constructor and assignment operator,
416 the ones that worked on the base class did not replace the
420 (KJS::ProtectedValue::ProtectedValue):
421 (KJS::ProtectedValue::operator=):
422 (KJS::ProtectedObject::ProtectedObject):
423 (KJS::ProtectedObject::operator=):
425 Also fixed a bug in the GC test mode that compares the results of
426 the old collector and the new collector.
433 2004-11-23 Richard Williamson <rjw@apple.com>
435 Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
439 * bindings/c/c_class.cpp:
440 (CClass::_commonInit):
442 2004-11-21 Maciej Stachowiak <mjs@apple.com>
446 <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
449 (KJS::Collector::Thread::Thread):
450 (KJS::destroyRegisteredThread):
451 (KJS::initializeRegisteredThreadKey):
452 (KJS::Collector::registerThread):
453 (KJS::Collector::markStackObjectsConservatively):
454 (KJS::Collector::markCurrentThreadConservatively):
455 (KJS::Collector::markOtherThreadConservatively):
463 2004-11-15 Richard Williamson <rjw@apple.com>
465 Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
469 * bindings/objc/objc_instance.mm:
470 (ObjcInstance::stringValue):
471 * bindings/objc/objc_utility.h:
472 * bindings/objc/objc_utility.mm:
473 (KJS::Bindings::convertNSStringToString):
474 (KJS::Bindings::convertObjcValueToValue):
478 2004-11-09 Chris Blumenberg <cblu@apple.com>
480 Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
485 * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
486 * bindings/softlinking.c: Added.
488 (getFunctionPointer): new
489 (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
493 2004-11-04 Darin Adler <darin@apple.com>
497 - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
498 - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
499 and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
500 than allocating a new one
502 * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
503 (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
504 of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
505 actually allocate only the very first time it's called.
506 (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
507 shared instance since there can be only one).
508 (-[WebUndefined copyWithZone:]): Ditto.
509 (-[WebUndefined retain]): Ditto.
510 (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
512 (-[WebUndefined autorelease]): Simplified to just return self (see above).
513 (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
514 (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
515 a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
516 bug mentioned above).
517 (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
518 No need to call init, since that's a no-op for this class.
520 2004-11-03 David Harrison <harrison@apple.com>
524 Eliminate the use of a marker file to determine how to build.
529 2004-11-01 Richard Williamson <rjw@apple.com>
531 Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
535 * bindings/c/c_instance.cpp:
536 (CInstance::invokeMethod):
537 (CInstance::invokeDefaultMethod):
538 Initialize out parameters to void type.
540 * bindings/c/c_runtime.cpp:
541 (CField::valueFromInstance):
542 (CField::setValueToInstance):
543 Initialize out parameters to void type.
544 Also added additional checks to protect against classes that
545 don't implement all functions.
547 2004-11-01 Richard Williamson <rjw@apple.com>
549 Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
554 * bindings/objc/WebScriptObject.mm:
555 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
556 Added additional conversion Undefined -> WebUndefined.
557 * bindings/objc/objc_utility.mm:
558 (KJS::Bindings::convertObjcValueToValue):
559 Added additional conversion WebUndefined -> Undefined.
561 2004-11-01 Darin Adler <darin@apple.com>
563 - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
565 * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
566 this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
567 report to match the contents of the file.
573 2004-10-22 Ken Kocienda <kocienda@apple.com>
577 * JavaScriptCore.pbproj/project.pbxproj:
578 Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
582 2004-10-13 Richard Williamson <rjw@apple.com>
584 Moved boolean checks prior to NSNumber checks. booleans are
587 Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
591 * bindings/objc/objc_utility.mm:
592 (KJS::Bindings::convertObjcValueToValue):
594 2004-10-12 Richard Williamson <rjw@apple.com>
596 Fixed access to DOM object via WebScriptObject API.
597 The execution context for DOM objects wasn't being found.
598 <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
602 * bindings/objc/WebScriptObject.mm:
604 (-[WebScriptObject KJS::Bindings::]):
605 (-[WebScriptObject callWebScriptMethod:withArguments:]):
606 (-[WebScriptObject evaluateWebScript:]):
607 (-[WebScriptObject setValue:forKey:]):
608 (-[WebScriptObject valueForKey:]):
609 (-[WebScriptObject stringRepresentation]):
610 * bindings/objc/WebScriptObjectPrivate.h:
612 2004-10-09 Darin Adler <darin@apple.com>
616 - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
618 * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
619 creating an init routine.
621 * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
622 require a global constructor that creates an init routine.
624 2004-10-09 Darin Adler <darin@apple.com>
628 - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
630 * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
631 work with the window object of the page the function is in, not the page of the caller. This
632 is what all other browsers do. This code was hidden before by the "everything is defined on
633 window object" hack in WebCore.
635 2004-10-07 Richard Williamson <rjw@apple.com>
637 Added simple JavaScript call tracing. Very useful for
638 debugging complex pages.
640 Tracing is only available in development builds and is
643 (gdb) set traceJavaScript = 1
647 setTraceJavaScript(true)
649 Function, args, and return values are printed to console. Very
654 * kjs/function_object.cpp:
655 (FunctionProtoFuncImp::call):
661 2004-10-05 Richard Williamson <rjw@apple.com>
663 Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
667 * bindings/NP_jsobject.cpp:
669 * bindings/npruntime.cpp:
670 (_NPN_SetExceptionWithUTF8):
671 * bindings/objc/WebScriptObject.mm:
672 (+[WebScriptObject throwException:]):
674 (KJS::InterpreterImp::context):
676 2004-10-05 Richard Williamson <rjw@apple.com>
678 Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
682 * bindings/objc/objc_utility.mm:
683 (KJS::Bindings::convertObjcValueToValue):
685 2004-10-04 Darin Adler <darin@apple.com>
689 - rolled in a fix the KDE folks did for the operations that generate HTML fragments
691 * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
693 - rolled out an old workaround we don't need any more
695 * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
696 required it is no longer there.
698 2004-09-30 Richard Williamson <rjw@apple.com>
700 Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
704 * bindings/NP_jsobject.cpp:
708 * bindings/c/c_class.cpp:
709 (CClass::methodsNamed):
710 (CClass::fieldNamed):
711 * bindings/c/c_class.h:
712 * bindings/c/c_instance.cpp:
713 (CInstance::invokeMethod):
714 * bindings/jni/jni_class.cpp:
715 (JavaClass::methodsNamed):
716 * bindings/jni/jni_class.h:
717 * bindings/npruntime.h:
718 * bindings/objc/objc_class.h:
719 * bindings/objc/objc_class.mm:
720 (ObjcClass::methodsNamed):
721 * bindings/runtime.h:
722 * bindings/runtime_object.cpp:
723 (RuntimeObjectImp::get):
724 (RuntimeObjectImp::hasProperty):
726 2004-09-29 Chris Blumenberg <cblu@apple.com>
728 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.
732 * JavaScriptCore.pbproj/project.pbxproj:
733 * bindings/NP_jsobject.cpp:
734 (_NPN_CreateScriptObject):
735 (_NPN_InvokeDefault):
740 (_NPN_RemoveProperty):
743 * bindings/c/c_class.cpp:
744 (CClass::methodsNamed):
745 (CClass::fieldNamed):
746 * bindings/c/c_instance.cpp:
747 (CInstance::CInstance):
748 (CInstance::~CInstance):
749 (CInstance::operator=):
750 (CInstance::invokeMethod):
751 (CInstance::invokeDefaultMethod):
752 * bindings/c/c_runtime.cpp:
753 * bindings/c/c_runtime.h:
754 (KJS::Bindings::CField::name):
755 (KJS::Bindings::CMethod::name):
756 * bindings/npruntime.cpp:
757 (_NPN_GetStringIdentifier):
758 (_NPN_GetStringIdentifiers):
759 (_NPN_GetIntIdentifier):
760 (_NPN_IdentifierIsString):
761 (_NPN_UTF8FromIdentifier):
762 (_NPN_IntFromIdentifier):
763 (NPN_InitializeVariantWithObject):
764 (_NPN_ReleaseVariantValue):
767 (_NPN_ReleaseObject):
768 (_NPN_SetExceptionWithUTF8):
771 2004-09-26 Darin Adler <darin@apple.com>
773 * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
774 low() to get Unicode value of character, and just use unicode().
776 2004-09-26 Darin Adler <darin@apple.com>
778 - refine charAt/charCodeAt fix slightly
780 * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
781 omitted parameter, as we do everywhere else, and as other browsers do here.
783 2004-09-26 Darin Adler <darin@apple.com>
787 - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
789 * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
790 the program. We were doing this properly for functions, but not entire programs.
792 - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
794 * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
795 and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
797 * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
803 2004-09-14 Richard Williamson <rjw@apple.com>
805 1. Add class parameter to object allocation function. This is somewhat redundant, given that
806 the allocation function is in the class function vector, but people wanted to use the same
807 allocation function for different classes.
809 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
811 3. Add support for a default function on an object. This is a feature that ActiveX supports,
812 and will allow JavaScript code to be written that will look exactly the same for both ActiveX
813 plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
814 'Objective-C' bindings.
816 There bugs are covered by
818 <rdar://problem/3776343> Support for default functions in the JavaScript bindings
819 <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
820 <rdar://problem/3674754> Need to implement latest npruntime.h
824 * bindings/NP_jsobject.cpp:
828 * bindings/c/c_class.cpp:
829 * bindings/c/c_instance.cpp:
830 (CInstance::CInstance):
831 (CInstance::operator=):
832 (CInstance::invokeMethod):
833 (CInstance::invokeDefaultMethod):
834 * bindings/c/c_instance.h:
835 * bindings/c/c_runtime.cpp:
836 * bindings/c/c_runtime.h:
837 * bindings/jni/jni_instance.cpp:
838 (JavaInstance::invokeDefaultMethod):
839 * bindings/jni/jni_instance.h:
840 * bindings/npruntime.cpp:
842 * bindings/npruntime.h:
843 * bindings/objc/WebScriptObject.h:
844 * bindings/objc/objc_class.mm:
845 (ObjcClass::fallbackObject):
846 * bindings/objc/objc_instance.h:
847 * bindings/objc/objc_instance.mm:
848 (ObjcInstance::invokeDefaultMethod):
849 * bindings/objc/objc_runtime.h:
850 * bindings/objc/objc_runtime.mm:
851 (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
852 (ObjcFallbackObjectImp::get):
853 (ObjcFallbackObjectImp::put):
854 (ObjcFallbackObjectImp::canPut):
855 (ObjcFallbackObjectImp::implementsCall):
856 (ObjcFallbackObjectImp::call):
857 (ObjcFallbackObjectImp::hasProperty):
858 (ObjcFallbackObjectImp::deleteProperty):
859 (ObjcFallbackObjectImp::defaultValue):
860 * bindings/runtime.h:
861 (KJS::Bindings::Class::fallbackObject):
862 (KJS::Bindings::Instance::getValueOfUndefinedField):
863 (KJS::Bindings::Instance::setValueOfUndefinedField):
864 (KJS::Bindings::Instance::valueOf):
865 * bindings/runtime_object.cpp:
866 (RuntimeObjectImp::implementsCall):
867 (RuntimeObjectImp::call):
868 * bindings/runtime_object.h:
870 2004-09-13 Maciej Stachowiak <mjs@apple.com>
874 <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
876 * kjs/string_object.cpp:
877 (StringProtoFuncImp::call): Replaced implementation of replace()
878 method with function below...
879 (replace): In order to avoid excessive allocation and copying,
880 figure out the ranges of the original string and replacement
881 strings to be assembled, instead of constantly creating new
882 strings at each substitution. The old behavior is basically O(N^2)
883 for a global replace on a pattern that matches many places in the
885 (regExpIsGlobal): Helper function for the above.
886 (expandSourceRanges): ditto
887 (pushSourceRange): ditto
888 (expandReplacements): ditto
889 (pushReplacement): ditto
891 (KJS::UString::spliceSubstringsWithSeparators): New method that
892 pieces together substring ranges of this string together with
893 specified separators, all at one go.
895 (KJS::UString::Range::Range): Added new helper class to represent
898 2004-09-14 Maciej Stachowiak <mjs@apple.com>
902 - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
905 (KJS::GlobalFuncImp::call): Make sure to escape null
906 characters. This is a bug in the new code that made part of the
909 2004-09-13 Darin Adler <darin@apple.com>
911 Reviewed by Kevin and Maciej.
913 - new function to support fix for DIG bug in WebCore
915 * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
916 * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
918 2004-09-12 Darin Adler <darin@apple.com>
920 * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
921 of escape and unescape.
923 2004-09-12 Darin Adler <darin@apple.com>
927 - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
929 * kjs/date_object.cpp:
930 (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
931 uses CFDateFormatter.
932 (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
934 2004-09-09 Maciej Stachowiak <mjs@apple.com>
938 <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
941 (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
942 ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
944 (Lexer::isHexDigit): Made static and non-const.
949 2004-09-06 Darin Adler <darin@apple.com>
951 * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
955 2004-09-01 Richard Williamson <rjw@apple.com>
957 Add pid to exception messages (to help debug dashboard clients).
961 * kjs/interpreter.cpp:
962 (Interpreter::evaluate):
966 2004-08-20 Richard Williamson <rjw@apple.com>
968 Implemented new JNI abstraction. We no longer invoke Java methods
969 directly with JNI, rather we call into the plugin. This allows the
970 plugin to dispatch the call to the appropriate VM thread. This
971 change should (will?) fix a whole class of threading related problems with
976 * JavaScriptCore.pbproj/project.pbxproj:
977 * bindings/c/c_instance.h:
978 (KJS::Bindings::CInstance::setExecutionContext):
979 (KJS::Bindings::CInstance::executionContext):
980 * bindings/jni/jni_instance.cpp:
981 (JavaInstance::JavaInstance):
982 (JavaInstance::invokeMethod):
983 (JavaInstance::setExecutionContext):
984 (JavaInstance::executionContext):
985 * bindings/jni/jni_instance.h:
986 * bindings/jni/jni_jsobject.cpp:
987 (JSObject::convertJObjectToValue):
988 * bindings/jni/jni_runtime.cpp:
989 (JavaField::JavaField):
990 (JavaArray::convertJObjectToArray):
991 (JavaField::valueFromInstance):
992 (JavaArray::JavaArray):
993 (JavaArray::valueAt):
994 * bindings/jni/jni_runtime.h:
995 (KJS::Bindings::JavaArray::operator=):
996 (KJS::Bindings::JavaArray::executionContext):
997 * bindings/jni/jni_utility.h:
998 * bindings/objc/objc_instance.h:
999 (KJS::Bindings::ObjcInstance::setExecutionContext):
1000 (KJS::Bindings::ObjcInstance::executionContext):
1001 * bindings/runtime.cpp:
1002 (Instance::createBindingForLanguageInstance):
1003 * bindings/runtime.h:
1004 * bindings/runtime_root.h:
1005 (KJS::Bindings::RootObject::nativeHandle):
1009 2004-08-19 Vicki Murley <vicki@apple.com>
1013 * kjs/property_map.cpp:
1014 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
1016 2004-08-17 Darin Adler <darin@apple.com>
1020 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
1022 * kjs/property_map.h: Added some private functions.
1023 * kjs/property_map.cpp:
1024 (KJS::PropertyMap::clear): Set sentinelCount to 0.
1025 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
1026 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
1027 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
1028 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
1029 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
1030 deleted-element sentinels.
1031 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
1033 2004-08-16 Maciej Stachowiak <mjs@apple.com>
1035 Code change by Eric Albert, reviewd by me.
1037 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
1039 * kjs/date_object.cpp:
1040 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
1041 entirely would be even better, but is not required to fix this bug.
1045 2004-08-16 Richard Williamson <rjw@apple.com>
1047 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
1049 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
1053 * bindings/NP_jsobject.cpp:
1055 * bindings/jni/jni_jsobject.cpp:
1057 * bindings/objc/WebScriptObject.mm:
1058 (-[WebScriptObject evaluateWebScript:]):
1060 2004-08-15 Richard Williamson <rjw@apple.com>
1062 More updates to np headers. Implemented new NPN functions.
1066 * bindings/NP_jsobject.cpp:
1070 * bindings/npruntime.h:
1072 2004-08-13 Darin Adler <darin@apple.com>
1074 - fix build so we can compile again
1076 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
1077 is good enough so that we can compile, but it's only a stopgap measure, because I think
1078 Richard has a newer one he wants to check in.
1080 2004-08-12 Richard Williamson <rjw@apple.com>
1082 Bring npruntime.h and friends closer to compliance with
1087 * JavaScriptCore.pbproj/project.pbxproj:
1088 * bindings/NP_jsobject.cpp:
1090 (_NPN_CreateScriptObject):
1095 (NPN_RemoveProperty):
1096 * bindings/NP_jsobject.h:
1097 * bindings/c/c_instance.cpp:
1098 (CInstance::invokeMethod):
1099 * bindings/c/c_utility.cpp:
1100 (convertNPVariantToValue):
1101 * bindings/npruntime.cpp:
1102 (NPN_IdentifierIsString):
1103 (NPN_VariantIsVoid):
1104 (NPN_VariantIsNull):
1105 (NPN_VariantIsUndefined):
1106 (NPN_VariantIsBool):
1107 (NPN_VariantIsInt32):
1108 (NPN_VariantIsDouble):
1109 (NPN_VariantIsString):
1110 (NPN_VariantIsObject):
1111 (NPN_VariantToBool):
1112 (NPN_VariantToString):
1113 (NPN_VariantToInt32):
1114 (NPN_VariantToDouble):
1115 (NPN_VariantToObject):
1116 (NPN_InitializeVariantAsVoid):
1117 (NPN_InitializeVariantAsNull):
1118 (NPN_InitializeVariantAsUndefined):
1119 (NPN_InitializeVariantWithBool):
1120 (NPN_InitializeVariantWithInt32):
1121 (NPN_InitializeVariantWithDouble):
1122 (NPN_InitializeVariantWithString):
1123 (NPN_InitializeVariantWithStringCopy):
1124 (NPN_InitializeVariantWithObject):
1125 (NPN_InitializeVariantWithVariant):
1126 (NPN_ReleaseVariantValue):
1128 * bindings/npruntime.h:
1130 (_NPString::_NPVariant::):
1131 * bindings/npruntime_priv.h: Added.
1133 2004-08-12 Darin Adler <darin@apple.com>
1137 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
1140 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
1141 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
1142 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
1143 to skip leading "+" or "-".
1147 2004-08-12 Darin Adler <darin@apple.com>
1151 - fixed 43 Mozilla JavaScript tests
1153 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
1154 * kjs/date_object.cpp:
1155 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
1156 than constructing a number object to pass to it.
1157 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
1158 (KJS::parseDate): Change to return a double instead of creating the Number object here.
1159 (KJS::timeClip): Implement this as specified in the language standard.
1161 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
1162 flags on the prototype property.
1165 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
1167 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
1169 (KJS::parseDigit): Added. Helper function for parseInt.
1170 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
1171 strtoll can handle. Also matches standard more closely.
1172 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
1174 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
1176 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
1178 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
1180 (Lexer::setCode): Clear error state.
1181 (Lexer::lex): Set error state if the lexer encounters an error
1184 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
1185 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
1187 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
1188 Change round to round values between -0.5 and -0 to -0 instead of +0.
1190 * kjs/nodes.h: Add evaluateReference function to GroupNode.
1191 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
1192 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
1193 would change x.y into a value that can't be deleted as a side effect.
1195 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
1198 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
1199 get rid of the fixed size limit for code.
1201 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
1202 returns the string without creating a new Rep, since I'm using substr in a place where it will
1203 often be passed a 0.
1205 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
1206 the other day that was making a couple tests fail.
1207 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1208 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1209 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1210 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1211 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1213 * kjs/string_object.lut.h: Regenerated.
1215 2004-08-11 Darin Adler <darin@apple.com>
1217 - fixed a tiny problem with the UTF-16 PCRE check-in
1219 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
1220 the ctype_meta flag to get set in items that should not have it.
1222 * pcre/chartables.c: Regenerated.
1224 2004-08-10 Richard Williamson <rjw@apple.com>
1226 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
1228 The following WebScripting methods are now supported on bound
1231 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
1232 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
1233 - (id)valueForUndefinedKey:(NSString *)key
1237 * bindings/c/c_class.cpp:
1238 (CClass::fieldNamed):
1239 * bindings/c/c_class.h:
1240 * bindings/jni/jni_class.cpp:
1241 (JavaClass::fieldNamed):
1242 * bindings/jni/jni_class.h:
1243 * bindings/objc/objc_class.h:
1244 (KJS::Bindings::ObjcClass::isa):
1245 * bindings/objc/objc_class.mm:
1246 (ObjcClass::methodsNamed):
1247 (ObjcClass::fieldNamed):
1248 (ObjcClass::fallbackObject):
1249 * bindings/objc/objc_instance.h:
1250 * bindings/objc/objc_instance.mm:
1251 (ObjcInstance::invokeMethod):
1252 (ObjcInstance::setValueOfField):
1253 (ObjcInstance::setValueOfUndefinedField):
1254 (ObjcInstance::getValueOfField):
1255 (ObjcInstance::getValueOfUndefinedField):
1256 * bindings/objc/objc_runtime.h:
1257 (KJS::Bindings::ObjcField::~ObjcField):
1258 (KJS::Bindings::ObjcField::ObjcField):
1259 (KJS::Bindings::ObjcField::operator=):
1260 (KJS::Bindings::FallbackObjectImp::classInfo):
1261 * bindings/objc/objc_runtime.mm:
1262 (ObjcField::ObjcField):
1265 (ObjcField::valueFromInstance):
1266 (ObjcField::setValueToInstance):
1267 (FallbackObjectImp::FallbackObjectImp):
1268 (FallbackObjectImp::get):
1269 (FallbackObjectImp::put):
1270 (FallbackObjectImp::canPut):
1271 (FallbackObjectImp::implementsCall):
1272 (FallbackObjectImp::call):
1273 (FallbackObjectImp::hasProperty):
1274 (FallbackObjectImp::deleteProperty):
1275 (FallbackObjectImp::defaultValue):
1276 * bindings/runtime.h:
1277 (KJS::Bindings::Class::fallbackObject):
1278 (KJS::Bindings::Instance::getValueOfUndefinedField):
1279 (KJS::Bindings::Instance::setValueOfUndefinedField):
1280 * bindings/runtime_object.cpp:
1281 (RuntimeObjectImp::get):
1282 (RuntimeObjectImp::put):
1283 (RuntimeObjectImp::canPut):
1284 (RuntimeObjectImp::hasProperty):
1285 * bindings/testbindings.mm:
1286 (-[MyFirstInterface valueForUndefinedKey:]):
1287 (-[MyFirstInterface setValue:forUndefinedKey:]):
1289 2004-08-10 Darin Adler <darin@apple.com>
1293 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
1295 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
1296 or uint16_t depending on the mode, and used appropriate in the 7 public functions
1297 that need to use it.
1298 * pcre/pcre.c: Add UTF-16 support to all functions.
1299 * pcre/study.c: Ditto.
1301 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
1302 the mode. Changed declarations to use symbolic constants and typedefs so we size
1303 things to ichar when needed.
1305 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
1306 sized to 16-bit characters instead of 8-bit.
1309 (pcre_copy_substring): Use pcre_char instead of char.
1310 (pcre_get_substring_list): Ditto.
1311 (pcre_free_substring_list): Ditto.
1312 (pcre_get_substring): Ditto.
1313 (pcre_free_substring): Ditto.
1315 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
1316 of hard-coding 8-bit table sizes.
1318 * pcre/chartables.c: Regenerated.
1320 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
1321 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
1322 is not null. The null string still has a null pointer. This prevents us from
1323 passing a null through to the regular expression engine (which results in a null
1324 error even when the string length is 0).
1327 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
1328 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
1330 2004-08-09 Darin Adler <darin@apple.com>
1334 - fixed 28 Mozilla JavaScript tests
1336 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
1337 checking the number of arguments for the join method.
1339 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
1340 than integers, so we aren't limited to 32 bits.
1342 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
1343 the implementation of the pow operation. Also simplied a case that was handling positive
1344 and negative infinity separately.
1346 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
1347 putting them in a long, so that unsigned shift will work properly.
1349 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
1351 * kjs/operations.cpp:
1352 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
1353 sign of isinf; our isinf function returns +1 even for negative infinity.
1354 (KJS::isNegInf): And again.
1355 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
1356 Our floating point already handles the various infinity cases correctly.
1358 * kjs/regexp_object.cpp:
1359 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
1360 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
1361 array in cases where we did not match.
1362 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
1363 "global", "ignoreCase", "multiline", and "source".
1365 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
1366 string into undefined rather than an empty string. For the slice method, handle an
1367 undefined parameter for the limit properly as decribed in the specification, and add
1368 the limit to one case that didn't have the limit at all. For the methods that generate
1369 HTML strings, use lowercase tags instead of uppercase.
1372 (KJS::UChar::toLower): Use u_tolower from the ICU library.
1373 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
1374 (KJS::UString::append): Fix some math that caused a buffer overflow.
1375 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
1376 flag) rather than converting them all to 0.
1377 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
1379 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
1381 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
1382 the Unicode specification in a few cases where it was wrong before.
1383 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
1384 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
1385 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
1386 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
1387 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1388 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1389 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1390 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1391 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1393 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
1395 * kjs/number_object.lut.h: Regenerated.
1397 2004-08-09 Darin Adler <darin@apple.com>
1401 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
1403 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
1404 we get a buffer overflow.
1408 2004-08-05 Richard Williamson <rjw@apple.com>
1410 Fixed part of 3674747. The QT guys need this for feature freeze.
1412 This patch implements support for the
1414 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
1416 method of objects bound to JavaScript.
1421 * bindings/objc/objc_class.mm:
1422 (ObjcClass::methodsNamed):
1423 (ObjcClass::fieldNamed):
1424 * bindings/objc/objc_instance.mm:
1425 (ObjcInstance::invokeMethod):
1426 * bindings/objc/objc_runtime.h:
1427 (KJS::Bindings::ObjcMethod::~ObjcMethod):
1428 (KJS::Bindings::ObjcMethod::isFallbackMethod):
1429 (KJS::Bindings::ObjcMethod::javaScriptName):
1430 * bindings/objc/objc_runtime.mm:
1431 (ObjcMethod::ObjcMethod):
1432 (ObjcMethod::getMethodSignature):
1433 (ObjcMethod::setJavaScriptName):
1434 * bindings/testbindings.mm:
1436 2004-08-04 Vicki Murley <vicki@apple.com>
1440 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
1443 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
1444 go to the next line and continue parsing the string (instead of failing). This matches
1445 behavior in Mac IE and Mozilla.
1447 2004-08-03 Kevin Decker <kdecker@apple.com>
1451 Rolled in changes from the latest KJS sources that support additional
1452 Number.prototype functions.
1454 Specifically this patch covers the follow parts of the ECMA 3 spec:
1455 15.7.4.5, 15.7.4.6, and 15.7.4.7
1458 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
1459 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
1460 <rdar://problem/3749591> missing Number.toExponential prototype implementation
1462 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
1463 list of supported identifiers (a macro).
1464 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
1465 and toExponential().
1466 (NumberPrototypeImp::NumberPrototypeImp):
1467 (NumberProtoFuncImp::call):
1468 * kjs/number_object.h: Added property names for toFixed, toPrecision,
1470 (KJS::NumberProtoFuncImp::):
1471 * tests/mozilla/expected.html: Update results.
1473 2004-08-03 Darin Adler <darin@apple.com>
1477 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
1479 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
1480 we are supposed to just copy the regular expression object, and do so.
1481 Also tighten up arguments check to handle case where an actual "undefined"
1482 is passed rather than just omitting an argument.
1484 * tests/mozilla/expected.html: Update results.
1486 2004-08-02 Darin Adler <darin@apple.com>
1488 * tests/mozilla/.cvsignore: Added.
1489 * tests/mozilla/expected.html: Update results.
1491 2004-08-02 Darin Adler <darin@apple.com>
1495 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
1497 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
1498 Append the flags here so more tests paseed.
1500 2004-08-02 Darin Adler <darin@apple.com>
1504 - fixed a couple things making 5 Mozilla regexp tests pass
1506 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
1508 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
1509 be used as the flags string when no parameter was passed.
1511 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
1512 Added a class info object for RegExp prototype so it can return
1513 a string instead of raising an exception when converting to a string.
1515 * tests/mozilla/expected.html: Update results.
1517 2004-08-02 Darin Adler <darin@apple.com>
1521 - fix crashes in mozilla tests due to mishandling NaN
1523 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
1524 calls to toInteger so that NaN will get turned into something that fits in an integer.
1525 These were the ones John already fixed, but his fix used isnan and the new fix is
1528 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
1529 after a call to toInteger to handle NaN properly. Also removed separate check
1530 for undefined that's not needed.
1532 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
1533 as in the above two files, but for a lot more functions. Also changed one place with
1534 an explicit check for undefined to instead just check isNaN.
1536 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
1537 like me who don't keep $SYMROOTS in their $PATH.
1543 2004-07-26 Kevin Decker <kdecker@apple.com>
1545 Changes done by Darin, reviewed by Kevin.
1547 - changed testkjs to build in Xcode rather than from Makefile
1549 * .cvsignore: Removed obsolete files from this list.
1550 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
1551 Changed to build target "All" rather than default target. This makes us
1552 build the testkjs test tool.
1553 * dummy.cpp: Removed.
1554 * kjs/.cvsignore: Removed obsolete files from this list, including
1555 the testkjs tool, which is now built in the symroots directory.
1556 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
1557 changed this file. Also this has the nice side effect of causing the tool
1558 to be rebuilt in the new location even if there are no other changes in
1559 your tree when you check this out.
1560 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
1561 without setting the execute bit on jsDriver.pl.
1563 2004-07-22 Kevin Decker <kdecker@apple.com>
1567 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
1569 * kjs/function_object.cpp:
1570 (FunctionObjectImp::construct):
1571 * kjs/function_object.h:
1573 (KJS::ObjectImp::construct):
1575 (KJS::Object::construct):
1577 2004-07-21 Darin Adler <darin@apple.com>
1579 * bindings/npruntime.h: Fixed typo.
1581 2004-07-19 John Sullivan <sullivan@apple.com>
1585 - bulletproofed array.slice() against NAN arguments. Harri noticed this
1586 vulnerability in my patch for 3714644
1588 * kjs/array_object.cpp:
1589 (ArrayProtoFuncImp::call):
1590 handle NAN parameters passed to slice() by clamping to 0 and length.
1592 2004-07-19 Richard Williamson <rjw@apple.com>
1594 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
1599 * bindings/jni/jni_jsobject.cpp:
1601 (JSObject::JSObject):
1603 2004-07-16 John Sullivan <sullivan@apple.com>
1607 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
1608 hangs browser with javascript
1610 * kjs/array_object.cpp:
1611 (ArrayProtoFuncImp::call):
1612 Check for undefined type for args[0] the same way we were already checking
1613 for args[1]. In this case, args was zero-length, but we were treating
1614 args[0] like an integer anyway. Resulted in some code looping from a NAN
1615 value to 4, taking approximately forever.
1617 * JavaScriptCore.pbproj/project.pbxproj:
1622 2004-07-14 Maciej Stachowiak <mjs@apple.com>
1626 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
1627 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
1629 * kjs/number_object.cpp:
1630 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
1632 2004-07-13 Kevin Decker <kdecker@apple.com>
1634 Reviewed by kocienda.
1636 - made testkjs and JavaScriptCore a subtarget of 'All'
1637 - testkjs now builds in $SYMROOTS
1639 * JavaScriptCore.pbproj/project.pbxproj:
1643 2004-06-24 Chris Blumenberg <cblu@apple.com>
1645 Ignore .mode1 files in JavaScriptCore.pbproj
1647 Reviewed by kocienda.
1649 * JavaScriptCore.pbproj/.cvsignore:
1651 2004-06-23 Richard Williamson <rjw@apple.com>
1653 Implemented changes for latest npruntime.h.
1657 * JavaScriptCore.pbproj/project.pbxproj:
1658 * bindings/NP_jsobject.cpp:
1659 (listFromVariantArgs):
1660 (identiferFromNPIdentifier):
1661 (_NPN_CreateScriptObject):
1666 (NPN_RemoveProperty):
1667 * bindings/NP_jsobject.h:
1668 * bindings/c/c_class.cpp:
1669 (CClass::methodsNamed):
1670 (CClass::fieldNamed):
1671 * bindings/c/c_instance.cpp:
1672 (CInstance::invokeMethod):
1673 * bindings/c/c_utility.cpp:
1674 (convertNPVariantToValue):
1675 * bindings/c/c_utility.h:
1676 * bindings/npruntime.cpp:
1677 (stringIdentifierEqual):
1678 (stringIdentifierHash):
1679 (getStringIdentifierDictionary):
1680 (intIdentifierEqual):
1681 (intIdentifierHash):
1682 (getIntIdentifierDictionary):
1683 (NPN_GetStringIdentifier):
1684 (NPN_GetStringIdentifiers):
1685 (NPN_GetIntIdentifier):
1686 (NPN_IdentifierIsString):
1687 (NPN_UTF8FromIdentifier):
1688 (NPN_VariantToInt32):
1689 (NPN_VariantToDouble):
1691 * bindings/npruntime.h:
1692 * bindings/objc/WebScriptObject.mm:
1693 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1694 * bindings/runtime_object.cpp:
1695 (RuntimeObjectImp::~RuntimeObjectImp):
1696 * bindings/runtime_root.cpp:
1697 (KJS::Bindings::rootForInterpreter):
1698 * bindings/testbindings.cpp:
1699 (initializeIdentifiers):
1705 === JavaScriptCore-146.1 ===
1707 2004-06-16 Richard Williamson <rjw@apple.com>
1709 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1711 This turned out to be a show stopper for Dashboard. Accessing a nil
1712 ObjC property from JS caused a crash. Similar to the problem
1713 3696112 fixed below.
1717 * bindings/objc/objc_runtime.mm:
1718 (KJS::Bindings::ObjcField::valueFromInstance):
1722 2004-06-16 Richard Williamson <rjw@apple.com>
1724 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1726 This turned out to be a show stopper for Dashboard. We now
1727 return Undefined() when nil is returned from a ObjC method
1728 that returns an object type.
1732 * bindings/objc/objc_utility.mm:
1733 (KJS::Bindings::convertObjcValueToValue):
1737 2004-06-15 Richard Williamson <rjw@apple.com>
1739 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1741 No longer need to check respondsToSelector: for
1742 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1743 because these now have a default implementation on NSObject.
1747 * bindings/objc/objc_class.mm:
1748 (ObjcClass::methodsNamed):
1749 (ObjcClass::fieldNamed):
1751 2004-06-14 Darin Adler <darin@apple.com>
1755 - fixed some things for GC that Patrick missed, or that happened after the branch
1757 * bindings/objc/WebScriptObject.mm:
1758 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1759 (-[WebScriptObject finalize]): Added.
1761 - added some missing nil checks
1763 * bindings/objc/objc_instance.mm:
1764 (ObjcInstance::ObjcInstance): Check for nil.
1765 (ObjcInstance::~ObjcInstance): Check for nil.
1766 (ObjcInstance::operator=): Check for nil.
1768 2004-06-14 Darin Adler <darin@apple.com>
1770 Reviewed by me, code changes by Patrick Beard.
1772 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1774 * bindings/objc/objc_instance.mm:
1775 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1776 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1777 (ObjcInstance::operator=): More of the same.
1778 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1780 * bindings/objc/objc_runtime.mm:
1781 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1782 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1783 (ObjcArray::operator=): More of the same.
1785 * bindings/testbindings.mm: Fixed incorrect license.
1786 (main): Use [pool drain] if compiling on Tiger.
1790 2004-06-10 Kevin Decker <kdecker@apple.com>
1796 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1798 (KJS::Lexer::lineNo):
1799 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1801 === JavaScriptCore-143.2 ===
1803 2004-06-07 Darin Adler <darin@apple.com>
1805 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1807 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1808 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1810 === JavaScriptCore-143.1 ===
1812 2004-06-04 Kevin Decker <kdecker@apple.com>
1816 - fixed <rdar://problem/3680594>
1819 (KJS::Error::create):
1823 2004-06-04 Darin Adler <darin@apple.com>
1825 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1827 2004-06-04 Kevin Decker <kdecker@apple.com>
1831 - ObjC bindings do not (yet) pass along sourceurl or line numbers
1832 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1833 - changed the wording of an error message
1834 - the lexer, parser, and interpreter have been made "sourceURL aware"
1835 - stored the url into Error
1837 * bindings/NP_jsobject.cpp:
1839 * bindings/jni/jni_jsobject.cpp:
1841 * bindings/objc/WebScriptObject.mm:
1842 (-[WebScriptObject evaluateWebScript:]):
1844 (GlobalFuncImp::call):
1845 * kjs/function_object.cpp:
1846 (FunctionObjectImp::construct):
1849 (InterpreterImp::checkSyntax):
1850 (InterpreterImp::evaluate):
1852 * kjs/interpreter.cpp:
1853 (Interpreter::evaluate):
1854 * kjs/interpreter.h:
1858 (KJS::Lexer::sourceURL):
1862 (FunctionCallNode::evaluate):
1865 (KJS::Error::create):
1868 2004-06-04 Richard Williamson <rjw@apple.com>
1870 Fixed crash when attempting to access properties on nil
1875 * bindings/objc/objc_instance.mm:
1876 (ObjcInstance::getClass):
1877 * bindings/runtime_object.cpp:
1878 (RuntimeObjectImp::get):
1879 * bindings/testM.js:
1880 * bindings/testbindings.mm:
1881 (-[MyFirstInterface getString]):
1883 2004-05-27 Kevin Decker <kdecker@apple.com>
1887 -revised generated error message content
1889 * kjs/error_object.cpp:
1890 (ErrorProtoFuncImp::call):
1894 (KJS::Error::create):
1898 2004-05-27 Richard Williamson <rjw@apple.com>
1900 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1904 * bindings/objc/WebScriptObject.h:
1906 2004-05-27 Darin Adler <darin@apple.com>
1910 - moved to new symlink technique for embedding frameworks
1912 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1913 because we don't need it any more.
1915 2004-05-24 Richard Williamson <rjw@apple.com>
1917 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1918 fixed ClassInfo to correctly reflect inheritance. This is required
1919 because of the runtime checks in JSC for arrays, i.e. in
1920 the Function objects apply method.
1924 * bindings/jni/jni_runtime.cpp:
1925 (JavaArray::convertJObjectToArray):
1926 * bindings/objc/objc_utility.mm:
1927 (KJS::Bindings::convertObjcValueToValue):
1928 * bindings/runtime_array.cpp:
1929 (RuntimeArrayImp::RuntimeArrayImp):
1930 * bindings/runtime_array.h:
1931 * bindings/testM.js: Added.
1932 * bindings/testbindings.mm:
1933 (+[MyFirstInterface webScriptNameForSelector:]):
1934 (-[MyFirstInterface logMessages:]):
1935 (-[MyFirstInterface logMessage:prefix:]):
1936 (-[MyFirstInterface callJSObject::]):
1938 2004-05-22 Darin Adler <darin@apple.com>
1942 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
1944 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
1945 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
1946 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
1947 it hasn't been set explicitly.
1951 2004-05-20 Richard Williamson <rjw@apple.com>
1953 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
1954 can now be referenced like any other WebScriptObject, meaning
1955 you can do JS operations on them.
1957 All added implementation of finalizeForWebScript.
1961 * bindings/objc/WebScriptObject.h:
1962 * bindings/objc/WebScriptObject.mm:
1963 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1964 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1965 (-[WebScriptObject KJS::]):
1966 (-[WebScriptObject dealloc]):
1967 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1968 (-[WebScriptObject evaluateWebScript:]):
1969 (-[WebScriptObject setValue:forKey:]):
1970 (-[WebScriptObject valueForKey:]):
1971 (-[WebScriptObject stringRepresentation]):
1972 * bindings/objc/WebScriptObjectPrivate.h:
1973 * bindings/objc/objc_instance.mm:
1974 (ObjcInstance::~ObjcInstance):
1976 2004-05-19 Richard Williamson <rjw@apple.com>
1978 Removed extraneous tabs that were added (by XCode?).
1980 * bindings/objc/WebScriptObject.h:
1982 2004-05-19 Darin Adler <darin@apple.com>
1984 - fixed headers with licenses mangled by Xcode auto-indenting
1986 * bindings/jni/jni_jsobject.cpp:
1987 * bindings/jni/jni_jsobject.h:
1988 * bindings/runtime_array.h:
1989 * bindings/runtime_root.cpp:
1990 * bindings/runtime_root.h:
1992 2004-05-18 Richard Williamson <rjw@apple.com>
1994 Added exception logging. Also check for exception and
1995 set results as appropriate.
1997 Reviewed by Maciej (partially reviewed).
1999 * bindings/objc/WebScriptObject.mm:
2000 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2001 (-[WebScriptObject evaluateWebScript:]):
2002 (-[WebScriptObject setValue:forKey:]):
2003 (-[WebScriptObject valueForKey:]):
2005 2004-05-18 Richard Williamson <rjw@apple.com>
2007 Finsished implementing support for windowScriptObject.
2008 Had to make WebScriptObjectPrivate.h accessible from
2013 * JavaScriptCore.pbproj/project.pbxproj:
2014 * bindings/objc/WebScriptObjectPrivate.h:
2016 2004-05-18 Richard Williamson <rjw@apple.com>
2018 Use KVC to set/get values instead of directly accessing
2023 * bindings/objc/WebScriptObject.mm:
2024 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2025 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2026 * bindings/objc/objc_runtime.mm:
2027 (ObjcField::valueFromInstance):
2028 (convertValueToObjcObject):
2029 (ObjcField::setValueToInstance):
2031 2004-05-17 Richard Williamson <rjw@apple.com>
2033 Implemented new API for WebScriptObject.
2035 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
2036 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
2040 * JavaScriptCore.pbproj/project.pbxproj:
2041 * bindings/c/c_instance.cpp:
2042 (CInstance::invokeMethod):
2043 * bindings/jni/jni_instance.cpp:
2044 (JavaInstance::invokeMethod):
2045 * bindings/jni/jni_jsobject.cpp:
2046 (JSObject::convertValueToJObject):
2047 * bindings/jni/jni_utility.cpp:
2048 (KJS::Bindings::getJNIField):
2049 * bindings/objc/WebScriptObject.mm:
2051 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2052 (-[WebScriptObject KJS::]):
2053 (-[WebScriptObject dealloc]):
2054 (+[WebScriptObject throwException:]):
2056 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2057 (-[WebScriptObject evaluateWebScript:]):
2058 (-[WebScriptObject setValue:forKey:]):
2059 (-[WebScriptObject valueForKey:]):
2060 (-[WebScriptObject stringRepresentation]):
2061 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2062 (+[WebUndefined undefined]):
2063 (-[WebUndefined initWithCoder:]):
2064 (-[WebUndefined encodeWithCoder:]):
2065 (-[WebUndefined copyWithZone:]):
2066 (-[WebUndefined retain]):
2067 (-[WebUndefined release]):
2068 (-[WebUndefined retainCount]):
2069 (-[WebUndefined autorelease]):
2070 (-[WebUndefined dealloc]):
2071 (-[WebUndefined copy]):
2072 (-[WebUndefined replacementObjectForPortCoder:]):
2073 * bindings/objc/WebScriptObjectPrivate.h: Added.
2074 * bindings/objc/objc_class.mm:
2075 (ObjcClass::methodsNamed):
2076 (ObjcClass::fieldNamed):
2077 * bindings/objc/objc_instance.mm:
2078 (ObjcInstance::invokeMethod):
2079 * bindings/objc/objc_jsobject.h:
2080 * bindings/objc/objc_jsobject.mm:
2081 * bindings/objc/objc_runtime.mm:
2082 (ObjcField::valueFromInstance):
2083 * bindings/objc/objc_utility.mm:
2084 (KJS::Bindings::JSMethodNameToObjCMethodName):
2085 (KJS::Bindings::convertValueToObjcValue):
2086 (KJS::Bindings::convertObjcValueToValue):
2087 * bindings/runtime.cpp:
2088 (Instance::setDidExecuteFunction):
2089 (Instance::didExecuteFunction):
2090 (Instance::setValueOfField):
2091 * bindings/runtime.h:
2092 * bindings/testbindings.mm:
2093 (+[MyFirstInterface webScriptNameForSelector:]):
2094 (-[MyFirstInterface callJSObject::]):
2096 2004-05-14 Vicki Murley <vicki@apple.com>
2100 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
2102 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
2106 2004-05-13 Richard Williamson <rjw@apple.com>
2113 * bindings/objc/WebScriptObject.h:
2115 2004-05-13 Richard Williamson <rjw@apple.com>
2117 Approved API changes. Currently unimplemented.
2122 * JavaScriptCore.pbproj/project.pbxproj:
2123 * bindings/objc/WebScriptObject.h: Added.
2124 * bindings/objc/WebScriptObject.mm: Added.
2125 (+[WebScriptObject throwException:]):
2126 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2127 (-[WebScriptObject evaluateWebScript:]):
2128 (-[WebScriptObject stringRepresentation]):
2129 (+[WebUndefined undefined]):
2130 (-[WebUndefined initWithCoder:]):
2131 (-[WebUndefined encodeWithCoder:]):
2132 (-[WebUndefined copyWithZone:]):
2134 2004-05-07 Vicki Murley <vicki@apple.com>
2138 Turn off GC since it uses ppc only instructions (which breaks
2141 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
2145 2004-05-07 Maciej Stachowiak <mjs@apple.com>
2149 - add -funroll-loops=16 compiler option for approx .5% speedup on
2150 HTML iBench and .5-1% speedup on JS iBench.
2152 * JavaScriptCore.pbproj/project.pbxproj:
2154 2004-04-25 Maciej Stachowiak <mjs@apple.com>
2158 Enable full conservative GC mode in addition to test mode. When
2159 conservative GC is enabled, we now get an 11% speed improvement on
2160 the iBench. Also fix some spots I missed before.
2162 Specific noteworth changes:
2164 * kjs/collector.cpp:
2165 (KJS::Collector::markStackObjectsConservatively): Check possible
2166 cell pointers for 8-byte aligment and verify they are not 0.
2168 * kjs/protected_values.cpp:
2169 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
2170 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
2172 (KJS::gcProtectNullTolerant): ...to here...
2173 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
2174 tolerance, and doing the check is expensive.
2176 * kjs/protected_values.cpp:
2177 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
2178 that is still very good.
2183 (KJS::ProtectedValue::ProtectedValue):
2184 (KJS::ProtectedValue::~ProtectedValue):
2185 (KJS::ProtectedValue::operator=):
2186 (KJS::ProtectedObject::ProtectedObject):
2187 (KJS::ProtectedObject::~ProtectedObject):
2188 (KJS::ProtectedObject::operator=):
2189 (KJS::ProtectedReference::ProtectedReference):
2190 (KJS::ProtectedReference::~ProtectedReference):
2191 (KJS::ProtectedReference::operator=):
2192 * kjs/protected_values.cpp:
2193 (KJS::ProtectedValues::getProtectCount):
2194 (KJS::ProtectedValues::increaseProtectCount):
2195 (KJS::ProtectedValues::decreaseProtectCount):
2196 (KJS::ProtectedValues::computeHash):
2197 * bindings/runtime_root.cpp:
2198 (KJS::Bindings::addNativeReference):
2199 (KJS::Bindings::removeNativeReference):
2200 (RootObject::removeAllNativeReferences):
2201 * bindings/runtime_root.h:
2202 (KJS::Bindings::RootObject::~RootObject):
2203 (KJS::Bindings::RootObject::setRootObjectImp):
2204 * kjs/collector.cpp:
2205 (KJS::Collector::allocate):
2206 (KJS::Collector::collect):
2209 (NumberImp::create):
2210 (InterpreterImp::globalInit):
2211 (InterpreterImp::globalClear):
2212 (InterpreterImp::mark):
2214 (KJS::List::derefValues):
2215 (KJS::List::refValues):
2216 (KJS::List::append):
2218 (KJS::ObjectImp::setInternalValue):
2219 (KJS::ObjectImp::putDirect):
2224 (KJS::ValueImp::ValueImp):
2225 (KJS::ValueImp::~ValueImp):
2227 (KJS::Value::Value):
2228 (KJS::Value::~Value):
2229 (KJS::Value::operator=):
2231 2004-04-30 Richard Williamson <rjw@apple.com>
2233 Asking an NSInvocation for it's return value when return type
2234 is void throws an exception. Added check for void return types
2235 to avoid this exception.
2239 * bindings/objc/objc_instance.mm:
2240 (ObjcInstance::invokeMethod):
2242 2004-04-29 Richard Williamson <rjw@apple.com>
2244 Fixed several bad problems with the ObjC bindings. In particular, conversion
2245 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
2249 * bindings/objc/objc_jsobject.h:
2250 * bindings/objc/objc_jsobject.mm:
2251 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2252 (-[JavaScriptObject KJS::]):
2253 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2254 (-[JavaScriptObject call:arguments:]):
2255 (-[JavaScriptObject evaluate:]):
2256 (-[JavaScriptObject getMember:]):
2257 (-[JavaScriptObject getSlot:]):
2258 * bindings/objc/objc_runtime.mm:
2259 (ObjcField::valueFromInstance):
2260 (ObjcField::setValueToInstance):
2261 * bindings/objc/objc_utility.mm:
2262 (KJS::Bindings::convertValueToObjcValue):
2263 (KJS::Bindings::convertObjcValueToValue):
2264 * bindings/runtime.h:
2265 * bindings/runtime_root.cpp:
2266 (KJS::Bindings::rootForInterpreter):
2267 (KJS::Bindings::addNativeReference):
2268 (KJS::Bindings::removeNativeReference):
2269 * bindings/runtime_root.h:
2270 * bindings/testbindings.mm:
2271 (-[MyFirstInterface logMessage:]):
2272 (-[MyFirstInterface setJSObject:]):
2273 (-[MyFirstInterface callJSObject::]):
2275 2004-04-24 Darin Adler <darin@apple.com>
2279 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
2282 2004-04-23 Maciej Stachowiak <mjs@apple.com>
2286 Implementation of conservative GC, based partly on code from
2287 Darin. It's turned off for now, so it shouldn't have any effect on
2290 * JavaScriptCore.pbproj/project.pbxproj:
2291 * kjs/collector.cpp:
2292 (KJS::Collector::markStackObjectsConservatively):
2293 (KJS::Collector::markProtectedObjects):
2294 (KJS::Collector::collect):
2299 * kjs/protected_values.cpp: Added.
2300 (KJS::ProtectedValues::getProtectCount):
2301 (KJS::ProtectedValues::increaseProtectCount):
2302 (KJS::ProtectedValues::insert):
2303 (KJS::ProtectedValues::decreaseProtectCount):
2304 (KJS::ProtectedValues::expand):
2305 (KJS::ProtectedValues::shrink):
2306 (KJS::ProtectedValues::rehash):
2307 (KJS::ProtectedValues::computeHash):
2308 * kjs/protected_values.h: Added.
2310 (ValueImp::useConservativeMark):
2318 2004-04-22 Richard Williamson <rjw@apple.com>
2320 Fixed build snafu (re-declaration of NPBool in npruntime.h and
2323 * bindings/npruntime.h:
2325 2004-04-22 Richard Williamson <rjw@apple.com>
2327 Updated plugin binding API to reflect latest revision from
2330 Biggest change is the introduction of NPVariant used to represent
2331 value types. NPVariant replaces the use of NPObject for the
2332 exchange of values between scripting environment and native code.
2336 * JavaScriptCore.pbproj/project.pbxproj:
2337 * bindings/NP_jsobject.cpp:
2338 (identiferFromNPIdentifier):
2344 (NPN_GetPropertyAtIndex):
2345 (NPN_SetPropertyAtIndex):
2346 * bindings/c/c_class.cpp:
2347 (CClass::methodsNamed):
2348 (CClass::fieldNamed):
2349 * bindings/c/c_instance.cpp:
2350 (CInstance::invokeMethod):
2351 (CInstance::defaultValue):
2352 * bindings/c/c_runtime.cpp:
2353 (CField::valueFromInstance):
2354 (CField::setValueToInstance):
2355 * bindings/c/c_utility.cpp:
2356 (convertNPStringToUTF16):
2357 (convertUTF8ToUTF16):
2358 (coerceValueToNPVariantStringType):
2359 (convertValueToNPVariant):
2360 (convertNPVariantToValue):
2361 * bindings/c/c_utility.h:
2362 * bindings/npruntime.cpp:
2363 (NPN_GetIdentifier):
2364 (NPN_GetIdentifiers):
2365 (NPN_UTF8FromIdentifier):
2366 (NPN_VariantIsVoid):
2367 (NPN_VariantIsNull):
2368 (NPN_VariantIsUndefined):
2369 (NPN_VariantIsBool):
2370 (NPN_VariantIsInt32):
2371 (NPN_VariantIsDouble):
2372 (NPN_VariantIsString):
2373 (NPN_VariantIsObject):
2374 (NPN_VariantToBool):
2375 (NPN_VariantToString):
2376 (NPN_VariantToInt32):
2377 (NPN_VariantToDouble):
2378 (NPN_VariantToObject):
2379 (NPN_InitializeVariantAsVoid):
2380 (NPN_InitializeVariantAsNull):
2381 (NPN_InitializeVariantAsUndefined):
2382 (NPN_InitializeVariantWithBool):
2383 (NPN_InitializeVariantWithInt32):
2384 (NPN_InitializeVariantWithDouble):
2385 (NPN_InitializeVariantWithString):
2386 (NPN_InitializeVariantWithStringCopy):
2387 (NPN_InitializeVariantWithObject):
2388 (NPN_InitializeVariantWithVariant):
2389 (NPN_ReleaseVariantValue):
2392 (NPN_ReleaseObject):
2393 (NPN_IsKindOfClass):
2394 (NPN_SetExceptionWithUTF8):
2396 * bindings/npruntime.h:
2398 (_NPString::_NPVariant::):
2399 * bindings/testbindings.cpp:
2414 2004-04-22 Darin Adler <darin@apple.com>
2418 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
2421 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
2422 Was resulting in a buffer 2x the needed size.
2423 (KJS::UString::expandPreCapacity): Ditto.
2424 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
2426 2004-04-21 Maciej Stachowiak <mjs@apple.com>
2430 Preliminary change for conservative GC. Create "protected"
2431 subclasses to GC-protect objects when on heap, since we will soon
2432 remove the built-in refcounting of the normal wrapper classes. Use
2435 * JavaScriptCore.pbproj/project.pbxproj:
2438 (KJS::InterpreterImp::globalObject):
2439 * kjs/interpreter.h:
2440 * kjs/property_map.cpp:
2442 * kjs/reference_list.cpp:
2444 2004-04-19 Maciej Stachowiak <mjs@apple.com>
2448 Optimize prepend using the shared substring optimization. Also,
2449 limit the applicability of shared append and shared prepend. If
2450 you overdo it, it does more harm than good, because you create a
2451 bunch of strings that are disqualified from future shared
2452 append/prepend, for not much immediate savings in allocate/copy
2457 (KJS::UString::Rep::create):
2458 (KJS::UString::expandedSize):
2459 (KJS::UString::usedPreCapacity):
2460 (KJS::UString::expandCapacity):
2461 (KJS::UString::expandPreCapacity):
2462 (KJS::UString::UString):
2463 (KJS::UString::append):
2464 (KJS::UString::operator=):
2466 (KJS::UString::Rep::data):
2468 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2469 Reviewed by Richard.
2471 No more need for Completion or Reference to privately inherit from
2472 Value, none of the superclass functionality is used.
2479 2004-04-16 Richard Williamson <rjw@apple.com>
2481 Added interpreter lock protection around object creation.
2485 * bindings/runtime.cpp:
2486 (Instance::createRuntimeObject):
2488 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2492 Another JavaScript speed improvement: use the mechanism from
2493 string append optimization to make taking a substring fast, again
2496 A further 22% improvement on the 24fun string speed test.
2500 (KJS::UString::Rep::create):
2501 (KJS::UString::UString):
2502 (KJS::UString::append):
2503 (KJS::UString::operator=):
2504 (KJS::UString::substr):
2506 (KJS::UString::Rep::data):
2508 2004-04-13 Maciej Stachowiak <mjs@apple.com>
2512 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
2513 - fixed <rdar://problem/3600691>: Table generation test is really slow
2514 - fixed <rdar://problem/3600661>: 24fun date test is really slow
2516 80% speedup on the string test, lesser speedups on the other two.
2518 Two different optimizations here:
2520 1) Avoid large overhead of scanning strings to see if they are all
2521 ASCII before numeric conversion.
2524 (AssignNode::evaluate): Don't convert to integer until we know for
2525 sure the operation will need it. Attempting to convert strings to
2526 numbers is a waste when they are being appended with +=.
2528 2) Avoid huge cost of appending strings.
2530 This is done by allowing multiple strings to share a buffer but
2531 actually use different ranges of it. The first time a string is
2532 appended to, we start leaving at least 10% extra space in the
2533 buffer, so doing N appends to the same string takes O(log N)
2534 mallocs instead of O(N).
2536 * kjs/identifier.cpp:
2537 (KJS::Identifier::equal):
2538 (KJS::Identifier::add):
2541 (KJS::UCharReference::operator=):
2542 (KJS::UCharReference::ref):
2543 (KJS::UString::Rep::create):
2544 (KJS::UString::Rep::destroy):
2545 (KJS::UString::expandedSize):
2546 (KJS::UString::usedCapacity):
2547 (KJS::UString::expandCapacity):
2548 (KJS::UString::UString):
2549 (KJS::UString::null):
2550 (KJS::UString::append):
2551 (KJS::UString::operator=):
2552 (KJS::UString::toStrictUInt32):
2553 (KJS::UString::detach):
2554 (KJS::KJS::operator==):
2556 (KJS::UString::Rep::data):
2557 (KJS::UString::Rep::hash):
2559 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2563 - fix deployment build by avoiding deployment-only warning.
2565 * kjs/scope_chain.cpp:
2566 (KJS::ScopeChain::bottom):
2568 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2572 Changed things so that newly created objects get a prototype based
2573 on the scope chain of the current function, rather than the
2574 interpreter that started execution. This fixes the following bugs:
2576 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
2577 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
2579 * JavaScriptCore.pbproj/project.pbxproj:
2580 * kjs/array_object.cpp:
2581 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2582 (ArrayProtoFuncImp::ArrayProtoFuncImp):
2583 (ArrayProtoFuncImp::call):
2584 (ArrayObjectImp::construct):
2585 * kjs/bool_object.cpp:
2586 (BooleanObjectImp::construct):
2587 * kjs/date_object.cpp:
2588 (DateProtoFuncImp::DateProtoFuncImp):
2589 (DateProtoFuncImp::call):
2590 (DateObjectImp::construct):
2591 * kjs/error_object.cpp:
2592 (ErrorObjectImp::construct):
2594 (FunctionImp::FunctionImp):
2595 (FunctionImp::call):
2596 (DeclaredFunctionImp::construct):
2597 (ArgumentsImp::ArgumentsImp):
2598 (GlobalFuncImp::call):
2599 * kjs/function_object.cpp:
2600 (FunctionProtoFuncImp::call):
2601 (FunctionObjectImp::construct):
2603 (BooleanImp::toObject):
2604 (StringImp::toObject):
2605 (NumberImp::toObject):
2606 (InterpreterImp::InterpreterImp):
2607 (InterpreterImp::clear):
2608 (InterpreterImp::interpreterWithGlobalObject):
2610 * kjs/interpreter.cpp:
2611 (ExecState::lexicalInterpreter):
2612 * kjs/interpreter.h:
2613 (KJS::ExecState::dynamicInterpreter):
2614 (KJS::ExecState::interpreter):
2615 * kjs/math_object.cpp:
2616 (MathFuncImp::MathFuncImp):
2618 (StatementNode::hitStatement):
2619 (StatementNode::abortStatement):
2620 (RegExpNode::evaluate):
2621 (ElementNode::evaluate):
2622 (ArrayNode::evaluate):
2623 (ObjectLiteralNode::evaluate):
2624 (PropertyValueNode::evaluate):
2625 (FunctionCallNode::evaluate):
2626 (FuncDeclNode::processFuncDecl):
2627 (FuncExprNode::evaluate):
2628 * kjs/number_object.cpp:
2629 (NumberObjectImp::construct):
2631 (KJS::ObjectImp::defaultValue):
2632 (KJS::Error::create):
2633 * kjs/object_object.cpp:
2634 (ObjectObjectImp::construct):
2635 * kjs/reference.cpp:
2636 (Reference::putValue):
2637 * kjs/regexp_object.cpp:
2638 (RegExpProtoFuncImp::call):
2639 (RegExpObjectImp::arrayOfMatches):
2640 (RegExpObjectImp::construct):
2641 * kjs/scope_chain.cpp:
2642 (KJS::ScopeChain::bottom):
2643 * kjs/scope_chain.h:
2644 * kjs/string_object.cpp:
2645 (StringProtoFuncImp::StringProtoFuncImp):
2646 (StringProtoFuncImp::call):
2647 (StringObjectImp::construct):
2653 2004-03-31 Richard Williamson <rjw@apple.com>
2655 Tedious renames based on feedback from plugin-futures list.
2656 NP_ functions are renamed with NPN_ prefix.
2657 Types prefix renamed from NP_ to NP.
2658 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
2660 No review because this was just a renaming patch.
2662 * bindings/NP_jsobject.cpp:
2665 (identiferFromNPIdentifier):
2670 (NPN_RemoveProperty):
2672 (NPN_GetPropertyAtIndex):
2673 (NPN_SetPropertyAtIndex):
2674 * bindings/NP_jsobject.h:
2675 * bindings/c/c_class.cpp:
2676 (CClass::_commonInit):
2677 (CClass::classForIsA):
2679 (CClass::methodsNamed):
2680 (CClass::fieldNamed):
2681 * bindings/c/c_class.h:
2682 * bindings/c/c_instance.cpp:
2683 (CInstance::CInstance):
2684 (CInstance::~CInstance):
2685 (CInstance::operator=):
2686 (CInstance::invokeMethod):
2687 (CInstance::defaultValue):
2688 * bindings/c/c_instance.h:
2689 (KJS::Bindings::CInstance::getObject):
2690 * bindings/c/c_runtime.cpp:
2691 (CField::valueFromInstance):
2692 (CField::setValueToInstance):
2693 * bindings/c/c_runtime.h:
2694 (KJS::Bindings::CField::CField):
2695 (KJS::Bindings::CField::name):
2696 (KJS::Bindings::CMethod::CMethod):
2697 (KJS::Bindings::CMethod::name):
2698 * bindings/c/c_utility.cpp:
2699 (coerceValueToNPString):
2700 (convertValueToNPValueType):
2701 (convertNPValueTypeToValue):
2702 * bindings/c/c_utility.h:
2703 * bindings/npruntime.cpp:
2704 (NPN_IdentifierFromUTF8):
2705 (NPN_IsValidIdentifier):
2706 (NPN_GetIdentifiers):
2707 (NPN_UTF8FromIdentifier):
2710 (NPN_ReleaseObject):
2711 (NPN_IsKindOfClass):
2712 (NPN_SetExceptionWithUTF8):
2715 (NPN_CreateNumberWithInt):
2716 (NPN_CreateNumberWithFloat):
2717 (NPN_CreateNumberWithDouble):
2718 (NPN_IntFromNumber):
2719 (NPN_FloatFromNumber):
2720 (NPN_DoubleFromNumber):
2722 (NPN_CreateStringWithUTF8):
2723 (NPN_CreateStringWithUTF16):
2724 (NPN_DeallocateUTF8):
2725 (NPN_UTF8FromString):
2726 (NPN_UTF16FromString):
2729 (NPN_CreateBoolean):
2730 (NPN_BoolFromBoolean):
2733 (undefinedAllocate):
2739 (NPN_ObjectAtIndex):
2740 * bindings/npruntime.h:
2741 * bindings/runtime.cpp:
2742 (Instance::createBindingForLanguageInstance):
2743 * bindings/testbindings.cpp:
2744 (initializeIdentifiers):
2764 2004-03-31 Richard Williamson <rjw@apple.com>
2766 Changed references to NP_runtime.h to npruntime.h
2768 * JavaScriptCore.pbproj/project.pbxproj:
2769 * bindings/NP_jsobject.h:
2770 * bindings/c/c_class.h:
2771 * bindings/c/c_instance.h:
2772 * bindings/c/c_runtime.h:
2773 * bindings/c/c_utility.h:
2774 * bindings/npruntime.cpp:
2776 2004-03-31 Richard Williamson <rjw@apple.com>
2778 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2780 * JavaScriptCore.pbproj/project.pbxproj:
2781 * bindings/NP_jsobject.h:
2782 * bindings/npruntime.cpp:
2786 2004-03-23 Richard Williamson <rjw@apple.com>
2788 Added implementation of KJS::Value <-> NP_Object conversion functions.
2789 Augmented test program for 'C' bindings.
2790 Added asserts and parameter checking to all public API.
2794 * JavaScriptCore.pbproj/project.pbxproj:
2795 * bindings/NP_jsobject.cpp:
2797 * bindings/NP_jsobject.h: Added.
2798 * bindings/NP_runtime.cpp:
2799 (NP_IdentifierFromUTF8):
2800 (NP_IsValidIdentifier):
2801 (NP_GetIdentifiers):
2806 (NP_SetExceptionWithUTF8):
2809 (NP_FloatFromNumber):
2810 (NP_DoubleFromNumber):
2811 (NP_CreateStringWithUTF8):
2812 (NP_CreateStringWithUTF16):
2813 (NP_DeallocateUTF8):
2814 (NP_UTF8FromString):
2815 (NP_UTF16FromString):
2817 (NP_BoolFromBoolean):
2818 * bindings/NP_runtime.h:
2819 * bindings/c/c_instance.cpp:
2820 (CInstance::invokeMethod):
2821 * bindings/c/c_utility.cpp:
2822 (coerceValueToNPString):
2823 (convertValueToNPValueType):
2824 (convertNPValueTypeToValue):
2825 * bindings/c/c_utility.h:
2827 * bindings/testC.js: Added.
2828 * bindings/testbindings.cpp:
2838 (myInterfaceInvoke):
2839 (myInterfaceAllocate):
2843 2004-03-19 Darin Adler <darin@apple.com>
2847 - fixed problem with methods like setUTCHour
2849 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2850 GMT vs. local time function based on the utc flag.
2852 2004-03-17 Richard Williamson <rjw@apple.com>
2854 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
2858 * bindings/NP_jsobject.cpp:
2863 (NP_GetPropertyAtIndex):
2864 * bindings/NP_runtime.h:
2866 2004-03-16 Richard Williamson <rjw@apple.com>
2868 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.
2872 * bindings/jni/jni_class.cpp:
2873 (JavaClass::methodsNamed):
2875 2004-03-15 Richard Williamson <rjw@apple.com>
2877 Fixed 3570854. Don't attempt to convert Null to strings. We
2878 were incorrectly converting to "Null".
2880 Actually fixed by Scott Kovatch.
2882 Reviewed by Richard.
2884 * bindings/jni/jni_utility.cpp:
2885 (KJS::Bindings::convertValueToJValue):
2889 2004-03-11 Richard Williamson <rjw@apple.com>
2891 Stitched together the NP stuff to our language independent
2892 JavaScript binding stuff. Very close to being done.
2894 Added program to test C bindings (and NP stuff). Just tests
2895 properties. Will add methods and JavaScript access, etc.
2897 Updated Makefile.am to account for new bindings/c directory.
2899 Change NP_UTF8 from "const char *" to "char" to allow for
2900 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
2903 Added NP_IsValidIdentifier().
2907 * JavaScriptCore.pbproj/project.pbxproj:
2909 * bindings/NP_jsobject.cpp:
2910 (identiferFromNPIdentifier):
2912 * bindings/NP_runtime.cpp:
2913 (NP_IdentifierFromUTF8):
2914 (NP_IsValidIdentifier):
2915 (NP_GetIdentifiers):
2916 (NP_UTF8FromIdentifier):
2917 (NP_SetExceptionWithUTF8):
2919 (NP_CreateStringWithUTF8):
2920 (NP_CreateStringWithUTF16):
2921 (NP_UTF8FromString):
2922 (NP_UTF16FromString):
2923 * bindings/NP_runtime.h:
2924 * bindings/c/c_class.cpp: Added.
2925 (CClass::_commonDelete):
2926 (CClass::_commonCopy):
2927 (CClass::_commonInit):
2928 (_createClassesByIsAIfNecessary):
2929 (CClass::classForIsA):
2932 (CClass::methodsNamed):
2933 (CClass::fieldNamed):
2934 * bindings/c/c_class.h: Added.
2935 (KJS::Bindings::CClass::~CClass):
2936 (KJS::Bindings::CClass::CClass):
2937 (KJS::Bindings::CClass::operator=):
2938 (KJS::Bindings::CClass::constructorAt):
2939 (KJS::Bindings::CClass::numConstructors):
2940 * bindings/c/c_instance.cpp: Added.
2941 (CInstance::CInstance):
2942 (CInstance::~CInstance):
2943 (CInstance::operator=):
2944 (CInstance::getClass):
2947 (CInstance::invokeMethod):
2948 (CInstance::defaultValue):
2949 (CInstance::stringValue):
2950 (CInstance::numberValue):
2951 (CInstance::booleanValue):
2952 (CInstance::valueOf):
2953 * bindings/c/c_instance.h: Added.
2954 (KJS::Bindings::CInstance::getObject):
2955 * bindings/c/c_runtime.cpp: Added.
2956 (CField::valueFromInstance):
2957 (CField::setValueToInstance):
2958 * bindings/c/c_runtime.h: Added.
2959 (KJS::Bindings::CField::CField):
2960 (KJS::Bindings::CField::name):
2961 (KJS::Bindings::CField::type):
2962 (KJS::Bindings::CMethod::CMethod):
2963 (KJS::Bindings::CMethod::name):
2964 (KJS::Bindings::CMethod::numParameters):
2965 * bindings/c/c_utility.cpp: Added.
2966 (coerceValueToNPValueType):
2967 (convertValueToNPValueType):
2968 (convertNPValueTypeToValue):
2969 * bindings/c/c_utility.h: Added.
2970 * bindings/make_testbindings:
2971 * bindings/runtime.cpp:
2972 (Instance::createBindingForLanguageInstance):
2973 * bindings/runtime.h:
2974 (KJS::Bindings::Instance::):
2975 * bindings/testbindings.cpp: Added.
2976 (initializeIdentifiers):
2977 (myInterfaceHasProperty):
2978 (myInterfaceHasMethod):
2979 (myInterfaceGetProperty):
2980 (myInterfaceSetProperty):
2981 (myInterfaceInvoke):
2982 (myInterfaceAllocate):
2983 (myInterfaceInvalidate):
2984 (myInterfaceDeallocate):
2985 (GlobalImp::className):
2986 (readJavaScriptFromFile):
2989 2004-03-10 Richard Williamson <rjw@apple.com>
2991 Made changes to support new asychronous approach to calls from
2992 plugin to JavaScript
2996 * bindings/NP_jsobject.cpp:
3001 (NP_GetPropertyAtIndex):
3002 * bindings/NP_runtime.h:
3003 * bindings/make_testbindings:
3004 * bindings/runtime.cpp:
3005 (Instance::createBindingForLanguageInstance):
3007 2004-03-10 Richard Williamson <rjw@apple.com>
3009 Updated header to include proposed changes from
3010 plugin-futures list. Calls from plugin to JavaScript
3011 are now asynchronous.
3015 * bindings/NP_runtime.h:
3019 2004-03-04 Richard Williamson <rjw@apple.com>
3021 Implementation of NP_JavaScriptObject. This is the 'C' class
3022 that wraps a JavaScript object.
3026 * JavaScriptCore.pbproj/project.pbxproj:
3027 * bindings/NP_jsobject.cpp: Added.
3028 (coerceValueToNPValueType):
3029 (convertValueToNPValueType):
3030 (convertNPValueTypeToValue):
3034 (identiferFromNPIdentifier):
3039 (NP_RemoveProperty):
3041 (NP_GetPropertyAtIndex):
3042 (NP_SetPropertyAtIndex):
3043 * bindings/NP_runtime.cpp:
3045 * bindings/NP_runtime.h:
3046 * bindings/runtime_object.h:
3048 2004-03-04 Richard Williamson <rjw@apple.com>
3050 Added NP_Array implementation.
3052 Changed NP_Boolean to just depend on two static instances, no
3053 space is required for values.
3057 * bindings/NP_runtime.cpp:
3059 (NP_BoolFromBoolean):
3065 * bindings/NP_runtime.h:
3067 2004-03-03 Darin Adler <darin@apple.com>
3071 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
3072 copyright string, and that's all that was in here.
3073 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
3075 2004-03-03 Richard Williamson <rjw@apple.com>
3077 More 'C' binding implementation. Fleshed out all the
3078 'primitive' data types.
3082 * bindings/NP_runtime.cpp:
3087 (NP_CreateStringWithUTF8):
3088 (NP_CreateStringWithUTF16):
3089 (NP_UTF8FromString):
3090 (NP_UTF16FromString):
3093 (booleanDeallocate):
3095 (NP_BoolFromBoolean):
3099 (undefinedAllocate):
3100 (undefinedDeallocate):
3102 * bindings/NP_runtime.h:
3104 2004-03-03 Richard Williamson <rjw@apple.com>
3106 More 'C' binding implementation.
3110 * bindings/NP_runtime.cpp:
3113 (getIdentifierDictionary):
3114 (NP_IdentifierFromUTF8):
3115 (NP_UTF8FromIdentifier):
3120 (NP_CreateNumberWithInt):
3121 (NP_CreateNumberWithFloat):
3122 (NP_CreateNumberWithDouble):
3124 (NP_FloatFromNumber):
3125 (NP_DoubleFromNumber):
3126 * bindings/NP_runtime.h:
3128 2004-03-02 Richard Williamson <rjw@apple.com>
3130 Removed retain/release from NP_Class. Classes will not be allowed to implement their
3131 own customer retain/release scheme.
3135 * bindings/NP_runtime.cpp:
3138 * bindings/NP_runtime.h:
3140 2004-03-02 Richard Williamson <rjw@apple.com>
3142 C binding API. Partial implementation.
3144 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.
3146 Factored root object reference counting scheme. It is now useful independent
3151 * JavaScriptCore.pbproj/project.pbxproj:
3152 * bindings/NP_runtime.cpp: Added.
3153 (NP_IdentifierFromUTF8):
3154 (NP_GetIdentifiers):
3155 (NP_UTF8FromIdentifier):
3165 (NP_RemoveProperty):
3167 (NP_GetPropertyAtIndex):
3168 (NP_SetPropertyAtIndex):
3169 (NP_CreateNumberWithInt):
3170 (NP_CreateNumberWithFloat):
3171 (NP_CreateNumberWithDouble):
3173 (NP_FloatFromNumber):
3174 (NP_DoubleFromNumber):
3175 (NP_CreateStringWithUTF8):
3176 (NP_CreateStringWithUTF16):
3177 (NP_UTF8FromString):
3178 (NP_UTF16FromString):
3180 (NP_BoolFromBoolean):
3186 * bindings/NP_runtime.h: Added.
3187 * bindings/jni/jni_jsobject.cpp:
3189 (JSObject::finalize):
3190 (JSObject::createNative):
3191 (JSObject::convertValueToJObject):
3192 * bindings/jni/jni_jsobject.h:
3193 * bindings/objc/objc_jsobject.h:
3194 * bindings/objc/objc_jsobject.mm:
3196 (windowJavaScriptObject):
3197 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
3198 (-[JavaScriptObject dealloc]):
3199 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
3200 (-[JavaScriptObject call:arguments:]):
3201 (-[JavaScriptObject evaluate:]):
3202 (-[JavaScriptObject getMember:]):
3203 (-[JavaScriptObject setMember:value:]):
3204 (-[JavaScriptObject removeMember:]):
3205 (-[JavaScriptObject toString]):
3206 (-[JavaScriptObject getSlot:]):
3207 (-[JavaScriptObject setSlot:value:]):
3208 * bindings/objc/objc_utility.h:
3209 * bindings/objc/objc_utility.mm:
3210 (KJS::Bindings::convertValueToObjcValue):
3211 * bindings/runtime_root.cpp: Added.
3212 (getReferencesByRootDictionary):
3213 (getReferencesDictionary):
3214 (KJS::Bindings::findReferenceDictionary):
3215 (KJS::Bindings::rootForImp):
3216 (KJS::Bindings::addNativeReference):
3217 (KJS::Bindings::removeNativeReference):
3218 (completedJavaScriptAccess):
3219 (initializeJavaScriptAccessLock):
3220 (lockJavaScriptAccess):
3221 (unlockJavaScriptAccess):
3222 (RootObject::dispatchToJavaScriptThread):
3223 (performJavaScriptAccess):
3224 (RootObject::setFindRootObjectForNativeHandleFunction):
3225 (RootObject::removeAllNativeReferences):
3226 * bindings/runtime_root.h: Added.
3227 (KJS::Bindings::RootObject::RootObject):
3228 (KJS::Bindings::RootObject::~RootObject):
3229 (KJS::Bindings::RootObject::setRootObjectImp):
3230 (KJS::Bindings::RootObject::rootObjectImp):
3231 (KJS::Bindings::RootObject::setInterpreter):
3232 (KJS::Bindings::RootObject::interpreter):
3233 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
3234 (KJS::Bindings::RootObject::runLoop):
3235 (KJS::Bindings::RootObject::performJavaScriptSource):
3241 2004-02-18 Richard Williamson <rjw@apple.com>
3243 Added NSNumber/Number conversion.
3245 Removed some unnecessary KJS:: namespace specifiers.
3249 * bindings/objc/objc_utility.mm:
3250 (KJS::Bindings::convertValueToObjcValue):
3251 (KJS::Bindings::convertObjcValueToValue):
3252 * bindings/runtime_array.h:
3254 2004-02-18 Richard Williamson <rjw@apple.com>
3256 Added support for export NSArrays.
3258 Updated valueAt() to take an ExecState so we can throw
3261 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
3262 ObjectiveC classes to control the visibility of their methods in
3267 * bindings/jni/jni_runtime.cpp:
3268 (JavaField::valueFromInstance):
3269 (JavaArray::valueAt):
3270 * bindings/jni/jni_runtime.h:
3271 * bindings/objc/objc_class.mm:
3272 (ObjcClass::methodsNamed):
3273 * bindings/objc/objc_runtime.h:
3274 (KJS::Bindings::ObjcArray::getObjcArray):
3275 * bindings/objc/objc_runtime.mm:
3276 (ObjcField::valueFromInstance):
3277 (ObjcField::setValueToInstance):
3278 (ObjcArray::ObjcArray):
3279 (ObjcArray::~ObjcArray):
3280 (ObjcArray::operator=):
3281 (ObjcArray::setValueAt):
3282 (ObjcArray::valueAt):
3283 (ObjcArray::getLength):
3284 * bindings/objc/objc_utility.mm:
3285 (KJS::Bindings::convertValueToObjcValue):
3286 (KJS::Bindings::convertObjcValueToValue):
3287 * bindings/runtime.cpp:
3288 (Instance::getValueOfField):
3289 * bindings/runtime.h:
3290 * bindings/runtime_array.cpp:
3291 (RuntimeArrayImp::get):
3292 * bindings/runtime_object.cpp:
3293 (RuntimeObjectImp::get):
3295 2004-02-17 Richard Williamson <rjw@apple.com>
3297 Added String <-> NSString conversion.
3298 Added tests of String <-> NSString conversion to test program.
3302 * bindings/objc/objc_utility.mm:
3303 (KJS::Bindings::convertValueToObjcValue):
3304 (KJS::Bindings::convertObjcValueToValue):
3306 * bindings/testbindings.mm:
3307 (-[MyFirstInterface getString]):
3309 2004-02-15 Darin Adler <darin@apple.com>
3313 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
3314 and removing redundant settings of things that match defaults in other build styles.
3316 2004-02-13 Richard Williamson <rjw@apple.com>
3318 Work towards the JavaScript ObjC bindings. The bindings now work for
3319 simple scalar types. testbindings.mm is an illustration of how the
3324 * JavaScriptCore.pbproj/project.pbxproj:
3326 * bindings/jni/jni_class.cpp:
3327 (JavaClass::methodsNamed):
3328 * bindings/jni/jni_class.h:
3329 * bindings/jni/jni_instance.cpp:
3330 (JavaInstance::invokeMethod):
3331 * bindings/jni/jni_instance.h:
3332 * bindings/jni/jni_runtime.h:
3333 (KJS::Bindings::JavaMethod::returnType):
3334 * bindings/make_testbindings: Added.
3335 * bindings/objc/objc_class.h: Added.
3336 (KJS::Bindings::ObjcClass::~ObjcClass):
3337 (KJS::Bindings::ObjcClass::ObjcClass):
3338 (KJS::Bindings::ObjcClass::operator=):
3339 (KJS::Bindings::ObjcClass::constructorAt):
3340 (KJS::Bindings::ObjcClass::numConstructors):
3341 * bindings/objc/objc_class.mm: Added.
3342 (ObjcClass::_commonDelete):
3343 (ObjcClass::_commonCopy):
3344 (ObjcClass::_commonInit):
3345 (_createClassesByIsAIfNecessary):
3346 (ObjcClass::classForIsA):
3347 (ObjcClass::ObjcClass):
3349 (ObjcClass::methodsNamed):
3350 (ObjcClass::fieldNamed):
3351 * bindings/objc/objc_header.h: Added.
3352 * bindings/objc/objc_instance.h: Added.
3353 (KJS::Bindings::ObjcInstance::getObject):
3354 * bindings/objc/objc_instance.mm: Added.
3355 (ObjcInstance::ObjcInstance):
3356 (ObjcInstance::~ObjcInstance):
3357 (ObjcInstance::operator=):
3358 (ObjcInstance::begin):
3359 (ObjcInstance::end):
3360 (ObjcInstance::getClass):
3361 (ObjcInstance::invokeMethod):
3362 (ObjcInstance::defaultValue):
3363 (ObjcInstance::stringValue):
3364 (ObjcInstance::numberValue):
3365 (ObjcInstance::booleanValue):
3366 (ObjcInstance::valueOf):
3367 * bindings/objc/objc_jsobject.h: Added.
3368 * bindings/objc/objc_jsobject.mm: Added.
3369 * bindings/objc/objc_runtime.h:
3370 (KJS::Bindings::ObjcField::~ObjcField):
3371 (KJS::Bindings::ObjcField::ObjcField):
3372 (KJS::Bindings::ObjcField::operator=):
3373 (KJS::Bindings::ObjcMethod::ObjcMethod):
3374 (KJS::Bindings::ObjcMethod::~ObjcMethod):
3375 (KJS::Bindings::ObjcMethod::operator=):
3376 * bindings/objc/objc_runtime.mm: Added.
3377 (ObjcMethod::ObjcMethod):
3379 (ObjcMethod::numParameters):
3380 (ObjcMethod::getMethodSignature):
3381 (ObjcField::ObjcField):
3384 (ObjcField::valueFromInstance):
3385 (ObjcField::setValueToInstance):
3386 * bindings/objc/objc_utility.h: Added.
3388 * bindings/objc/objc_utility.mm: Added.
3389 (KJS::Bindings::JSMethodNameToObjCMethodName):
3390 (KJS::Bindings::convertValueToObjcValue):
3391 (KJS::Bindings::convertObjcValueToValue):
3392 (KJS::Bindings::objcValueTypeForType):
3393 * bindings/runtime.cpp:
3394 (MethodList::MethodList):
3395 (MethodList::operator=):
3396 (Instance::setValueOfField):
3397 (Instance::createBindingForLanguageInstance):
3398 (Instance::createRuntimeObject):
3399 * bindings/runtime.h:
3400 * bindings/runtime_method.cpp:
3401 (RuntimeMethodImp::RuntimeMethodImp):
3402 (RuntimeMethodImp::get):
3403 (RuntimeMethodImp::call):
3404 * bindings/runtime_method.h:
3405 * bindings/runtime_object.cpp:
3406 (RuntimeObjectImp::get):
3407 (RuntimeObjectImp::hasProperty):
3408 * bindings/test.js: Added.
3409 * bindings/testbindings.mm: Added.
3410 (-[MySecondInterface init]):
3411 (-[MyFirstInterface init]):
3412 (-[MyFirstInterface dealloc]):
3413 (+[MyFirstInterface JavaScriptNameForSelector:]):
3414 (-[MyFirstInterface getInt]):
3415 (-[MyFirstInterface setInt:]):
3416 (-[MyFirstInterface getMySecondInterface]):
3417 (-[MyFirstInterface logMessage:]):
3418 (GlobalImp::className):
3419 (readJavaScriptFromFile):
3424 2004-02-08 Darin Adler <darin@apple.com>
3428 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
3430 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
3431 macros from working right in C++ code that uses the <cctype> header.
3434 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
3435 (KJS::UTF8SequenceLengthNonASCII): Added.
3436 (KJS::inlineUTF8SequenceLength): Added.
3437 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
3438 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3439 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
3440 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3441 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3443 - fixed the test program so it won't hit the interpreter lock assertion
3445 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
3449 2004-02-06 Richard Williamson <rjw@apple.com>
3451 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.
3455 * bindings/jni/jni_jsobject.cpp:
3456 (JSObject::toString):
3457 * bindings/jni/jni_utility.cpp:
3458 (KJS::Bindings::convertValueToJValue):
3460 2004-02-02 Darin Adler <darin@apple.com>
3464 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
3466 * kjs/array_object.cpp:
3467 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
3468 we start putting values in. This prevents new Array(2147483647) from causing trouble.
3469 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
3470 number is out of range. This prevents new Array(-1) from causing trouble.
3472 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
3474 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
3475 casting to int. Results now match those in other browsers.
3477 2004-02-02 Darin Adler <darin@apple.com>
3481 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
3482 - fixed other related overflow issues
3484 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
3486 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
3487 must not restrict values to the range of a particular integer type.
3488 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
3489 proper handling for negative results from fmod.
3490 (ValueImp::toUInt32): Ditto.
3491 (ValueImp::toUInt16): Ditto.
3492 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
3494 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
3495 out-of-integer-range values better in the slice function.
3496 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
3497 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
3498 out-of-integer-range values better in the toString function.
3499 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
3500 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
3501 and substr functions.
3505 2004-01-30 Richard Williamson <rjw@apple.com>
3507 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
3511 * bindings/jni/jni_instance.cpp:
3512 (JavaInstance::stringValue):
3514 2004-01-26 Darin Adler <darin@apple.com>
3516 * Makefile.am: Switch from pbxbuild to xcodebuild.
3518 2004-01-22 Richard Williamson <rjw@apple.com>
3520 Added stubs for ObjC language binding to JavaScript.
3522 * JavaScriptCore.pbproj/project.pbxproj:
3523 * bindings/jni/jni_runtime.h:
3524 * bindings/objc/objc_runtime.h: Added.
3525 (KJS::Bindings::ObjcParameter::ObjcParameter):
3526 (KJS::Bindings::ObjcParameter::~ObjcParameter):
3527 (KJS::Bindings::ObjcParameter::operator=):
3528 (KJS::Bindings::ObjcParameter::type):
3529 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
3530 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
3531 (KJS::Bindings::ObjcConstructor::_commonCopy):
3532 (KJS::Bindings::ObjcConstructor::operator=):
3533 (KJS::Bindings::ObjcConstructor::value):
3534 (KJS::Bindings::ObjcConstructor::parameterAt):
3535 (KJS::Bindings::ObjcConstructor::numParameters):
3536 (KJS::Bindings::ObjcField::ObjcField):
3537 (KJS::Bindings::ObjcField::~ObjcField):
3538 * bindings/runtime.h:
3540 2004-01-22 Richard Williamson <rjw@apple.com>
3542 Simplified JavaString by using UString as backing store. This
3543 revealed a bug in CString's assignment operator which I fixed.
3545 Removed some dead code.
3549 * bindings/jni/jni_runtime.h:
3550 (KJS::Bindings::JavaString::JavaString):
3551 (KJS::Bindings::JavaString::_commonInit):
3552 (KJS::Bindings::JavaString::UTF8String):
3553 (KJS::Bindings::JavaString::uchars):
3554 (KJS::Bindings::JavaString::length):
3555 (KJS::Bindings::JavaString::ustring):
3556 * bindings/runtime_object.cpp:
3557 (RuntimeObjectImp::RuntimeObjectImp):
3558 * bindings/runtime_object.h:
3560 (KJS::CString::CString):
3561 (KJS::CString::operator=):
3567 2004-01-16 Richard Williamson <rjw@apple.com>
3569 Fixed 3525853. We weren't handling mapping to overloaded Java
3570 methods very well. Even though this is undefined the other