9 2005-02-21 Darin Adler <darin@apple.com>
11 * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
13 2005-02-17 Richard Williamson <rjw@apple.com>
15 Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
19 Reviewed by John Sullivan.
21 * bindings/jni/jni_runtime.cpp:
22 (JavaField::valueFromInstance):
26 2005-02-11 Richard Williamson <rjw@apple.com>
28 Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
30 Re-factored how 'native' wrappers for JS objects are created. The interpreter now
31 creates these wrappers. The WebCore subclass of the interpreter now overrides
32 createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
36 * bindings/c/c_utility.cpp:
37 (convertValueToNPVariant):
38 * bindings/jni/jni_instance.cpp:
39 (JavaInstance::invokeMethod):
40 * bindings/jni/jni_objc.mm:
41 (KJS::Bindings::dispatchJNICall):
42 * bindings/jni/jni_runtime.cpp:
43 (JavaField::valueFromInstance):
45 * bindings/objc/WebScriptObject.mm:
46 (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
47 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
48 * bindings/objc/WebScriptObjectPrivate.h:
49 * bindings/objc/objc_utility.h:
50 * bindings/objc/objc_utility.mm:
51 (KJS::Bindings::convertObjcValueToValue):
52 (KJS::Bindings::createObjcInstanceForValue):
53 * bindings/runtime.cpp:
54 (Instance::createBindingForLanguageInstance):
55 (Instance::createRuntimeObject):
56 (Instance::createLanguageInstanceForValue):
58 * kjs/interpreter.cpp:
59 (Interpreter::createLanguageInstanceForValue):
64 2005-02-10 Darin Adler <darin@apple.com>
66 "Reviewed" by Richard (he told me the file was obsolete).
68 - got rid of an obsolete file
70 * bindings/npsap.h: Removed.
76 2005-02-03 Richard Williamson <rjw@apple.com>
78 Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
80 Revert to old (and correct) behavior of returning runtime object
81 when passed as a parameter, rather than it's corresponding DOM
86 * bindings/objc/WebScriptObject.mm:
87 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
91 2005-01-28 Richard Williamson <rjw@apple.com>
93 Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
95 Only use special 'back door' property to get the runtime object if thisObj isn't
96 already a runtime object.
98 <gratuitous> Cleaned up a couple of strcmp on ClassInfo name. Used == on
99 ClassInfo pointer instead.
103 * bindings/c/c_utility.cpp:
104 (convertValueToNPVariant):
105 * bindings/objc/WebScriptObject.mm:
106 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
107 * bindings/runtime_method.cpp:
108 (RuntimeMethodImp::call):
112 2005-01-26 Richard Williamson <rjw@apple.com>
114 Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
116 I added a member variable to ObjectImp. This changed it's size and consequently
117 hampered the optimizations built into the garbage collector. Objects no longer
118 fit within the allocators cell size, and thus allocation fell back to a slower
121 As a result of this fix I also dramatically cleaned up how runtime objects are
122 accessed. The path mostly *removes* code.
126 * bindings/runtime_method.cpp:
127 (RuntimeMethodImp::call):
128 * bindings/runtime_object.cpp:
129 (RuntimeObjectImp::get):
130 (RuntimeObjectImp::put):
131 (RuntimeObjectImp::canPut):
132 (RuntimeObjectImp::hasProperty):
133 (RuntimeObjectImp::defaultValue):
134 * bindings/runtime_object.h:
136 (KJS::ObjectImp::ObjectImp):
139 2005-01-20 Darin Adler <darin@apple.com>
141 Reviewed by me, changes by Han Ming Ong.
143 - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
145 * bindings/objc/WebScriptObjectPrivate.h: Make members public.
146 * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
148 2005-01-20 Richard Williamson <rjw@apple.com>
150 Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
152 The comprehensive fix for this problem requires new API, as described in 3965326. However,
153 given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
154 like and Undefined object if invokeUndefinedMethodFromWebScript:withArguments: isn't
155 implemented on the bound object.
159 * bindings/objc/objc_runtime.h:
160 * bindings/objc/objc_runtime.mm:
161 (ObjcFallbackObjectImp::type):
162 (ObjcFallbackObjectImp::implementsCall):
163 (ObjcFallbackObjectImp::toBoolean):
164 * bindings/testbindings.mm:
165 (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
166 (+[MyFirstInterface isKeyExcludedFromWebScript:]):
170 2005-01-19 Richard Williamson <rjw@apple.com>
172 Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
174 Fixed the following problems with LiveConnect that are demonstrated by the application
175 described in 3853676.
177 1. If a nil object is passed in an array from Java to JavaScript we will crash.
178 2. We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
179 3. We will sometimes fail to find the correct static method ID.
183 * bindings/jni/jni_jsobject.cpp:
184 (JSObject::convertJObjectToValue):
185 (JSObject::listFromJArray):
186 * bindings/jni/jni_runtime.cpp:
187 (JavaField::valueFromInstance):
188 (JavaField::setValueToInstance):
189 * bindings/jni/jni_utility.cpp:
190 (KJS::Bindings::getMethodID):
191 (KJS::Bindings::convertValueToJValue):
192 * bindings/runtime_array.h:
194 2005-01-18 Richard Williamson <rjw@apple.com>
196 Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
198 Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
199 Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
200 Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
201 Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
203 We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
204 tags. Also, if any of these elements are named they can be accessed from the document or window objects.
205 Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
209 * bindings/objc/objc_instance.h:
210 * bindings/objc/objc_instance.mm:
211 (ObjcInstance::supportsSetValueOfUndefinedField):
212 * bindings/runtime.h:
213 (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
214 * bindings/runtime_object.cpp:
215 (RuntimeObjectImp::RuntimeObjectImp):
216 (RuntimeObjectImp::get):
217 (RuntimeObjectImp::put):
218 (RuntimeObjectImp::canPut):
219 (RuntimeObjectImp::hasProperty):
220 (RuntimeObjectImp::defaultValue):
221 * bindings/runtime_object.h:
222 (KJS::RuntimeObjectImp::fallbackObject):
224 (KJS::ObjectImp::ObjectImp):
226 (KJS::ObjectImp::forwardingScriptMessage):
227 (KJS::ObjectImp::setForwardingScriptMessage):
229 2005-01-18 Richard Williamson <rjw@apple.com>
231 Back out a change that was incorrectly committed yesterday.
235 * bindings/objc/objc_utility.mm:
236 (KJS::Bindings::convertValueToObjcValue):
238 2005-01-17 Richard Williamson <rjw@apple.com>
240 Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
242 Keep track of originating execution context and target execution
243 context for native JS object wrappers, and perform appropriate
246 Reviewed by David Harrison.
248 * bindings/NP_jsobject.cpp:
250 (_NPN_CreateScriptObject):
255 (_NPN_RemoveProperty):
259 * bindings/NP_jsobject.h:
260 * bindings/c/c_instance.cpp:
261 (CInstance::CInstance):
262 (CInstance::stringValue):
263 * bindings/c/c_instance.h:
264 * bindings/c/c_utility.cpp:
265 (convertValueToNPVariant):
266 * bindings/jni/jni_instance.cpp:
267 (JavaInstance::JavaInstance):
268 (JavaInstance::valueOf):
269 * bindings/jni/jni_instance.h:
270 * bindings/objc/WebScriptObject.mm:
271 (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
272 (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
273 (-[WebScriptObject KJS::Bindings::]):
274 (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
275 (-[WebScriptObject _isSafeScript]):
276 (-[WebScriptObject callWebScriptMethod:withArguments:]):
277 (-[WebScriptObject evaluateWebScript:]):
278 (-[WebScriptObject setValue:forKey:]):
279 (-[WebScriptObject valueForKey:]):
280 (-[WebScriptObject removeWebScriptKey:]):
281 (-[WebScriptObject stringRepresentation]):
282 (-[WebScriptObject webScriptValueAtIndex:]):
283 (-[WebScriptObject setWebScriptValueAtIndex:value:]):
284 (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
285 * bindings/objc/WebScriptObjectPrivate.h:
286 * bindings/objc/objc_instance.h:
287 * bindings/objc/objc_runtime.mm:
288 (convertValueToObjcObject):
289 * bindings/objc/objc_utility.mm:
290 (KJS::Bindings::convertValueToObjcValue):
291 * bindings/runtime.cpp:
292 (Instance::Instance):
293 (Instance::operator=):
294 * bindings/runtime.h:
295 (KJS::Bindings::Instance::Instance):
296 (KJS::Bindings::Instance::setExecutionContext):
297 (KJS::Bindings::Instance::executionContext):
298 * bindings/runtime_root.cpp:
299 (RootObject::setInterpreter):
300 * bindings/runtime_root.h:
302 (KJS::Interpreter::isGlobalObject):
303 (KJS::Interpreter::interpreterForGlobalObject):
304 (KJS::Interpreter::isSafeScript):
308 2005-01-13 Vicki Murley <vicki@apple.com>
312 - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
314 * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
316 2005-01-12 Richard Williamson <rjw@apple.com>
318 Avoid additional work on dealloc by adding early out to
319 removeNativeReference(). (This will save time on dealloc
320 for all ObjC DOM objects.)
324 * bindings/runtime_root.cpp:
325 (KJS::Bindings::removeNativeReference):
327 2005-01-12 Richard Williamson <rjw@apple.com>
329 Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
331 We were always returning the first "root" object for all runtime
332 objects. Changed 0 in loop to i, the index.
334 Reviewed by David Harrison.
336 * bindings/runtime_root.cpp:
337 (KJS::Bindings::rootForImp):
339 2005-01-11 Richard Williamson <rjw@apple.com>
341 Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
343 Use the new dispatching API to invoke JNI, rather than calling JNI
346 Reviewed by David Harrison.
348 * bindings/jni/jni_instance.cpp:
349 (JavaInstance::invokeMethod):
350 * bindings/jni/jni_runtime.cpp:
351 (JavaField::dispatchValueFromInstance):
352 (JavaField::valueFromInstance):
353 (JavaField::dispatchSetValueToInstance):
354 (JavaField::setValueToInstance):
355 * bindings/jni/jni_runtime.h:
356 * bindings/jni/jni_utility.cpp:
357 (KJS::Bindings::convertValueToJValue):
365 2004-12-17 Maciej Stachowiak <mjs@apple.com>
369 <rdar://problem/3926869> Opening caches window after running PLT causes crash
371 * kjs/protected_values.cpp:
372 (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
373 the protected value table.
374 (KJS::ProtectedValues::increaseProtectCount): Ditto.
375 (KJS::ProtectedValues::decreaseProtectCount): Ditto.
377 2004-12-16 Darin Adler <darin@apple.com>
381 - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
383 * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
384 * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
385 non-locale-specific versions.
386 * kjs/string_object.lut.h: Regenerated.
388 2004-12-14 Richard Williamson <rjw@apple.com>
390 Pass URL of plugin view when call into JNI.
394 * bindings/jni/jni_objc.mm:
395 (KJS::Bindings::dispatchJNICall):
397 2004-12-13 Richard Williamson <rjw@apple.com>
399 Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
401 Add support for calling static Java methods from JavaScript.
405 * bindings/jni/jni_instance.cpp:
406 (JavaInstance::invokeMethod):
407 * bindings/jni/jni_runtime.cpp:
408 (JavaMethod::JavaMethod):
409 * bindings/jni/jni_runtime.h:
410 (KJS::Bindings::JavaMethod::isStatic):
411 * bindings/jni/jni_utility.cpp:
412 (callJNIStaticMethod):
413 (KJS::Bindings::callJNIBooleanMethod):
414 (KJS::Bindings::callJNIStaticBooleanMethod):
415 * bindings/jni/jni_utility.h:
417 2004-12-13 Richard Williamson <rjw@apple.com>
419 Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
423 * bindings/jni/jni_instance.cpp:
424 (JavaInstance::invokeMethod):
425 * bindings/jni/jni_objc.mm:
426 (KJS::Bindings::dispatchJNICall):
427 * bindings/jni/jni_runtime.h:
428 * bindings/jni/jni_utility.h:
432 2004-12-07 Maciej Stachowiak <mjs@apple.com>
436 <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
438 The fix was to implement copy constructor and assignment operator,
439 the ones that worked on the base class did not replace the
443 (KJS::ProtectedValue::ProtectedValue):
444 (KJS::ProtectedValue::operator=):
445 (KJS::ProtectedObject::ProtectedObject):
446 (KJS::ProtectedObject::operator=):
448 Also fixed a bug in the GC test mode that compares the results of
449 the old collector and the new collector.
456 2004-11-23 Richard Williamson <rjw@apple.com>
458 Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
462 * bindings/c/c_class.cpp:
463 (CClass::_commonInit):
465 2004-11-21 Maciej Stachowiak <mjs@apple.com>
469 <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
472 (KJS::Collector::Thread::Thread):
473 (KJS::destroyRegisteredThread):
474 (KJS::initializeRegisteredThreadKey):
475 (KJS::Collector::registerThread):
476 (KJS::Collector::markStackObjectsConservatively):
477 (KJS::Collector::markCurrentThreadConservatively):
478 (KJS::Collector::markOtherThreadConservatively):
486 2004-11-15 Richard Williamson <rjw@apple.com>
488 Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
492 * bindings/objc/objc_instance.mm:
493 (ObjcInstance::stringValue):
494 * bindings/objc/objc_utility.h:
495 * bindings/objc/objc_utility.mm:
496 (KJS::Bindings::convertNSStringToString):
497 (KJS::Bindings::convertObjcValueToValue):
501 2004-11-09 Chris Blumenberg <cblu@apple.com>
503 Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
508 * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
509 * bindings/softlinking.c: Added.
511 (getFunctionPointer): new
512 (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
516 2004-11-04 Darin Adler <darin@apple.com>
520 - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
521 - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
522 and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
523 than allocating a new one
525 * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
526 (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
527 of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
528 actually allocate only the very first time it's called.
529 (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
530 shared instance since there can be only one).
531 (-[WebUndefined copyWithZone:]): Ditto.
532 (-[WebUndefined retain]): Ditto.
533 (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
535 (-[WebUndefined autorelease]): Simplified to just return self (see above).
536 (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
537 (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
538 a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
539 bug mentioned above).
540 (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
541 No need to call init, since that's a no-op for this class.
543 2004-11-03 David Harrison <harrison@apple.com>
547 Eliminate the use of a marker file to determine how to build.
552 2004-11-01 Richard Williamson <rjw@apple.com>
554 Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
558 * bindings/c/c_instance.cpp:
559 (CInstance::invokeMethod):
560 (CInstance::invokeDefaultMethod):
561 Initialize out parameters to void type.
563 * bindings/c/c_runtime.cpp:
564 (CField::valueFromInstance):
565 (CField::setValueToInstance):
566 Initialize out parameters to void type.
567 Also added additional checks to protect against classes that
568 don't implement all functions.
570 2004-11-01 Richard Williamson <rjw@apple.com>
572 Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
577 * bindings/objc/WebScriptObject.mm:
578 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
579 Added additional conversion Undefined -> WebUndefined.
580 * bindings/objc/objc_utility.mm:
581 (KJS::Bindings::convertObjcValueToValue):
582 Added additional conversion WebUndefined -> Undefined.
584 2004-11-01 Darin Adler <darin@apple.com>
586 - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
588 * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
589 this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
590 report to match the contents of the file.
596 2004-10-22 Ken Kocienda <kocienda@apple.com>
600 * JavaScriptCore.pbproj/project.pbxproj:
601 Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
605 2004-10-13 Richard Williamson <rjw@apple.com>
607 Moved boolean checks prior to NSNumber checks. booleans are
610 Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
614 * bindings/objc/objc_utility.mm:
615 (KJS::Bindings::convertObjcValueToValue):
617 2004-10-12 Richard Williamson <rjw@apple.com>
619 Fixed access to DOM object via WebScriptObject API.
620 The execution context for DOM objects wasn't being found.
621 <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
625 * bindings/objc/WebScriptObject.mm:
627 (-[WebScriptObject KJS::Bindings::]):
628 (-[WebScriptObject callWebScriptMethod:withArguments:]):
629 (-[WebScriptObject evaluateWebScript:]):
630 (-[WebScriptObject setValue:forKey:]):
631 (-[WebScriptObject valueForKey:]):
632 (-[WebScriptObject stringRepresentation]):
633 * bindings/objc/WebScriptObjectPrivate.h:
635 2004-10-09 Darin Adler <darin@apple.com>
639 - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
641 * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
642 creating an init routine.
644 * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
645 require a global constructor that creates an init routine.
647 2004-10-09 Darin Adler <darin@apple.com>
651 - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
653 * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
654 work with the window object of the page the function is in, not the page of the caller. This
655 is what all other browsers do. This code was hidden before by the "everything is defined on
656 window object" hack in WebCore.
658 2004-10-07 Richard Williamson <rjw@apple.com>
660 Added simple JavaScript call tracing. Very useful for
661 debugging complex pages.
663 Tracing is only available in development builds and is
666 (gdb) set traceJavaScript = 1
670 setTraceJavaScript(true)
672 Function, args, and return values are printed to console. Very
677 * kjs/function_object.cpp:
678 (FunctionProtoFuncImp::call):
684 2004-10-05 Richard Williamson <rjw@apple.com>
686 Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
690 * bindings/NP_jsobject.cpp:
692 * bindings/npruntime.cpp:
693 (_NPN_SetExceptionWithUTF8):
694 * bindings/objc/WebScriptObject.mm:
695 (+[WebScriptObject throwException:]):
697 (KJS::InterpreterImp::context):
699 2004-10-05 Richard Williamson <rjw@apple.com>
701 Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
705 * bindings/objc/objc_utility.mm:
706 (KJS::Bindings::convertObjcValueToValue):
708 2004-10-04 Darin Adler <darin@apple.com>
712 - rolled in a fix the KDE folks did for the operations that generate HTML fragments
714 * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
716 - rolled out an old workaround we don't need any more
718 * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
719 required it is no longer there.
721 2004-09-30 Richard Williamson <rjw@apple.com>
723 Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
727 * bindings/NP_jsobject.cpp:
731 * bindings/c/c_class.cpp:
732 (CClass::methodsNamed):
733 (CClass::fieldNamed):
734 * bindings/c/c_class.h:
735 * bindings/c/c_instance.cpp:
736 (CInstance::invokeMethod):
737 * bindings/jni/jni_class.cpp:
738 (JavaClass::methodsNamed):
739 * bindings/jni/jni_class.h:
740 * bindings/npruntime.h:
741 * bindings/objc/objc_class.h:
742 * bindings/objc/objc_class.mm:
743 (ObjcClass::methodsNamed):
744 * bindings/runtime.h:
745 * bindings/runtime_object.cpp:
746 (RuntimeObjectImp::get):
747 (RuntimeObjectImp::hasProperty):
749 2004-09-29 Chris Blumenberg <cblu@apple.com>
751 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.
755 * JavaScriptCore.pbproj/project.pbxproj:
756 * bindings/NP_jsobject.cpp:
757 (_NPN_CreateScriptObject):
758 (_NPN_InvokeDefault):
763 (_NPN_RemoveProperty):
766 * bindings/c/c_class.cpp:
767 (CClass::methodsNamed):
768 (CClass::fieldNamed):
769 * bindings/c/c_instance.cpp:
770 (CInstance::CInstance):
771 (CInstance::~CInstance):
772 (CInstance::operator=):
773 (CInstance::invokeMethod):
774 (CInstance::invokeDefaultMethod):
775 * bindings/c/c_runtime.cpp:
776 * bindings/c/c_runtime.h:
777 (KJS::Bindings::CField::name):
778 (KJS::Bindings::CMethod::name):
779 * bindings/npruntime.cpp:
780 (_NPN_GetStringIdentifier):
781 (_NPN_GetStringIdentifiers):
782 (_NPN_GetIntIdentifier):
783 (_NPN_IdentifierIsString):
784 (_NPN_UTF8FromIdentifier):
785 (_NPN_IntFromIdentifier):
786 (NPN_InitializeVariantWithObject):
787 (_NPN_ReleaseVariantValue):
790 (_NPN_ReleaseObject):
791 (_NPN_SetExceptionWithUTF8):
794 2004-09-26 Darin Adler <darin@apple.com>
796 * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
797 low() to get Unicode value of character, and just use unicode().
799 2004-09-26 Darin Adler <darin@apple.com>
801 - refine charAt/charCodeAt fix slightly
803 * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
804 omitted parameter, as we do everywhere else, and as other browsers do here.
806 2004-09-26 Darin Adler <darin@apple.com>
810 - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
812 * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
813 the program. We were doing this properly for functions, but not entire programs.
815 - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
817 * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
818 and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
820 * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
826 2004-09-14 Richard Williamson <rjw@apple.com>
828 1. Add class parameter to object allocation function. This is somewhat redundant, given that
829 the allocation function is in the class function vector, but people wanted to use the same
830 allocation function for different classes.
832 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
834 3. Add support for a default function on an object. This is a feature that ActiveX supports,
835 and will allow JavaScript code to be written that will look exactly the same for both ActiveX
836 plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
837 'Objective-C' bindings.
839 There bugs are covered by
841 <rdar://problem/3776343> Support for default functions in the JavaScript bindings
842 <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
843 <rdar://problem/3674754> Need to implement latest npruntime.h
847 * bindings/NP_jsobject.cpp:
851 * bindings/c/c_class.cpp:
852 * bindings/c/c_instance.cpp:
853 (CInstance::CInstance):
854 (CInstance::operator=):
855 (CInstance::invokeMethod):
856 (CInstance::invokeDefaultMethod):
857 * bindings/c/c_instance.h:
858 * bindings/c/c_runtime.cpp:
859 * bindings/c/c_runtime.h:
860 * bindings/jni/jni_instance.cpp:
861 (JavaInstance::invokeDefaultMethod):
862 * bindings/jni/jni_instance.h:
863 * bindings/npruntime.cpp:
865 * bindings/npruntime.h:
866 * bindings/objc/WebScriptObject.h:
867 * bindings/objc/objc_class.mm:
868 (ObjcClass::fallbackObject):
869 * bindings/objc/objc_instance.h:
870 * bindings/objc/objc_instance.mm:
871 (ObjcInstance::invokeDefaultMethod):
872 * bindings/objc/objc_runtime.h:
873 * bindings/objc/objc_runtime.mm:
874 (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
875 (ObjcFallbackObjectImp::get):
876 (ObjcFallbackObjectImp::put):
877 (ObjcFallbackObjectImp::canPut):
878 (ObjcFallbackObjectImp::implementsCall):
879 (ObjcFallbackObjectImp::call):
880 (ObjcFallbackObjectImp::hasProperty):
881 (ObjcFallbackObjectImp::deleteProperty):
882 (ObjcFallbackObjectImp::defaultValue):
883 * bindings/runtime.h:
884 (KJS::Bindings::Class::fallbackObject):
885 (KJS::Bindings::Instance::getValueOfUndefinedField):
886 (KJS::Bindings::Instance::setValueOfUndefinedField):
887 (KJS::Bindings::Instance::valueOf):
888 * bindings/runtime_object.cpp:
889 (RuntimeObjectImp::implementsCall):
890 (RuntimeObjectImp::call):
891 * bindings/runtime_object.h:
893 2004-09-13 Maciej Stachowiak <mjs@apple.com>
897 <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
899 * kjs/string_object.cpp:
900 (StringProtoFuncImp::call): Replaced implementation of replace()
901 method with function below...
902 (replace): In order to avoid excessive allocation and copying,
903 figure out the ranges of the original string and replacement
904 strings to be assembled, instead of constantly creating new
905 strings at each substitution. The old behavior is basically O(N^2)
906 for a global replace on a pattern that matches many places in the
908 (regExpIsGlobal): Helper function for the above.
909 (expandSourceRanges): ditto
910 (pushSourceRange): ditto
911 (expandReplacements): ditto
912 (pushReplacement): ditto
914 (KJS::UString::spliceSubstringsWithSeparators): New method that
915 pieces together substring ranges of this string together with
916 specified separators, all at one go.
918 (KJS::UString::Range::Range): Added new helper class to represent
921 2004-09-14 Maciej Stachowiak <mjs@apple.com>
925 - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
928 (KJS::GlobalFuncImp::call): Make sure to escape null
929 characters. This is a bug in the new code that made part of the
932 2004-09-13 Darin Adler <darin@apple.com>
934 Reviewed by Kevin and Maciej.
936 - new function to support fix for DIG bug in WebCore
938 * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
939 * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
941 2004-09-12 Darin Adler <darin@apple.com>
943 * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
944 of escape and unescape.
946 2004-09-12 Darin Adler <darin@apple.com>
950 - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
952 * kjs/date_object.cpp:
953 (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
954 uses CFDateFormatter.
955 (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
957 2004-09-09 Maciej Stachowiak <mjs@apple.com>
961 <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
964 (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
965 ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
967 (Lexer::isHexDigit): Made static and non-const.
972 2004-09-06 Darin Adler <darin@apple.com>
974 * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
978 2004-09-01 Richard Williamson <rjw@apple.com>
980 Add pid to exception messages (to help debug dashboard clients).
984 * kjs/interpreter.cpp:
985 (Interpreter::evaluate):
989 2004-08-20 Richard Williamson <rjw@apple.com>
991 Implemented new JNI abstraction. We no longer invoke Java methods
992 directly with JNI, rather we call into the plugin. This allows the
993 plugin to dispatch the call to the appropriate VM thread. This
994 change should (will?) fix a whole class of threading related problems with
999 * JavaScriptCore.pbproj/project.pbxproj:
1000 * bindings/c/c_instance.h:
1001 (KJS::Bindings::CInstance::setExecutionContext):
1002 (KJS::Bindings::CInstance::executionContext):
1003 * bindings/jni/jni_instance.cpp:
1004 (JavaInstance::JavaInstance):
1005 (JavaInstance::invokeMethod):
1006 (JavaInstance::setExecutionContext):
1007 (JavaInstance::executionContext):
1008 * bindings/jni/jni_instance.h:
1009 * bindings/jni/jni_jsobject.cpp:
1010 (JSObject::convertJObjectToValue):
1011 * bindings/jni/jni_runtime.cpp:
1012 (JavaField::JavaField):
1013 (JavaArray::convertJObjectToArray):
1014 (JavaField::valueFromInstance):
1015 (JavaArray::JavaArray):
1016 (JavaArray::valueAt):
1017 * bindings/jni/jni_runtime.h:
1018 (KJS::Bindings::JavaArray::operator=):
1019 (KJS::Bindings::JavaArray::executionContext):
1020 * bindings/jni/jni_utility.h:
1021 * bindings/objc/objc_instance.h:
1022 (KJS::Bindings::ObjcInstance::setExecutionContext):
1023 (KJS::Bindings::ObjcInstance::executionContext):
1024 * bindings/runtime.cpp:
1025 (Instance::createBindingForLanguageInstance):
1026 * bindings/runtime.h:
1027 * bindings/runtime_root.h:
1028 (KJS::Bindings::RootObject::nativeHandle):
1032 2004-08-19 Vicki Murley <vicki@apple.com>
1036 * kjs/property_map.cpp:
1037 (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
1039 2004-08-17 Darin Adler <darin@apple.com>
1043 - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
1045 * kjs/property_map.h: Added some private functions.
1046 * kjs/property_map.cpp:
1047 (KJS::PropertyMap::clear): Set sentinelCount to 0.
1048 (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
1049 Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
1050 (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
1051 (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
1052 (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
1053 deleted-element sentinels.
1054 (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
1056 2004-08-16 Maciej Stachowiak <mjs@apple.com>
1058 Code change by Eric Albert, reviewd by me.
1060 <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
1062 * kjs/date_object.cpp:
1063 (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
1064 entirely would be even better, but is not required to fix this bug.
1068 2004-08-16 Richard Williamson <rjw@apple.com>
1070 Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
1072 Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
1076 * bindings/NP_jsobject.cpp:
1078 * bindings/jni/jni_jsobject.cpp:
1080 * bindings/objc/WebScriptObject.mm:
1081 (-[WebScriptObject evaluateWebScript:]):
1083 2004-08-15 Richard Williamson <rjw@apple.com>
1085 More updates to np headers. Implemented new NPN functions.
1089 * bindings/NP_jsobject.cpp:
1093 * bindings/npruntime.h:
1095 2004-08-13 Darin Adler <darin@apple.com>
1097 - fix build so we can compile again
1099 * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
1100 is good enough so that we can compile, but it's only a stopgap measure, because I think
1101 Richard has a newer one he wants to check in.
1103 2004-08-12 Richard Williamson <rjw@apple.com>
1105 Bring npruntime.h and friends closer to compliance with
1110 * JavaScriptCore.pbproj/project.pbxproj:
1111 * bindings/NP_jsobject.cpp:
1113 (_NPN_CreateScriptObject):
1118 (NPN_RemoveProperty):
1119 * bindings/NP_jsobject.h:
1120 * bindings/c/c_instance.cpp:
1121 (CInstance::invokeMethod):
1122 * bindings/c/c_utility.cpp:
1123 (convertNPVariantToValue):
1124 * bindings/npruntime.cpp:
1125 (NPN_IdentifierIsString):
1126 (NPN_VariantIsVoid):
1127 (NPN_VariantIsNull):
1128 (NPN_VariantIsUndefined):
1129 (NPN_VariantIsBool):
1130 (NPN_VariantIsInt32):
1131 (NPN_VariantIsDouble):
1132 (NPN_VariantIsString):
1133 (NPN_VariantIsObject):
1134 (NPN_VariantToBool):
1135 (NPN_VariantToString):
1136 (NPN_VariantToInt32):
1137 (NPN_VariantToDouble):
1138 (NPN_VariantToObject):
1139 (NPN_InitializeVariantAsVoid):
1140 (NPN_InitializeVariantAsNull):
1141 (NPN_InitializeVariantAsUndefined):
1142 (NPN_InitializeVariantWithBool):
1143 (NPN_InitializeVariantWithInt32):
1144 (NPN_InitializeVariantWithDouble):
1145 (NPN_InitializeVariantWithString):
1146 (NPN_InitializeVariantWithStringCopy):
1147 (NPN_InitializeVariantWithObject):
1148 (NPN_InitializeVariantWithVariant):
1149 (NPN_ReleaseVariantValue):
1151 * bindings/npruntime.h:
1153 (_NPString::_NPVariant::):
1154 * bindings/npruntime_priv.h: Added.
1156 2004-08-12 Darin Adler <darin@apple.com>
1160 - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
1163 (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
1164 (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
1165 (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
1166 to skip leading "+" or "-".
1170 2004-08-12 Darin Adler <darin@apple.com>
1174 - fixed 43 Mozilla JavaScript tests
1176 * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
1177 * kjs/date_object.cpp:
1178 (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
1179 than constructing a number object to pass to it.
1180 (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
1181 (KJS::parseDate): Change to return a double instead of creating the Number object here.
1182 (KJS::timeClip): Implement this as specified in the language standard.
1184 * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
1185 flags on the prototype property.
1188 (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
1190 (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
1192 (KJS::parseDigit): Added. Helper function for parseInt.
1193 (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
1194 strtoll can handle. Also matches standard more closely.
1195 (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
1197 (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
1199 * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
1201 * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
1203 (Lexer::setCode): Clear error state.
1204 (Lexer::lex): Set error state if the lexer encounters an error
1207 (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
1208 (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
1210 * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
1211 Change round to round values between -0.5 and -0 to -0 instead of +0.
1213 * kjs/nodes.h: Add evaluateReference function to GroupNode.
1214 * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
1215 expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
1216 would change x.y into a value that can't be deleted as a side effect.
1218 * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
1221 * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
1222 get rid of the fixed size limit for code.
1224 * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
1225 returns the string without creating a new Rep, since I'm using substr in a place where it will
1226 often be passed a 0.
1228 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
1229 the other day that was making a couple tests fail.
1230 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1231 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1232 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1233 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1234 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1236 * kjs/string_object.lut.h: Regenerated.
1238 2004-08-11 Darin Adler <darin@apple.com>
1240 - fixed a tiny problem with the UTF-16 PCRE check-in
1242 * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
1243 the ctype_meta flag to get set in items that should not have it.
1245 * pcre/chartables.c: Regenerated.
1247 2004-08-10 Richard Williamson <rjw@apple.com>
1249 Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
1251 The following WebScripting methods are now supported on bound
1254 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
1255 - (void)setValue:(id)value forUndefinedKey:(NSString *)key
1256 - (id)valueForUndefinedKey:(NSString *)key
1260 * bindings/c/c_class.cpp:
1261 (CClass::fieldNamed):
1262 * bindings/c/c_class.h:
1263 * bindings/jni/jni_class.cpp:
1264 (JavaClass::fieldNamed):
1265 * bindings/jni/jni_class.h:
1266 * bindings/objc/objc_class.h:
1267 (KJS::Bindings::ObjcClass::isa):
1268 * bindings/objc/objc_class.mm:
1269 (ObjcClass::methodsNamed):
1270 (ObjcClass::fieldNamed):
1271 (ObjcClass::fallbackObject):
1272 * bindings/objc/objc_instance.h:
1273 * bindings/objc/objc_instance.mm:
1274 (ObjcInstance::invokeMethod):
1275 (ObjcInstance::setValueOfField):
1276 (ObjcInstance::setValueOfUndefinedField):
1277 (ObjcInstance::getValueOfField):
1278 (ObjcInstance::getValueOfUndefinedField):
1279 * bindings/objc/objc_runtime.h:
1280 (KJS::Bindings::ObjcField::~ObjcField):
1281 (KJS::Bindings::ObjcField::ObjcField):
1282 (KJS::Bindings::ObjcField::operator=):
1283 (KJS::Bindings::FallbackObjectImp::classInfo):
1284 * bindings/objc/objc_runtime.mm:
1285 (ObjcField::ObjcField):
1288 (ObjcField::valueFromInstance):
1289 (ObjcField::setValueToInstance):
1290 (FallbackObjectImp::FallbackObjectImp):
1291 (FallbackObjectImp::get):
1292 (FallbackObjectImp::put):
1293 (FallbackObjectImp::canPut):
1294 (FallbackObjectImp::implementsCall):
1295 (FallbackObjectImp::call):
1296 (FallbackObjectImp::hasProperty):
1297 (FallbackObjectImp::deleteProperty):
1298 (FallbackObjectImp::defaultValue):
1299 * bindings/runtime.h:
1300 (KJS::Bindings::Class::fallbackObject):
1301 (KJS::Bindings::Instance::getValueOfUndefinedField):
1302 (KJS::Bindings::Instance::setValueOfUndefinedField):
1303 * bindings/runtime_object.cpp:
1304 (RuntimeObjectImp::get):
1305 (RuntimeObjectImp::put):
1306 (RuntimeObjectImp::canPut):
1307 (RuntimeObjectImp::hasProperty):
1308 * bindings/testbindings.mm:
1309 (-[MyFirstInterface valueForUndefinedKey:]):
1310 (-[MyFirstInterface setValue:forUndefinedKey:]):
1312 2004-08-10 Darin Adler <darin@apple.com>
1316 - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
1318 * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
1319 or uint16_t depending on the mode, and used appropriate in the 7 public functions
1320 that need to use it.
1321 * pcre/pcre.c: Add UTF-16 support to all functions.
1322 * pcre/study.c: Ditto.
1324 * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
1325 the mode. Changed declarations to use symbolic constants and typedefs so we size
1326 things to ichar when needed.
1328 * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
1329 sized to 16-bit characters instead of 8-bit.
1332 (pcre_copy_substring): Use pcre_char instead of char.
1333 (pcre_get_substring_list): Ditto.
1334 (pcre_free_substring_list): Ditto.
1335 (pcre_get_substring): Ditto.
1336 (pcre_free_substring): Ditto.
1338 * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
1339 of hard-coding 8-bit table sizes.
1341 * pcre/chartables.c: Regenerated.
1343 * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
1344 * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
1345 is not null. The null string still has a null pointer. This prevents us from
1346 passing a null through to the regular expression engine (which results in a null
1347 error even when the string length is 0).
1350 (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
1351 (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
1353 2004-08-09 Darin Adler <darin@apple.com>
1357 - fixed 28 Mozilla JavaScript tests
1359 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
1360 checking the number of arguments for the join method.
1362 * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
1363 than integers, so we aren't limited to 32 bits.
1365 * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
1366 the implementation of the pow operation. Also simplied a case that was handling positive
1367 and negative infinity separately.
1369 * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
1370 putting them in a long, so that unsigned shift will work properly.
1372 * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
1374 * kjs/operations.cpp:
1375 (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
1376 sign of isinf; our isinf function returns +1 even for negative infinity.
1377 (KJS::isNegInf): And again.
1378 (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
1379 Our floating point already handles the various infinity cases correctly.
1381 * kjs/regexp_object.cpp:
1382 (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
1383 (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
1384 array in cases where we did not match.
1385 (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
1386 "global", "ignoreCase", "multiline", and "source".
1388 * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
1389 string into undefined rather than an empty string. For the slice method, handle an
1390 undefined parameter for the limit properly as decribed in the specification, and add
1391 the limit to one case that didn't have the limit at all. For the methods that generate
1392 HTML strings, use lowercase tags instead of uppercase.
1395 (KJS::UChar::toLower): Use u_tolower from the ICU library.
1396 (KJS::UChar::toUpper): Use u_toupper from the ICU library.
1397 (KJS::UString::append): Fix some math that caused a buffer overflow.
1398 (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
1399 flag) rather than converting them all to 0.
1400 (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
1402 * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
1404 * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
1405 the Unicode specification in a few cases where it was wrong before.
1406 * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
1407 * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
1408 * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
1409 * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
1410 * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
1411 * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
1412 * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
1413 * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
1414 * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
1416 * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
1418 * kjs/number_object.lut.h: Regenerated.
1420 2004-08-09 Darin Adler <darin@apple.com>
1424 - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
1426 * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
1427 we get a buffer overflow.
1431 2004-08-05 Richard Williamson <rjw@apple.com>
1433 Fixed part of 3674747. The QT guys need this for feature freeze.
1435 This patch implements support for the
1437 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
1439 method of objects bound to JavaScript.
1444 * bindings/objc/objc_class.mm:
1445 (ObjcClass::methodsNamed):
1446 (ObjcClass::fieldNamed):
1447 * bindings/objc/objc_instance.mm:
1448 (ObjcInstance::invokeMethod):
1449 * bindings/objc/objc_runtime.h:
1450 (KJS::Bindings::ObjcMethod::~ObjcMethod):
1451 (KJS::Bindings::ObjcMethod::isFallbackMethod):
1452 (KJS::Bindings::ObjcMethod::javaScriptName):
1453 * bindings/objc/objc_runtime.mm:
1454 (ObjcMethod::ObjcMethod):
1455 (ObjcMethod::getMethodSignature):
1456 (ObjcMethod::setJavaScriptName):
1457 * bindings/testbindings.mm:
1459 2004-08-04 Vicki Murley <vicki@apple.com>
1463 - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
1466 (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
1467 go to the next line and continue parsing the string (instead of failing). This matches
1468 behavior in Mac IE and Mozilla.
1470 2004-08-03 Kevin Decker <kdecker@apple.com>
1474 Rolled in changes from the latest KJS sources that support additional
1475 Number.prototype functions.
1477 Specifically this patch covers the follow parts of the ECMA 3 spec:
1478 15.7.4.5, 15.7.4.6, and 15.7.4.7
1481 <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
1482 <rdar://problem/3749492> missing Number.toPrecision prototype implementation
1483 <rdar://problem/3749591> missing Number.toExponential prototype implementation
1485 * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
1486 list of supported identifiers (a macro).
1487 * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
1488 and toExponential().
1489 (NumberPrototypeImp::NumberPrototypeImp):
1490 (NumberProtoFuncImp::call):
1491 * kjs/number_object.h: Added property names for toFixed, toPrecision,
1493 (KJS::NumberProtoFuncImp::):
1494 * tests/mozilla/expected.html: Update results.
1496 2004-08-03 Darin Adler <darin@apple.com>
1500 - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
1502 * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
1503 we are supposed to just copy the regular expression object, and do so.
1504 Also tighten up arguments check to handle case where an actual "undefined"
1505 is passed rather than just omitting an argument.
1507 * tests/mozilla/expected.html: Update results.
1509 2004-08-02 Darin Adler <darin@apple.com>
1511 * tests/mozilla/.cvsignore: Added.
1512 * tests/mozilla/expected.html: Update results.
1514 2004-08-02 Darin Adler <darin@apple.com>
1518 - fixed RegExp.toString so 3 more Mozilla regexp tests pass
1520 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
1521 Append the flags here so more tests paseed.
1523 2004-08-02 Darin Adler <darin@apple.com>
1527 - fixed a couple things making 5 Mozilla regexp tests pass
1529 * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
1531 (RegExpObjectImp::construct): Fix bug where the string "undefined" would
1532 be used as the flags string when no parameter was passed.
1534 * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
1535 Added a class info object for RegExp prototype so it can return
1536 a string instead of raising an exception when converting to a string.
1538 * tests/mozilla/expected.html: Update results.
1540 2004-08-02 Darin Adler <darin@apple.com>
1544 - fix crashes in mozilla tests due to mishandling NaN
1546 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
1547 calls to toInteger so that NaN will get turned into something that fits in an integer.
1548 These were the ones John already fixed, but his fix used isnan and the new fix is
1551 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
1552 after a call to toInteger to handle NaN properly. Also removed separate check
1553 for undefined that's not needed.
1555 * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
1556 as in the above two files, but for a lot more functions. Also changed one place with
1557 an explicit check for undefined to instead just check isNaN.
1559 * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
1560 like me who don't keep $SYMROOTS in their $PATH.
1566 2004-07-26 Kevin Decker <kdecker@apple.com>
1568 Changes done by Darin, reviewed by Kevin.
1570 - changed testkjs to build in Xcode rather than from Makefile
1572 * .cvsignore: Removed obsolete files from this list.
1573 * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
1574 Changed to build target "All" rather than default target. This makes us
1575 build the testkjs test tool.
1576 * dummy.cpp: Removed.
1577 * kjs/.cvsignore: Removed obsolete files from this list, including
1578 the testkjs tool, which is now built in the symroots directory.
1579 * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
1580 changed this file. Also this has the nice side effect of causing the tool
1581 to be rebuilt in the new location even if there are no other changes in
1582 your tree when you check this out.
1583 * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
1584 without setting the execute bit on jsDriver.pl.
1586 2004-07-22 Kevin Decker <kdecker@apple.com>
1590 Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
1592 * kjs/function_object.cpp:
1593 (FunctionObjectImp::construct):
1594 * kjs/function_object.h:
1596 (KJS::ObjectImp::construct):
1598 (KJS::Object::construct):
1600 2004-07-21 Darin Adler <darin@apple.com>
1602 * bindings/npruntime.h: Fixed typo.
1604 2004-07-19 John Sullivan <sullivan@apple.com>
1608 - bulletproofed array.slice() against NAN arguments. Harri noticed this
1609 vulnerability in my patch for 3714644
1611 * kjs/array_object.cpp:
1612 (ArrayProtoFuncImp::call):
1613 handle NAN parameters passed to slice() by clamping to 0 and length.
1615 2004-07-19 Richard Williamson <rjw@apple.com>
1617 Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
1622 * bindings/jni/jni_jsobject.cpp:
1624 (JSObject::JSObject):
1626 2004-07-16 John Sullivan <sullivan@apple.com>
1630 - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
1631 hangs browser with javascript
1633 * kjs/array_object.cpp:
1634 (ArrayProtoFuncImp::call):
1635 Check for undefined type for args[0] the same way we were already checking
1636 for args[1]. In this case, args was zero-length, but we were treating
1637 args[0] like an integer anyway. Resulted in some code looping from a NAN
1638 value to 4, taking approximately forever.
1640 * JavaScriptCore.pbproj/project.pbxproj:
1645 2004-07-14 Maciej Stachowiak <mjs@apple.com>
1649 <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
1650 <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
1652 * kjs/number_object.cpp:
1653 (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
1655 2004-07-13 Kevin Decker <kdecker@apple.com>
1657 Reviewed by kocienda.
1659 - made testkjs and JavaScriptCore a subtarget of 'All'
1660 - testkjs now builds in $SYMROOTS
1662 * JavaScriptCore.pbproj/project.pbxproj:
1666 2004-06-24 Chris Blumenberg <cblu@apple.com>
1668 Ignore .mode1 files in JavaScriptCore.pbproj
1670 Reviewed by kocienda.
1672 * JavaScriptCore.pbproj/.cvsignore:
1674 2004-06-23 Richard Williamson <rjw@apple.com>
1676 Implemented changes for latest npruntime.h.
1680 * JavaScriptCore.pbproj/project.pbxproj:
1681 * bindings/NP_jsobject.cpp:
1682 (listFromVariantArgs):
1683 (identiferFromNPIdentifier):
1684 (_NPN_CreateScriptObject):
1689 (NPN_RemoveProperty):
1690 * bindings/NP_jsobject.h:
1691 * bindings/c/c_class.cpp:
1692 (CClass::methodsNamed):
1693 (CClass::fieldNamed):
1694 * bindings/c/c_instance.cpp:
1695 (CInstance::invokeMethod):
1696 * bindings/c/c_utility.cpp:
1697 (convertNPVariantToValue):
1698 * bindings/c/c_utility.h:
1699 * bindings/npruntime.cpp:
1700 (stringIdentifierEqual):
1701 (stringIdentifierHash):
1702 (getStringIdentifierDictionary):
1703 (intIdentifierEqual):
1704 (intIdentifierHash):
1705 (getIntIdentifierDictionary):
1706 (NPN_GetStringIdentifier):
1707 (NPN_GetStringIdentifiers):
1708 (NPN_GetIntIdentifier):
1709 (NPN_IdentifierIsString):
1710 (NPN_UTF8FromIdentifier):
1711 (NPN_VariantToInt32):
1712 (NPN_VariantToDouble):
1714 * bindings/npruntime.h:
1715 * bindings/objc/WebScriptObject.mm:
1716 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1717 * bindings/runtime_object.cpp:
1718 (RuntimeObjectImp::~RuntimeObjectImp):
1719 * bindings/runtime_root.cpp:
1720 (KJS::Bindings::rootForInterpreter):
1721 * bindings/testbindings.cpp:
1722 (initializeIdentifiers):
1728 === JavaScriptCore-146.1 ===
1730 2004-06-16 Richard Williamson <rjw@apple.com>
1732 Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
1734 This turned out to be a show stopper for Dashboard. Accessing a nil
1735 ObjC property from JS caused a crash. Similar to the problem
1736 3696112 fixed below.
1740 * bindings/objc/objc_runtime.mm:
1741 (KJS::Bindings::ObjcField::valueFromInstance):
1745 2004-06-16 Richard Williamson <rjw@apple.com>
1747 Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
1749 This turned out to be a show stopper for Dashboard. We now
1750 return Undefined() when nil is returned from a ObjC method
1751 that returns an object type.
1755 * bindings/objc/objc_utility.mm:
1756 (KJS::Bindings::convertObjcValueToValue):
1760 2004-06-15 Richard Williamson <rjw@apple.com>
1762 Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
1764 No longer need to check respondsToSelector: for
1765 isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
1766 because these now have a default implementation on NSObject.
1770 * bindings/objc/objc_class.mm:
1771 (ObjcClass::methodsNamed):
1772 (ObjcClass::fieldNamed):
1774 2004-06-14 Darin Adler <darin@apple.com>
1778 - fixed some things for GC that Patrick missed, or that happened after the branch
1780 * bindings/objc/WebScriptObject.mm:
1781 (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
1782 (-[WebScriptObject finalize]): Added.
1784 - added some missing nil checks
1786 * bindings/objc/objc_instance.mm:
1787 (ObjcInstance::ObjcInstance): Check for nil.
1788 (ObjcInstance::~ObjcInstance): Check for nil.
1789 (ObjcInstance::operator=): Check for nil.
1791 2004-06-14 Darin Adler <darin@apple.com>
1793 Reviewed by me, code changes by Patrick Beard.
1795 - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
1797 * bindings/objc/objc_instance.mm:
1798 (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
1799 (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
1800 (ObjcInstance::operator=): More of the same.
1801 (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
1803 * bindings/objc/objc_runtime.mm:
1804 (ObjcArray::ObjcArray): Use CFRetain instead of retain.
1805 (ObjcArray::~ObjcArray): Use CFRelease instead of release.
1806 (ObjcArray::operator=): More of the same.
1808 * bindings/testbindings.mm: Fixed incorrect license.
1809 (main): Use [pool drain] if compiling on Tiger.
1813 2004-06-10 Kevin Decker <kdecker@apple.com>
1819 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1821 (KJS::Lexer::lineNo):
1822 - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
1824 === JavaScriptCore-143.2 ===
1826 2004-06-07 Darin Adler <darin@apple.com>
1828 - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
1830 * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
1831 * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
1833 === JavaScriptCore-143.1 ===
1835 2004-06-04 Kevin Decker <kdecker@apple.com>
1839 - fixed <rdar://problem/3680594>
1842 (KJS::Error::create):
1846 2004-06-04 Darin Adler <darin@apple.com>
1848 * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
1850 2004-06-04 Kevin Decker <kdecker@apple.com>
1854 - ObjC bindings do not (yet) pass along sourceurl or line numbers
1855 - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
1856 - changed the wording of an error message
1857 - the lexer, parser, and interpreter have been made "sourceURL aware"
1858 - stored the url into Error
1860 * bindings/NP_jsobject.cpp:
1862 * bindings/jni/jni_jsobject.cpp:
1864 * bindings/objc/WebScriptObject.mm:
1865 (-[WebScriptObject evaluateWebScript:]):
1867 (GlobalFuncImp::call):
1868 * kjs/function_object.cpp:
1869 (FunctionObjectImp::construct):
1872 (InterpreterImp::checkSyntax):
1873 (InterpreterImp::evaluate):
1875 * kjs/interpreter.cpp:
1876 (Interpreter::evaluate):
1877 * kjs/interpreter.h:
1881 (KJS::Lexer::sourceURL):
1885 (FunctionCallNode::evaluate):
1888 (KJS::Error::create):
1891 2004-06-04 Richard Williamson <rjw@apple.com>
1893 Fixed crash when attempting to access properties on nil
1898 * bindings/objc/objc_instance.mm:
1899 (ObjcInstance::getClass):
1900 * bindings/runtime_object.cpp:
1901 (RuntimeObjectImp::get):
1902 * bindings/testM.js:
1903 * bindings/testbindings.mm:
1904 (-[MyFirstInterface getString]):
1906 2004-05-27 Kevin Decker <kdecker@apple.com>
1910 -revised generated error message content
1912 * kjs/error_object.cpp:
1913 (ErrorProtoFuncImp::call):
1917 (KJS::Error::create):
1921 2004-05-27 Richard Williamson <rjw@apple.com>
1923 Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
1927 * bindings/objc/WebScriptObject.h:
1929 2004-05-27 Darin Adler <darin@apple.com>
1933 - moved to new symlink technique for embedding frameworks
1935 * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
1936 because we don't need it any more.
1938 2004-05-24 Richard Williamson <rjw@apple.com>
1940 Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
1941 fixed ClassInfo to correctly reflect inheritance. This is required
1942 because of the runtime checks in JSC for arrays, i.e. in
1943 the Function objects apply method.
1947 * bindings/jni/jni_runtime.cpp:
1948 (JavaArray::convertJObjectToArray):
1949 * bindings/objc/objc_utility.mm:
1950 (KJS::Bindings::convertObjcValueToValue):
1951 * bindings/runtime_array.cpp:
1952 (RuntimeArrayImp::RuntimeArrayImp):
1953 * bindings/runtime_array.h:
1954 * bindings/testM.js: Added.
1955 * bindings/testbindings.mm:
1956 (+[MyFirstInterface webScriptNameForSelector:]):
1957 (-[MyFirstInterface logMessages:]):
1958 (-[MyFirstInterface logMessage:prefix:]):
1959 (-[MyFirstInterface callJSObject::]):
1961 2004-05-22 Darin Adler <darin@apple.com>
1965 - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
1967 * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
1968 with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
1969 CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
1970 it hasn't been set explicitly.
1974 2004-05-20 Richard Williamson <rjw@apple.com>
1976 Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
1977 can now be referenced like any other WebScriptObject, meaning
1978 you can do JS operations on them.
1980 All added implementation of finalizeForWebScript.
1984 * bindings/objc/WebScriptObject.h:
1985 * bindings/objc/WebScriptObject.mm:
1986 (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
1987 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
1988 (-[WebScriptObject KJS::]):
1989 (-[WebScriptObject dealloc]):
1990 (-[WebScriptObject callWebScriptMethod:withArguments:]):
1991 (-[WebScriptObject evaluateWebScript:]):
1992 (-[WebScriptObject setValue:forKey:]):
1993 (-[WebScriptObject valueForKey:]):
1994 (-[WebScriptObject stringRepresentation]):
1995 * bindings/objc/WebScriptObjectPrivate.h:
1996 * bindings/objc/objc_instance.mm:
1997 (ObjcInstance::~ObjcInstance):
1999 2004-05-19 Richard Williamson <rjw@apple.com>
2001 Removed extraneous tabs that were added (by XCode?).
2003 * bindings/objc/WebScriptObject.h:
2005 2004-05-19 Darin Adler <darin@apple.com>
2007 - fixed headers with licenses mangled by Xcode auto-indenting
2009 * bindings/jni/jni_jsobject.cpp:
2010 * bindings/jni/jni_jsobject.h:
2011 * bindings/runtime_array.h:
2012 * bindings/runtime_root.cpp:
2013 * bindings/runtime_root.h:
2015 2004-05-18 Richard Williamson <rjw@apple.com>
2017 Added exception logging. Also check for exception and
2018 set results as appropriate.
2020 Reviewed by Maciej (partially reviewed).
2022 * bindings/objc/WebScriptObject.mm:
2023 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2024 (-[WebScriptObject evaluateWebScript:]):
2025 (-[WebScriptObject setValue:forKey:]):
2026 (-[WebScriptObject valueForKey:]):
2028 2004-05-18 Richard Williamson <rjw@apple.com>
2030 Finsished implementing support for windowScriptObject.
2031 Had to make WebScriptObjectPrivate.h accessible from
2036 * JavaScriptCore.pbproj/project.pbxproj:
2037 * bindings/objc/WebScriptObjectPrivate.h:
2039 2004-05-18 Richard Williamson <rjw@apple.com>
2041 Use KVC to set/get values instead of directly accessing
2046 * bindings/objc/WebScriptObject.mm:
2047 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2048 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2049 * bindings/objc/objc_runtime.mm:
2050 (ObjcField::valueFromInstance):
2051 (convertValueToObjcObject):
2052 (ObjcField::setValueToInstance):
2054 2004-05-17 Richard Williamson <rjw@apple.com>
2056 Implemented new API for WebScriptObject.
2058 Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
2059 Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
2063 * JavaScriptCore.pbproj/project.pbxproj:
2064 * bindings/c/c_instance.cpp:
2065 (CInstance::invokeMethod):
2066 * bindings/jni/jni_instance.cpp:
2067 (JavaInstance::invokeMethod):
2068 * bindings/jni/jni_jsobject.cpp:
2069 (JSObject::convertValueToJObject):
2070 * bindings/jni/jni_utility.cpp:
2071 (KJS::Bindings::getJNIField):
2072 * bindings/objc/WebScriptObject.mm:
2074 (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2075 (-[WebScriptObject KJS::]):
2076 (-[WebScriptObject dealloc]):
2077 (+[WebScriptObject throwException:]):
2079 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2080 (-[WebScriptObject evaluateWebScript:]):
2081 (-[WebScriptObject setValue:forKey:]):
2082 (-[WebScriptObject valueForKey:]):
2083 (-[WebScriptObject stringRepresentation]):
2084 (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2085 (+[WebUndefined undefined]):
2086 (-[WebUndefined initWithCoder:]):
2087 (-[WebUndefined encodeWithCoder:]):
2088 (-[WebUndefined copyWithZone:]):
2089 (-[WebUndefined retain]):
2090 (-[WebUndefined release]):
2091 (-[WebUndefined retainCount]):
2092 (-[WebUndefined autorelease]):
2093 (-[WebUndefined dealloc]):
2094 (-[WebUndefined copy]):
2095 (-[WebUndefined replacementObjectForPortCoder:]):
2096 * bindings/objc/WebScriptObjectPrivate.h: Added.
2097 * bindings/objc/objc_class.mm:
2098 (ObjcClass::methodsNamed):
2099 (ObjcClass::fieldNamed):
2100 * bindings/objc/objc_instance.mm:
2101 (ObjcInstance::invokeMethod):
2102 * bindings/objc/objc_jsobject.h:
2103 * bindings/objc/objc_jsobject.mm:
2104 * bindings/objc/objc_runtime.mm:
2105 (ObjcField::valueFromInstance):
2106 * bindings/objc/objc_utility.mm:
2107 (KJS::Bindings::JSMethodNameToObjCMethodName):
2108 (KJS::Bindings::convertValueToObjcValue):
2109 (KJS::Bindings::convertObjcValueToValue):
2110 * bindings/runtime.cpp:
2111 (Instance::setDidExecuteFunction):
2112 (Instance::didExecuteFunction):
2113 (Instance::setValueOfField):
2114 * bindings/runtime.h:
2115 * bindings/testbindings.mm:
2116 (+[MyFirstInterface webScriptNameForSelector:]):
2117 (-[MyFirstInterface callJSObject::]):
2119 2004-05-14 Vicki Murley <vicki@apple.com>
2123 <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
2125 * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
2129 2004-05-13 Richard Williamson <rjw@apple.com>
2136 * bindings/objc/WebScriptObject.h:
2138 2004-05-13 Richard Williamson <rjw@apple.com>
2140 Approved API changes. Currently unimplemented.
2145 * JavaScriptCore.pbproj/project.pbxproj:
2146 * bindings/objc/WebScriptObject.h: Added.
2147 * bindings/objc/WebScriptObject.mm: Added.
2148 (+[WebScriptObject throwException:]):
2149 (-[WebScriptObject callWebScriptMethod:withArguments:]):
2150 (-[WebScriptObject evaluateWebScript:]):
2151 (-[WebScriptObject stringRepresentation]):
2152 (+[WebUndefined undefined]):
2153 (-[WebUndefined initWithCoder:]):
2154 (-[WebUndefined encodeWithCoder:]):
2155 (-[WebUndefined copyWithZone:]):
2157 2004-05-07 Vicki Murley <vicki@apple.com>
2161 Turn off GC since it uses ppc only instructions (which breaks
2164 * kjs/value.h: set USE_CONSERVATIVE_GC to 0
2168 2004-05-07 Maciej Stachowiak <mjs@apple.com>
2172 - add -funroll-loops=16 compiler option for approx .5% speedup on
2173 HTML iBench and .5-1% speedup on JS iBench.
2175 * JavaScriptCore.pbproj/project.pbxproj:
2177 2004-04-25 Maciej Stachowiak <mjs@apple.com>
2181 Enable full conservative GC mode in addition to test mode. When
2182 conservative GC is enabled, we now get an 11% speed improvement on
2183 the iBench. Also fix some spots I missed before.
2185 Specific noteworth changes:
2187 * kjs/collector.cpp:
2188 (KJS::Collector::markStackObjectsConservatively): Check possible
2189 cell pointers for 8-byte aligment and verify they are not 0.
2191 * kjs/protected_values.cpp:
2192 (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
2193 (KJS::ProtectedValues::decreaseProtectCount): ...and here...
2195 (KJS::gcProtectNullTolerant): ...to here...
2196 (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
2197 tolerance, and doing the check is expensive.
2199 * kjs/protected_values.cpp:
2200 (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
2201 that is still very good.
2206 (KJS::ProtectedValue::ProtectedValue):
2207 (KJS::ProtectedValue::~ProtectedValue):
2208 (KJS::ProtectedValue::operator=):
2209 (KJS::ProtectedObject::ProtectedObject):
2210 (KJS::ProtectedObject::~ProtectedObject):
2211 (KJS::ProtectedObject::operator=):
2212 (KJS::ProtectedReference::ProtectedReference):
2213 (KJS::ProtectedReference::~ProtectedReference):
2214 (KJS::ProtectedReference::operator=):
2215 * kjs/protected_values.cpp:
2216 (KJS::ProtectedValues::getProtectCount):
2217 (KJS::ProtectedValues::increaseProtectCount):
2218 (KJS::ProtectedValues::decreaseProtectCount):
2219 (KJS::ProtectedValues::computeHash):
2220 * bindings/runtime_root.cpp:
2221 (KJS::Bindings::addNativeReference):
2222 (KJS::Bindings::removeNativeReference):
2223 (RootObject::removeAllNativeReferences):
2224 * bindings/runtime_root.h:
2225 (KJS::Bindings::RootObject::~RootObject):
2226 (KJS::Bindings::RootObject::setRootObjectImp):
2227 * kjs/collector.cpp:
2228 (KJS::Collector::allocate):
2229 (KJS::Collector::collect):
2232 (NumberImp::create):
2233 (InterpreterImp::globalInit):
2234 (InterpreterImp::globalClear):
2235 (InterpreterImp::mark):
2237 (KJS::List::derefValues):
2238 (KJS::List::refValues):
2239 (KJS::List::append):
2241 (KJS::ObjectImp::setInternalValue):
2242 (KJS::ObjectImp::putDirect):
2247 (KJS::ValueImp::ValueImp):
2248 (KJS::ValueImp::~ValueImp):
2250 (KJS::Value::Value):
2251 (KJS::Value::~Value):
2252 (KJS::Value::operator=):
2254 2004-04-30 Richard Williamson <rjw@apple.com>
2256 Asking an NSInvocation for it's return value when return type
2257 is void throws an exception. Added check for void return types
2258 to avoid this exception.
2262 * bindings/objc/objc_instance.mm:
2263 (ObjcInstance::invokeMethod):
2265 2004-04-29 Richard Williamson <rjw@apple.com>
2267 Fixed several bad problems with the ObjC bindings. In particular, conversion
2268 to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
2272 * bindings/objc/objc_jsobject.h:
2273 * bindings/objc/objc_jsobject.mm:
2274 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
2275 (-[JavaScriptObject KJS::]):
2276 (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2277 (-[JavaScriptObject call:arguments:]):
2278 (-[JavaScriptObject evaluate:]):
2279 (-[JavaScriptObject getMember:]):
2280 (-[JavaScriptObject getSlot:]):
2281 * bindings/objc/objc_runtime.mm:
2282 (ObjcField::valueFromInstance):
2283 (ObjcField::setValueToInstance):
2284 * bindings/objc/objc_utility.mm:
2285 (KJS::Bindings::convertValueToObjcValue):
2286 (KJS::Bindings::convertObjcValueToValue):
2287 * bindings/runtime.h:
2288 * bindings/runtime_root.cpp:
2289 (KJS::Bindings::rootForInterpreter):
2290 (KJS::Bindings::addNativeReference):
2291 (KJS::Bindings::removeNativeReference):
2292 * bindings/runtime_root.h:
2293 * bindings/testbindings.mm:
2294 (-[MyFirstInterface logMessage:]):
2295 (-[MyFirstInterface setJSObject:]):
2296 (-[MyFirstInterface callJSObject::]):
2298 2004-04-24 Darin Adler <darin@apple.com>
2302 * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
2305 2004-04-23 Maciej Stachowiak <mjs@apple.com>
2309 Implementation of conservative GC, based partly on code from
2310 Darin. It's turned off for now, so it shouldn't have any effect on
2313 * JavaScriptCore.pbproj/project.pbxproj:
2314 * kjs/collector.cpp:
2315 (KJS::Collector::markStackObjectsConservatively):
2316 (KJS::Collector::markProtectedObjects):
2317 (KJS::Collector::collect):
2322 * kjs/protected_values.cpp: Added.
2323 (KJS::ProtectedValues::getProtectCount):
2324 (KJS::ProtectedValues::increaseProtectCount):
2325 (KJS::ProtectedValues::insert):
2326 (KJS::ProtectedValues::decreaseProtectCount):
2327 (KJS::ProtectedValues::expand):
2328 (KJS::ProtectedValues::shrink):
2329 (KJS::ProtectedValues::rehash):
2330 (KJS::ProtectedValues::computeHash):
2331 * kjs/protected_values.h: Added.
2333 (ValueImp::useConservativeMark):
2341 2004-04-22 Richard Williamson <rjw@apple.com>
2343 Fixed build snafu (re-declaration of NPBool in npruntime.h and
2346 * bindings/npruntime.h:
2348 2004-04-22 Richard Williamson <rjw@apple.com>
2350 Updated plugin binding API to reflect latest revision from
2353 Biggest change is the introduction of NPVariant used to represent
2354 value types. NPVariant replaces the use of NPObject for the
2355 exchange of values between scripting environment and native code.
2359 * JavaScriptCore.pbproj/project.pbxproj:
2360 * bindings/NP_jsobject.cpp:
2361 (identiferFromNPIdentifier):
2367 (NPN_GetPropertyAtIndex):
2368 (NPN_SetPropertyAtIndex):
2369 * bindings/c/c_class.cpp:
2370 (CClass::methodsNamed):
2371 (CClass::fieldNamed):
2372 * bindings/c/c_instance.cpp:
2373 (CInstance::invokeMethod):
2374 (CInstance::defaultValue):
2375 * bindings/c/c_runtime.cpp:
2376 (CField::valueFromInstance):
2377 (CField::setValueToInstance):
2378 * bindings/c/c_utility.cpp:
2379 (convertNPStringToUTF16):
2380 (convertUTF8ToUTF16):
2381 (coerceValueToNPVariantStringType):
2382 (convertValueToNPVariant):
2383 (convertNPVariantToValue):
2384 * bindings/c/c_utility.h:
2385 * bindings/npruntime.cpp:
2386 (NPN_GetIdentifier):
2387 (NPN_GetIdentifiers):
2388 (NPN_UTF8FromIdentifier):
2389 (NPN_VariantIsVoid):
2390 (NPN_VariantIsNull):
2391 (NPN_VariantIsUndefined):
2392 (NPN_VariantIsBool):
2393 (NPN_VariantIsInt32):
2394 (NPN_VariantIsDouble):
2395 (NPN_VariantIsString):
2396 (NPN_VariantIsObject):
2397 (NPN_VariantToBool):
2398 (NPN_VariantToString):
2399 (NPN_VariantToInt32):
2400 (NPN_VariantToDouble):
2401 (NPN_VariantToObject):
2402 (NPN_InitializeVariantAsVoid):
2403 (NPN_InitializeVariantAsNull):
2404 (NPN_InitializeVariantAsUndefined):
2405 (NPN_InitializeVariantWithBool):
2406 (NPN_InitializeVariantWithInt32):
2407 (NPN_InitializeVariantWithDouble):
2408 (NPN_InitializeVariantWithString):
2409 (NPN_InitializeVariantWithStringCopy):
2410 (NPN_InitializeVariantWithObject):
2411 (NPN_InitializeVariantWithVariant):
2412 (NPN_ReleaseVariantValue):
2415 (NPN_ReleaseObject):
2416 (NPN_IsKindOfClass):
2417 (NPN_SetExceptionWithUTF8):
2419 * bindings/npruntime.h:
2421 (_NPString::_NPVariant::):
2422 * bindings/testbindings.cpp:
2437 2004-04-22 Darin Adler <darin@apple.com>
2441 - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
2444 (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
2445 Was resulting in a buffer 2x the needed size.
2446 (KJS::UString::expandPreCapacity): Ditto.
2447 (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
2449 2004-04-21 Maciej Stachowiak <mjs@apple.com>
2453 Preliminary change for conservative GC. Create "protected"
2454 subclasses to GC-protect objects when on heap, since we will soon
2455 remove the built-in refcounting of the normal wrapper classes. Use
2458 * JavaScriptCore.pbproj/project.pbxproj:
2461 (KJS::InterpreterImp::globalObject):
2462 * kjs/interpreter.h:
2463 * kjs/property_map.cpp:
2465 * kjs/reference_list.cpp:
2467 2004-04-19 Maciej Stachowiak <mjs@apple.com>
2471 Optimize prepend using the shared substring optimization. Also,
2472 limit the applicability of shared append and shared prepend. If
2473 you overdo it, it does more harm than good, because you create a
2474 bunch of strings that are disqualified from future shared
2475 append/prepend, for not much immediate savings in allocate/copy
2480 (KJS::UString::Rep::create):
2481 (KJS::UString::expandedSize):
2482 (KJS::UString::usedPreCapacity):
2483 (KJS::UString::expandCapacity):
2484 (KJS::UString::expandPreCapacity):
2485 (KJS::UString::UString):
2486 (KJS::UString::append):
2487 (KJS::UString::operator=):
2489 (KJS::UString::Rep::data):
2491 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2492 Reviewed by Richard.
2494 No more need for Completion or Reference to privately inherit from
2495 Value, none of the superclass functionality is used.
2502 2004-04-16 Richard Williamson <rjw@apple.com>
2504 Added interpreter lock protection around object creation.
2508 * bindings/runtime.cpp:
2509 (Instance::createRuntimeObject):
2511 2004-04-16 Maciej Stachowiak <mjs@apple.com>
2515 Another JavaScript speed improvement: use the mechanism from
2516 string append optimization to make taking a substring fast, again
2519 A further 22% improvement on the 24fun string speed test.
2523 (KJS::UString::Rep::create):
2524 (KJS::UString::UString):
2525 (KJS::UString::append):
2526 (KJS::UString::operator=):
2527 (KJS::UString::substr):
2529 (KJS::UString::Rep::data):
2531 2004-04-13 Maciej Stachowiak <mjs@apple.com>
2535 - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
2536 - fixed <rdar://problem/3600691>: Table generation test is really slow
2537 - fixed <rdar://problem/3600661>: 24fun date test is really slow
2539 80% speedup on the string test, lesser speedups on the other two.
2541 Two different optimizations here:
2543 1) Avoid large overhead of scanning strings to see if they are all
2544 ASCII before numeric conversion.
2547 (AssignNode::evaluate): Don't convert to integer until we know for
2548 sure the operation will need it. Attempting to convert strings to
2549 numbers is a waste when they are being appended with +=.
2551 2) Avoid huge cost of appending strings.
2553 This is done by allowing multiple strings to share a buffer but
2554 actually use different ranges of it. The first time a string is
2555 appended to, we start leaving at least 10% extra space in the
2556 buffer, so doing N appends to the same string takes O(log N)
2557 mallocs instead of O(N).
2559 * kjs/identifier.cpp:
2560 (KJS::Identifier::equal):
2561 (KJS::Identifier::add):
2564 (KJS::UCharReference::operator=):
2565 (KJS::UCharReference::ref):
2566 (KJS::UString::Rep::create):
2567 (KJS::UString::Rep::destroy):
2568 (KJS::UString::expandedSize):
2569 (KJS::UString::usedCapacity):
2570 (KJS::UString::expandCapacity):
2571 (KJS::UString::UString):
2572 (KJS::UString::null):
2573 (KJS::UString::append):
2574 (KJS::UString::operator=):
2575 (KJS::UString::toStrictUInt32):
2576 (KJS::UString::detach):
2577 (KJS::KJS::operator==):
2579 (KJS::UString::Rep::data):
2580 (KJS::UString::Rep::hash):
2582 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2586 - fix deployment build by avoiding deployment-only warning.
2588 * kjs/scope_chain.cpp:
2589 (KJS::ScopeChain::bottom):
2591 2004-04-09 Maciej Stachowiak <mjs@apple.com>
2595 Changed things so that newly created objects get a prototype based
2596 on the scope chain of the current function, rather than the
2597 interpreter that started execution. This fixes the following bugs:
2599 <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
2600 <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
2602 * JavaScriptCore.pbproj/project.pbxproj:
2603 * kjs/array_object.cpp:
2604 (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2605 (ArrayProtoFuncImp::ArrayProtoFuncImp):
2606 (ArrayProtoFuncImp::call):
2607 (ArrayObjectImp::construct):
2608 * kjs/bool_object.cpp:
2609 (BooleanObjectImp::construct):
2610 * kjs/date_object.cpp:
2611 (DateProtoFuncImp::DateProtoFuncImp):
2612 (DateProtoFuncImp::call):
2613 (DateObjectImp::construct):
2614 * kjs/error_object.cpp:
2615 (ErrorObjectImp::construct):
2617 (FunctionImp::FunctionImp):
2618 (FunctionImp::call):
2619 (DeclaredFunctionImp::construct):
2620 (ArgumentsImp::ArgumentsImp):
2621 (GlobalFuncImp::call):
2622 * kjs/function_object.cpp:
2623 (FunctionProtoFuncImp::call):
2624 (FunctionObjectImp::construct):
2626 (BooleanImp::toObject):
2627 (StringImp::toObject):
2628 (NumberImp::toObject):
2629 (InterpreterImp::InterpreterImp):
2630 (InterpreterImp::clear):
2631 (InterpreterImp::interpreterWithGlobalObject):
2633 * kjs/interpreter.cpp:
2634 (ExecState::lexicalInterpreter):
2635 * kjs/interpreter.h:
2636 (KJS::ExecState::dynamicInterpreter):
2637 (KJS::ExecState::interpreter):
2638 * kjs/math_object.cpp:
2639 (MathFuncImp::MathFuncImp):
2641 (StatementNode::hitStatement):
2642 (StatementNode::abortStatement):
2643 (RegExpNode::evaluate):
2644 (ElementNode::evaluate):
2645 (ArrayNode::evaluate):
2646 (ObjectLiteralNode::evaluate):
2647 (PropertyValueNode::evaluate):
2648 (FunctionCallNode::evaluate):
2649 (FuncDeclNode::processFuncDecl):
2650 (FuncExprNode::evaluate):
2651 * kjs/number_object.cpp:
2652 (NumberObjectImp::construct):
2654 (KJS::ObjectImp::defaultValue):
2655 (KJS::Error::create):
2656 * kjs/object_object.cpp:
2657 (ObjectObjectImp::construct):
2658 * kjs/reference.cpp:
2659 (Reference::putValue):
2660 * kjs/regexp_object.cpp:
2661 (RegExpProtoFuncImp::call):
2662 (RegExpObjectImp::arrayOfMatches):
2663 (RegExpObjectImp::construct):
2664 * kjs/scope_chain.cpp:
2665 (KJS::ScopeChain::bottom):
2666 * kjs/scope_chain.h:
2667 * kjs/string_object.cpp:
2668 (StringProtoFuncImp::StringProtoFuncImp):
2669 (StringProtoFuncImp::call):
2670 (StringObjectImp::construct):
2676 2004-03-31 Richard Williamson <rjw@apple.com>
2678 Tedious renames based on feedback from plugin-futures list.
2679 NP_ functions are renamed with NPN_ prefix.
2680 Types prefix renamed from NP_ to NP.
2681 NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
2683 No review because this was just a renaming patch.
2685 * bindings/NP_jsobject.cpp:
2688 (identiferFromNPIdentifier):
2693 (NPN_RemoveProperty):
2695 (NPN_GetPropertyAtIndex):
2696 (NPN_SetPropertyAtIndex):
2697 * bindings/NP_jsobject.h:
2698 * bindings/c/c_class.cpp:
2699 (CClass::_commonInit):
2700 (CClass::classForIsA):
2702 (CClass::methodsNamed):
2703 (CClass::fieldNamed):
2704 * bindings/c/c_class.h:
2705 * bindings/c/c_instance.cpp:
2706 (CInstance::CInstance):
2707 (CInstance::~CInstance):
2708 (CInstance::operator=):
2709 (CInstance::invokeMethod):
2710 (CInstance::defaultValue):
2711 * bindings/c/c_instance.h:
2712 (KJS::Bindings::CInstance::getObject):
2713 * bindings/c/c_runtime.cpp:
2714 (CField::valueFromInstance):
2715 (CField::setValueToInstance):
2716 * bindings/c/c_runtime.h:
2717 (KJS::Bindings::CField::CField):
2718 (KJS::Bindings::CField::name):
2719 (KJS::Bindings::CMethod::CMethod):
2720 (KJS::Bindings::CMethod::name):
2721 * bindings/c/c_utility.cpp:
2722 (coerceValueToNPString):
2723 (convertValueToNPValueType):
2724 (convertNPValueTypeToValue):
2725 * bindings/c/c_utility.h:
2726 * bindings/npruntime.cpp:
2727 (NPN_IdentifierFromUTF8):
2728 (NPN_IsValidIdentifier):
2729 (NPN_GetIdentifiers):
2730 (NPN_UTF8FromIdentifier):
2733 (NPN_ReleaseObject):
2734 (NPN_IsKindOfClass):
2735 (NPN_SetExceptionWithUTF8):
2738 (NPN_CreateNumberWithInt):
2739 (NPN_CreateNumberWithFloat):
2740 (NPN_CreateNumberWithDouble):
2741 (NPN_IntFromNumber):
2742 (NPN_FloatFromNumber):
2743 (NPN_DoubleFromNumber):
2745 (NPN_CreateStringWithUTF8):
2746 (NPN_CreateStringWithUTF16):
2747 (NPN_DeallocateUTF8):
2748 (NPN_UTF8FromString):
2749 (NPN_UTF16FromString):
2752 (NPN_CreateBoolean):
2753 (NPN_BoolFromBoolean):
2756 (undefinedAllocate):
2762 (NPN_ObjectAtIndex):
2763 * bindings/npruntime.h:
2764 * bindings/runtime.cpp:
2765 (Instance::createBindingForLanguageInstance):
2766 * bindings/testbindings.cpp:
2767 (initializeIdentifiers):
2787 2004-03-31 Richard Williamson <rjw@apple.com>
2789 Changed references to NP_runtime.h to npruntime.h
2791 * JavaScriptCore.pbproj/project.pbxproj:
2792 * bindings/NP_jsobject.h:
2793 * bindings/c/c_class.h:
2794 * bindings/c/c_instance.h:
2795 * bindings/c/c_runtime.h:
2796 * bindings/c/c_utility.h:
2797 * bindings/npruntime.cpp:
2799 2004-03-31 Richard Williamson <rjw@apple.com>
2801 Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
2803 * JavaScriptCore.pbproj/project.pbxproj:
2804 * bindings/NP_jsobject.h:
2805 * bindings/npruntime.cpp:
2809 2004-03-23 Richard Williamson <rjw@apple.com>
2811 Added implementation of KJS::Value <-> NP_Object conversion functions.
2812 Augmented test program for 'C' bindings.
2813 Added asserts and parameter checking to all public API.
2817 * JavaScriptCore.pbproj/project.pbxproj:
2818 * bindings/NP_jsobject.cpp:
2820 * bindings/NP_jsobject.h: Added.
2821 * bindings/NP_runtime.cpp:
2822 (NP_IdentifierFromUTF8):
2823 (NP_IsValidIdentifier):
2824 (NP_GetIdentifiers):
2829 (NP_SetExceptionWithUTF8):
2832 (NP_FloatFromNumber):
2833 (NP_DoubleFromNumber):
2834 (NP_CreateStringWithUTF8):
2835 (NP_CreateStringWithUTF16):
2836 (NP_DeallocateUTF8):
2837 (NP_UTF8FromString):
2838 (NP_UTF16FromString):
2840 (NP_BoolFromBoolean):
2841 * bindings/NP_runtime.h:
2842 * bindings/c/c_instance.cpp:
2843 (CInstance::invokeMethod):
2844 * bindings/c/c_utility.cpp:
2845 (coerceValueToNPString):
2846 (convertValueToNPValueType):
2847 (convertNPValueTypeToValue):
2848 * bindings/c/c_utility.h:
2850 * bindings/testC.js: Added.
2851 * bindings/testbindings.cpp:
2861 (myInterfaceInvoke):
2862 (myInterfaceAllocate):
2866 2004-03-19 Darin Adler <darin@apple.com>
2870 - fixed problem with methods like setUTCHour
2872 * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
2873 GMT vs. local time function based on the utc flag.
2875 2004-03-17 Richard Williamson <rjw@apple.com>
2877 Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
2881 * bindings/NP_jsobject.cpp:
2886 (NP_GetPropertyAtIndex):
2887 * bindings/NP_runtime.h:
2889 2004-03-16 Richard Williamson <rjw@apple.com>
2891 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.
2895 * bindings/jni/jni_class.cpp:
2896 (JavaClass::methodsNamed):
2898 2004-03-15 Richard Williamson <rjw@apple.com>
2900 Fixed 3570854. Don't attempt to convert Null to strings. We
2901 were incorrectly converting to "Null".
2903 Actually fixed by Scott Kovatch.
2905 Reviewed by Richard.
2907 * bindings/jni/jni_utility.cpp:
2908 (KJS::Bindings::convertValueToJValue):
2912 2004-03-11 Richard Williamson <rjw@apple.com>
2914 Stitched together the NP stuff to our language independent
2915 JavaScript binding stuff. Very close to being done.
2917 Added program to test C bindings (and NP stuff). Just tests
2918 properties. Will add methods and JavaScript access, etc.
2920 Updated Makefile.am to account for new bindings/c directory.
2922 Change NP_UTF8 from "const char *" to "char" to allow for
2923 declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
2926 Added NP_IsValidIdentifier().
2930 * JavaScriptCore.pbproj/project.pbxproj:
2932 * bindings/NP_jsobject.cpp:
2933 (identiferFromNPIdentifier):
2935 * bindings/NP_runtime.cpp:
2936 (NP_IdentifierFromUTF8):
2937 (NP_IsValidIdentifier):
2938 (NP_GetIdentifiers):
2939 (NP_UTF8FromIdentifier):
2940 (NP_SetExceptionWithUTF8):
2942 (NP_CreateStringWithUTF8):
2943 (NP_CreateStringWithUTF16):
2944 (NP_UTF8FromString):
2945 (NP_UTF16FromString):
2946 * bindings/NP_runtime.h:
2947 * bindings/c/c_class.cpp: Added.
2948 (CClass::_commonDelete):
2949 (CClass::_commonCopy):
2950 (CClass::_commonInit):
2951 (_createClassesByIsAIfNecessary):
2952 (CClass::classForIsA):
2955 (CClass::methodsNamed):
2956 (CClass::fieldNamed):
2957 * bindings/c/c_class.h: Added.
2958 (KJS::Bindings::CClass::~CClass):
2959 (KJS::Bindings::CClass::CClass):
2960 (KJS::Bindings::CClass::operator=):
2961 (KJS::Bindings::CClass::constructorAt):
2962 (KJS::Bindings::CClass::numConstructors):
2963 * bindings/c/c_instance.cpp: Added.
2964 (CInstance::CInstance):
2965 (CInstance::~CInstance):
2966 (CInstance::operator=):
2967 (CInstance::getClass):
2970 (CInstance::invokeMethod):
2971 (CInstance::defaultValue):
2972 (CInstance::stringValue):
2973 (CInstance::numberValue):
2974 (CInstance::booleanValue):
2975 (CInstance::valueOf):
2976 * bindings/c/c_instance.h: Added.
2977 (KJS::Bindings::CInstance::getObject):
2978 * bindings/c/c_runtime.cpp: Added.
2979 (CField::valueFromInstance):
2980 (CField::setValueToInstance):
2981 * bindings/c/c_runtime.h: Added.
2982 (KJS::Bindings::CField::CField):
2983 (KJS::Bindings::CField::name):
2984 (KJS::Bindings::CField::type):
2985 (KJS::Bindings::CMethod::CMethod):
2986 (KJS::Bindings::CMethod::name):
2987 (KJS::Bindings::CMethod::numParameters):
2988 * bindings/c/c_utility.cpp: Added.
2989 (coerceValueToNPValueType):
2990 (convertValueToNPValueType):
2991 (convertNPValueTypeToValue):
2992 * bindings/c/c_utility.h: Added.
2993 * bindings/make_testbindings:
2994 * bindings/runtime.cpp:
2995 (Instance::createBindingForLanguageInstance):
2996 * bindings/runtime.h:
2997 (KJS::Bindings::Instance::):
2998 * bindings/testbindings.cpp: Added.
2999 (initializeIdentifiers):
3000 (myInterfaceHasProperty):
3001 (myInterfaceHasMethod):
3002 (myInterfaceGetProperty):
3003 (myInterfaceSetProperty):
3004 (myInterfaceInvoke):
3005 (myInterfaceAllocate):
3006 (myInterfaceInvalidate):
3007 (myInterfaceDeallocate):
3008 (GlobalImp::className):
3009 (readJavaScriptFromFile):
3012 2004-03-10 Richard Williamson <rjw@apple.com>
3014 Made changes to support new asychronous approach to calls from
3015 plugin to JavaScript
3019 * bindings/NP_jsobject.cpp:
3024 (NP_GetPropertyAtIndex):
3025 * bindings/NP_runtime.h:
3026 * bindings/make_testbindings:
3027 * bindings/runtime.cpp:
3028 (Instance::createBindingForLanguageInstance):
3030 2004-03-10 Richard Williamson <rjw@apple.com>
3032 Updated header to include proposed changes from
3033 plugin-futures list. Calls from plugin to JavaScript
3034 are now asynchronous.
3038 * bindings/NP_runtime.h:
3042 2004-03-04 Richard Williamson <rjw@apple.com>
3044 Implementation of NP_JavaScriptObject. This is the 'C' class
3045 that wraps a JavaScript object.
3049 * JavaScriptCore.pbproj/project.pbxproj:
3050 * bindings/NP_jsobject.cpp: Added.
3051 (coerceValueToNPValueType):
3052 (convertValueToNPValueType):
3053 (convertNPValueTypeToValue):
3057 (identiferFromNPIdentifier):
3062 (NP_RemoveProperty):
3064 (NP_GetPropertyAtIndex):
3065 (NP_SetPropertyAtIndex):
3066 * bindings/NP_runtime.cpp:
3068 * bindings/NP_runtime.h:
3069 * bindings/runtime_object.h:
3071 2004-03-04 Richard Williamson <rjw@apple.com>
3073 Added NP_Array implementation.
3075 Changed NP_Boolean to just depend on two static instances, no
3076 space is required for values.
3080 * bindings/NP_runtime.cpp:
3082 (NP_BoolFromBoolean):
3088 * bindings/NP_runtime.h:
3090 2004-03-03 Darin Adler <darin@apple.com>
3094 * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
3095 copyright string, and that's all that was in here.
3096 * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
3098 2004-03-03 Richard Williamson <rjw@apple.com>
3100 More 'C' binding implementation. Fleshed out all the
3101 'primitive' data types.
3105 * bindings/NP_runtime.cpp:
3110 (NP_CreateStringWithUTF8):
3111 (NP_CreateStringWithUTF16):
3112 (NP_UTF8FromString):
3113 (NP_UTF16FromString):
3116 (booleanDeallocate):
3118 (NP_BoolFromBoolean):
3122 (undefinedAllocate):
3123 (undefinedDeallocate):
3125 * bindings/NP_runtime.h:
3127 2004-03-03 Richard Williamson <rjw@apple.com>
3129 More 'C' binding implementation.
3133 * bindings/NP_runtime.cpp:
3136 (getIdentifierDictionary):
3137 (NP_IdentifierFromUTF8):
3138 (NP_UTF8FromIdentifier):
3143 (NP_CreateNumberWithInt):
3144 (NP_CreateNumberWithFloat):
3145 (NP_CreateNumberWithDouble):
3147 (NP_FloatFromNumber):
3148 (NP_DoubleFromNumber):
3149 * bindings/NP_runtime.h:
3151 2004-03-02 Richard Williamson <rjw@apple.com>
3153 Removed retain/release from NP_Class. Classes will not be allowed to implement their
3154 own customer retain/release scheme.
3158 * bindings/NP_runtime.cpp:
3161 * bindings/NP_runtime.h:
3163 2004-03-02 Richard Williamson <rjw@apple.com>
3165 C binding API. Partial implementation.
3167 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.
3169 Factored root object reference counting scheme. It is now useful independent
3174 * JavaScriptCore.pbproj/project.pbxproj:
3175 * bindings/NP_runtime.cpp: Added.
3176 (NP_IdentifierFromUTF8):
3177 (NP_GetIdentifiers):
3178 (NP_UTF8FromIdentifier):
3188 (NP_RemoveProperty):
3190 (NP_GetPropertyAtIndex):
3191 (NP_SetPropertyAtIndex):
3192 (NP_CreateNumberWithInt):
3193 (NP_CreateNumberWithFloat):
3194 (NP_CreateNumberWithDouble):
3196 (NP_FloatFromNumber):
3197 (NP_DoubleFromNumber):
3198 (NP_CreateStringWithUTF8):
3199 (NP_CreateStringWithUTF16):
3200 (NP_UTF8FromString):
3201 (NP_UTF16FromString):
3203 (NP_BoolFromBoolean):
3209 * bindings/NP_runtime.h: Added.
3210 * bindings/jni/jni_jsobject.cpp:
3212 (JSObject::finalize):
3213 (JSObject::createNative):
3214 (JSObject::convertValueToJObject):
3215 * bindings/jni/jni_jsobject.h:
3216 * bindings/objc/objc_jsobject.h:
3217 * bindings/objc/objc_jsobject.mm:
3219 (windowJavaScriptObject):
3220 (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
3221 (-[JavaScriptObject dealloc]):
3222 (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
3223 (-[JavaScriptObject call:arguments:]):
3224 (-[JavaScriptObject evaluate:]):
3225 (-[JavaScriptObject getMember:]):
3226 (-[JavaScriptObject setMember:value:]):
3227 (-[JavaScriptObject removeMember:]):
3228 (-[JavaScriptObject toString]):
3229 (-[JavaScriptObject getSlot:]):
3230 (-[JavaScriptObject setSlot:value:]):
3231 * bindings/objc/objc_utility.h:
3232 * bindings/objc/objc_utility.mm:
3233 (KJS::Bindings::convertValueToObjcValue):
3234 * bindings/runtime_root.cpp: Added.
3235 (getReferencesByRootDictionary):
3236 (getReferencesDictionary):
3237 (KJS::Bindings::findReferenceDictionary):
3238 (KJS::Bindings::rootForImp):
3239 (KJS::Bindings::addNativeReference):
3240 (KJS::Bindings::removeNativeReference):
3241 (completedJavaScriptAccess):
3242 (initializeJavaScriptAccessLock):
3243 (lockJavaScriptAccess):
3244 (unlockJavaScriptAccess):
3245 (RootObject::dispatchToJavaScriptThread):
3246 (performJavaScriptAccess):
3247 (RootObject::setFindRootObjectForNativeHandleFunction):
3248 (RootObject::removeAllNativeReferences):
3249 * bindings/runtime_root.h: Added.
3250 (KJS::Bindings::RootObject::RootObject):
3251 (KJS::Bindings::RootObject::~RootObject):
3252 (KJS::Bindings::RootObject::setRootObjectImp):
3253 (KJS::Bindings::RootObject::rootObjectImp):
3254 (KJS::Bindings::RootObject::setInterpreter):
3255 (KJS::Bindings::RootObject::interpreter):
3256 (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
3257 (KJS::Bindings::RootObject::runLoop):
3258 (KJS::Bindings::RootObject::performJavaScriptSource):
3264 2004-02-18 Richard Williamson <rjw@apple.com>
3266 Added NSNumber/Number conversion.
3268 Removed some unnecessary KJS:: namespace specifiers.
3272 * bindings/objc/objc_utility.mm:
3273 (KJS::Bindings::convertValueToObjcValue):
3274 (KJS::Bindings::convertObjcValueToValue):
3275 * bindings/runtime_array.h:
3277 2004-02-18 Richard Williamson <rjw@apple.com>
3279 Added support for export NSArrays.
3281 Updated valueAt() to take an ExecState so we can throw
3284 Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
3285 ObjectiveC classes to control the visibility of their methods in
3290 * bindings/jni/jni_runtime.cpp:
3291 (JavaField::valueFromInstance):
3292 (JavaArray::valueAt):
3293 * bindings/jni/jni_runtime.h:
3294 * bindings/objc/objc_class.mm:
3295 (ObjcClass::methodsNamed):
3296 * bindings/objc/objc_runtime.h:
3297 (KJS::Bindings::ObjcArray::getObjcArray):
3298 * bindings/objc/objc_runtime.mm:
3299 (ObjcField::valueFromInstance):
3300 (ObjcField::setValueToInstance):
3301 (ObjcArray::ObjcArray):
3302 (ObjcArray::~ObjcArray):
3303 (ObjcArray::operator=):
3304 (ObjcArray::setValueAt):
3305 (ObjcArray::valueAt):
3306 (ObjcArray::getLength):
3307 * bindings/objc/objc_utility.mm:
3308 (KJS::Bindings::convertValueToObjcValue):
3309 (KJS::Bindings::convertObjcValueToValue):
3310 * bindings/runtime.cpp:
3311 (Instance::getValueOfField):
3312 * bindings/runtime.h:
3313 * bindings/runtime_array.cpp:
3314 (RuntimeArrayImp::get):
3315 * bindings/runtime_object.cpp:
3316 (RuntimeObjectImp::get):
3318 2004-02-17 Richard Williamson <rjw@apple.com>
3320 Added String <-> NSString conversion.
3321 Added tests of String <-> NSString conversion to test program.
3325 * bindings/objc/objc_utility.mm:
3326 (KJS::Bindings::convertValueToObjcValue):
3327 (KJS::Bindings::convertObjcValueToValue):
3329 * bindings/testbindings.mm:
3330 (-[MyFirstInterface getString]):
3332 2004-02-15 Darin Adler <darin@apple.com>
3336 * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
3337 and removing redundant settings of things that match defaults in other build styles.
3339 2004-02-13 Richard Williamson <rjw@apple.com>
3341 Work towards the JavaScript ObjC bindings. The bindings now work for
3342 simple scalar types. testbindings.mm is an illustration of how the
3347 * JavaScriptCore.pbproj/project.pbxproj:
3349 * bindings/jni/jni_class.cpp:
3350 (JavaClass::methodsNamed):
3351 * bindings/jni/jni_class.h:
3352 * bindings/jni/jni_instance.cpp:
3353 (JavaInstance::invokeMethod):
3354 * bindings/jni/jni_instance.h:
3355 * bindings/jni/jni_runtime.h:
3356 (KJS::Bindings::JavaMethod::returnType):
3357 * bindings/make_testbindings: Added.
3358 * bindings/objc/objc_class.h: Added.
3359 (KJS::Bindings::ObjcClass::~ObjcClass):
3360 (KJS::Bindings::ObjcClass::ObjcClass):
3361 (KJS::Bindings::ObjcClass::operator=):
3362 (KJS::Bindings::ObjcClass::constructorAt):
3363 (KJS::Bindings::ObjcClass::numConstructors):
3364 * bindings/objc/objc_class.mm: Added.
3365 (ObjcClass::_commonDelete):
3366 (ObjcClass::_commonCopy):
3367 (ObjcClass::_commonInit):
3368 (_createClassesByIsAIfNecessary):
3369 (ObjcClass::classForIsA):
3370 (ObjcClass::ObjcClass):
3372 (ObjcClass::methodsNamed):
3373 (ObjcClass::fieldNamed):
3374 * bindings/objc/objc_header.h: Added.
3375 * bindings/objc/objc_instance.h: Added.
3376 (KJS::Bindings::ObjcInstance::getObject):
3377 * bindings/objc/objc_instance.mm: Added.
3378 (ObjcInstance::ObjcInstance):
3379 (ObjcInstance::~ObjcInstance):
3380 (ObjcInstance::operator=):
3381 (ObjcInstance::begin):
3382 (ObjcInstance::end):
3383 (ObjcInstance::getClass):
3384 (ObjcInstance::invokeMethod):
3385 (ObjcInstance::defaultValue):
3386 (ObjcInstance::stringValue):
3387 (ObjcInstance::numberValue):
3388 (ObjcInstance::booleanValue):
3389 (ObjcInstance::valueOf):
3390 * bindings/objc/objc_jsobject.h: Added.
3391 * bindings/objc/objc_jsobject.mm: Added.
3392 * bindings/objc/objc_runtime.h:
3393 (KJS::Bindings::ObjcField::~ObjcField):
3394 (KJS::Bindings::ObjcField::ObjcField):
3395 (KJS::Bindings::ObjcField::operator=):
3396 (KJS::Bindings::ObjcMethod::ObjcMethod):
3397 (KJS::Bindings::ObjcMethod::~ObjcMethod):
3398 (KJS::Bindings::ObjcMethod::operator=):
3399 * bindings/objc/objc_runtime.mm: Added.
3400 (ObjcMethod::ObjcMethod):
3402 (ObjcMethod::numParameters):
3403 (ObjcMethod::getMethodSignature):
3404 (ObjcField::ObjcField):
3407 (ObjcField::valueFromInstance):
3408 (ObjcField::setValueToInstance):
3409 * bindings/objc/objc_utility.h: Added.
3411 * bindings/objc/objc_utility.mm: Added.
3412 (KJS::Bindings::JSMethodNameToObjCMethodName):
3413 (KJS::Bindings::convertValueToObjcValue):
3414 (KJS::Bindings::convertObjcValueToValue):
3415 (KJS::Bindings::objcValueTypeForType):
3416 * bindings/runtime.cpp:
3417 (MethodList::MethodList):
3418 (MethodList::operator=):
3419 (Instance::setValueOfField):
3420 (Instance::createBindingForLanguageInstance):
3421 (Instance::createRuntimeObject):
3422 * bindings/runtime.h:
3423 * bindings/runtime_method.cpp:
3424 (RuntimeMethodImp::RuntimeMethodImp):
3425 (RuntimeMethodImp::get):
3426 (RuntimeMethodImp::call):
3427 * bindings/runtime_method.h:
3428 * bindings/runtime_object.cpp:
3429 (RuntimeObjectImp::get):
3430 (RuntimeObjectImp::hasProperty):
3431 * bindings/test.js: Added.
3432 * bindings/testbindings.mm: Added.
3433 (-[MySecondInterface init]):
3434 (-[MyFirstInterface init]):
3435 (-[MyFirstInterface dealloc]):
3436 (+[MyFirstInterface JavaScriptNameForSelector:]):
3437 (-[MyFirstInterface getInt]):
3438 (-[MyFirstInterface setInt:]):
3439 (-[MyFirstInterface getMySecondInterface]):
3440 (-[MyFirstInterface logMessage:]):
3441 (GlobalImp::className):
3442 (readJavaScriptFromFile):
3447 2004-02-08 Darin Adler <darin@apple.com>
3451 - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
3453 * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
3454 macros from working right in C++ code that uses the <cctype> header.
3457 (KJS::inlineUTF8SequenceLengthNonASCII): Added.
3458 (KJS::UTF8SequenceLengthNonASCII): Added.
3459 (KJS::inlineUTF8SequenceLength): Added.
3460 (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
3461 (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3462 (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
3463 (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3464 (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
3466 - fixed the test program so it won't hit the interpreter lock assertion
3468 * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
3472 2004-02-06 Richard Williamson <rjw@apple.com>
3474 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.
3478 * bindings/jni/jni_jsobject.cpp:
3479 (JSObject::toString):
3480 * bindings/jni/jni_utility.cpp:
3481 (KJS::Bindings::convertValueToJValue):
3483 2004-02-02 Darin Adler <darin@apple.com>
3487 - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
3489 * kjs/array_object.cpp:
3490 (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
3491 we start putting values in. This prevents new Array(2147483647) from causing trouble.
3492 (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
3493 number is out of range. This prevents new Array(-1) from causing trouble.
3495 - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
3497 * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
3498 casting to int. Results now match those in other browsers.
3500 2004-02-02 Darin Adler <darin@apple.com>
3504 - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
3505 - fixed other related overflow issues
3507 * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
3509 (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
3510 must not restrict values to the range of a particular integer type.
3511 (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
3512 proper handling for negative results from fmod.
3513 (ValueImp::toUInt32): Ditto.
3514 (ValueImp::toUInt16): Ditto.
3515 (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
3517 * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
3518 out-of-integer-range values better in the slice function.
3519 * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
3520 * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
3521 out-of-integer-range values better in the toString function.
3522 * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
3523 out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
3524 and substr functions.
3528 2004-01-30 Richard Williamson <rjw@apple.com>
3530 Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
3534 * bindings/jni/jni_instance.cpp:
3535 (JavaInstance::stringValue):
3537 2004-01-26 Darin Adler <darin@apple.com>
3539 * Makefile.am: Switch from pbxbuild to xcodebuild.
3541 2004-01-22 Richard Williamson <rjw@apple.com>
3543 Added stubs for ObjC language binding to JavaScript.
3545 * JavaScriptCore.pbproj/project.pbxproj:
3546 * bindings/jni/jni_runtime.h:
3547 * bindings/objc/objc_runtime.h: Added.
3548 (KJS::Bindings::ObjcParameter::ObjcParameter):
3549 (KJS::Bindings::ObjcParameter::~ObjcParameter):
3550 (KJS::Bindings::ObjcParameter::operator=):
3551 (KJS::Bindings::ObjcParameter::type):
3552 (KJS::Bindings::ObjcConstructor::ObjcConstructor):
3553 (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
3554 (KJS::Bindings::ObjcConstructor::_commonCopy):
3555 (KJS::Bindings::ObjcConstructor::operator=):
3556 (KJS::Bindings::ObjcConstructor::value):
3557 (KJS::Bindings::ObjcConstructor::parameterAt):
3558 (KJS::Bindings::ObjcConstructor::numParameters):
3559 (KJS::Bindings::ObjcField::ObjcField):
3560 (KJS::Bindings::ObjcField::~ObjcField):
3561 * bindings/runtime.h:
3563 2004-01-22 Richard Williamson <rjw@apple.com>
3565 Simplified JavaString by using UString as backing store. This
3566 revealed a bug in CString's assignment operator which I fixed.
3568 Removed some dead code.
3572 * bindings/jni/jni_runtime.h:
3573 (KJS::Bindings::JavaString::JavaString):
3574 (KJS::Bindings::JavaString::_commonInit):
3575 (KJS::Bindings::JavaString::UTF8String):
3576 (KJS::Bindings::JavaString::uchars):
3577 (KJS::Bindings::JavaString::length):
3578 (KJS::Bindings::JavaString::ustring):
3579 * bindings/runtime_object.cpp:
3580 (RuntimeObjectImp::RuntimeObjectImp):
3581 * bindings/runtime_object.h:
3583 (KJS::CString::CString):
3584 (KJS::CString::operator=):
3590 2004-01-16 Richard Williamson <rjw@apple.com>
3592 Fixed 3525853. We weren't handling mapping to overloaded Java
3593 methods very well. Even though this is undefined the other
3594 browsers support it. Also fixed a bug with returning arrays
3595 from Java functions.
3599 * bindings/jni/jni_class.cpp:
3600 (JavaClass::_commonInit):
3601 (JavaClass::methodsNamed):
3602 * bindings/jni/jni_class.h:
3603 * bindings/jni/jni_instance.cpp:
3604 (JavaInstance::invokeMethod):
3605 * bindings/jni/jni_instance.h:
3606 * bindings/jni/jni_runtime.cpp:
3607 (JavaArray::convertJObjectToArray):
3608 (JavaField::valueFromInstance):
3609 (JavaMethod::signature):
3610 (JavaArray::valueAt):
3611 * bindings/jni/jni_runtime.h:
3612 * bindings/jni_jsobject.cpp:
3614 (JSObject::convertJObjectToValue):
3615 * bindings/runtime.cpp:
3616 (MethodList::addMethod):
3617 (MethodList::length):
3618 (MethodList::methodAt):
3619 (MethodList::~MethodList):
3620 * bindings/runtime.h:
3621 (KJS::Bindings::MethodList::MethodList):
3622 * bindings/runtime_method.cpp:
3623 (RuntimeMethodImp::RuntimeMethodImp):
3624 (RuntimeMethodImp::get):
3625 (RuntimeMethodImp::call):
3626 * bindings/runtime_method.h:
3627 * bindings/runtime_object.cpp:
3628 (RuntimeObjectImp::get):
3629 (RuntimeObjectImp::hasProperty):
3631 2004-01-16 Richard Williamson <rjw@apple.com>
3633 Fixed 3531229. Another place that needs the Push/PopLocalFrame
3634 protection implemented for 3530401.
3638 * bindings/runtime_method.cpp:
3639 (RuntimeMethodImp::call):
3641 2004-01-15 Richard Williamson <rjw@apple.com>
3643 Fixed 3530401. JNI doesn't cleanup local refs created on the
3644 main thread. IMO this is a bad bug in our JMI implementation.
3646 To work-around the problem I explicitly delete all local refs.
3647 Further, I've added Push/PopLocalFrame calls to catch any refs
3648 that I may have missed. This will guarantee that we don't leak
3649 any Java references.
3653 * bindings/jni/jni_class.cpp:
3654 (JavaClass::_commonInit):
3655 (JavaClass::JavaClass):
3656 * bindings/jni/jni_instance.cpp:
3657 (JavaInstance::begin):
3658 (JavaInstance::end):
3659 * bindings/jni/jni_instance.h:
3660 * bindings/jni/jni_runtime.cpp:
3661 (JavaConstructor::JavaConstructor):
3662 (JavaMethod::JavaMethod):
3663 * bindings/jni_jsobject.cpp:
3664 (JSObject::listFromJArray):
3665 * bindings/runtime.h:
3666 (KJS::Bindings::Instance::begin):
3667 (KJS::Bindings::Instance::end):
3668 * bindings/runtime_object.cpp:
3669 (RuntimeObjectImp::get):
3670 (RuntimeObjectImp::put):
3671 (RuntimeObjectImp::canPut):
3672 (RuntimeObjectImp::hasProperty):
3673 (RuntimeObjectImp::defaultValue):
3675 2004-01-15 Vicki Murley <vicki@apple.com>
3679 * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
3681 2004-01-14 Richard Williamson <rjw@apple.com>
3683 Fixed 3529466. With recent changes to Java plugin we must no
3684 longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
3688 * bindings/jni/jni_instance.cpp:
3689 (JObjectWrapper::JObjectWrapper):
3693 2004-01-14 Richard Williamson <rjw@apple.com>
3697 Finalize may be called on an JSObject after we've already remove all our references. The assert in this case is firing because we've received a finalize call from Java for an instance that we no longer know about. The fix is to check in finalize that we're getting a call on an instance that we still care about.
3701 * bindings/jni_jsobject.cpp:
3703 (removeJavaReference):
3704 (RootObject::removeAllJavaReferencesForRoot):
3707 2004-01-13 Richard Williamson <rjw@apple.com>
3711 The run loop that is used to execute JavaScript (in practice, always the main run loop) is held in a class variable. It is set and retained once and should not be released. Unfortunately is it being released when the 'root' object on a LiveConnect applet is released. This has the symptom of eventually causing an deallocation of the main run loop! Usually after about 5 instantiations/destructions of a LiveConnect applet. The CFRelease of the run loop was removed.
3715 * bindings/jni_jsobject.h:
3716 (KJS::Bindings::RootObject::~RootObject):
3722 2004-01-06 Richard Williamson <rjw@apple.com>
3724 Fixed 3521814. Finalize messages weren't being dispatched!
3728 * bindings/jni_jsobject.cpp:
3731 2004-01-05 Richard Williamson <rjw@apple.com>
3733 Added cache of JNI method IDs to minimize allocations. This mitigates the problem
3734 described by 3515579.
3736 Also cleanup up logging of Java exceptions.
3740 * bindings/jni/jni_class.cpp:
3741 (JavaClass::classForInstance):
3742 * bindings/jni/jni_instance.cpp:
3743 (JavaInstance::JavaInstance):
3744 (JavaInstance::getClass):
3745 (JavaInstance::invokeMethod):
3746 (JObjectWrapper::JObjectWrapper):
3747 (JObjectWrapper::~JObjectWrapper):
3748 * bindings/jni/jni_instance.h:
3749 (KJS::Bindings::JavaInstance::operator=):
3750 * bindings/jni/jni_runtime.cpp:
3751 (JavaMethod::JavaMethod):
3752 (JavaMethod::methodID):
3753 * bindings/jni/jni_runtime.h:
3754 (KJS::Bindings::JavaMethod::JavaMethod):
3755 * bindings/jni/jni_utility.cpp:
3759 (KJS::Bindings::getMethodID):
3760 (KJS::Bindings::callJNIVoidMethodIDA):
3761 (KJS::Bindings::callJNIObjectMethodIDA):
3762 (KJS::Bindings::callJNIByteMethodIDA):
3763 (KJS::Bindings::callJNICharMethodIDA):
3764 (KJS::Bindings::callJNIShortMethodIDA):
3765 (KJS::Bindings::callJNIIntMethodIDA):
3766 (KJS::Bindings::callJNILongMethodIDA):
3767 (KJS::Bindings::callJNIFloatMethodIDA):
3768 (KJS::Bindings::callJNIDoubleMethodIDA):
3769 (KJS::Bindings::callJNIBooleanMethodIDA):
3770 (KJS::Bindings::getCharactersFromJStringInEnv):
3771 (KJS::Bindings::getUCharactersFromJStringInEnv):
3772 (KJS::Bindings::getJNIField):
3773 * bindings/jni/jni_utility.h:
3775 l2003-12-23 John Sullivan <sullivan@apple.com>
3777 * JavaScriptCore.pbproj/project.pbxproj:
3778 Xcode version wars, harmless
3780 2003-12-23 Darin Adler <darin@apple.com>
3782 Reviewed by John (concept, not code, which is just the old code coming back).
3784 - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
3786 * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
3787 mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
3789 2003-12-19 Richard Williamson <rjw@apple.com>
3791 Fixed 3515597. When an error occurs we need
3792 to make sure result values are zeroed.
3794 Cleaned up logs by adding a newline.
3798 * bindings/jni/jni_utility.cpp:
3799 (KJS::Bindings::getJavaVM):
3800 (KJS::Bindings::getJNIEnv):
3803 (KJS::Bindings::getJNIField):
3804 * bindings/jni_jsobject.cpp:
3805 (JSObject::convertValueToJObject):
3809 2003-12-17 Richard Williamson <rjw@apple.com>
3811 Ensure that all the symbols we export are in the KJS
3812 namespace (3512245).
3814 Also renamed JavaString.characters() to JavaString.UTF8String()
3815 for enhanced clarity.
3817 Added some sanity checking to constructor of JObjectWrapper.
3822 * bindings/jni/jni_class.cpp:
3823 * bindings/jni/jni_class.h:
3824 * bindings/jni/jni_instance.cpp:
3825 (JavaInstance::invokeMethod):
3826 (JObjectWrapper::JObjectWrapper):
3827 * bindings/jni/jni_instance.h:
3828 * bindings/jni/jni_runtime.cpp:
3829 (JavaParameter::JavaParameter):
3830 (JavaField::JavaField):
3831 (JavaMethod::JavaMethod):
3832 (JavaMethod::signature):
3833 * bindings/jni/jni_runtime.h:
3834 (KJS::Bindings::JavaString::ascii):
3835 (KJS::Bindings::JavaString::UTF8String):
3836 (KJS::Bindings::JavaString::JavaString):
3837 (KJS::Bindings::JavaString::_commonInit):
3838 (KJS::Bindings::JavaString::uchars):
3839 (KJS::Bindings::JavaString::length):
3840 (KJS::Bindings::JavaString::ustring):
3841 (KJS::Bindings::JavaParameter::type):
3842 (KJS::Bindings::JavaField::name):
3843 (KJS::Bindings::JavaField::type):
3844 (KJS::Bindings::JavaMethod::name):
3845 (KJS::Bindings::JavaMethod::returnType):
3846 * bindings/jni/jni_utility.cpp:
3847 (KJS::Bindings::getJavaVM):
3848 (KJS::Bindings::getJNIEnv):
3849 (KJS::Bindings::callJNIVoidMethod):
3850 (KJS::Bindings::callJNIObjectMethod):
3851 (KJS::Bindings::callJNIBooleanMethod):
3852 (KJS::Bindings::callJNIByteMethod):
3853 (KJS::Bindings::callJNICharMethod):
3854 (KJS::Bindings::callJNIShortMethod):
3855 (KJS::Bindings::callJNIIntMethod):
3856 (KJS::Bindings::callJNILongMethod):
3857 (KJS::Bindings::callJNIFloatMethod):
3858 (KJS::Bindings::callJNIDoubleMethod):
3859 (KJS::Bindings::callJNIVoidMethodA):
3860 (KJS::Bindings::callJNIObjectMethodA):
3861 (KJS::Bindings::callJNIByteMethodA):
3862 (KJS::Bindings::callJNICharMethodA):
3863 (KJS::Bindings::callJNIShortMethodA):
3864 (KJS::Bindings::callJNIIntMethodA):
3865 (KJS::Bindings::callJNILongMethodA):
3866 (KJS::Bindings::callJNIFloatMethodA):
3867 (KJS::Bindings::callJNIDoubleMethodA):
3868 (KJS::Bindings::callJNIBooleanMethodA):
3869 (KJS::Bindings::getCharactersFromJString):
3870 (KJS::Bindings::releaseCharactersForJString):
3871 (KJS::Bindings::getCharactersFromJStringInEnv):
3872 (KJS::Bindings::releaseCharactersForJStringInEnv):
3873 (KJS::Bindings::getUCharactersFromJStringInEnv):
3874 (KJS::Bindings::releaseUCharactersForJStringInEnv):
3875 (KJS::Bindings::JNITypeFromClassName):
3876 (KJS::Bindings::signatureFromPrimitiveType):
3877 (KJS::Bindings::JNITypeFromPrimitiveType):
3878 (KJS::Bindings::getJNIField):
3879 (KJS::Bindings::convertValueToJValue):
3880 * bindings/jni/jni_utility.h:
3881 * bindings/jni_jsobject.cpp:
3882 (KJS::Bindings::JSObject::invoke):
3883 (KJS::Bindings::JSObject::JSObject):
3884 (KJS::Bindings::JSObject::call):
3885 (KJS::Bindings::JSObject::eval):
3886 (KJS::Bindings::JSObject::getMember):
3887 (KJS::Bindings::JSObject::setMember):
3888 (KJS::Bindings::JSObject::removeMember):
3889 (KJS::Bindings::JSObject::getSlot):
3890 (KJS::Bindings::JSObject::setSlot):
3891 (KJS::Bindings::JSObject::toString):
3892 (KJS::Bindings::JSObject::finalize):
3893 (KJS::Bindings::JSObject::createNative):
3894 (KJS::Bindings::JSObject::convertValueToJObject):
3895 (KJS::Bindings::JSObject::convertJObjectToValue):
3896 (KJS::Bindings::JSObject::listFromJArray):
3897 * bindings/jni_jsobject.h:
3898 * bindings/runtime.cpp:
3899 * bindings/runtime.h:
3900 * bindings/runtime_method.cpp:
3901 * bindings/runtime_method.h:
3905 2003-12-16 Richard Williamson <rjw@apple.com>
3907 Ack! More assertions. Lock ALL entry points into the interpreter!
3912 * bindings/jni_jsobject.cpp:
3913 (Bindings::JSObject::call):
3914 (Bindings::JSObject::eval):
3915 (Bindings::JSObject::getMember):
3916 (Bindings::JSObject::setMember):
3917 (Bindings::JSObject::removeMember):
3918 (Bindings::JSObject::getSlot):
3919 (Bindings::JSObject::setSlot):
3920 (Bindings::JSObject::convertJObjectToValue):
3922 2003-12-15 Richard Williamson <rjw@apple.com>
3924 Fixed a couple of snafus and removed some logging.
3928 * bindings/jni_jsobject.cpp:
3929 (Bindings::performJavaScriptAccess):
3930 (Bindings::completedJavaScriptAccess):
3931 (Bindings::dispatchToJavaScriptThread):
3932 Removed some annoying JS_LOG clutter.
3934 (Bindings::RootObject::removeAllJavaReferencesForRoot):
3935 Fixed allocation of key buffer that was called after it was needed.
3937 (Bindings::JSObject::invoke):
3938 (Bindings::JSObject::JSObject):
3939 (Bindings::JSObject::getMember):
3940 (Bindings::JSObject::getSlot):
3941 Added additional interpreter locks around getMember and getSlot.
3942 These functions may cause allocation of JS impls.
3944 2003-12-15 Richard Williamson <rjw@apple.com>
3946 args weren't passed to 'call' invocation. d'oh.
3947 lock interpreter when we create instances of JS impls.
3951 * bindings/jni_jsobject.cpp:
3952 (Bindings::JSObject::call):
3953 (Bindings::JSObject::eval):
3954 (Bindings::JSObject::getMember):
3955 (Bindings::JSObject::setMember):
3956 (Bindings::JSObject::getSlot):
3957 (Bindings::JSObject::convertValueToJObject):
3958 (Bindings::JSObject::convertJObjectToValue):
3959 (Bindings::JSObject::listFromJArray):
3960 * bindings/jni_jsobject.h:
3962 2003-12-15 Richard Williamson <rjw@apple.com>
3964 Last piece of LiveConnect! This checkin adds implementation
3965 of the Java to JavaScript object conversion functions.
3969 * bindings/jni/jni_instance.cpp:
3970 (JavaInstance::invokeMethod):
3971 * bindings/jni/jni_utility.cpp:
3972 * bindings/jni/jni_utility.h:
3973 * bindings/jni_jsobject.cpp:
3974 (Bindings::JSObject::invoke):
3975 (Bindings::JSObject::call):
3976 (Bindings::JSObject::eval):
3977 (Bindings::JSObject::getMember):
3978 (Bindings::JSObject::setMember):
3979 (Bindings::JSObject::getSlot):
3980 (Bindings::JSObject::setSlot):
3981 (Bindings::JSObject::createNative):
3982 (Bindings::JSObject::convertValueToJObject):
3983 (Bindings::JSObject::convertJObjectToValue):
3984 (Bindings::JSObject::listFromJArray):
3985 * bindings/jni_jsobject.h:
3987 * bindings/runtime_method.cpp:
3988 (RuntimeMethodImp::get):
3989 (RuntimeMethodImp::codeType):
3990 (RuntimeMethodImp::execute):
3992 2003-12-12 Richard Williamson <rjw@apple.com>
3994 Added implementation of stubs in JSObject. All that
3995 remains is a couple of simple conversion functions stubs and
3996 we're done with LiveConnect. Also, changed string passing to
3997 JS to use uchars instead of chars.
4001 * bindings/jni/jni_runtime.h:
4002 (Bindings::JavaString::JavaString):
4003 (Bindings::JavaString::_commonInit):
4004 (Bindings::JavaString::_commonCopy):
4005 (Bindings::JavaString::_commonDelete):
4006 (Bindings::JavaString::~JavaString):
4007 (Bindings::JavaString::operator=):
4008 (Bindings::JavaString::uchars):
4009 (Bindings::JavaString::length):
4010 (Bindings::JavaString::ustring):
4011 * bindings/jni/jni_utility.cpp:
4012 (getUCharactersFromJStringInEnv):
4013 (releaseUCharactersForJStringInEnv):
4014 (convertValueToJObject):
4015 (convertJObjectToValue):
4016 * bindings/jni/jni_utility.h:
4017 * bindings/jni_jsobject.cpp:
4018 (Bindings::JSObject::invoke):
4019 (Bindings::JSObject::call):
4020 (Bindings::JSObject::eval):
4021 (Bindings::JSObject::getMember):
4022 (Bindings::JSObject::setMember):
4023 (Bindings::JSObject::removeMember):
4024 (Bindings::JSObject::getSlot):
4025 (Bindings::JSObject::setSlot):
4026 * bindings/jni_jsobject.h:
4028 2003-12-12 Richard Williamson <rjw@apple.com>
4030 Ensure that all calls from Java into JavaScript are
4031 performed on a designated thread (the main thread).
4035 * bindings/jni_jsobject.cpp:
4036 (isJavaScriptThread):
4038 (Bindings::performJavaScriptAccess):
4039 (Bindings::completedJavaScriptAccess):
4040 (Bindings::initializeJavaScriptAccessLock):
4041 (Bindings::lockJavaScriptAccess):
4042 (Bindings::unlockJavaScriptAccess):
4043 (Bindings::dispatchToJavaScriptThread):
4044 (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
4045 (Bindings::RootObject::removeAllJavaReferencesForRoot):
4046 (Bindings::JSObject::invoke):
4047 (Bindings::JSObject::JSObject):
4048 (Bindings::JSObject::call):
4049 (Bindings::JSObject::eval):
4050 (Bindings::JSObject::getMember):
4051 (Bindings::JSObject::setMember):
4052 (Bindings::JSObject::removeMember):
4053 (Bindings::JSObject::getSlot):
4054 (Bindings::JSObject::setSlot):
4055 (Bindings::JSObject::toString):
4056 (Bindings::JSObject::finalize):
4057 (Bindings::JSObject::getWindow):
4058 * bindings/jni_jsobject.h:
4059 (Bindings::RootObject::~RootObject):
4060 (Bindings::RootObject::findRootObjectForNativeHandleFunction):
4061 (Bindings::RootObject::runLoop):
4062 (Bindings::RootObject::performJavaScriptSource):
4065 2003-12-11 Richard Williamson <rjw@apple.com>
4067 Added support for calling a JavaScript function from
4068 Java. Right now this only works for void func(void)
4069 functions, but the conversion of args and return values
4072 Cleaned up and verified reference counting scheme, and
4073 dereferencing of vended JavaScript objects when applet is
4074 destroyed (actually when part is destroyed).
4076 Removed link hack for testkjs now that the Java folks think
4077 they have a solution for the 1.4.2 JavaVM link problem. Although
4078 Greg B. thinks his solution may cause problems for the 1.3.1
4079 version of the VM!?!
4084 * bindings/jni/jni_runtime.h:
4085 (Bindings::JavaString::JavaString):
4086 * bindings/jni/jni_utility.cpp:
4087 (convertValueToJValue):
4088 (convertValueToJObject):
4090 * bindings/jni/jni_utility.h:
4091 * bindings/jni_jsobject.cpp:
4092 (KJS_setFindRootObjectForNativeHandleFunction):
4093 (KJS_findRootObjectForNativeHandleFunction):
4094 (getReferencesByRootDictionary):
4095 (getReferencesDictionary):
4096 (findReferenceDictionary):
4099 (removeJavaReference):
4100 * bindings/jni_jsobject.h:
4101 (Bindings::RootObject::RootObject):
4102 (Bindings::RootObject::~RootObject):
4103 (Bindings::RootObject::setRootObjectImp):
4104 (Bindings::RootObject::rootObjectImp):
4105 (Bindings::RootObject::setInterpreter):
4106 (Bindings::RootObject::interpreter):
4110 2003-12-10 Darin Adler <darin@apple.com>
4114 - fixed regression in JavaScript tests reported by the KDE guys
4115 - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
4117 * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
4119 (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
4120 tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
4121 and binary compatibility than default parameter values.
4122 (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
4124 * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
4125 "tolerate empty string" parameter.
4127 2003-12-10 Richard Williamson <rjw@apple.com>
4129 Added code to manage reference counting of JavaScript
4130 objects passed to Java. Also added implementation of
4131 KJS_JSCreateNativeJSObject. This is the function that
4132 provides the root object to Java (KJS::Window).
4136 * JavaScriptCore.pbproj/project.pbxproj:
4137 * bindings/jni_jsobject.cpp:
4138 (KJS_setFindObjectForNativeHandleFunction):
4139 (KJS_findObjectForNativeHandleFunction):
4140 (getReferencesByOwnerDictionary):
4141 (getReferencesDictionary):
4142 (findReferenceDictionary):
4144 (removeJavaReference):
4145 (removeAllJavaReferencesForOwner):
4146 * bindings/jni_jsobject.h:
4148 2003-12-09 Richard Williamson <rjw@apple.com>
4150 LiveConnect stubs that correspond to the native methods
4151 on JSObject. These will be called from the new Java plugin
4152 when an instance of JSObject is instantiated and messaged.
4153 When these are implemented the Java will be able to originate
4154 calls into JavaScript.
4156 Also a temporary work-around added to Makefile.am to solve
4157 a link problem. The 1.4.2 JavaVM accidentally links against
4158 libobjc. This call a failure linking testkjs. Mike Hay is
4159 working with someone to fix the problem (3505587).
4163 * JavaScriptCore.pbproj/project.pbxproj:
4165 * bindings/jni_jsobject.cpp: Added.
4166 (KJS_JSCreateNativeJSObject):
4167 (KJS_JSObject_JSFinalize):
4168 (KJS_JSObject_JSObjectCall):
4169 (KJS_JSObject_JSObjectEval):
4170 (KJS_JSObject_JSObjectGetMember):
4171 (KJS_JSObject_JSObjectSetMember):
4172 (KJS_JSObject_JSObjectRemoveMember):
4173 (KJS_JSObject_JSObjectGetSlot):
4174 (KJS_JSObject_JSObjectSetSlot):
4175 (KJS_JSObject_JSObjectToString):
4176 * bindings/jni_jsobject.h: Added.
4178 2003-12-09 Maciej Stachowiak <mjs@apple.com>
4182 <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
4184 * kjs/collector.cpp:
4185 (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
4186 (KJS::Collector::collect): likewise
4188 2003-12-08 Richard Williamson <rjw@apple.com>
4190 LiveConnect: The last piece of the JavaScript side of the
4191 LiveConnect implementation. This change adds support for
4192 setting/getting values from Java arrays in JavaScript.
4196 * bindings/jni/jni_instance.h:
4197 * bindings/jni/jni_runtime.cpp:
4198 (JavaField::JavaField):
4199 (convertJObjectToArray):
4200 (JavaArray::JavaArray):
4201 (JavaArray::~JavaArray):
4202 (JavaArray::setValueAt):
4203 (JavaArray::valueAt):
4204 (JavaArray::getLength):
4205 * bindings/jni/jni_runtime.h:
4206 (Bindings::JavaArray::operator=):
4207 (Bindings::JavaArray::javaArray):
4208 * bindings/jni/jni_utility.cpp: